2018-05-06 21:58:06 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
2015-08-13 02:55:34 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2009
|
|
|
|
* Stefano Babic, DENX Software Engineering, sbabic@denx.de.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _SYS_PROTO_H_
|
|
|
|
#define _SYS_PROTO_H_
|
|
|
|
|
2017-02-24 10:15:12 +00:00
|
|
|
#include <asm/io.h>
|
2017-06-29 08:16:06 +00:00
|
|
|
#include <asm/mach-imx/regs-common.h>
|
2020-05-01 14:08:34 +00:00
|
|
|
#include <asm/mach-imx/module_fuse.h>
|
2020-05-10 17:39:55 +00:00
|
|
|
#include <linux/bitops.h>
|
2015-08-13 02:55:34 +00:00
|
|
|
#include "../arch-imx/cpu.h"
|
|
|
|
|
2020-05-10 17:39:55 +00:00
|
|
|
struct bd_info;
|
|
|
|
|
2015-08-13 02:55:34 +00:00
|
|
|
#define soc_rev() (get_cpu_rev() & 0xFF)
|
|
|
|
#define is_soc_rev(rev) (soc_rev() == rev)
|
|
|
|
|
|
|
|
/* returns MXC_CPU_ value */
|
2020-02-05 09:44:28 +00:00
|
|
|
#define cpu_type(rev) (((rev) >> 12) & 0x1ff)
|
2015-09-02 18:54:12 +00:00
|
|
|
#define soc_type(rev) (((rev) >> 12) & 0xf0)
|
2015-08-13 02:55:34 +00:00
|
|
|
/* both macros return/take MXC_CPU_ constants */
|
|
|
|
#define get_cpu_type() (cpu_type(get_cpu_rev()))
|
2015-09-02 18:54:12 +00:00
|
|
|
#define get_soc_type() (soc_type(get_cpu_rev()))
|
2015-08-13 02:55:34 +00:00
|
|
|
#define is_cpu_type(cpu) (get_cpu_type() == cpu)
|
2015-09-02 18:54:12 +00:00
|
|
|
#define is_soc_type(soc) (get_soc_type() == soc)
|
2015-08-13 02:55:34 +00:00
|
|
|
|
2016-05-23 10:35:52 +00:00
|
|
|
#define is_mx6() (is_soc_type(MXC_SOC_MX6))
|
|
|
|
#define is_mx7() (is_soc_type(MXC_SOC_MX7))
|
2018-11-20 10:19:25 +00:00
|
|
|
#define is_imx8m() (is_soc_type(MXC_SOC_IMX8M))
|
2018-10-18 12:28:16 +00:00
|
|
|
#define is_imx8() (is_soc_type(MXC_SOC_IMX8))
|
2021-05-20 14:10:13 +00:00
|
|
|
#define is_imxrt() (is_soc_type(MXC_SOC_IMXRT))
|
2016-05-23 10:35:52 +00:00
|
|
|
|
2015-08-13 02:55:34 +00:00
|
|
|
#define is_mx6dqp() (is_cpu_type(MXC_CPU_MX6QP) || is_cpu_type(MXC_CPU_MX6DP))
|
2016-05-23 10:35:52 +00:00
|
|
|
#define is_mx6dq() (is_cpu_type(MXC_CPU_MX6Q) || is_cpu_type(MXC_CPU_MX6D))
|
|
|
|
#define is_mx6sdl() (is_cpu_type(MXC_CPU_MX6SOLO) || is_cpu_type(MXC_CPU_MX6DL))
|
2016-10-08 12:30:11 +00:00
|
|
|
#define is_mx6dl() (is_cpu_type(MXC_CPU_MX6DL))
|
2016-05-23 10:35:52 +00:00
|
|
|
#define is_mx6sx() (is_cpu_type(MXC_CPU_MX6SX))
|
|
|
|
#define is_mx6sl() (is_cpu_type(MXC_CPU_MX6SL))
|
2016-10-08 12:30:11 +00:00
|
|
|
#define is_mx6solo() (is_cpu_type(MXC_CPU_MX6SOLO))
|
2016-05-23 10:35:52 +00:00
|
|
|
#define is_mx6ul() (is_cpu_type(MXC_CPU_MX6UL))
|
2020-02-05 12:17:17 +00:00
|
|
|
#define is_mx6ull() (is_cpu_type(MXC_CPU_MX6ULL) || is_cpu_type(MXC_CPU_MX6ULZ))
|
2019-08-08 09:55:52 +00:00
|
|
|
#define is_mx6ulz() (is_cpu_type(MXC_CPU_MX6ULZ))
|
2016-12-11 11:24:20 +00:00
|
|
|
#define is_mx6sll() (is_cpu_type(MXC_CPU_MX6SLL))
|
2015-08-13 02:55:34 +00:00
|
|
|
|
2017-02-22 08:21:46 +00:00
|
|
|
#define is_mx7ulp() (is_cpu_type(MXC_CPU_MX7ULP))
|
|
|
|
|
2020-02-05 09:34:54 +00:00
|
|
|
#define is_imx8mq() (is_cpu_type(MXC_CPU_IMX8MQ) || is_cpu_type(MXC_CPU_IMX8MD) || is_cpu_type(MXC_CPU_IMX8MQL))
|
|
|
|
#define is_imx8md() (is_cpu_type(MXC_CPU_IMX8MD))
|
|
|
|
#define is_imx8mql() (is_cpu_type(MXC_CPU_IMX8MQL))
|
2019-08-26 08:11:46 +00:00
|
|
|
#define is_imx8qm() (is_cpu_type(MXC_CPU_IMX8QM))
|
2019-08-27 06:25:04 +00:00
|
|
|
#define is_imx8mm() (is_cpu_type(MXC_CPU_IMX8MM) || is_cpu_type(MXC_CPU_IMX8MML) ||\
|
|
|
|
is_cpu_type(MXC_CPU_IMX8MMD) || is_cpu_type(MXC_CPU_IMX8MMDL) || \
|
|
|
|
is_cpu_type(MXC_CPU_IMX8MMS) || is_cpu_type(MXC_CPU_IMX8MMSL))
|
|
|
|
#define is_imx8mml() (is_cpu_type(MXC_CPU_IMX8MML))
|
|
|
|
#define is_imx8mmd() (is_cpu_type(MXC_CPU_IMX8MMD))
|
|
|
|
#define is_imx8mmdl() (is_cpu_type(MXC_CPU_IMX8MMDL))
|
|
|
|
#define is_imx8mms() (is_cpu_type(MXC_CPU_IMX8MMS))
|
|
|
|
#define is_imx8mmsl() (is_cpu_type(MXC_CPU_IMX8MMSL))
|
2020-02-05 09:39:27 +00:00
|
|
|
#define is_imx8mn() (is_cpu_type(MXC_CPU_IMX8MN) || is_cpu_type(MXC_CPU_IMX8MND) || \
|
|
|
|
is_cpu_type(MXC_CPU_IMX8MNS) || is_cpu_type(MXC_CPU_IMX8MNL) || \
|
2021-03-19 07:57:11 +00:00
|
|
|
is_cpu_type(MXC_CPU_IMX8MNDL) || is_cpu_type(MXC_CPU_IMX8MNSL) || \
|
|
|
|
is_cpu_type(MXC_CPU_IMX8MNUD) || is_cpu_type(MXC_CPU_IMX8MNUS) || is_cpu_type(MXC_CPU_IMX8MNUQ))
|
2020-02-05 09:39:27 +00:00
|
|
|
#define is_imx8mnd() (is_cpu_type(MXC_CPU_IMX8MND))
|
|
|
|
#define is_imx8mns() (is_cpu_type(MXC_CPU_IMX8MNS))
|
|
|
|
#define is_imx8mnl() (is_cpu_type(MXC_CPU_IMX8MNL))
|
|
|
|
#define is_imx8mndl() (is_cpu_type(MXC_CPU_IMX8MNDL))
|
|
|
|
#define is_imx8mnsl() (is_cpu_type(MXC_CPU_IMX8MNSL))
|
2021-03-19 07:57:11 +00:00
|
|
|
#define is_imx8mnuq() (is_cpu_type(MXC_CPU_IMX8MNUQ))
|
|
|
|
#define is_imx8mnud() (is_cpu_type(MXC_CPU_IMX8MNUD))
|
|
|
|
#define is_imx8mnus() (is_cpu_type(MXC_CPU_IMX8MNUS))
|
imx8mp: Add fused parts support
iMX8MP has 6 fused parts in each qualification tier, with core, VPU,
ISP, NPU or DSP fused respectively.
The configuration tables for enabled modules:
MIMX8ML8DVNLZAA Quad Core, VPU, NPU, ISP, DSP
MIMX8ML7DVNLZAA Quad Core, NPU, ISP
MIMX8ML6DVNLZAA Quad Core, VPU, ISP
MIMX8ML5DVNLZAA Quad Core, VPU
MIMX8ML4DVNLZAA Quad Lite
MIMX8ML3DVNLZAA Dual Core, VPU, NPU, ISP, DSP
Add the support in U-Boot
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-04-21 03:12:54 +00:00
|
|
|
#define is_imx8mp() (is_cpu_type(MXC_CPU_IMX8MP) || is_cpu_type(MXC_CPU_IMX8MPD) || \
|
2020-09-16 07:17:22 +00:00
|
|
|
is_cpu_type(MXC_CPU_IMX8MPL) || is_cpu_type(MXC_CPU_IMX8MP6))
|
imx8mp: Add fused parts support
iMX8MP has 6 fused parts in each qualification tier, with core, VPU,
ISP, NPU or DSP fused respectively.
The configuration tables for enabled modules:
MIMX8ML8DVNLZAA Quad Core, VPU, NPU, ISP, DSP
MIMX8ML7DVNLZAA Quad Core, NPU, ISP
MIMX8ML6DVNLZAA Quad Core, VPU, ISP
MIMX8ML5DVNLZAA Quad Core, VPU
MIMX8ML4DVNLZAA Quad Lite
MIMX8ML3DVNLZAA Dual Core, VPU, NPU, ISP, DSP
Add the support in U-Boot
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-04-21 03:12:54 +00:00
|
|
|
#define is_imx8mpd() (is_cpu_type(MXC_CPU_IMX8MPD))
|
|
|
|
#define is_imx8mpl() (is_cpu_type(MXC_CPU_IMX8MPL))
|
|
|
|
#define is_imx8mp6() (is_cpu_type(MXC_CPU_IMX8MP6))
|
2019-06-27 09:23:49 +00:00
|
|
|
|
2018-10-18 12:28:16 +00:00
|
|
|
#define is_imx8qxp() (is_cpu_type(MXC_CPU_IMX8QXP))
|
|
|
|
|
2021-05-20 14:10:13 +00:00
|
|
|
#define is_imxrt1020() (is_cpu_type(MXC_CPU_IMXRT1020))
|
|
|
|
#define is_imxrt1050() (is_cpu_type(MXC_CPU_IMXRT1050))
|
|
|
|
|
2017-02-24 10:15:12 +00:00
|
|
|
#ifdef CONFIG_MX6
|
2020-08-05 13:34:04 +00:00
|
|
|
#define IMX6_SRC_GPR10_BMODE BIT(28)
|
2020-08-05 13:34:05 +00:00
|
|
|
#define IMX6_SRC_GPR10_PERSIST_SECONDARY_BOOT BIT(30)
|
2017-02-24 10:15:12 +00:00
|
|
|
|
2017-02-24 10:15:14 +00:00
|
|
|
#define IMX6_BMODE_MASK GENMASK(7, 0)
|
|
|
|
#define IMX6_BMODE_SHIFT 4
|
|
|
|
#define IMX6_BMODE_EMI_MASK BIT(3)
|
|
|
|
#define IMX6_BMODE_EMI_SHIFT 3
|
|
|
|
#define IMX6_BMODE_SERIAL_ROM_MASK GENMASK(26, 24)
|
|
|
|
#define IMX6_BMODE_SERIAL_ROM_SHIFT 24
|
|
|
|
|
|
|
|
enum imx6_bmode_serial_rom {
|
|
|
|
IMX6_BMODE_ECSPI1,
|
|
|
|
IMX6_BMODE_ECSPI2,
|
|
|
|
IMX6_BMODE_ECSPI3,
|
|
|
|
IMX6_BMODE_ECSPI4,
|
|
|
|
IMX6_BMODE_ECSPI5,
|
|
|
|
IMX6_BMODE_I2C1,
|
|
|
|
IMX6_BMODE_I2C2,
|
|
|
|
IMX6_BMODE_I2C3,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum imx6_bmode_emi {
|
|
|
|
IMX6_BMODE_NOR,
|
2019-01-03 22:50:51 +00:00
|
|
|
IMX6_BMODE_ONENAND,
|
2017-02-24 10:15:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum imx6_bmode {
|
|
|
|
IMX6_BMODE_EMI,
|
2017-08-16 00:49:42 +00:00
|
|
|
#if defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL)
|
|
|
|
IMX6_BMODE_QSPI,
|
|
|
|
IMX6_BMODE_RESERVED,
|
|
|
|
#else
|
|
|
|
IMX6_BMODE_RESERVED,
|
2017-02-24 10:15:14 +00:00
|
|
|
IMX6_BMODE_SATA,
|
2017-08-16 00:49:42 +00:00
|
|
|
#endif
|
2017-02-24 10:15:14 +00:00
|
|
|
IMX6_BMODE_SERIAL_ROM,
|
|
|
|
IMX6_BMODE_SD,
|
|
|
|
IMX6_BMODE_ESD,
|
|
|
|
IMX6_BMODE_MMC,
|
|
|
|
IMX6_BMODE_EMMC,
|
2017-12-14 18:20:02 +00:00
|
|
|
IMX6_BMODE_NAND_MIN,
|
|
|
|
IMX6_BMODE_NAND_MAX = 0xf,
|
2017-02-24 10:15:14 +00:00
|
|
|
};
|
|
|
|
|
2017-02-24 10:15:12 +00:00
|
|
|
u32 imx6_src_get_boot_mode(void);
|
2017-08-24 13:00:16 +00:00
|
|
|
void gpr_init(void);
|
|
|
|
|
2017-02-24 10:15:12 +00:00
|
|
|
#endif /* CONFIG_MX6 */
|
|
|
|
|
2020-08-05 13:34:04 +00:00
|
|
|
#ifdef CONFIG_MX7
|
|
|
|
#define IMX7_SRC_GPR10_BMODE BIT(28)
|
2020-08-05 13:34:05 +00:00
|
|
|
#define IMX7_SRC_GPR10_PERSIST_SECONDARY_BOOT BIT(30)
|
2020-08-05 13:34:04 +00:00
|
|
|
#endif
|
|
|
|
|
2019-12-30 11:56:44 +00:00
|
|
|
/* address translation table */
|
|
|
|
struct rproc_att {
|
|
|
|
u32 da; /* device address (From Cortex M4 view) */
|
|
|
|
u32 sa; /* system bus address */
|
|
|
|
u32 size; /* size of reg range */
|
|
|
|
};
|
|
|
|
|
2019-09-16 03:09:31 +00:00
|
|
|
#ifdef CONFIG_IMX8M
|
|
|
|
struct rom_api {
|
|
|
|
u16 ver;
|
|
|
|
u16 tag;
|
|
|
|
u32 reserved1;
|
|
|
|
u32 (*download_image)(u8 *dest, u32 offset, u32 size, u32 xor);
|
|
|
|
u32 (*query_boot_infor)(u32 info_type, u32 *info, u32 xor);
|
|
|
|
};
|
|
|
|
|
|
|
|
enum boot_dev_type_e {
|
|
|
|
BT_DEV_TYPE_SD = 1,
|
|
|
|
BT_DEV_TYPE_MMC = 2,
|
|
|
|
BT_DEV_TYPE_NAND = 3,
|
|
|
|
BT_DEV_TYPE_FLEXSPINOR = 4,
|
|
|
|
|
|
|
|
BT_DEV_TYPE_USB = 0xE,
|
|
|
|
BT_DEV_TYPE_MEM_DEV = 0xF,
|
|
|
|
|
|
|
|
BT_DEV_TYPE_INVALID = 0xFF
|
|
|
|
};
|
|
|
|
|
|
|
|
#define QUERY_ROM_VER 1
|
|
|
|
#define QUERY_BT_DEV 2
|
|
|
|
#define QUERY_PAGE_SZ 3
|
|
|
|
#define QUERY_IVT_OFF 4
|
|
|
|
#define QUERY_BT_STAGE 5
|
|
|
|
#define QUERY_IMG_OFF 6
|
|
|
|
|
|
|
|
#define ROM_API_OKAY 0xF0
|
|
|
|
|
|
|
|
extern struct rom_api *g_rom_api;
|
|
|
|
#endif
|
|
|
|
|
2015-08-13 02:55:34 +00:00
|
|
|
u32 get_nr_cpus(void);
|
|
|
|
u32 get_cpu_rev(void);
|
|
|
|
u32 get_cpu_speed_grade_hz(void);
|
|
|
|
u32 get_cpu_temp_grade(int *minc, int *maxc);
|
|
|
|
const char *get_imx_type(u32 imxtype);
|
|
|
|
u32 imx_ddr_size(void);
|
|
|
|
void sdelay(unsigned long);
|
|
|
|
void set_chipselect_size(int const);
|
|
|
|
|
2015-09-02 18:54:15 +00:00
|
|
|
void init_aips(void);
|
|
|
|
void init_src(void);
|
2018-04-05 18:46:06 +00:00
|
|
|
void init_snvs(void);
|
2017-11-23 12:55:33 +00:00
|
|
|
void imx_wdog_disable_powerdown(void);
|
2015-09-02 18:54:15 +00:00
|
|
|
|
2020-10-22 08:21:40 +00:00
|
|
|
void board_mem_get_layout(u64 *phys_sdram_1_start,
|
|
|
|
u64 *phys_sdram_1_size,
|
|
|
|
u64 *phys_sdram_2_start,
|
|
|
|
u64 *phys_sdram_2_size);
|
|
|
|
|
2019-12-03 12:04:47 +00:00
|
|
|
int arch_auxiliary_core_check_up(u32 core_id);
|
|
|
|
|
2017-09-21 18:10:03 +00:00
|
|
|
int board_mmc_get_env_dev(int devno);
|
|
|
|
|
2017-11-27 12:25:09 +00:00
|
|
|
int nxp_board_rev(void);
|
|
|
|
char nxp_board_rev_string(void);
|
|
|
|
|
2015-08-13 02:55:34 +00:00
|
|
|
/*
|
|
|
|
* Initializes on-chip ethernet controllers.
|
|
|
|
* to override, implement board_eth_init()
|
|
|
|
*/
|
2020-05-10 17:39:55 +00:00
|
|
|
int fecmxc_initialize(struct bd_info *bis);
|
2015-08-13 02:55:34 +00:00
|
|
|
u32 get_ahb_clk(void);
|
|
|
|
u32 get_periph_clk(void);
|
|
|
|
|
2015-10-29 07:54:49 +00:00
|
|
|
void lcdif_power_down(void);
|
|
|
|
|
2015-08-13 02:55:34 +00:00
|
|
|
int mxs_reset_block(struct mxs_register_32 *reg);
|
|
|
|
int mxs_wait_mask_set(struct mxs_register_32 *reg, u32 mask, u32 timeout);
|
|
|
|
int mxs_wait_mask_clr(struct mxs_register_32 *reg, u32 mask, u32 timeout);
|
2018-01-10 05:20:23 +00:00
|
|
|
|
|
|
|
unsigned long call_imx_sip(unsigned long id, unsigned long reg0,
|
2019-10-26 14:24:03 +00:00
|
|
|
unsigned long reg1, unsigned long reg2,
|
|
|
|
unsigned long reg3);
|
2019-04-12 07:54:50 +00:00
|
|
|
unsigned long call_imx_sip_ret2(unsigned long id, unsigned long reg0,
|
|
|
|
unsigned long *reg1, unsigned long reg2,
|
|
|
|
unsigned long reg3);
|
2020-05-03 14:41:19 +00:00
|
|
|
|
|
|
|
void imx_get_mac_from_fuse(int dev_id, unsigned char *mac);
|
2015-08-13 02:55:34 +00:00
|
|
|
#endif
|