2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2015-09-02 18:54:19 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2015 Freescale Semiconductor, Inc.
|
2022-03-24 06:20:30 +00:00
|
|
|
* Copyright 2021 NXP
|
2015-09-02 18:54:19 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2020-05-10 17:40:02 +00:00
|
|
|
#include <init.h>
|
2015-09-02 18:54:19 +00:00
|
|
|
#include <asm/io.h>
|
|
|
|
#include <asm/arch/imx-regs.h>
|
|
|
|
#include <asm/arch/clock.h>
|
|
|
|
#include <asm/arch/sys_proto.h>
|
2017-06-29 08:16:06 +00:00
|
|
|
#include <asm/mach-imx/dma.h>
|
|
|
|
#include <asm/mach-imx/hab.h>
|
|
|
|
#include <asm/mach-imx/rdc-sema.h>
|
imx: mx7d: isolate resources to domain 0 for A7 core
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.
Signed-off-by: Ye.Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2016-01-28 08:55:09 +00:00
|
|
|
#include <asm/arch/imx-rdc.h>
|
2020-08-05 13:34:04 +00:00
|
|
|
#include <asm/mach-imx/boot_mode.h>
|
2022-01-02 19:36:56 +00:00
|
|
|
#include <asm/mach-imx/sys_proto.h>
|
2015-09-02 18:54:19 +00:00
|
|
|
#include <asm/arch/crm_regs.h>
|
2021-08-30 13:16:29 +00:00
|
|
|
#include <asm/bootm.h>
|
2015-09-02 18:54:19 +00:00
|
|
|
#include <dm.h>
|
2019-08-01 15:46:51 +00:00
|
|
|
#include <env.h>
|
2015-09-02 18:54:19 +00:00
|
|
|
#include <imx_thermal.h>
|
2018-03-26 14:27:32 +00:00
|
|
|
#include <asm/setup.h>
|
2020-05-10 17:40:11 +00:00
|
|
|
#include <linux/delay.h>
|
2015-09-02 18:54:19 +00:00
|
|
|
|
2018-08-08 01:17:49 +00:00
|
|
|
#define IOMUXC_GPR1 0x4
|
|
|
|
#define BM_IOMUXC_GPR1_IRQ 0x1000
|
|
|
|
|
|
|
|
#define GPC_LPCR_A7_BSC 0x0
|
|
|
|
#define GPC_LPCR_M4 0x8
|
|
|
|
#define GPC_SLPCR 0x14
|
|
|
|
#define GPC_PGC_ACK_SEL_A7 0x24
|
|
|
|
#define GPC_IMR1_CORE0 0x30
|
|
|
|
#define GPC_IMR1_CORE1 0x40
|
|
|
|
#define GPC_IMR1_M4 0x50
|
|
|
|
#define GPC_PGC_CPU_MAPPING 0xec
|
|
|
|
#define GPC_PGC_C0_PUPSCR 0x804
|
|
|
|
#define GPC_PGC_SCU_TIMING 0x890
|
|
|
|
#define GPC_PGC_C1_PUPSCR 0x844
|
|
|
|
|
|
|
|
#define BM_LPCR_A7_BSC_IRQ_SRC_A7_WAKEUP 0x70000000
|
|
|
|
#define BM_LPCR_A7_BSC_CPU_CLK_ON_LPM 0x4000
|
|
|
|
#define BM_LPCR_M4_MASK_DSM_TRIGGER 0x80000000
|
|
|
|
#define BM_SLPCR_EN_DSM 0x80000000
|
|
|
|
#define BM_SLPCR_RBC_EN 0x40000000
|
|
|
|
#define BM_SLPCR_REG_BYPASS_COUNT 0x3f000000
|
|
|
|
#define BM_SLPCR_VSTBY 0x4
|
|
|
|
#define BM_SLPCR_SBYOS 0x2
|
|
|
|
#define BM_SLPCR_BYPASS_PMIC_READY 0x1
|
|
|
|
#define BM_SLPCR_EN_A7_FASTWUP_WAIT_MODE 0x10000
|
|
|
|
|
|
|
|
#define BM_GPC_PGC_ACK_SEL_A7_DUMMY_PUP_ACK 0x80000000
|
|
|
|
#define BM_GPC_PGC_ACK_SEL_A7_DUMMY_PDN_ACK 0x8000
|
|
|
|
|
|
|
|
#define BM_GPC_PGC_CORE_PUPSCR 0x7fff80
|
|
|
|
|
2015-09-02 18:54:19 +00:00
|
|
|
#if defined(CONFIG_IMX_THERMAL)
|
|
|
|
static const struct imx_thermal_plat imx7_thermal_plat = {
|
|
|
|
.regs = (void *)ANATOP_BASE_ADDR,
|
|
|
|
.fuse_bank = 3,
|
|
|
|
.fuse_word = 3,
|
|
|
|
};
|
|
|
|
|
2020-12-29 03:34:54 +00:00
|
|
|
U_BOOT_DRVINFO(imx7_thermal) = {
|
2015-09-02 18:54:19 +00:00
|
|
|
.name = "imx_thermal",
|
2020-12-03 23:55:18 +00:00
|
|
|
.plat = &imx7_thermal_plat,
|
2015-09-02 18:54:19 +00:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2017-08-12 14:10:57 +00:00
|
|
|
#if CONFIG_IS_ENABLED(IMX_RDC)
|
imx: mx7d: isolate resources to domain 0 for A7 core
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.
Signed-off-by: Ye.Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2016-01-28 08:55:09 +00:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
|
2019-09-20 06:47:53 +00:00
|
|
|
#if defined(CONFIG_IMX_HAB)
|
2015-10-12 18:48:13 +00:00
|
|
|
struct imx_sec_config_fuse_t const imx_sec_config_fuse = {
|
|
|
|
.bank = 1,
|
|
|
|
.word = 3,
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2016-02-28 15:33:17 +00:00
|
|
|
static bool is_mx7d(void)
|
|
|
|
{
|
|
|
|
struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR;
|
|
|
|
struct fuse_bank *bank = &ocotp->bank[1];
|
|
|
|
struct fuse_bank1_regs *fuse =
|
|
|
|
(struct fuse_bank1_regs *)bank->fuse_regs;
|
|
|
|
int val;
|
|
|
|
|
|
|
|
val = readl(&fuse->tester4);
|
|
|
|
if (val & 1)
|
|
|
|
return false;
|
|
|
|
else
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-09-02 18:54:19 +00:00
|
|
|
u32 get_cpu_rev(void)
|
|
|
|
{
|
|
|
|
struct mxc_ccm_anatop_reg *ccm_anatop = (struct mxc_ccm_anatop_reg *)
|
|
|
|
ANATOP_BASE_ADDR;
|
|
|
|
u32 reg = readl(&ccm_anatop->digprog);
|
|
|
|
u32 type = (reg >> 16) & 0xff;
|
|
|
|
|
2016-02-28 15:33:17 +00:00
|
|
|
if (!is_mx7d())
|
|
|
|
type = MXC_CPU_MX7S;
|
|
|
|
|
2015-09-02 18:54:19 +00:00
|
|
|
reg &= 0xff;
|
|
|
|
return (type << 12) | reg;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_REVISION_TAG
|
|
|
|
u32 __weak get_board_rev(void)
|
|
|
|
{
|
|
|
|
return get_cpu_rev();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-01-04 05:16:41 +00:00
|
|
|
static void imx_enet_mdio_fixup(void)
|
|
|
|
{
|
|
|
|
struct iomuxc_gpr_base_regs *gpr_regs =
|
|
|
|
(struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The management data input/output (MDIO) requires open-drain,
|
|
|
|
* i.MX7D TO1.0 ENET MDIO pin has no open drain, but TO1.1 supports
|
|
|
|
* this feature. So to TO1.1, need to enable open drain by setting
|
|
|
|
* bits GPR0[8:7].
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (soc_rev() >= CHIP_REV_1_1) {
|
|
|
|
setbits_le32(&gpr_regs->gpr[0],
|
|
|
|
IOMUXC_GPR_GPR0_ENET_MDIO_OPEN_DRAIN_MASK);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-08 06:38:30 +00:00
|
|
|
static void init_cpu_basic(void)
|
|
|
|
{
|
|
|
|
imx_enet_mdio_fixup();
|
|
|
|
|
|
|
|
#ifdef CONFIG_APBH_DMA
|
|
|
|
/* Start APBH DMA */
|
|
|
|
mxs_dma_init();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2019-12-30 11:56:44 +00:00
|
|
|
#ifdef CONFIG_IMX_BOOTAUX
|
|
|
|
/*
|
|
|
|
* Table of mappings of physical mem regions in both
|
|
|
|
* Cortex-A7 and Cortex-M4 address spaces.
|
|
|
|
*
|
|
|
|
* For additional details check sections 2.1.2 and 2.1.3 in
|
|
|
|
* i.MX7Dual Applications Processor Reference Manual
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
const struct rproc_att hostmap[] = {
|
|
|
|
/* aux core , host core, size */
|
|
|
|
{ 0x00000000, 0x00180000, 0x8000 }, /* OCRAM_S */
|
|
|
|
{ 0x00180000, 0x00180000, 0x8000 }, /* OCRAM_S */
|
|
|
|
{ 0x20180000, 0x00180000, 0x8000 }, /* OCRAM_S */
|
|
|
|
{ 0x1fff8000, 0x007f8000, 0x8000 }, /* TCML */
|
|
|
|
{ 0x20000000, 0x00800000, 0x8000 }, /* TCMU */
|
|
|
|
{ 0x00900000, 0x00900000, 0x20000 }, /* OCRAM_128KB */
|
|
|
|
{ 0x20200000, 0x00900000, 0x20000 }, /* OCRAM_128KB */
|
|
|
|
{ 0x00920000, 0x00920000, 0x20000 }, /* OCRAM_EPDC */
|
|
|
|
{ 0x20220000, 0x00920000, 0x20000 }, /* OCRAM_EPDC */
|
|
|
|
{ 0x00940000, 0x00940000, 0x20000 }, /* OCRAM_PXP */
|
|
|
|
{ 0x20240000, 0x00940000, 0x20000 }, /* OCRAM_PXP */
|
|
|
|
{ 0x10000000, 0x80000000, 0x0fff0000 }, /* DDR Code alias */
|
2020-07-15 10:30:52 +00:00
|
|
|
{ 0x80000000, 0x80000000, 0x60000000 }, /* DDRC */
|
2019-12-30 11:56:44 +00:00
|
|
|
{ /* sentinel */ }
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2021-08-28 01:18:30 +00:00
|
|
|
#if !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT)
|
2019-05-08 06:38:30 +00:00
|
|
|
/* enable all periherial can be accessed in nosec mode */
|
|
|
|
static void init_csu(void)
|
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
for (i = 0; i < CSU_NUM_REGS; i++)
|
|
|
|
writel(CSU_INIT_SEC_LEVEL0, CSU_IPS_BASE_ADDR + i * 4);
|
|
|
|
}
|
|
|
|
|
2018-08-08 01:17:49 +00:00
|
|
|
static void imx_gpcv2_init(void)
|
|
|
|
{
|
|
|
|
u32 val, i;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Force IOMUXC irq pending, so that the interrupt to GPC can be
|
|
|
|
* used to deassert dsm_request signal when the signal gets
|
|
|
|
* asserted unexpectedly.
|
|
|
|
*/
|
|
|
|
val = readl(IOMUXC_GPR_BASE_ADDR + IOMUXC_GPR1);
|
|
|
|
val |= BM_IOMUXC_GPR1_IRQ;
|
|
|
|
writel(val, IOMUXC_GPR_BASE_ADDR + IOMUXC_GPR1);
|
|
|
|
|
|
|
|
/* Initially mask all interrupts */
|
|
|
|
for (i = 0; i < 4; i++) {
|
|
|
|
writel(~0, GPC_IPS_BASE_ADDR + GPC_IMR1_CORE0 + i * 4);
|
|
|
|
writel(~0, GPC_IPS_BASE_ADDR + GPC_IMR1_CORE1 + i * 4);
|
|
|
|
writel(~0, GPC_IPS_BASE_ADDR + GPC_IMR1_M4 + i * 4);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set SCU timing */
|
|
|
|
writel((0x59 << 10) | 0x5B | (0x2 << 20),
|
|
|
|
GPC_IPS_BASE_ADDR + GPC_PGC_SCU_TIMING);
|
|
|
|
|
|
|
|
/* only external IRQs to wake up LPM and core 0/1 */
|
|
|
|
val = readl(GPC_IPS_BASE_ADDR + GPC_LPCR_A7_BSC);
|
|
|
|
val |= BM_LPCR_A7_BSC_IRQ_SRC_A7_WAKEUP;
|
|
|
|
writel(val, GPC_IPS_BASE_ADDR + GPC_LPCR_A7_BSC);
|
|
|
|
|
|
|
|
/* set C0 power up timming per design requirement */
|
|
|
|
val = readl(GPC_IPS_BASE_ADDR + GPC_PGC_C0_PUPSCR);
|
|
|
|
val &= ~BM_GPC_PGC_CORE_PUPSCR;
|
|
|
|
val |= (0x1A << 7);
|
|
|
|
writel(val, GPC_IPS_BASE_ADDR + GPC_PGC_C0_PUPSCR);
|
|
|
|
|
|
|
|
/* set C1 power up timming per design requirement */
|
|
|
|
val = readl(GPC_IPS_BASE_ADDR + GPC_PGC_C1_PUPSCR);
|
|
|
|
val &= ~BM_GPC_PGC_CORE_PUPSCR;
|
|
|
|
val |= (0x1A << 7);
|
|
|
|
writel(val, GPC_IPS_BASE_ADDR + GPC_PGC_C1_PUPSCR);
|
|
|
|
|
|
|
|
/* dummy ack for time slot by default */
|
|
|
|
writel(BM_GPC_PGC_ACK_SEL_A7_DUMMY_PUP_ACK |
|
|
|
|
BM_GPC_PGC_ACK_SEL_A7_DUMMY_PDN_ACK,
|
|
|
|
GPC_IPS_BASE_ADDR + GPC_PGC_ACK_SEL_A7);
|
|
|
|
|
|
|
|
/* mask M4 DSM trigger */
|
|
|
|
writel(readl(GPC_IPS_BASE_ADDR + GPC_LPCR_M4) |
|
|
|
|
BM_LPCR_M4_MASK_DSM_TRIGGER,
|
|
|
|
GPC_IPS_BASE_ADDR + GPC_LPCR_M4);
|
|
|
|
|
|
|
|
/* set mega/fast mix in A7 domain */
|
|
|
|
writel(0x1, GPC_IPS_BASE_ADDR + GPC_PGC_CPU_MAPPING);
|
|
|
|
|
|
|
|
/* DSM related settings */
|
|
|
|
val = readl(GPC_IPS_BASE_ADDR + GPC_SLPCR);
|
|
|
|
val &= ~(BM_SLPCR_EN_DSM | BM_SLPCR_VSTBY | BM_SLPCR_RBC_EN |
|
|
|
|
BM_SLPCR_SBYOS | BM_SLPCR_BYPASS_PMIC_READY |
|
|
|
|
BM_SLPCR_REG_BYPASS_COUNT);
|
|
|
|
val |= BM_SLPCR_EN_A7_FASTWUP_WAIT_MODE;
|
|
|
|
writel(val, GPC_IPS_BASE_ADDR + GPC_SLPCR);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* disabling RBC need to delay at least 2 cycles of CKIL(32K)
|
|
|
|
* due to hardware design requirement, which is
|
|
|
|
* ~61us, here we use 65us for safe
|
|
|
|
*/
|
|
|
|
udelay(65);
|
|
|
|
}
|
|
|
|
|
2015-09-02 18:54:19 +00:00
|
|
|
int arch_cpu_init(void)
|
|
|
|
{
|
|
|
|
init_aips();
|
|
|
|
|
2015-10-23 02:13:04 +00:00
|
|
|
init_csu();
|
2015-09-02 18:54:19 +00:00
|
|
|
/* Disable PDE bit of WMCR register */
|
2017-11-23 12:55:33 +00:00
|
|
|
imx_wdog_disable_powerdown();
|
2015-09-02 18:54:19 +00:00
|
|
|
|
2019-05-08 06:38:30 +00:00
|
|
|
init_cpu_basic();
|
2015-09-02 18:54:19 +00:00
|
|
|
|
2017-08-12 14:10:57 +00:00
|
|
|
#if CONFIG_IS_ENABLED(IMX_RDC)
|
|
|
|
isolate_resource();
|
|
|
|
#endif
|
imx: mx7d: isolate resources to domain 0 for A7 core
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.
Signed-off-by: Ye.Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2016-01-28 08:55:09 +00:00
|
|
|
|
2018-04-05 18:46:06 +00:00
|
|
|
init_snvs();
|
|
|
|
|
2018-08-08 01:17:49 +00:00
|
|
|
imx_gpcv2_init();
|
|
|
|
|
2022-01-02 19:36:56 +00:00
|
|
|
enable_ca7_smp();
|
|
|
|
|
2015-09-02 18:54:19 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2019-05-08 06:38:30 +00:00
|
|
|
#else
|
|
|
|
int arch_cpu_init(void)
|
|
|
|
{
|
|
|
|
init_cpu_basic();
|
|
|
|
|
2015-09-02 18:54:19 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2018-09-05 10:56:05 +00:00
|
|
|
#endif
|
2015-09-02 18:54:19 +00:00
|
|
|
|
2016-07-13 07:25:39 +00:00
|
|
|
#ifdef CONFIG_ARCH_MISC_INIT
|
|
|
|
int arch_misc_init(void)
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
|
2021-08-30 13:16:29 +00:00
|
|
|
struct tag_serialnr serialnr;
|
|
|
|
char serial_string[0x20];
|
|
|
|
|
2016-07-13 07:25:39 +00:00
|
|
|
if (is_mx7d())
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("soc", "imx7d");
|
2016-07-13 07:25:39 +00:00
|
|
|
else
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("soc", "imx7s");
|
2021-08-30 13:16:29 +00:00
|
|
|
|
|
|
|
/* Set serial# standard environment variable based on OTP settings */
|
|
|
|
get_board_serial(&serialnr);
|
|
|
|
snprintf(serial_string, sizeof(serial_string), "0x%08x%08x",
|
|
|
|
serialnr.low, serialnr.high);
|
|
|
|
env_set("serial#", serial_string);
|
2016-07-13 07:25:39 +00:00
|
|
|
#endif
|
|
|
|
|
2022-03-24 06:20:30 +00:00
|
|
|
if (IS_ENABLED(CONFIG_FSL_CAAM)) {
|
|
|
|
struct udevice *dev;
|
|
|
|
int ret;
|
|
|
|
ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(caam_jr), &dev);
|
|
|
|
if (ret)
|
2022-05-11 08:26:20 +00:00
|
|
|
printf("Failed to initialize caam_jr: %d\n", ret);
|
2022-03-24 06:20:30 +00:00
|
|
|
}
|
2018-01-26 16:27:58 +00:00
|
|
|
|
2016-07-13 07:25:39 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-08-30 13:16:29 +00:00
|
|
|
#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
|
2018-03-26 14:27:33 +00:00
|
|
|
/*
|
|
|
|
* OCOTP_TESTER
|
|
|
|
* i.MX 7Solo Applications Processor Reference Manual, Rev. 0.1, 08/2016
|
|
|
|
* OCOTP_TESTER describes a unique ID based on silicon wafer
|
|
|
|
* and die X/Y position
|
|
|
|
*
|
|
|
|
* OCOTOP_TESTER offset 0x410
|
|
|
|
* 31:0 fuse 0
|
|
|
|
* FSL-wide unique, encoded LOT ID STD II/SJC CHALLENGE/ Unique ID
|
|
|
|
*
|
|
|
|
* OCOTP_TESTER1 offset 0x420
|
|
|
|
* 31:24 fuse 1
|
|
|
|
* The X-coordinate of the die location on the wafer/SJC CHALLENGE/ Unique ID
|
|
|
|
* 23:16 fuse 1
|
|
|
|
* The Y-coordinate of the die location on the wafer/SJC CHALLENGE/ Unique ID
|
|
|
|
* 15:11 fuse 1
|
|
|
|
* The wafer number of the wafer on which the device was fabricated/SJC
|
|
|
|
* CHALLENGE/ Unique ID
|
|
|
|
* 10:0 fuse 1
|
|
|
|
* FSL-wide unique, encoded LOT ID STD II/SJC CHALLENGE/ Unique ID
|
|
|
|
*/
|
2015-09-02 18:54:19 +00:00
|
|
|
void get_board_serial(struct tag_serialnr *serialnr)
|
|
|
|
{
|
|
|
|
struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR;
|
|
|
|
struct fuse_bank *bank = &ocotp->bank[0];
|
|
|
|
struct fuse_bank0_regs *fuse =
|
|
|
|
(struct fuse_bank0_regs *)bank->fuse_regs;
|
|
|
|
|
|
|
|
serialnr->low = fuse->tester0;
|
|
|
|
serialnr->high = fuse->tester1;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void set_wdog_reset(struct wdog_regs *wdog)
|
|
|
|
{
|
|
|
|
u32 reg = readw(&wdog->wcr);
|
|
|
|
/*
|
|
|
|
* Output WDOG_B signal to reset external pmic or POR_B decided by
|
|
|
|
* the board desgin. Without external reset, the peripherals/DDR/
|
|
|
|
* PMIC are not reset, that may cause system working abnormal.
|
|
|
|
*/
|
|
|
|
reg = readw(&wdog->wcr);
|
|
|
|
reg |= 1 << 3;
|
|
|
|
/*
|
|
|
|
* WDZST bit is write-once only bit. Align this bit in kernel,
|
|
|
|
* otherwise kernel code will have no chance to set this bit.
|
|
|
|
*/
|
|
|
|
reg |= 1 << 0;
|
|
|
|
writew(reg, &wdog->wcr);
|
|
|
|
}
|
|
|
|
|
|
|
|
void s_init(void)
|
|
|
|
{
|
|
|
|
/* clock configuration. */
|
|
|
|
clock_init();
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2016-05-19 05:02:16 +00:00
|
|
|
|
2020-08-05 13:34:04 +00:00
|
|
|
#ifndef CONFIG_SPL_BUILD
|
|
|
|
const struct boot_mode soc_boot_modes[] = {
|
|
|
|
{"normal", MAKE_CFGVAL(0x00, 0x00, 0x00, 0x00)},
|
2020-08-05 13:34:05 +00:00
|
|
|
{"primary", MAKE_CFGVAL_PRIMARY_BOOT},
|
|
|
|
{"secondary", MAKE_CFGVAL_SECONDARY_BOOT},
|
2020-08-05 13:34:04 +00:00
|
|
|
{NULL, 0},
|
|
|
|
};
|
2020-08-05 13:34:07 +00:00
|
|
|
|
|
|
|
int boot_mode_getprisec(void)
|
|
|
|
{
|
|
|
|
struct src *psrc = (struct src *)SRC_BASE_ADDR;
|
|
|
|
|
|
|
|
return !!(readl(&psrc->gpr10) & IMX7_SRC_GPR10_PERSIST_SECONDARY_BOOT);
|
|
|
|
}
|
2020-08-05 13:34:04 +00:00
|
|
|
#endif
|
|
|
|
|
2016-05-19 05:02:16 +00:00
|
|
|
void reset_misc(void)
|
|
|
|
{
|
2018-12-11 18:40:37 +00:00
|
|
|
#ifndef CONFIG_SPL_BUILD
|
2022-10-18 13:46:31 +00:00
|
|
|
#if defined(CONFIG_VIDEO_MXS) && !defined(CONFIG_VIDEO)
|
2016-05-19 05:02:16 +00:00
|
|
|
lcdif_power_down();
|
|
|
|
#endif
|
2018-12-11 18:40:37 +00:00
|
|
|
#endif
|
2016-05-19 05:02:16 +00:00
|
|
|
}
|