1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2017-2019 A. Karas, SomLabs
4 * Copyright (C) 2015-2016 Freescale Semiconductor, Inc.
8 #include <asm/arch/clock.h>
9 #include <asm/arch/crm_regs.h>
10 #include <asm/arch/imx-regs.h>
11 #include <asm/arch/iomux.h>
12 #include <asm/arch/mx6-pins.h>
13 #include <asm/arch/sys_proto.h>
14 #include <asm/global_data.h>
16 #include <asm/mach-imx/boot_mode.h>
17 #include <asm/mach-imx/iomux-v3.h>
18 #include <asm/mach-imx/mxc_i2c.h>
22 #include <fsl_esdhc_imx.h>
25 #include <linux/sizes.h>
29 DECLARE_GLOBAL_DATA_PTR;
31 #define UART_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
32 PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
33 PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST | PAD_CTL_HYS)
37 gd->ram_size = imx_ddr_size();
42 static iomux_v3_cfg_t const uart1_pads[] = {
43 MX6_PAD_UART1_TX_DATA__UART1_DCE_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
44 MX6_PAD_UART1_RX_DATA__UART1_DCE_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
47 static void setup_iomux_uart(void)
49 imx_iomux_v3_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads));
53 static int setup_fec(void)
55 struct iomuxc *const iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR;
59 * Use 50M anatop loopback REF_CLK1 for ENET1,
60 * clear gpr1[13], set gpr1[17].
62 clrsetbits_le32(&iomuxc_regs->gpr[1], IOMUX_GPR1_FEC1_MASK,
63 IOMUX_GPR1_FEC1_CLOCK_MUX1_SEL_MASK);
65 ret = enable_fec_anatop_clock(0, ENET_50MHZ);
74 int board_phy_config(struct phy_device *phydev)
76 phy_write(phydev, MDIO_DEVAD_NONE, 0x1f, 0x8190);
78 if (phydev->drv->config)
79 phydev->drv->config(phydev);
85 int board_mmc_get_env_dev(int devno)
90 int mmc_map_to_kernel_blk(int devno)
95 int board_early_init_f(void)
104 /* Address of boot parameters */
105 gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
107 #ifdef CONFIG_SYS_I2C_LEGACY
108 setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1);
111 #ifdef CONFIG_FEC_MXC
118 #ifdef CONFIG_CMD_BMODE
119 static const struct boot_mode board_boot_modes[] = {
120 /* 4 bit bus width */
121 {"sd1", MAKE_CFGVAL(0x42, 0x20, 0x00, 0x00)},
122 {"sd2", MAKE_CFGVAL(0x40, 0x28, 0x00, 0x00)},
127 int board_late_init(void)
129 #ifdef CONFIG_CMD_BMODE
130 add_board_boot_modes(board_boot_modes);
133 if (is_cpu_type(MXC_CPU_MX6ULL))
134 env_set("board", "visionsom-6ull");
136 env_set("board", "visionsom-6ul");
143 printf("Board: SoMLabs VisionSOM-6UL%s\n",
144 is_cpu_type(MXC_CPU_MX6ULL) ? "L" : "");