2 * Copyright (C) 2013 Freescale Semiconductor, Inc.
3 * Copyright (C) 2015 ECA Sinters
5 * Author: Fabio Estevam <fabio.estevam@freescale.com>
6 * Modified by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 * SPDX-License-Identifier: GPL-2.0+
11 #include <asm/arch/clock.h>
12 #include <asm/arch/imx-regs.h>
13 #include <asm/arch/iomux.h>
14 #include <asm/arch/mx6-pins.h>
15 #include <linux/errno.h>
17 #include <asm/imx-common/iomux-v3.h>
18 #include <asm/imx-common/boot_mode.h>
21 #include <fsl_esdhc.h>
24 #include <asm/arch/mxc_hdmi.h>
25 #include <asm/arch/crm_regs.h>
27 #include <ipu_pixfmt.h>
29 #include <asm/arch/sys_proto.h>
31 #include <asm/imx-common/mxc_i2c.h>
34 #include "../common/mx6.h"
36 DECLARE_GLOBAL_DATA_PTR;
40 gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE);
45 int board_early_init_f(void)
47 seco_mx6_setup_uart_iomux();
52 int board_phy_config(struct phy_device *phydev)
54 seco_mx6_rgmii_rework(phydev);
55 if (phydev->drv->config)
56 phydev->drv->config(phydev);
61 int board_eth_init(bd_t *bis)
63 uint32_t base = IMX_FEC_BASE;
64 struct mii_dev *bus = NULL;
65 struct phy_device *phydev = NULL;
68 seco_mx6_setup_enet_iomux();
71 bus = fec_get_miibus(base, -1);
75 /* scan phy 4,5,6,7 */
76 phydev = phy_find_by_mask(bus, (0xf << 4), PHY_INTERFACE_MODE_RGMII);
82 printf("using phy at %d\n", phydev->addr);
83 ret = fec_probe(bis, -1, base, bus, phydev);
87 printf("FEC MXC: %s:failed\n", __func__);
94 #define USDHC4_CD_GPIO IMX_GPIO_NR(2, 6)
96 static struct fsl_esdhc_cfg usdhc_cfg[2] = {
97 {USDHC3_BASE_ADDR, 0, 4},
98 {USDHC4_BASE_ADDR, 0, 4},
101 int board_mmc_getcd(struct mmc *mmc)
103 struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
106 switch (cfg->esdhc_base) {
107 case USDHC3_BASE_ADDR:
108 ret = 1; /* Assume eMMC is always present */
110 case USDHC4_BASE_ADDR:
111 ret = !gpio_get_value(USDHC4_CD_GPIO);
118 int board_mmc_init(bd_t *bis)
124 * Following map is done:
125 * (U-Boot device node) (Physical Port)
129 for (index = 0; index < CONFIG_SYS_FSL_USDHC_NUM; ++index) {
132 seco_mx6_setup_usdhc_iomux(3);
133 usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
136 seco_mx6_setup_usdhc_iomux(4);
137 usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
141 printf("Warning: %d exceed maximum number of SD ports %d\n",
142 index + 1, CONFIG_SYS_FSL_USDHC_NUM);
146 ret = fsl_esdhc_initialize(bis, &usdhc_cfg[index]);
156 /* address of boot parameters */
157 gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
159 imx_iomux_v3_setup_pad(MX6_PAD_NANDF_D4__GPIO2_IO04 |
160 MUX_PAD_CTRL(NO_PAD_CTRL));
162 gpio_direction_output(IMX_GPIO_NR(2, 4), 0);
165 gpio_set_value(IMX_GPIO_NR(2, 4), 0);
169 gpio_set_value(IMX_GPIO_NR(2, 4), 1);
176 puts("Board: SECO uQ7\n");