1 // SPDX-License-Identifier: GPL-2.0+
10 #include <linux/libfdt.h>
11 #include <fsl_esdhc_imx.h>
14 #include <asm/arch/clock.h>
15 #include <asm/arch/sci/sci.h>
16 #include <asm/arch/imx8-pins.h>
17 #include <asm/arch/iomux.h>
18 #include <asm/arch/sys_proto.h>
20 DECLARE_GLOBAL_DATA_PTR;
22 #define GPIO_PAD_CTRL ((SC_PAD_CONFIG_NORMAL << PADRING_CONFIG_SHIFT) | \
23 (SC_PAD_ISO_OFF << PADRING_LPCONFIG_SHIFT) | \
24 (SC_PAD_28FDSOI_DSE_DV_HIGH << PADRING_DSE_SHIFT) | \
25 (SC_PAD_28FDSOI_PS_PU << PADRING_PULL_SHIFT))
27 #define UART_PAD_CTRL ((SC_PAD_CONFIG_OUT_IN << PADRING_CONFIG_SHIFT) | \
28 (SC_PAD_ISO_OFF << PADRING_LPCONFIG_SHIFT) | \
29 (SC_PAD_28FDSOI_DSE_DV_HIGH << PADRING_DSE_SHIFT) | \
30 (SC_PAD_28FDSOI_PS_PU << PADRING_PULL_SHIFT))
32 static iomux_cfg_t uart0_pads[] = {
33 SC_P_UART0_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
34 SC_P_UART0_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
37 static void setup_iomux_uart(void)
39 imx8_iomux_setup_multiple_pads(uart0_pads, ARRAY_SIZE(uart0_pads));
42 int board_early_init_f(void)
44 sc_pm_clock_rate_t rate = SC_80MHZ;
47 /* Set UART0 clock root to 80 MHz */
48 ret = sc_pm_setup_uart(SC_R_UART_0, rate);
57 #if IS_ENABLED(CONFIG_DM_GPIO)
58 static void board_gpio_init(void)
60 struct gpio_desc desc;
63 ret = dm_gpio_lookup_name("gpio@1a_3", &desc);
67 ret = dm_gpio_request(&desc, "bb_per_rst_b");
71 dm_gpio_set_dir_flags(&desc, GPIOD_IS_OUT);
72 dm_gpio_set_value(&desc, 0);
74 dm_gpio_set_value(&desc, 1);
77 static inline void board_gpio_init(void) {}
80 #if IS_ENABLED(CONFIG_FEC_MXC)
83 int board_phy_config(struct phy_device *phydev)
85 phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x1f);
86 phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x8);
88 phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x05);
89 phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x100);
91 if (phydev->drv->config)
92 phydev->drv->config(phydev);
100 puts("Board: iMX8QXP MEK\n");
115 void detail_board_ddr_info(void)
121 * Board specific reset that is system reset.
123 void reset_cpu(ulong addr)
128 #ifdef CONFIG_OF_BOARD_SETUP
129 int ft_board_setup(void *blob, bd_t *bd)
135 int board_mmc_get_env_dev(int devno)
140 int board_late_init(void)
142 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
143 env_set("board_name", "MEK");
144 env_set("board_rev", "iMX8QXP");