imx: introduce rdc and boot auxiliary core
Subsystems (2)
v2 cover imx: introduce rdc and boot auxiliary core
From: Peng Fan <[email protected]>
To i.MX6SX and i.MX7D, there is a M4 core embedded. Resources can be shared or occupied exclusively by setting Resource domain controller between A9/7 core and M4 core.
Refer "Chapter 52 Resource Domain Controller (RDC)" of i.MX 6SoloX RM and "Chapter 3.2 Resource Domain Controller (RDC)" of i.MX 7Dual RM for detailed infomation.
To bootup M4 core, a new command 'bootaux' is introduced. To i.MX7D, we need to setting RDC when booting M4 core, so make RDC and boot auxiliary core patches into one patch set.
Since we also sometimes put the M4 image in QSPI to let M4 directly fecth code in the memory mapped QSPI space, we can not support such as libz compressed image.
Peng Fan (11):
imx: mx6: introduce rdc regs
imx: imx-common: introduce Resource Domain Controller support
imx: mx6sx Add RDC mappings of masters and peripherals
imx: mx7d: Add RDC support
imx: mx7d: clock support for RDC
imx: imx-common: introduce boot auxiliary core
imx: mx6: implement functions to boot auxiliary core
imx: mx6sxsabresd: add command and macros for boot m4 core
imx: mx7: implement functions to boot auxiliary core
imx: mx7dsabresd: add command and macros for boot m4 core
imx: mx7d: isolate resources to domain 0 for A7 core
arch/arm/cpu/armv7/mx6/soc.c | 38 ++++++ arch/arm/cpu/armv7/mx7/clock.c | 6 + arch/arm/cpu/armv7/mx7/soc.c | 100 ++++++++++++++++ arch/arm/imx-common/Kconfig | 14 +++ arch/arm/imx-common/Makefile | 2 + arch/arm/imx-common/imx_bootaux.c | 72 ++++++++++++ arch/arm/imx-common/rdc-sema.c | 183 +++++++++++++++++++++++++++++ arch/arm/include/asm/arch-mx6/imx-rdc.h | 16 +++ arch/arm/include/asm/arch-mx6/imx-regs.h | 29 +++++ arch/arm/include/asm/arch-mx6/mx6sx_rdc.h | 155 ++++++++++++++++++++++++ arch/arm/include/asm/arch-mx7/imx-rdc.h | 16 +++ arch/arm/include/asm/arch-mx7/imx-regs.h | 8 ++ arch/arm/include/asm/arch-mx7/mx7d_rdc.h | 163 +++++++++++++++++++++++++ arch/arm/include/asm/imx-common/rdc-sema.h | 100 ++++++++++++++++ configs/mx7dsabresd_defconfig | 2 + include/configs/mx6sxsabresd.h | 24 ++++ include/configs/mx7dsabresd.h | 24 ++++ 17 files changed, 952 insertions(+) create mode 100644 arch/arm/imx-common/imx_bootaux.c create mode 100644 arch/arm/imx-common/rdc-sema.c create mode 100644 arch/arm/include/asm/arch-mx6/imx-rdc.h create mode 100644 arch/arm/include/asm/arch-mx6/mx6sx_rdc.h create mode 100644 arch/arm/include/asm/arch-mx7/imx-rdc.h create mode 100644 arch/arm/include/asm/arch-mx7/mx7d_rdc.h create mode 100644 arch/arm/include/asm/imx-common/rdc-sema.h
Signature · 1 line
2.6.2
PATCH v2 1/11 imx: mx6: introduce rdc regs
From: Peng Fan <[email protected]>
Introudce rdc regs structure and rdc sema reg structure for i.MX6. For now, to i.MX6, only i.MX6SX supports this.
---
V2:
no change
arch/arm/include/asm/arch-mx6/imx-regs.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
arch/arm/include/asm/arch-mx6/imx-regs.h +24 -0
@@ -356,6 +356,30 @@ extern void imx_get_mac_from_fuse(int dev_id, unsigned char *mac);#define SRC_SCR_CORE_3_ENABLE_OFFSET 24#define SRC_SCR_CORE_3_ENABLE_MASK (1<<SRC_SCR_CORE_3_ENABLE_OFFSET) +struct rdc_regs { +u32 vir;/* Version information */ +u32 reserved1[8 ]; +u32 stat;/* Status */ +u32 intctrl;/* Interrupt and Control */ +u32 intstat;/* Interrupt Status */ +u32 reserved2[116 ]; +u32 mda[32 ];/* Master Domain Assignment */ +u32 reserved3[96 ]; +u32 pdap[104 ];/* Peripheral Domain Access Permissions */ +u32 reserved4[88 ]; +struct { +u32 mrsa;/* Memory Region Start Address */ +u32 mrea;/* Memory Region End Address */ +u32 mrc;/* Memory Region Control */ +u32 mrvs;/* Memory Region Violation Status */ + } mem_region[55 ]; +}; + +struct rdc_sema_regs { +u8 gate[64 ];/* Gate */ +u16 rstgt;/* Reset Gate */ +}; +/* WEIM registers */ struct weim {u32 cs0gcr1;
Signature · 1 line
2.6.2
PATCH v2 2/11 imx: imx-common: introduce Resource Domain Controller support
In reply to Peng FanFrom: Peng Fan <[email protected]>
Introduce Resource Domain Controller support for i.MX. Now i.MX6SX and i.MX7D supports this feature to assign masters and peripherals to different domains.
---
V2:
change imx_rdc_check_permission to support checking domain id.
arch/arm/imx-common/Kconfig | 8 ++ arch/arm/imx-common/Makefile | 1 + arch/arm/imx-common/rdc-sema.c | 183 +++++++++++++++++++++++++++++ arch/arm/include/asm/arch-mx6/imx-rdc.h | 12 ++ arch/arm/include/asm/imx-common/rdc-sema.h | 100 ++++++++++++++++ 5 files changed, 304 insertions(+) create mode 100644 arch/arm/imx-common/rdc-sema.c create mode 100644 arch/arm/include/asm/arch-mx6/imx-rdc.h create mode 100644 arch/arm/include/asm/imx-common/rdc-sema.h
arch/arm/imx-common/Kconfig +8 -0
@@ -3,3 +3,11 @@ config IMX_CONFIG config ROM_UNIFIED_SECTIONS bool + +config IMX_RDC + bool "i.MX Resource domain controller driver" + depends on ARCH_MX6 || ARCH_MX7 + help + i.MX Resource domain controller is used to assign masters + and peripherals to differet domains. This can be used to + isolate resources.
arch/arm/imx-common/Makefile +1 -0
@@ -27,6 +27,7 @@ ifeq ($(SOC),$(filter $(SOC),mx6 mx7)) obj-y += cache.o init.o obj-$(CONFIG_CMD_SATA) += sata.o obj-$(CONFIG_IMX_VIDEO_SKIP) += video.o +obj-$(CONFIG_IMX_RDC) += rdc-sema.o obj-$(CONFIG_SECURE_BOOT) += hab.o endif ifeq ($(SOC),$(filter $(SOC),vf610))
arch/arm/imx-common/rdc-sema.c new file +183 -0
183 lines not on this page · raw message
arch/arm/include/asm/arch-mx6/imx-rdc.h new file +12 -0
@@ -0,0 +1,12 @@ +/* +* Copyright (C) 2016 Freescale Semiconductor, Inc. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __IMX_RDC_H__ +#define __IMX_RDC_H__ + +#error "Please select cpu" + +#endif /* __IMX_RDC_H__*/
arch/arm/include/asm/imx-common/rdc-sema.h new file +100 -0
100 lines not on this page · raw message
Signature · 1 line
2.6.2
PATCH v2 3/11 imx: mx6sx Add RDC mappings of masters and peripherals
In reply to Peng FanFrom: Peng Fan <[email protected]>
Add the definitions for the RDC mappings for i.MX6 SoloX.
---
V2:
no change
arch/arm/include/asm/arch-mx6/imx-rdc.h | 4 + arch/arm/include/asm/arch-mx6/mx6sx_rdc.h | 155 ++++++++++++++++++++++++++++++ 2 files changed, 159 insertions(+) create mode 100644 arch/arm/include/asm/arch-mx6/mx6sx_rdc.h
arch/arm/include/asm/arch-mx6/imx-rdc.h +4 -0
@@ -7,6 +7,10 @@#ifndef __IMX_RDC_H__#define __IMX_RDC_H__ +#if defined(CONFIG_MX6SX ) +#include "mx6sx_rdc.h" +#else #error "Please select cpu" +#endif /* CONFIG_MX6SX */ #endif /* __IMX_RDC_H__*/
arch/arm/include/asm/arch-mx6/mx6sx_rdc.h new file +155 -0
155 lines not on this page · raw message
Signature · 1 line
2.6.2
PATCH v2 4/11 imx: mx7d: Add RDC support
In reply to Peng FanFrom: Peng Fan <[email protected]>
Add the peripherals/masters definitions and registers base addresses for mx7d RDC.
---
V2:
no change
arch/arm/include/asm/arch-mx7/imx-rdc.h | 16 +++ arch/arm/include/asm/arch-mx7/imx-regs.h | 3 + arch/arm/include/asm/arch-mx7/mx7d_rdc.h | 163 +++++++++++++++++++++++++++++++ 3 files changed, 182 insertions(+) create mode 100644 arch/arm/include/asm/arch-mx7/imx-rdc.h create mode 100644 arch/arm/include/asm/arch-mx7/mx7d_rdc.h
arch/arm/include/asm/arch-mx7/imx-rdc.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* Copyright (C) 2016 Freescale Semiconductor, Inc. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __IMX_RDC_H__ +#define __IMX_RDC_H__ + +#if defined(CONFIG_MX7D ) +#include "mx7d_rdc.h" +#else +#error "Please select cpu" +#endif /* CONFIG_MX7D */ + +#endif /* __IMX_RDC_H__*/
arch/arm/include/asm/arch-mx7/imx-regs.h +3 -0
@@ -212,6 +212,9 @@#define DEBUG_MONITOR_BASE_ADDR IP2APB_AXIMON_IPS_BASE_ADDR#define USB_BASE_ADDR USBOTG1_IPS_BASE_ADDR +#define SEMAPHORE1_BASE_ADDR SEMA41_IPS_BASE_ADDR +#define SEMAPHORE2_BASE_ADDR SEMA42_IPS_BASE_ADDR +#define RDC_BASE_ADDR RDC_IPS_BASE_ADDR#define FEC_QUIRK_ENET_MAC #define SNVS_LPGPR 0x68
arch/arm/include/asm/arch-mx7/mx7d_rdc.h new file +163 -0
163 lines not on this page · raw message
Signature · 1 line
2.6.2
PATCH v2 5/11 imx: mx7d: clock support for RDC
In reply to Peng FanFrom: Peng Fan <[email protected]>
If CONFIG_IMX_RDC is enabled, enable clock for RDC and SEMAPHORE.
---
V2: no change
arch/arm/cpu/armv7/mx7/clock.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/cpu/armv7/mx7/clock.c +6 -0
@@ -1067,6 +1067,12 @@ void clock_init(void)#ifdef CONFIG_NAND_MXS clock_enable (CCGR_RAWNAND ,1 );#endif + +if (IS_ENABLED (CONFIG_IMX_RDC )) { +clock_enable (CCGR_RDC ,1 ); +clock_enable (CCGR_SEMA1 ,1 ); +clock_enable (CCGR_SEMA2 ,1 ); + } }#ifdef CONFIG_SECURE_BOOT
Signature · 1 line
2.6.2
PATCH v2 6/11 imx: imx-common: introduce boot auxiliary core
In reply to Peng FanFrom: Peng Fan <[email protected]>
To boot a auxiliary core in asymmetric multicore system, introduce the new command "bootaux" to do it. Example of boot auxliary core from 0x70000000 where stores the boot head information that should be parsed by auxiliary core, "bootaux 0x70000000".
Introduce Kconfig option IMX_BOOTAUX.
---
V2:
add more comments for bootaux command
arch/arm/imx-common/Kconfig | 6 ++++ arch/arm/imx-common/Makefile | 1 + arch/arm/imx-common/imx_bootaux.c | 72 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 arch/arm/imx-common/imx_bootaux.c
arch/arm/imx-common/Kconfig +6 -0
@@ -11,3 +11,9 @@ config IMX_RDC i.MX Resource domain controller is used to assign masters and peripherals to differet domains. This can be used to isolate resources. + +config IMX_BOOTAUX + bool "Support boot auxiliary core" + depends on ARCH_MX7 || ARCH_MX6 + help + bootaux [addr] to boot auxiliary core.
arch/arm/imx-common/Makefile +1 -0
@@ -28,6 +28,7 @@ obj-y += cache.o init.o obj-$(CONFIG_CMD_SATA) += sata.o obj-$(CONFIG_IMX_VIDEO_SKIP) += video.o obj-$(CONFIG_IMX_RDC) += rdc-sema.o +obj-$(CONFIG_IMX_BOOTAUX) += imx_bootaux.o obj-$(CONFIG_SECURE_BOOT) += hab.o endif ifeq ($(SOC),$(filter $(SOC),vf610))
arch/arm/imx-common/imx_bootaux.c new file +72 -0
72 lines not on this page · raw message
Signature · 1 line
2.6.2
PATCH v2 7/11 imx: mx6: implement functions to boot auxiliary core
In reply to Peng FanFrom: Peng Fan <[email protected]>
Implement arch_auxiliary_core_up and arch_auxiliary_core_check_up.
arch_auxiliary_core_check_up is used to check whether M4 is running or not. arch_auxiliary_core_up is to boot M4 core, the m4 core will use the pc and stack which is set in arch_auxiliary_core_up to set R15 and R13 register and boot.
---
V2:
no change
arch/arm/cpu/armv7/mx6/soc.c | 38 ++++++++++++++++++++++++++++++++ arch/arm/include/asm/arch-mx6/imx-regs.h | 5 +++++ 2 files changed, 43 insertions(+)
arch/arm/cpu/armv7/mx6/soc.c +38 -0
@@ -491,3 +491,41 @@ void imx_setup_hdmi(void)writel (reg, &mxc_ccm->chsccdr); }#endif + +#ifdef CONFIG_IMX_BOOTAUX +int arch_auxiliary_core_up (u32 core_id,u32 boot_private_data) +{ +struct src *src_reg; +u32 stack, pc; + +if (!boot_private_data) +return -EINVAL ; + + stack = *(u32 *)boot_private_data; + pc = *(u32 *)(boot_private_data +4 ); + +/* Set the stack and pc to M4 bootROM */ +writel (stack,M4_BOOTROM_BASE_ADDR ); +writel (pc,M4_BOOTROM_BASE_ADDR +4 ); + +/* Enable M4 */ + src_reg = (struct src *)SRC_BASE_ADDR ; +clrsetbits_le32 (&src_reg->scr,SRC_SCR_M4C_NON_SCLR_RST_MASK , +SRC_SCR_M4_ENABLE_MASK ); + +return 0 ; +} + +int arch_auxiliary_core_check_up (u32 core_id) +{ +struct src *src_reg = (struct src *)SRC_BASE_ADDR ; +unsigned val; + + val =readl (&src_reg->scr); + +if (val &SRC_SCR_M4C_NON_SCLR_RST_MASK ) +return 0 ;/* assert in reset */ + +return 1 ; +} +#endif
arch/arm/include/asm/arch-mx6/imx-regs.h +5 -0
@@ -438,6 +438,11 @@ struct src {u32 gpr10; }; +#define SRC_SCR_M4_ENABLE_OFFSET 22 +#define SRC_SCR_M4_ENABLE_MASK (1 << 22) +#define SRC_SCR_M4C_NON_SCLR_RST_OFFSET 4 +#define SRC_SCR_M4C_NON_SCLR_RST_MASK (1 << 4) +/* GPR1 bitfields */ #define IOMUXC_GPR1_APP_CLK_REQ_N BIT(30)#define IOMUXC_GPR1_PCIE_EXIT_L1 BIT(28)
Signature · 1 line
2.6.2
PATCH v2 8/11 imx: mx6sxsabresd: add command and macros for boot m4 core
In reply to Peng FanFrom: Peng Fan <[email protected]>
Introduce macros and command to support booting M4 core for i.MX6SX SabreSD board.
---
V2:
no change
include/configs/mx6sxsabresd.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
include/configs/mx6sxsabresd.h +24 -0
@@ -26,7 +26,31 @@#define CONFIG_MXC_UART #define CONFIG_MXC_UART_BASE UART1_BASE +#ifdef CONFIG_IMX_BOOTAUX +/* Set to QSPI2 B flash at default */ +#define CONFIG_SYS_AUXCORE_BOOTDATA 0x78000000 +#define CONFIG_CMD_SETEXPR + +#define UPDATE_M4_ENV \ + "m4image=m4_qspi.bin\0" \ + "loadm4image=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${m4image}\0" \ + "update_m4_from_sd=" \ + "if sf probe 1:0; then " \ + "if run loadm4image; then " \ + "setexpr fw_sz ${filesize} + 0xffff; " \ + "setexpr fw_sz ${fw_sz} / 0x10000; " \ + "setexpr fw_sz ${fw_sz} * 0x10000; " \ + "sf erase 0x0 ${fw_sz}; " \ + "sf write ${loadaddr} 0x0 ${filesize}; " \ + "fi; " \ + "fi\0" \ + "m4boot=sf probe 1:0; bootaux "__stringify(CONFIG_SYS_AUXCORE_BOOTDATA)"\0" +#else +#define UPDATE_M4_ENV "" +#endif +#define CONFIG_EXTRA_ENV_SETTINGS \ + UPDATE_M4_ENV \ "script=boot.scr\0" \ "image=zImage\0" \ "console=ttymxc0\0" \
Signature · 1 line
2.6.2
PATCH v2 9/11 imx: mx7: implement functions to boot auxiliary core
In reply to Peng FanFrom: Peng Fan <[email protected]>
Implement arch_auxiliary_core_up and arch_auxiliary_core_check_up.
arch_auxiliary_core_check_up is used to check whether M4 is running or not. arch_auxiliary_core_up is to boot M4 core, the m4 core will use the pc and stack which is set in arch_auxiliary_core_up to set R15 and R13 register and boot.
---
V2:
no change
arch/arm/cpu/armv7/mx7/soc.c | 36 ++++++++++++++++++++++++++++++++ arch/arm/include/asm/arch-mx7/imx-regs.h | 5 +++++ 2 files changed, 41 insertions(+)
arch/arm/cpu/armv7/mx7/soc.c +36 -0
@@ -211,6 +211,42 @@ void imx_get_mac_from_fuse(int dev_id, unsigned char *mac) }#endif +#ifdef CONFIG_IMX_BOOTAUX +int arch_auxiliary_core_up (u32 core_id,u32 boot_private_data) +{ +u32 stack, pc; +struct src *src_reg = (struct src *)SRC_BASE_ADDR ; + +if (!boot_private_data) +return 1 ; + + stack = *(u32 *)boot_private_data; + pc = *(u32 *)(boot_private_data +4 ); + +/* Set the stack and pc to M4 bootROM */ +writel (stack,M4_BOOTROM_BASE_ADDR ); +writel (pc,M4_BOOTROM_BASE_ADDR +4 ); + +/* Enable M4 */ +clrsetbits_le32 (&src_reg->m4rcr,SRC_M4RCR_M4C_NON_SCLR_RST_MASK , +SRC_M4RCR_ENABLE_M4_MASK ); + +return 0 ; +} + +int arch_auxiliary_core_check_up (u32 core_id) +{ +uint32_t val; +struct src *src_reg = (struct src *)SRC_BASE_ADDR ; + + val =readl (&src_reg->m4rcr); +if (val &0x00000001 ) +return 0 ;/* assert in reset */ + +return 1 ; +} +#endif +void set_wdog_reset (struct wdog_regs *wdog) {u32 reg =readw (&wdog->wcr);
arch/arm/include/asm/arch-mx7/imx-regs.h +5 -0
@@ -260,6 +260,11 @@ struct src {u32 ddrc_rcr; }; +#define SRC_M4RCR_M4C_NON_SCLR_RST_OFFSET 0 +#define SRC_M4RCR_M4C_NON_SCLR_RST_MASK (1 << 0) +#define SRC_M4RCR_ENABLE_M4_OFFSET 3 +#define SRC_M4RCR_ENABLE_M4_MASK (1 << 3) +/* GPR0 Bit Fields */ #define IOMUXC_GPR_GPR0_DMAREQ_MUX_SEL0_MASK 0x1u#define IOMUXC_GPR_GPR0_DMAREQ_MUX_SEL0_SHIFT 0
Signature · 1 line
2.6.2
PATCH v2 10/11 imx: mx7dsabresd: add command and macros for boot m4 core
In reply to Peng FanFrom: Peng Fan <[email protected]>
Introduce macros and command to support booting M4 core for i.MX7D SabreSD board.
---
V2:
no change
include/configs/mx7dsabresd.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
include/configs/mx7dsabresd.h +24 -0
@@ -57,6 +57,29 @@#define CONFIG_SUPPORT_EMMC_BOOT /* eMMC specific */ #define CONFIG_SYS_MMC_IMG_LOAD_PART 1 +#ifdef CONFIG_IMX_BOOTAUX +/* Set to QSPI1 A flash at default */ +#define CONFIG_SYS_AUXCORE_BOOTDATA 0x60000000 +#define CONFIG_CMD_SETEXPR + +#define UPDATE_M4_ENV \ + "m4image=m4_qspi.bin\0" \ + "loadm4image=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${m4image}\0" \ + "update_m4_from_sd=" \ + "if sf probe 0:0; then " \ + "if run loadm4image; then " \ + "setexpr fw_sz ${filesize} + 0xffff; " \ + "setexpr fw_sz ${fw_sz} / 0x10000; " \ + "setexpr fw_sz ${fw_sz} * 0x10000; " \ + "sf erase 0x0 ${fw_sz}; " \ + "sf write ${loadaddr} 0x0 ${filesize}; " \ + "fi; " \ + "fi\0" \ + "m4boot=sf probe 0:0; bootaux "__stringify(CONFIG_SYS_AUXCORE_BOOTDATA)"\0" +#else +#define UPDATE_M4_ENV "" +#endif +#define CONFIG_MFG_ENV_SETTINGS \ "mfgtool_args=setenv bootargs console=${console},${baudrate} " \ "rdinit=/linuxrc " \
@@ -76,6 +99,7 @@"rootfs part 0 2\0" \ #define CONFIG_EXTRA_ENV_SETTINGS \ +UPDATE_M4_ENV \CONFIG_MFG_ENV_SETTINGS \CONFIG_DFU_ENV_SETTINGS \"script=boot.scr\0" \
Signature · 1 line
2.6.2
PATCH v2 11/11 imx: mx7d: isolate resources to domain 0 for A7 core
In reply to Peng FanFrom: Peng Fan <[email protected]>
In current design, if any peripheral was assigned to both A7 and M4, it will receive ipg_stop or ipg_wait when any of the 2 platforms enter low power mode. We will have a risk that, if A7 enter wait, M4 enter stop, peripheral will have chance to get ipg_stop and ipg_wait asserted same time. Also if M4 enters stop mode, A7 will have no chance to access the peripheral.
There are 26 peripherals affected by this IC issue:
SIM2(sim2/emvsim2)
SIM1(sim1/emvsim1)
UART1/UART2/UART3/UART4/UART5/UART6/UART7
SAI1/SAI2/SAI3
WDOG1/WDOG2/WDOG3/WDOG4
GPT1/GPT2/GPT3/GPT4
PWM1/PWM2/PWM3/PWM4
ENET1/ENET2
Software Workaround:
The solution is to set the peripherals to Domain0 by A core, since A core in Domain0. The peripherals which will be used by M4, will be set to Domain1 by M4.
For example, A core set WDOG4 to domain0, but when M4 boots up, M4 will set WDOG4 to domain1, because M4 will use WDOG4.
So the peripherals are not shared by them. This way requires the uboot implemented the RDC driver and set the 26 IPs above to domain 0 only. M4 image will set the M4 to domain 1 and set peripheral which it will use to domain 1.
This patch enables the CONFIG_IMX_RDC and CONFIG_IMX_BOOTAUX for i.MX7D SABRESD board, and setup the 26 IP resources to domain 0.
---
V2:
update commit log
arch/arm/cpu/armv7/mx7/soc.c | 64 +++++++++++++++++++++++++++++++++++++++++++ configs/mx7dsabresd_defconfig | 2 ++ 2 files changed, 66 insertions(+)
arch/arm/cpu/armv7/mx7/soc.c +64 -0
@@ -12,6 +12,8 @@#include <asm/imx-common/boot_mode.h> #include <asm/imx-common/dma.h> #include <asm/imx-common/hab.h> +#include <asm/imx-common/rdc-sema.h> +#include <asm/arch/imx-rdc.h> #include <asm/arch/crm_regs.h> #include <dm.h> #include <imx_thermal.h>
@@ -29,6 +31,65 @@ U_BOOT_DEVICE(imx7_thermal) = { };#endif +#ifdef CONFIG_IMX_RDC +/* +* In current design, if any peripheral was assigned to both A7 and M4, +* it will receive ipg_stop or ipg_wait when any of the 2 platforms enter +* low power mode. So M4 sleep will cause some peripherals fail to work +* at A7 core side. At default, all resources are in domain 0 - 3. +* +* There are 26 peripherals impacted by this IC issue: +* SIM2(sim2/emvsim2) +* SIM1(sim1/emvsim1) +* UART1/UART2/UART3/UART4/UART5/UART6/UART7 +* SAI1/SAI2/SAI3 +* WDOG1/WDOG2/WDOG3/WDOG4 +* GPT1/GPT2/GPT3/GPT4 +* PWM1/PWM2/PWM3/PWM4 +* ENET1/ENET2 +* Software Workaround: +* Here we setup some resources to domain 0 where M4 codes will move +* the M4 out of this domain. Then M4 is not able to access them any longer. +* This is a workaround for ic issue. So the peripherals are not shared +* by them. This way requires the uboot implemented the RDC driver and +* set the 26 IPs above to domain 0 only. M4 code will assign resource +* to its own domain, if it want to use the resource. +*/ +static rdc_peri_cfg_t const resources[] = { + (RDC_PER_SIM1 |RDC_DOMAIN (0 )), + (RDC_PER_SIM2 |RDC_DOMAIN (0 )), + (RDC_PER_UART1 |RDC_DOMAIN (0 )), + (RDC_PER_UART2 |RDC_DOMAIN (0 )), + (RDC_PER_UART3 |RDC_DOMAIN (0 )), + (RDC_PER_UART4 |RDC_DOMAIN (0 )), + (RDC_PER_UART5 |RDC_DOMAIN (0 )), + (RDC_PER_UART6 |RDC_DOMAIN (0 )), + (RDC_PER_UART7 |RDC_DOMAIN (0 )), + (RDC_PER_SAI1 |RDC_DOMAIN (0 )), + (RDC_PER_SAI2 |RDC_DOMAIN (0 )), + (RDC_PER_SAI3 |RDC_DOMAIN (0 )), + (RDC_PER_WDOG1 |RDC_DOMAIN (0 )), + (RDC_PER_WDOG2 |RDC_DOMAIN (0 )), + (RDC_PER_WDOG3 |RDC_DOMAIN (0 )), + (RDC_PER_WDOG4 |RDC_DOMAIN (0 )), + (RDC_PER_GPT1 |RDC_DOMAIN (0 )), + (RDC_PER_GPT2 |RDC_DOMAIN (0 )), + (RDC_PER_GPT3 |RDC_DOMAIN (0 )), + (RDC_PER_GPT4 |RDC_DOMAIN (0 )), + (RDC_PER_PWM1 |RDC_DOMAIN (0 )), + (RDC_PER_PWM2 |RDC_DOMAIN (0 )), + (RDC_PER_PWM3 |RDC_DOMAIN (0 )), + (RDC_PER_PWM4 |RDC_DOMAIN (0 )), + (RDC_PER_ENET1 |RDC_DOMAIN (0 )), + (RDC_PER_ENET2 |RDC_DOMAIN (0 )), +}; + +static void isolate_resource (void ) +{ +imx_rdc_setup_peripherals (resources,ARRAY_SIZE (resources)); +} +#endif +#if defined(CONFIG_SECURE_BOOT )struct imx_sec_config_fuse_t const imx_sec_config_fuse = { .bank = 1,
@@ -163,6 +224,9 @@ int arch_cpu_init(void)mxs_dma_init ();#endif +if (IS_ENABLED (CONFIG_IMX_RDC )) +isolate_resource (); +return 0 ; }
configs/mx7dsabresd_defconfig +2 -0
@@ -1,6 +1,8 @@ CONFIG_ARM=y CONFIG_ARCH_MX7=y CONFIG_TARGET_MX7DSABRESD=y +CONFIG_IMX_RDC=y +CONFIG_IMX_BOOTAUX=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx7dsabresd/imximage.cfg,MX7D" # CONFIG_CMD_BOOTD is not set # CONFIG_CMD_IMI is not set
Signature · 1 line
2.6.2
v2 cover imx: introduce rdc and boot auxiliary core
In reply to Peng FanHi Peng,
Quoted 6 lines · Peng Fan
From: Peng Fan <[email protected]>
To i.MX6SX and i.MX7D, there is a M4 core embedded. Resources can be shared or occupied exclusively by setting Resource domain controller between A9/7 core and M4 core.
Quoted 8 lines
Refer "Chapter 52 Resource Domain Controller (RDC)" of i.MX 6SoloX RM and "Chapter 3.2 Resource Domain Controller (RDC)" of i.MX 7Dual RM for detailed infomation.
To bootup M4 core, a new command 'bootaux' is introduced. To i.MX7D, we need to setting RDC when booting M4 core, so make RDC and boot auxiliary core patches into one patch set.
I applied the whole series - maybe in future we can think about to make "bootaux" available to other SOCs, too. At the moment, it remains i.MX specific code and I do not see any reason to do it now - just to note it.
Quoted 4 lines
Since we also sometimes put the M4 image in QSPI to let M4 directly fecth code in the memory mapped QSPI space, we can not support such as libz compressed image.
Quoted 13 lines
Peng Fan (11):
imx: mx6: introduce rdc regs
imx: imx-common: introduce Resource Domain Controller support
imx: mx6sx Add RDC mappings of masters and peripherals
imx: mx7d: Add RDC support
imx: mx7d: clock support for RDC
imx: imx-common: introduce boot auxiliary core
imx: mx6: implement functions to boot auxiliary core
imx: mx6sxsabresd: add command and macros for boot m4 core
imx: mx7: implement functions to boot auxiliary core
imx: mx7dsabresd: add command and macros for boot m4 core
imx: mx7d: isolate resources to domain 0 for A7 core
Applied to u-boot-imx, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================