arch/mx8mp: add rptun/rpmsg client support

New target mx8mp:rpsmsg has been added which enables
a virtual tty and can be accessed from the A53 core
running linux-imx
This commit is contained in:
Andre Heinemans 2024-03-18 17:24:36 +01:00 committed by Alan Carvalho de Assis
parent b87804c2ba
commit 4f1ac5160c
17 changed files with 965 additions and 1 deletions

View File

@ -123,6 +123,14 @@ config MX8MP_SPI_DRIVER
endif # MX8MP_SPI
config MX8MP_RPMSG
bool "RPMSG support"
default y
depends on DEV_RPMSG
---help---
Enable RPMSG shared memory and behave as a client device that can be
accessed by the IMX8MP A53 core running Linux IMX.
endmenu # i.MX8MP Peripheral Selection
# These "hidden" settings determine whether a peripheral option is available

View File

@ -43,3 +43,7 @@ endif
ifeq ($(CONFIG_SPI),y)
CHIP_CSRCS += mx8mp_ecspi.c
endif
ifeq ($(CONFIG_MX8MP_RPMSG),y)
CHIP_CSRCS += mx8mp_rptun.c mx8mp_ipc.c mx8mp_rsctable.c
endif

View File

@ -105,6 +105,8 @@
#define MX8M_ECSPI2 0x30830000u
#define MX8M_ECSPI3 0x30840000u
#define MX8M_MUB 0x30AB0000u
#define MX8M_GPIO 0x30200000u
#define MX8M_GPIO1 (MX8M_GPIO + 0x10000 * 0)
#define MX8M_GPIO2 (MX8M_GPIO + 0x10000 * 1)

View File

@ -0,0 +1,59 @@
/****************************************************************************
* arch/arm/src/mx8mp/hardware/mx8mp_mu.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __ARCH_ARM_SRC_MX8MP_HARDWARE_MX8MP_MU_H
#define __ARCH_ARM_SRC_MX8MP_HARDWARE_MX8MP_MU_H
/****************************************************************************
* Included Files
****************************************************************************/
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Messaging Unit Register Offsets ******************************************/
#define MU_TR_OFFSET 0x0000
#define MU_RR_OFFSET 0x0010
#define MU_SR_OFFSET 0x0020
#define MU_CR_OFFSET 0x0024
/* Messaging Unit Register Bit Definitions **********************************/
#define MU_SR_RF0_SHIFT 27
#define MU_SR_RF1_SHIFT 26
#define MU_SR_RF2_SHIFT 25
#define MU_SR_RF3_SHIFT 24
#define MU_SR_TE0_SHIFT 23
#define MU_SR_TE1_SHIFT 22
#define MU_SR_TE2_SHIFT 21
#define MU_SR_TE3_SHIFT 20
#define MU_CR_GIE_MASK 0xf0000000U
#define MU_CR_RIE_MASK 0x0f000000U
#define MU_CR_TIE_MASK 0x00f00000U
#define MU_CR_GIR_MASK 0x000f0000U
#define MU_CR_RIE0_SHIFT 27
#define MU_CR_RIE1_SHIFT 26
#define MU_CR_RIE2_SHIFT 25
#define MU_CR_RIE3_SHIFT 24
#endif /* __ARCH_ARM_SRC_MX8MP_HARDWARE_MX8MP_I2C_H */

View File

@ -92,6 +92,8 @@ void mx8mp_clockconfig(void)
mx8mp_ccm_gate_clock(CCM_SIM_WAKEUP_CLK_GATE, CLK_ALWAYS_NEEDED);
mx8mp_ccm_gate_clock(CCM_DEBUG_CLK_GATE, CLK_ALWAYS_NEEDED);
mx8mp_ccm_gate_clock(CCM_SEC_DEBUG_CLK_GATE, CLK_ALWAYS_NEEDED);
mx8mp_ccm_gate_clock(CCM_UART4_CLK_GATE, CLK_ALWAYS_NEEDED);
mx8mp_ccm_gate_clock(CCM_MU_CLK_GATE, CLK_ALWAYS_NEEDED);
/* Make sure that main buses are enabled (TODO to be tuned or adjust
* by configuration)

View File

@ -0,0 +1,216 @@
/****************************************************************************
* arch/arm/src/mx8mp/mx8mp_ipc.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include "mx8mp_ipc.h"
#include <debug.h>
#include <inttypes.h>
#include <nuttx/arch.h>
#include <nuttx/config.h>
#include <stdint.h>
#include "arm_internal.h"
#include "hardware/mx8mp_mu.h"
#include "hardware/mx8mp_memorymap.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define MX8MP_IPC_CHANS 8
#define RPMSG_MU_CHANNEL 1
/****************************************************************************
* Private Types
****************************************************************************/
/* IPC receive channel configuration */
struct mx8mp_ipc_recv_s
{
ipc_callback_t callback;
void *args;
};
/* IPC device */
struct mx8mp_ipc_s
{
struct mx8mp_ipc_recv_s recv[MX8MP_IPC_CHANS];
};
/****************************************************************************
* Private Data
****************************************************************************/
struct mx8mp_ipc_s g_mx8mp_ipc;
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: mx8mp_ipc_disable_all_interrupts
****************************************************************************/
static void mx8mp_ipc_disable_all_interrupts(void)
{
uint32_t reg = getreg32(MX8M_MUB + MU_CR_OFFSET);
putreg32(reg & ~(MU_CR_GIE_MASK | MU_CR_RIE_MASK | MU_CR_TIE_MASK),
MX8M_MUB + MU_CR_OFFSET);
}
/****************************************************************************
* Name: mx8mp_ipc_mu_enable_interrupt
****************************************************************************/
static void mx8mp_ipc_mu_enable_interrupt(uint32_t index)
{
uint32_t reg = getreg32(MX8M_MUB + MU_CR_OFFSET);
/* GIR bits must be masked! */
putreg32((reg & ~MU_CR_GIR_MASK) | (1UL << MU_CR_RIE0_SHIFT) >> index,
MX8M_MUB + MU_CR_OFFSET);
}
/****************************************************************************
* Name: mx8mp_ipc_mu_data_ready
****************************************************************************/
static bool mx8mp_ipc_mu_data_ready(int id)
{
return (((1UL << MU_SR_RF0_SHIFT) >> id)
& getreg32(MX8M_MUB + MU_SR_OFFSET)) != 0UL;
}
/****************************************************************************
* Name: mx8mp_ipc_mu_tx_empty
****************************************************************************/
static bool mx8mp_ipc_mu_tx_empty(int index)
{
return (getreg32(MX8M_MUB + MU_SR_OFFSET)
& ((1UL << MU_SR_TE0_SHIFT) >> index)) != 0UL;
}
/****************************************************************************
* Name: mx8mp_ipc_mu_send_msg
****************************************************************************/
static void mx8mp_ipc_mu_send_msg(uint32_t index, uint32_t msg)
{
putreg32(msg, MX8M_MUB + MU_TR_OFFSET + (index * sizeof(uint32_t)));
}
/****************************************************************************
* Name: mx8mp_ipc_interrupt
****************************************************************************/
static int mx8mp_ipc_interrupt(int irq, void *context, void *args)
{
struct mx8mp_ipc_s *dev = args;
if (!mx8mp_ipc_mu_data_ready(RPMSG_MU_CHANNEL))
{
return 0;
}
uint32_t channel = getreg32(MX8M_MUB + MU_RR_OFFSET
+ (RPMSG_MU_CHANNEL * sizeof(uint32_t)))
>> 16;
if (channel >= MX8MP_IPC_CHANS)
{
return 0;
}
if (dev->recv[channel].callback)
{
dev->recv[channel].callback(channel, dev->recv[channel].args);
}
return 0;
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: mx8mp_ipc_subscribe
****************************************************************************/
void mx8mp_ipc_subscribe(int id, ipc_callback_t callback, void *args)
{
struct mx8mp_ipc_s *dev = &g_mx8mp_ipc;
DEBUGASSERT(id < MX8MP_IPC_CHANS);
ipcinfo("IPC subscribe %d\n", id);
/* Register callback */
dev->recv[id].callback = callback;
dev->recv[id].args = args;
}
/****************************************************************************
* Name: mx8mp_ipc_signal
****************************************************************************/
void mx8mp_ipc_signal(int id)
{
DEBUGASSERT(id < MX8MP_IPC_CHANS);
ipcinfo("IPC signal %d\n", id);
/* Wait TX register to be empty. */
while (!mx8mp_ipc_mu_tx_empty(id))
{
}
mx8mp_ipc_mu_send_msg(1, id);
}
/****************************************************************************
* Name: mx8mp_ipc_init
****************************************************************************/
void mx8mp_ipc_init(void)
{
struct mx8mp_ipc_s *dev = &g_mx8mp_ipc;
/* Reset device */
memset(dev, 0, sizeof(struct mx8mp_ipc_s));
mx8mp_ipc_disable_all_interrupts();
/* Attach and enable the IRQ */
irq_attach(MX8MP_IRQ_MU1_M7, mx8mp_ipc_interrupt, dev);
up_enable_irq(MX8MP_IRQ_MU1_M7);
mx8mp_ipc_mu_enable_interrupt(RPMSG_MU_CHANNEL);
}

View File

@ -0,0 +1,45 @@
/****************************************************************************
* arch/arm/src/mx8mp/mx8mp_ipc.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __ARCH_ARM_SRC_MX8MP_MX8MP_IPC_H
#define __ARCH_ARM_SRC_MX8MP_MX8MP_IPC_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
/****************************************************************************
* Public Types
****************************************************************************/
typedef void (*ipc_callback_t)(int id, void *arg);
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
void mx8mp_ipc_subscribe(int id, ipc_callback_t callback, void *args);
void mx8mp_ipc_signal(int id);
void mx8mp_ipc_init(void);
void mx8mp_ipc_enable(void);
#endif /* __ARCH_ARM_SRC_MX8MP_MX8MP_IPC_H */

View File

@ -0,0 +1,297 @@
/****************************************************************************
* arch/arm/src/mx8mp/mx8mp_rptun.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include "mx8mp_rptun.h"
#include "mx8mp_ipc.h"
#include "mx8mp_rsctable.h"
#include <nuttx/config.h>
#include <debug.h>
#include <nuttx/nuttx.h>
#include <nuttx/kthread.h>
#include <nuttx/rptun/rptun.h>
#include <nuttx/signal.h>
#include <nuttx/semaphore.h>
#include "arm_internal.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Vring configuration parameters */
#define VRING_SHMEM (0x550FF000) /* Vring shared memory start */
/* IPC configuration */
#define RPTUN_IPC_CHAN_MASTER_RX (0) /* RX for master is ready */
#define RPTUN_IPC_CHAN_SLAVE_RX (1) /* RX for slave is ready */
/****************************************************************************
* Private Types
****************************************************************************/
/* MX8MP rptun sharred memory */
struct mx8mp_rptun_shmem_s
{
struct rptun_rsc_s rsc;
};
/* MX8MP rptun device */
struct mx8mp_rptun_dev_s
{
struct rptun_dev_s rptun;
rptun_callback_t callback;
void *arg;
struct mx8mp_rptun_shmem_s *shmem;
char cpuname[RPMSG_NAME_SIZE + 1];
char shmemname[RPMSG_NAME_SIZE + 1];
};
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
static const char *mx8mp_rptun_get_cpuname(struct rptun_dev_s *dev);
static const char *mx8mp_rptun_get_firmware(struct rptun_dev_s *dev);
static const struct rptun_addrenv_s *
mx8mp_rptun_get_addrenv(struct rptun_dev_s *dev);
static struct rptun_rsc_s *
mx8mp_rptun_get_resource(struct rptun_dev_s *dev);
static bool mx8mp_rptun_is_autostart(struct rptun_dev_s *dev);
static bool mx8mp_rptun_is_master(struct rptun_dev_s *dev);
static int mx8mp_rptun_start(struct rptun_dev_s *dev);
static int mx8mp_rptun_stop(struct rptun_dev_s *dev);
static int mx8mp_rptun_notify(struct rptun_dev_s *dev, uint32_t vqid);
static int mx8mp_rptun_register_callback(struct rptun_dev_s *dev,
rptun_callback_t callback,
void *arg);
/****************************************************************************
* Private Data
****************************************************************************/
static const struct rptun_ops_s g_mx8mp_rptun_ops =
{
.get_cpuname = mx8mp_rptun_get_cpuname,
.get_firmware = mx8mp_rptun_get_firmware,
.get_addrenv = mx8mp_rptun_get_addrenv,
.get_resource = mx8mp_rptun_get_resource,
.is_autostart = mx8mp_rptun_is_autostart,
.is_master = mx8mp_rptun_is_master,
.start = mx8mp_rptun_start,
.stop = mx8mp_rptun_stop,
.notify = mx8mp_rptun_notify,
.register_callback = mx8mp_rptun_register_callback,
};
struct mx8mp_rptun_dev_s g_rptun_dev;
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: mx8mp_rptun_get_cpuname
****************************************************************************/
static const char *mx8mp_rptun_get_cpuname(struct rptun_dev_s *dev)
{
struct mx8mp_rptun_dev_s *priv = container_of(dev,
struct mx8mp_rptun_dev_s, rptun);
return priv->cpuname;
}
/****************************************************************************
* Name: mx8mp_rptun_get_firmware
****************************************************************************/
static const char *mx8mp_rptun_get_firmware(struct rptun_dev_s *dev)
{
return NULL;
}
/****************************************************************************
* Name: mx8mp_rptun_get_addrenv
****************************************************************************/
static const struct rptun_addrenv_s *
mx8mp_rptun_get_addrenv(struct rptun_dev_s *dev)
{
return NULL;
}
/****************************************************************************
* Name: mx8mp_rptun_get_resource
****************************************************************************/
static struct rptun_rsc_s *mx8mp_rptun_get_resource(struct rptun_dev_s *dev)
{
struct mx8mp_rptun_dev_s *priv
= container_of(dev, struct mx8mp_rptun_dev_s, rptun);
if (priv->shmem != NULL)
{
return &priv->shmem->rsc;
}
priv->shmem = (struct mx8mp_rptun_shmem_s *)VRING_SHMEM;
if (priv->shmem->rsc.rsc_tbl_hdr.offset
!= g_mx8mp_rsc_table.rsc_tbl_hdr.offset)
{
mx8mp_copy_rsc_table();
}
return &priv->shmem->rsc;
}
/****************************************************************************
* Name: mx8mp_rptun_is_autostart
****************************************************************************/
static bool mx8mp_rptun_is_autostart(struct rptun_dev_s *dev)
{
return true;
}
/****************************************************************************
* Name: mx8mp_rptun_is_master
****************************************************************************/
static bool mx8mp_rptun_is_master(struct rptun_dev_s *dev)
{
return false;
}
/****************************************************************************
* Name: mx8mp_rptun_start
****************************************************************************/
static int mx8mp_rptun_start(struct rptun_dev_s *dev)
{
return 0;
}
/****************************************************************************
* Name: mx8mp_rptun_stop
****************************************************************************/
static int mx8mp_rptun_stop(struct rptun_dev_s *dev)
{
return 0;
}
/****************************************************************************
* Name: mx8mp_rptun_notify
****************************************************************************/
static int mx8mp_rptun_notify(struct rptun_dev_s *dev, uint32_t vqid)
{
mx8mp_ipc_signal(RPTUN_IPC_CHAN_MASTER_RX);
return 0;
}
/****************************************************************************
* Name: mx8mp_rptun_register_callback
****************************************************************************/
static int mx8mp_rptun_register_callback(struct rptun_dev_s *dev,
rptun_callback_t callback,
void *arg)
{
struct mx8mp_rptun_dev_s *priv = container_of(dev,
struct mx8mp_rptun_dev_s, rptun);
priv->callback = callback;
priv->arg = arg;
return 0;
}
/****************************************************************************
* Name: mx8mp_ipc_slave_callback
****************************************************************************/
static void mx8mp_ipc_callback(int id, void *arg)
{
ipcinfo("Rptun IPC interrupt %d\n", id);
if (id == RPTUN_IPC_CHAN_SLAVE_RX)
{
struct mx8mp_rptun_dev_s *dev = &g_rptun_dev;
up_invalidate_dcache(0x55000000, 0x55010000);
up_invalidate_dcache(0x55400000, 0x55500000);
if (dev->callback != NULL)
{
dev->callback(dev->arg, RPTUN_NOTIFY_ALL);
}
}
else
{
DEBUGASSERT(0);
}
__asm volatile("dsb 0xF" ::: "memory");
}
/****************************************************************************
* Public Functions
****************************************************************************/
int mx8mp_rptun_init(const char *shmemname, const char *cpuname)
{
struct mx8mp_rptun_dev_s *dev = &g_rptun_dev;
int ret = OK;
/* Initialize IPC */
mx8mp_ipc_init();
/* Subscribe to IPC */
mx8mp_ipc_subscribe(RPTUN_IPC_CHAN_SLAVE_RX,
mx8mp_ipc_callback,
dev);
/* Configure device */
dev->rptun.ops = &g_mx8mp_rptun_ops;
strncpy(dev->cpuname, cpuname, RPMSG_NAME_SIZE);
strncpy(dev->shmemname, shmemname, RPMSG_NAME_SIZE);
ret = rptun_initialize(&dev->rptun);
if (ret < 0)
{
ipcerr("ERROR: rptun_initialize failed %d!\n", ret);
}
return ret;
}

View File

@ -0,0 +1,44 @@
/****************************************************************************
* arch/arm/src/mx8mp/mx8mp_rptun.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __ARCH_ARM_SRC_MX8MP_MX8MP_RPTUN_H
#define __ARCH_ARM_SRC_MX8MP_MX8MP_RPTUN_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
/****************************************************************************
* Public Data
****************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: mx8mp_rptun_init
****************************************************************************/
int mx8mp_rptun_init(const char *shmemname, const char *cpuname);
#endif /* __ARCH_ARM_SRC_MX8MP_MX8MP_RPTUN_H */

View File

@ -0,0 +1,123 @@
/****************************************************************************
* arch/arm/src/mx8mp/mx8mp_rsctable.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include "mx8mp_rsctable.h"
#include <string.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define NUM_VRINGS 0x02
#define RL_BUFFER_COUNT 0x100
#define VRING_ALIGN 0x1000
#define VDEV0_VRING_BASE 0x55000000
#define RESOURCE_TABLE_BASE 0x550FF000
#define VRING_SIZE 0x8000
#define NO_RESOURCE_ENTRIES (1)
#define RSC_VDEV_FEATURE_NS (1) /* Support name service announcement */
#define MX8MP_RSC_TABLE_VERSION (1)
/****************************************************************************
* Private Functions
****************************************************************************/
/* Place resource table in special ELF section */
#if defined(__ARMCC_VERSION) || defined(__GNUC__)
__attribute__ ((section(".resource_table")))
#elif defined(__ICCARM__)
#pragma location = ".resource_table"
#else
#error Compiler not supported!
#endif
const struct rptun_rsc_s g_mx8mp_rsc_table =
{
.rsc_tbl_hdr =
{
MX8MP_RSC_TABLE_VERSION,
NO_RESOURCE_ENTRIES,
{
0, 0
}
},
.offset =
{
offsetof(struct rptun_rsc_s, rpmsg_vdev)
},
.log_trace =
{
RSC_TRACE, 0, 0
},
.rpmsg_vdev = /* SRTM virtio device entry */
{
RSC_VDEV,
7,
2,
RSC_VDEV_FEATURE_NS,
0,
0,
0,
NUM_VRINGS,
{
0, 0
}
},
.rpmsg_vring0 =
{
VDEV0_VRING_BASE,
VRING_ALIGN,
RL_BUFFER_COUNT,
0,
0
},
.rpmsg_vring1 =
{
VDEV0_VRING_BASE + VRING_SIZE,
VRING_ALIGN,
RL_BUFFER_COUNT,
1,
0
},
.config =
{
0
}
};
/****************************************************************************
* Public Functions
****************************************************************************/
void mx8mp_copy_rsc_table(void)
{
memcpy((void *)RESOURCE_TABLE_BASE, (void *)&g_mx8mp_rsc_table,
sizeof(g_mx8mp_rsc_table));
}

View File

@ -0,0 +1,42 @@
/****************************************************************************
* arch/arm/src/mx8mp/mx8mp_rsctable.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __ARCH_ARM_SRC_MX8MP_MX8MP_RSCTABLE_H
#define __ARCH_ARM_SRC_MX8MP_MX8MP_RSCTABLE_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/rptun/rptun.h>
/****************************************************************************
* Public Data
****************************************************************************/
extern const struct rptun_rsc_s g_mx8mp_rsc_table;
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
void mx8mp_copy_rsc_table(void);
#endif /* __ARCH_ARM_SRC_MX8MP_MX8MP_RSCTABLE_H */

View File

@ -2,3 +2,9 @@
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
config MX8MP_RUN_FROM_ITCM
bool "Run from Instruction Tightly Coupled Memory (ITCM)"
default n
---help---
Run software from ITCM instead of DDR memory

View File

@ -0,0 +1,73 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_ARCH_LEDS is not set
# CONFIG_ARCH_RAMFUNCS is not set
# CONFIG_STANDARD_SERIAL is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="verdin-mx8mp"
CONFIG_ARCH_BOARD_VERDIN_MX8MP=y
CONFIG_ARCH_BUTTONS=y
CONFIG_ARCH_CHIP="mx8mp"
CONFIG_ARCH_CHIP_MX8MP=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_IRQBUTTONS=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARMV7M_DCACHE=y
CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y
CONFIG_ARMV7M_ICACHE=y
CONFIG_ARM_MPU=y
CONFIG_BOARD_LOOPSPERMSEC=159972
CONFIG_BUILTIN=y
CONFIG_DEBUG_FEATURES=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEV_RPMSG=y
CONFIG_DEV_SIMPLE_ADDRENV=y
CONFIG_FS_PROCFS=y
CONFIG_I2CTOOL_MAXADDR=0x7f
CONFIG_I2CTOOL_MAXBUS=6
CONFIG_I2CTOOL_MINADDR=0x00
CONFIG_I2CTOOL_MINBUS=1
CONFIG_I2C_RESET=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INPUT=y
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_LOCALE=y
CONFIG_MX8MP_I2C4=y
CONFIG_MX8MP_I2C=y
CONFIG_MX8MP_RUN_FROM_ITCM=y
CONFIG_MX8MP_UART4=y
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_DISABLE_IFCONFIG=y
CONFIG_NSH_DISABLE_IFUPDOWN=y
CONFIG_NSH_DISABLE_PS=y
CONFIG_NSH_DISABLE_RPTUN=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_LINELEN=64
CONFIG_NSH_READLINE=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_PTHREAD_MUTEX_TYPES=y
CONFIG_RAM_SIZE=65536
CONFIG_RAM_START=0x20000000
CONFIG_RAW_BINARY=y
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RPMSG_UART=y
CONFIG_RPMSG_UART_CONSOLE=y
CONFIG_RPTUN=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_HPWORK=y
CONFIG_SCHED_WAITPID=y
CONFIG_SENSORS=y
CONFIG_START_DAY=10
CONFIG_START_MONTH=3
CONFIG_START_YEAR=2014
CONFIG_SYSTEM_I2CTOOL=y
CONFIG_SYSTEM_NSH=y
CONFIG_TESTING_RAMTEST=y
CONFIG_UART4_SERIAL_CONSOLE=y

View File

@ -22,7 +22,12 @@ include $(TOPDIR)/.config
include $(TOPDIR)/tools/Config.mk
include $(TOPDIR)/arch/arm/src/armv7-m/Toolchain.defs
ifeq ($(CONFIG_MX8MP_RUN_FROM_ITCM),y)
LDSCRIPT = itcm.ld
else
LDSCRIPT = ddr.ld
endif
ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10

View File

@ -41,6 +41,7 @@ SECTIONS
{
.text : {
_stext = ABSOLUTE(.);
. = ALIGN(4);
*(.vectors)
*(.text .text.*)
*(.fixup)
@ -55,6 +56,13 @@ SECTIONS
_etext = ABSOLUTE(.);
} > flash
.resource_table :
{
. = ALIGN(8);
KEEP(*(.resource_table))
. = ALIGN(4);
} > flash
.init_section : {
_sinit = ABSOLUTE(.);
KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))

View File

@ -39,6 +39,7 @@ SECTIONS
{
.text : {
_stext = ABSOLUTE(.);
. = ALIGN(4);
*(.vectors)
*(.text .text.*)
*(.fixup)
@ -53,6 +54,13 @@ SECTIONS
_etext = ABSOLUTE(.);
} > flash
.resource_table :
{
. = ALIGN(8);
KEEP(*(.resource_table))
. = ALIGN(4);
} > flash
.init_section : {
_sinit = ABSOLUTE(.);
KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))

View File

@ -25,7 +25,6 @@
#include <nuttx/config.h>
#include <nuttx/leds/userled.h>
#include <nuttx/input/buttons.h>
#include <debug.h>
#include "verdin-mx8mp.h"
@ -35,10 +34,29 @@
# include "mx8mp_ina219.h"
#endif
#ifdef CONFIG_MX8MP_RPMSG
# include <mx8mp_rptun.h>
#endif
#ifdef CONFIG_RPMSG_UART
# include <nuttx/serial/uart_rpmsg.h>
#endif
#ifdef CONFIG_FS_PROCFS
# include <nuttx/fs/fs.h>
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
#ifdef CONFIG_RPMSG_UART
void rpmsg_serialinit(void)
{
uart_rpmsg_init("netcore", "proxy", 4096, true);
}
#endif
/****************************************************************************
* Name: mx8mp_bringup
*
@ -51,6 +69,10 @@ int mx8mp_bringup(void)
{
int ret = OK;
#ifdef CONFIG_MX8MP_RPMSG
mx8mp_rptun_init("imx8mp-shmem", "netcore");
#endif /* CONFIG_MX8MP_RPMSG */
#if defined(CONFIG_USERLED) && !defined(CONFIG_ARCH_LEDS)
#ifdef CONFIG_USERLED_LOWER
/* Register the LED driver */