diff options
author | Teo Hall <teo.hall@nxp.com> | 2020-02-06 11:10:12 -0600 |
---|---|---|
committer | Ye Li <ye.li@nxp.com> | 2020-04-26 23:36:41 -0700 |
commit | 21091caeb59e6a3d36c205d20905a37a8f60b82d (patch) | |
tree | d7066df5f75a02f24fdf1e860f052a961794e9de /board | |
parent | fa60c9a36bcef694494ba34bcf7b977140978959 (diff) |
MLK-23280: Add i.MX8DXL EVK Board support
Add device trees, configs and board files for
the i.MX8DXL EVK board.
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Teo Hall <teo.hall@nxp.com>
(cherry picked from commit f0238679d332f1af2148d467804a93de8f868bd5)
Diffstat (limited to 'board')
-rw-r--r-- | board/freescale/imx8dxl_evk/Kconfig | 14 | ||||
-rw-r--r-- | board/freescale/imx8dxl_evk/Makefile | 8 | ||||
-rw-r--r-- | board/freescale/imx8dxl_evk/imx8dxl_evk.c | 189 | ||||
-rw-r--r-- | board/freescale/imx8dxl_evk/imximage.cfg | 22 | ||||
-rw-r--r-- | board/freescale/imx8dxl_evk/spl.c | 62 | ||||
-rw-r--r-- | board/freescale/imx8dxl_evk/uboot-container.cfg | 13 |
6 files changed, 308 insertions, 0 deletions
diff --git a/board/freescale/imx8dxl_evk/Kconfig b/board/freescale/imx8dxl_evk/Kconfig new file mode 100644 index 00000000000..4162f326ff9 --- /dev/null +++ b/board/freescale/imx8dxl_evk/Kconfig @@ -0,0 +1,14 @@ +if TARGET_IMX8DXL_EVK + +config SYS_BOARD + default "imx8dxl_evk" + +config SYS_VENDOR + default "freescale" + +config SYS_CONFIG_NAME + default "imx8dxl_evk" + +source "board/freescale/common/Kconfig" + +endif diff --git a/board/freescale/imx8dxl_evk/Makefile b/board/freescale/imx8dxl_evk/Makefile new file mode 100644 index 00000000000..f031c5fb500 --- /dev/null +++ b/board/freescale/imx8dxl_evk/Makefile @@ -0,0 +1,8 @@ +# +# Copyright 2020 NXP +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += imx8dxl_evk.o +obj-$(CONFIG_SPL_BUILD) += spl.o diff --git a/board/freescale/imx8dxl_evk/imx8dxl_evk.c b/board/freescale/imx8dxl_evk/imx8dxl_evk.c new file mode 100644 index 00000000000..f26c0d0d90b --- /dev/null +++ b/board/freescale/imx8dxl_evk/imx8dxl_evk.c @@ -0,0 +1,189 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2020 NXP + */ + +#include <common.h> +#include <cpu_func.h> +#include <env.h> +#include <errno.h> +#include <init.h> +#include <linux/libfdt.h> +#include <fsl_esdhc_imx.h> +#include <fdt_support.h> +#include <asm/io.h> +#include <asm/gpio.h> +#include <asm/arch/clock.h> +#include <asm/arch/sci/sci.h> +#include <asm/arch/imx8-pins.h> +#include <asm/arch/iomux.h> +#include <asm/arch/sys_proto.h> +#include <usb.h> +#include "../common/tcpc.h" + +DECLARE_GLOBAL_DATA_PTR; + +#define ENET_INPUT_PAD_CTRL ((SC_PAD_CONFIG_OD_IN << PADRING_CONFIG_SHIFT) | (SC_PAD_ISO_OFF << PADRING_LPCONFIG_SHIFT) \ + | (SC_PAD_28FDSOI_DSE_18V_10MA << PADRING_DSE_SHIFT) | (SC_PAD_28FDSOI_PS_PU << PADRING_PULL_SHIFT)) + +#define ENET_NORMAL_PAD_CTRL ((SC_PAD_CONFIG_NORMAL << PADRING_CONFIG_SHIFT) | (SC_PAD_ISO_OFF << PADRING_LPCONFIG_SHIFT) \ + | (SC_PAD_28FDSOI_DSE_18V_10MA << PADRING_DSE_SHIFT) | (SC_PAD_28FDSOI_PS_PU << PADRING_PULL_SHIFT)) + +#define GPIO_PAD_CTRL ((SC_PAD_CONFIG_NORMAL << PADRING_CONFIG_SHIFT) | \ + (SC_PAD_ISO_OFF << PADRING_LPCONFIG_SHIFT) | \ + (SC_PAD_28FDSOI_DSE_DV_HIGH << PADRING_DSE_SHIFT) | \ + (SC_PAD_28FDSOI_PS_PU << PADRING_PULL_SHIFT)) + +#define UART_PAD_CTRL ((SC_PAD_CONFIG_OUT_IN << PADRING_CONFIG_SHIFT) | \ + (SC_PAD_ISO_OFF << PADRING_LPCONFIG_SHIFT) | \ + (SC_PAD_28FDSOI_DSE_DV_HIGH << PADRING_DSE_SHIFT) | \ + (SC_PAD_28FDSOI_PS_PU << PADRING_PULL_SHIFT)) + +static iomux_cfg_t uart0_pads[] = { + SC_P_UART0_RX | MUX_PAD_CTRL(UART_PAD_CTRL), + SC_P_UART0_TX | MUX_PAD_CTRL(UART_PAD_CTRL), +}; + +static void setup_iomux_uart(void) +{ + imx8_iomux_setup_multiple_pads(uart0_pads, ARRAY_SIZE(uart0_pads)); +} + +int board_early_init_f(void) +{ + sc_pm_clock_rate_t rate = SC_80MHZ; + int ret; + + /* Set UART0 clock root to 80 MHz */ + ret = sc_pm_setup_uart(SC_R_UART_0, rate); + if (ret) + return ret; + + setup_iomux_uart(); + + return 0; +} + +#if CONFIG_IS_ENABLED(DM_GPIO) +static void board_gpio_init(void) +{ +} +#else +static inline void board_gpio_init(void) {} +#endif + +#if IS_ENABLED(CONFIG_NET) +#include <miiphy.h> + +int board_phy_config(struct phy_device *phydev) +{ + phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x1f); + phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x8); + + phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x00); + phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x82ee); + phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x05); + phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x100); + + if (phydev->drv->config) + phydev->drv->config(phydev); + + return 0; +} +#endif + +int checkboard(void) +{ + puts("Board: iMX8DXL EVK\n"); + + build_info(); + print_bootinfo(); + + return 0; +} + +#ifdef CONFIG_DWC_ETH_QOS +static int setup_eqos(void) +{ + sc_err_t err; + + /* set GPR14:12 to b’001: RGMII mode */ + err = sc_misc_set_control(-1, SC_R_ENET_1, SC_C_INTF_SEL, 0x1); + if (err != SC_ERR_NONE) + printf("SC_R_ENET_1 INTF_SEL failed! (error = %d)\n", err); + + /* enable GPR11:CLK_GEN_EN */ + err = sc_misc_set_control(-1, SC_R_ENET_1, SC_C_CLK_GEN_EN, 1); + if (err != SC_ERR_NONE) + printf("SC_R_ENET_1 CLK_GEN_EN failed! (error = %d)\n", err); + + return 0; +} +#endif + +int board_init(void) +{ + board_gpio_init(); +#ifdef CONFIG_DWC_ETH_QOS + /* clock, phy interface mode */ + setup_eqos(); +#endif + + return 0; +} + +void board_quiesce_devices(void) +{ + const char *power_on_devices[] = { + "dma_lpuart0", + }; + + power_off_pd_devices(power_on_devices, ARRAY_SIZE(power_on_devices)); +} + +/* + * Board specific reset that is system reset. + */ +void reset_cpu(ulong addr) +{ + /* TODO */ +} + +#ifdef CONFIG_OF_BOARD_SETUP +int ft_board_setup(void *blob, bd_t *bd) +{ + return 0; +} +#endif + +int board_late_init(void) +{ + char *fdt_file; + bool m4_boot; + +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG + env_set("board_name", "EVK"); + env_set("board_rev", "iMX8DXL"); +#endif + + env_set("sec_boot", "no"); +#ifdef CONFIG_AHAB_BOOT + env_set("sec_boot", "yes"); +#endif + + fdt_file = env_get("fdt_file"); + m4_boot = check_m4_parts_boot(); + + if (fdt_file && !strcmp(fdt_file, "undefined")) { + if (m4_boot) + env_set("fdt_file", "imx8dxl-evk-rpmsg.dtb"); + else + env_set("fdt_file", "imx8dxl-evk.dtb"); + } + +#ifdef CONFIG_ENV_IS_IN_MMC + board_late_mmc_env_init(); +#endif + + return 0; +} diff --git a/board/freescale/imx8dxl_evk/imximage.cfg b/board/freescale/imx8dxl_evk/imximage.cfg new file mode 100644 index 00000000000..e5f2a9e817f --- /dev/null +++ b/board/freescale/imx8dxl_evk/imximage.cfg @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2020 NXP + * + * Refer doc/README.imx8image for more details about how-to configure + * and create imx8image boot image + */ + +#define __ASSEMBLY__ + +/* Boot from SD, sector size 0x400 */ +BOOT_FROM SD 0x400 +/* SoC type IMX8DXL */ +SOC_TYPE IMX8DXL +/* Append seco container image */ +APPEND ahab-container.img +/* Create the 2nd container */ +CONTAINER +/* Add scfw image with exec attribute */ +IMAGE SCU mx8dxl-evk-scfw-tcm.bin +/* Add ATF image with exec attribute */ +IMAGE A35 spl/u-boot-spl.bin 0x00100000 diff --git a/board/freescale/imx8dxl_evk/spl.c b/board/freescale/imx8dxl_evk/spl.c new file mode 100644 index 00000000000..53782cefc68 --- /dev/null +++ b/board/freescale/imx8dxl_evk/spl.c @@ -0,0 +1,62 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2020 NXP + * + */ + +#include <common.h> +#include <dm.h> +#include <spl.h> +#include <dm/uclass.h> +#include <dm/device.h> +#include <dm/uclass-internal.h> +#include <dm/device-internal.h> +#include <dm/lists.h> +#include <bootm.h> + +DECLARE_GLOBAL_DATA_PTR; + +void spl_board_init(void) +{ + struct udevice *dev; + + uclass_find_first_device(UCLASS_MISC, &dev); + + for (; dev; uclass_find_next_device(&dev)) { + if (device_probe(dev)) + continue; + } + + board_early_init_f(); + + timer_init(); + + preloader_console_init(); + + puts("Normal Boot\n"); +} + +void spl_board_prepare_for_boot(void) +{ + board_quiesce_devices(); +} + +#ifdef CONFIG_SPL_LOAD_FIT +int board_fit_config_name_match(const char *name) +{ + /* Just empty function now - can't decide what to choose */ + debug("%s: %s\n", __func__, name); + + return 0; +} +#endif + +void board_init_f(ulong dummy) +{ + /* Clear the BSS. */ + memset(__bss_start, 0, __bss_end - __bss_start); + + arch_cpu_init(); + + board_init_r(NULL, 0); +} diff --git a/board/freescale/imx8dxl_evk/uboot-container.cfg b/board/freescale/imx8dxl_evk/uboot-container.cfg new file mode 100644 index 00000000000..9ef26331c13 --- /dev/null +++ b/board/freescale/imx8dxl_evk/uboot-container.cfg @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2019 NXP + */ + +#define __ASSEMBLY__ + +/* This file is to create a container image could be loaded by SPL */ +BOOT_FROM SD 0x400 +SOC_TYPE IMX8DXL +CONTAINER +IMAGE A35 bl31.bin 0x80000000 +IMAGE A35 u-boot.bin CONFIG_SYS_TEXT_BASE |