Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2007, Guennadi Liakhovetski <lg@denx.de> |
| 4 | * |
| 5 | * (C) Copyright 2008-2010 Freescale Semiconductor, Inc. |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <common.h> |
Simon Glass | 5255932 | 2019-11-14 12:57:46 -0700 | [diff] [blame] | 9 | #include <init.h> |
Simon Glass | 90526e9 | 2020-05-10 11:39:56 -0600 | [diff] [blame] | 10 | #include <net.h> |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 11 | #include <asm/io.h> |
Simon Glass | c05ed00 | 2020-05-10 11:40:11 -0600 | [diff] [blame] | 12 | #include <linux/delay.h> |
Masahiro Yamada | 1221ce4 | 2016-09-21 11:28:55 +0900 | [diff] [blame] | 13 | #include <linux/errno.h> |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 14 | #include <asm/arch/imx-regs.h> |
| 15 | #include <asm/arch/crm_regs.h> |
Benoît Thébaudeau | a2ac1b3 | 2012-10-01 08:36:25 +0000 | [diff] [blame] | 16 | #include <asm/arch/clock.h> |
Benoît Thébaudeau | 105c9ea | 2013-05-03 10:32:22 +0000 | [diff] [blame] | 17 | #include <asm/arch/iomux-mx35.h> |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 18 | #include <i2c.h> |
Łukasz Majewski | c733681 | 2012-11-13 03:21:55 +0000 | [diff] [blame] | 19 | #include <power/pmic.h> |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 20 | #include <fsl_pmic.h> |
Stefano Babic | 3292539 | 2012-09-05 21:47:42 +0000 | [diff] [blame] | 21 | #include <mmc.h> |
Yangbo Lu | e37ac71 | 2019-06-21 11:42:28 +0800 | [diff] [blame] | 22 | #include <fsl_esdhc_imx.h> |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 23 | #include <mc9sdz60.h> |
| 24 | #include <mc13892.h> |
| 25 | #include <linux/types.h> |
Stefano Babic | a4adedd | 2011-08-21 11:00:32 +0200 | [diff] [blame] | 26 | #include <asm/gpio.h> |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 27 | #include <asm/arch/sys_proto.h> |
| 28 | #include <netdev.h> |
Simon Glass | c62db35 | 2017-05-31 19:47:48 -0600 | [diff] [blame] | 29 | #include <asm/mach-types.h> |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 30 | |
Helmut Raiger | 9660e44 | 2011-10-20 04:19:47 +0000 | [diff] [blame] | 31 | #ifndef CONFIG_BOARD_LATE_INIT |
| 32 | #error "CONFIG_BOARD_LATE_INIT must be set for this board" |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 33 | #endif |
| 34 | |
| 35 | #ifndef CONFIG_BOARD_EARLY_INIT_F |
| 36 | #error "CONFIG_BOARD_EARLY_INIT_F must be set for this board" |
| 37 | #endif |
| 38 | |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 39 | DECLARE_GLOBAL_DATA_PTR; |
| 40 | |
| 41 | int dram_init(void) |
| 42 | { |
Stefano Babic | 6b5acfc | 2011-08-02 14:42:36 +0200 | [diff] [blame] | 43 | u32 size1, size2; |
| 44 | |
| 45 | size1 = get_ram_size((void *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE); |
| 46 | size2 = get_ram_size((void *)PHYS_SDRAM_2, PHYS_SDRAM_2_SIZE); |
| 47 | |
| 48 | gd->ram_size = size1 + size2; |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 49 | |
| 50 | return 0; |
| 51 | } |
| 52 | |
Simon Glass | 76b00ac | 2017-03-31 08:40:32 -0600 | [diff] [blame] | 53 | int dram_init_banksize(void) |
Stefano Babic | 6b5acfc | 2011-08-02 14:42:36 +0200 | [diff] [blame] | 54 | { |
| 55 | gd->bd->bi_dram[0].start = PHYS_SDRAM_1; |
| 56 | gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; |
| 57 | |
| 58 | gd->bd->bi_dram[1].start = PHYS_SDRAM_2; |
| 59 | gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE; |
Simon Glass | 76b00ac | 2017-03-31 08:40:32 -0600 | [diff] [blame] | 60 | |
| 61 | return 0; |
Stefano Babic | 6b5acfc | 2011-08-02 14:42:36 +0200 | [diff] [blame] | 62 | } |
| 63 | |
Benoît Thébaudeau | 105c9ea | 2013-05-03 10:32:22 +0000 | [diff] [blame] | 64 | #define I2C_PAD_CTRL (PAD_CTL_HYS | PAD_CTL_PUS_100K_DOWN | PAD_CTL_ODE) |
| 65 | |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 66 | static void setup_iomux_i2c(void) |
| 67 | { |
Benoît Thébaudeau | 105c9ea | 2013-05-03 10:32:22 +0000 | [diff] [blame] | 68 | static const iomux_v3_cfg_t i2c1_pads[] = { |
| 69 | NEW_PAD_CTRL(MX35_PAD_I2C1_CLK__I2C1_SCL, I2C_PAD_CTRL), |
| 70 | NEW_PAD_CTRL(MX35_PAD_I2C1_DAT__I2C1_SDA, I2C_PAD_CTRL), |
| 71 | }; |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 72 | |
| 73 | /* setup pins for I2C1 */ |
Benoît Thébaudeau | 105c9ea | 2013-05-03 10:32:22 +0000 | [diff] [blame] | 74 | imx_iomux_v3_setup_multiple_pads(i2c1_pads, ARRAY_SIZE(i2c1_pads)); |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | |
| 78 | static void setup_iomux_spi(void) |
| 79 | { |
Benoît Thébaudeau | 105c9ea | 2013-05-03 10:32:22 +0000 | [diff] [blame] | 80 | static const iomux_v3_cfg_t spi_pads[] = { |
| 81 | MX35_PAD_CSPI1_MOSI__CSPI1_MOSI, |
| 82 | MX35_PAD_CSPI1_MISO__CSPI1_MISO, |
| 83 | MX35_PAD_CSPI1_SS0__CSPI1_SS0, |
| 84 | MX35_PAD_CSPI1_SS1__CSPI1_SS1, |
| 85 | MX35_PAD_CSPI1_SCLK__CSPI1_SCLK, |
| 86 | }; |
| 87 | |
| 88 | imx_iomux_v3_setup_multiple_pads(spi_pads, ARRAY_SIZE(spi_pads)); |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 89 | } |
| 90 | |
Benoît Thébaudeau | 105c9ea | 2013-05-03 10:32:22 +0000 | [diff] [blame] | 91 | #define USBOTG_IN_PAD_CTRL (PAD_CTL_HYS | PAD_CTL_PUS_100K_DOWN | \ |
| 92 | PAD_CTL_DSE_LOW | PAD_CTL_SRE_SLOW) |
| 93 | #define USBOTG_OUT_PAD_CTRL (PAD_CTL_DSE_LOW | PAD_CTL_SRE_SLOW) |
| 94 | |
Benoît Thébaudeau | 961a762 | 2012-11-13 09:58:25 +0000 | [diff] [blame] | 95 | static void setup_iomux_usbotg(void) |
| 96 | { |
Benoît Thébaudeau | 105c9ea | 2013-05-03 10:32:22 +0000 | [diff] [blame] | 97 | static const iomux_v3_cfg_t usbotg_pads[] = { |
| 98 | NEW_PAD_CTRL(MX35_PAD_USBOTG_PWR__USB_TOP_USBOTG_PWR, |
| 99 | USBOTG_OUT_PAD_CTRL), |
| 100 | NEW_PAD_CTRL(MX35_PAD_USBOTG_OC__USB_TOP_USBOTG_OC, |
| 101 | USBOTG_IN_PAD_CTRL), |
| 102 | }; |
Benoît Thébaudeau | 961a762 | 2012-11-13 09:58:25 +0000 | [diff] [blame] | 103 | |
| 104 | /* Set up pins for USBOTG. */ |
Benoît Thébaudeau | 105c9ea | 2013-05-03 10:32:22 +0000 | [diff] [blame] | 105 | imx_iomux_v3_setup_multiple_pads(usbotg_pads, ARRAY_SIZE(usbotg_pads)); |
Benoît Thébaudeau | 961a762 | 2012-11-13 09:58:25 +0000 | [diff] [blame] | 106 | } |
| 107 | |
Benoît Thébaudeau | 105c9ea | 2013-05-03 10:32:22 +0000 | [diff] [blame] | 108 | #define FEC_PAD_CTRL (PAD_CTL_DSE_LOW | PAD_CTL_SRE_SLOW) |
| 109 | |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 110 | static void setup_iomux_fec(void) |
| 111 | { |
Benoît Thébaudeau | 105c9ea | 2013-05-03 10:32:22 +0000 | [diff] [blame] | 112 | static const iomux_v3_cfg_t fec_pads[] = { |
| 113 | NEW_PAD_CTRL(MX35_PAD_FEC_TX_CLK__FEC_TX_CLK, FEC_PAD_CTRL | |
| 114 | PAD_CTL_HYS | PAD_CTL_PUS_100K_DOWN), |
| 115 | NEW_PAD_CTRL(MX35_PAD_FEC_RX_CLK__FEC_RX_CLK, FEC_PAD_CTRL | |
| 116 | PAD_CTL_HYS | PAD_CTL_PUS_100K_DOWN), |
| 117 | NEW_PAD_CTRL(MX35_PAD_FEC_RX_DV__FEC_RX_DV, FEC_PAD_CTRL | |
| 118 | PAD_CTL_HYS | PAD_CTL_PUS_100K_DOWN), |
| 119 | NEW_PAD_CTRL(MX35_PAD_FEC_COL__FEC_COL, FEC_PAD_CTRL | |
| 120 | PAD_CTL_HYS | PAD_CTL_PUS_100K_DOWN), |
| 121 | NEW_PAD_CTRL(MX35_PAD_FEC_RDATA0__FEC_RDATA_0, FEC_PAD_CTRL | |
| 122 | PAD_CTL_HYS | PAD_CTL_PUS_100K_DOWN), |
| 123 | NEW_PAD_CTRL(MX35_PAD_FEC_TDATA0__FEC_TDATA_0, FEC_PAD_CTRL), |
| 124 | NEW_PAD_CTRL(MX35_PAD_FEC_TX_EN__FEC_TX_EN, FEC_PAD_CTRL), |
| 125 | NEW_PAD_CTRL(MX35_PAD_FEC_MDC__FEC_MDC, FEC_PAD_CTRL), |
| 126 | NEW_PAD_CTRL(MX35_PAD_FEC_MDIO__FEC_MDIO, FEC_PAD_CTRL | |
| 127 | PAD_CTL_HYS | PAD_CTL_PUS_22K_UP), |
| 128 | NEW_PAD_CTRL(MX35_PAD_FEC_TX_ERR__FEC_TX_ERR, FEC_PAD_CTRL), |
| 129 | NEW_PAD_CTRL(MX35_PAD_FEC_RX_ERR__FEC_RX_ERR, FEC_PAD_CTRL | |
| 130 | PAD_CTL_HYS | PAD_CTL_PUS_100K_DOWN), |
| 131 | NEW_PAD_CTRL(MX35_PAD_FEC_CRS__FEC_CRS, FEC_PAD_CTRL | |
| 132 | PAD_CTL_HYS | PAD_CTL_PUS_100K_DOWN), |
| 133 | NEW_PAD_CTRL(MX35_PAD_FEC_RDATA1__FEC_RDATA_1, FEC_PAD_CTRL | |
| 134 | PAD_CTL_HYS | PAD_CTL_PUS_100K_DOWN), |
| 135 | NEW_PAD_CTRL(MX35_PAD_FEC_TDATA1__FEC_TDATA_1, FEC_PAD_CTRL), |
| 136 | NEW_PAD_CTRL(MX35_PAD_FEC_RDATA2__FEC_RDATA_2, FEC_PAD_CTRL | |
| 137 | PAD_CTL_HYS | PAD_CTL_PUS_100K_DOWN), |
| 138 | NEW_PAD_CTRL(MX35_PAD_FEC_TDATA2__FEC_TDATA_2, FEC_PAD_CTRL), |
| 139 | NEW_PAD_CTRL(MX35_PAD_FEC_RDATA3__FEC_RDATA_3, FEC_PAD_CTRL | |
| 140 | PAD_CTL_HYS | PAD_CTL_PUS_100K_DOWN), |
| 141 | NEW_PAD_CTRL(MX35_PAD_FEC_TDATA3__FEC_TDATA_3, FEC_PAD_CTRL), |
| 142 | }; |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 143 | |
| 144 | /* setup pins for FEC */ |
Benoît Thébaudeau | 105c9ea | 2013-05-03 10:32:22 +0000 | [diff] [blame] | 145 | imx_iomux_v3_setup_multiple_pads(fec_pads, ARRAY_SIZE(fec_pads)); |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 146 | } |
| 147 | |
| 148 | int board_early_init_f(void) |
| 149 | { |
| 150 | struct ccm_regs *ccm = |
| 151 | (struct ccm_regs *)IMX_CCM_BASE; |
| 152 | |
| 153 | /* enable clocks */ |
| 154 | writel(readl(&ccm->cgr0) | |
| 155 | MXC_CCM_CGR0_EMI_MASK | |
Benoît Thébaudeau | 34a31bf | 2012-08-14 03:28:24 +0000 | [diff] [blame] | 156 | MXC_CCM_CGR0_EDIO_MASK | |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 157 | MXC_CCM_CGR0_EPIT1_MASK, |
| 158 | &ccm->cgr0); |
| 159 | |
| 160 | writel(readl(&ccm->cgr1) | |
| 161 | MXC_CCM_CGR1_FEC_MASK | |
| 162 | MXC_CCM_CGR1_GPIO1_MASK | |
| 163 | MXC_CCM_CGR1_GPIO2_MASK | |
| 164 | MXC_CCM_CGR1_GPIO3_MASK | |
| 165 | MXC_CCM_CGR1_I2C1_MASK | |
| 166 | MXC_CCM_CGR1_I2C2_MASK | |
| 167 | MXC_CCM_CGR1_IPU_MASK, |
| 168 | &ccm->cgr1); |
| 169 | |
| 170 | /* Setup NAND */ |
| 171 | __raw_writel(readl(&ccm->rcsr) | MXC_CCM_RCSR_NFC_FMS, &ccm->rcsr); |
| 172 | |
| 173 | setup_iomux_i2c(); |
Benoît Thébaudeau | 961a762 | 2012-11-13 09:58:25 +0000 | [diff] [blame] | 174 | setup_iomux_usbotg(); |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 175 | setup_iomux_fec(); |
| 176 | setup_iomux_spi(); |
| 177 | |
| 178 | return 0; |
| 179 | } |
| 180 | |
| 181 | int board_init(void) |
| 182 | { |
| 183 | gd->bd->bi_arch_number = MACH_TYPE_MX35_3DS; /* board id for linux */ |
| 184 | /* address of boot parameters */ |
| 185 | gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100; |
| 186 | |
| 187 | return 0; |
| 188 | } |
| 189 | |
| 190 | static inline int pmic_detect(void) |
| 191 | { |
Stefano Babic | 5213d6e | 2011-10-06 21:07:42 +0200 | [diff] [blame] | 192 | unsigned int id; |
Łukasz Majewski | c733681 | 2012-11-13 03:21:55 +0000 | [diff] [blame] | 193 | struct pmic *p = pmic_get("FSL_PMIC"); |
| 194 | if (!p) |
| 195 | return -ENODEV; |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 196 | |
Stefano Babic | 5213d6e | 2011-10-06 21:07:42 +0200 | [diff] [blame] | 197 | pmic_reg_read(p, REG_IDENTIFICATION, &id); |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 198 | |
| 199 | id = (id >> 6) & 0x7; |
| 200 | if (id == 0x7) |
| 201 | return 1; |
| 202 | return 0; |
| 203 | } |
| 204 | |
| 205 | u32 get_board_rev(void) |
| 206 | { |
| 207 | int rev; |
| 208 | |
| 209 | rev = pmic_detect(); |
| 210 | |
| 211 | return (get_cpu_rev() & ~(0xF << 8)) | (rev & 0xF) << 8; |
| 212 | } |
| 213 | |
| 214 | int board_late_init(void) |
| 215 | { |
| 216 | u8 val; |
| 217 | u32 pmic_val; |
Stefano Babic | 5213d6e | 2011-10-06 21:07:42 +0200 | [diff] [blame] | 218 | struct pmic *p; |
Łukasz Majewski | c733681 | 2012-11-13 03:21:55 +0000 | [diff] [blame] | 219 | int ret; |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 220 | |
Fabio Estevam | 570aa2f | 2013-11-20 21:17:36 -0200 | [diff] [blame] | 221 | ret = pmic_init(I2C_0); |
Łukasz Majewski | c733681 | 2012-11-13 03:21:55 +0000 | [diff] [blame] | 222 | if (ret) |
| 223 | return ret; |
| 224 | |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 225 | if (pmic_detect()) { |
Łukasz Majewski | c733681 | 2012-11-13 03:21:55 +0000 | [diff] [blame] | 226 | p = pmic_get("FSL_PMIC"); |
Benoît Thébaudeau | 105c9ea | 2013-05-03 10:32:22 +0000 | [diff] [blame] | 227 | imx_iomux_v3_setup_pad(MX35_PAD_WDOG_RST__WDOG_WDOG_B); |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 228 | |
Stefano Babic | 5213d6e | 2011-10-06 21:07:42 +0200 | [diff] [blame] | 229 | pmic_reg_read(p, REG_SETTING_0, &pmic_val); |
| 230 | pmic_reg_write(p, REG_SETTING_0, |
| 231 | pmic_val | VO_1_30V | VO_1_50V); |
| 232 | pmic_reg_read(p, REG_MODE_0, &pmic_val); |
| 233 | pmic_reg_write(p, REG_MODE_0, pmic_val | VGEN3EN); |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 234 | |
Benoît Thébaudeau | 105c9ea | 2013-05-03 10:32:22 +0000 | [diff] [blame] | 235 | imx_iomux_v3_setup_pad(MX35_PAD_COMPARE__GPIO1_5); |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 236 | |
Benoît Thébaudeau | 68088ce | 2013-05-06 01:33:51 +0000 | [diff] [blame] | 237 | gpio_direction_output(IMX_GPIO_NR(1, 5), 1); |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 238 | } |
| 239 | |
| 240 | val = mc9sdz60_reg_read(MC9SDZ60_REG_GPIO_1) | 0x04; |
| 241 | mc9sdz60_reg_write(MC9SDZ60_REG_GPIO_1, val); |
| 242 | mdelay(200); |
| 243 | |
| 244 | val = mc9sdz60_reg_read(MC9SDZ60_REG_RESET_1) & 0x7F; |
| 245 | mc9sdz60_reg_write(MC9SDZ60_REG_RESET_1, val); |
| 246 | mdelay(200); |
| 247 | |
| 248 | val |= 0x80; |
| 249 | mc9sdz60_reg_write(MC9SDZ60_REG_RESET_1, val); |
| 250 | |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 251 | /* Print board revision */ |
Fabio Estevam | ba901df | 2012-02-10 06:29:15 +0000 | [diff] [blame] | 252 | printf("Board: MX35 PDK %d.0\n", ((get_board_rev() >> 8) + 1) & 0x0F); |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 253 | |
| 254 | return 0; |
| 255 | } |
| 256 | |
Masahiro Yamada | b75d8dc | 2020-06-26 15:13:33 +0900 | [diff] [blame] | 257 | int board_eth_init(struct bd_info *bis) |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 258 | { |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 259 | #if defined(CONFIG_SMC911X) |
Fabio Estevam | a05f4ab | 2013-09-20 16:30:50 -0300 | [diff] [blame] | 260 | int rc = smc911x_initialize(0, CONFIG_SMC911X_BASE); |
| 261 | if (rc) |
| 262 | return rc; |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 263 | #endif |
Fabio Estevam | a05f4ab | 2013-09-20 16:30:50 -0300 | [diff] [blame] | 264 | return cpu_eth_init(bis); |
Stefano Babic | eae4988 | 2011-01-20 08:05:15 +0000 | [diff] [blame] | 265 | } |
Stefano Babic | 3292539 | 2012-09-05 21:47:42 +0000 | [diff] [blame] | 266 | |
Yangbo Lu | e37ac71 | 2019-06-21 11:42:28 +0800 | [diff] [blame] | 267 | #if defined(CONFIG_FSL_ESDHC_IMX) |
Stefano Babic | 3292539 | 2012-09-05 21:47:42 +0000 | [diff] [blame] | 268 | |
| 269 | struct fsl_esdhc_cfg esdhc_cfg = {MMC_SDHC1_BASE_ADDR}; |
| 270 | |
Masahiro Yamada | b75d8dc | 2020-06-26 15:13:33 +0900 | [diff] [blame] | 271 | int board_mmc_init(struct bd_info *bis) |
Stefano Babic | 3292539 | 2012-09-05 21:47:42 +0000 | [diff] [blame] | 272 | { |
Benoît Thébaudeau | 105c9ea | 2013-05-03 10:32:22 +0000 | [diff] [blame] | 273 | static const iomux_v3_cfg_t sdhc1_pads[] = { |
| 274 | MX35_PAD_SD1_CMD__ESDHC1_CMD, |
| 275 | MX35_PAD_SD1_CLK__ESDHC1_CLK, |
| 276 | MX35_PAD_SD1_DATA0__ESDHC1_DAT0, |
| 277 | MX35_PAD_SD1_DATA1__ESDHC1_DAT1, |
| 278 | MX35_PAD_SD1_DATA2__ESDHC1_DAT2, |
| 279 | MX35_PAD_SD1_DATA3__ESDHC1_DAT3, |
| 280 | }; |
| 281 | |
Stefano Babic | 3292539 | 2012-09-05 21:47:42 +0000 | [diff] [blame] | 282 | /* configure pins for SDHC1 only */ |
Benoît Thébaudeau | 105c9ea | 2013-05-03 10:32:22 +0000 | [diff] [blame] | 283 | imx_iomux_v3_setup_multiple_pads(sdhc1_pads, ARRAY_SIZE(sdhc1_pads)); |
Stefano Babic | 3292539 | 2012-09-05 21:47:42 +0000 | [diff] [blame] | 284 | |
Benoît Thébaudeau | a2ac1b3 | 2012-10-01 08:36:25 +0000 | [diff] [blame] | 285 | esdhc_cfg.sdhc_clk = mxc_get_clock(MXC_ESDHC1_CLK); |
Stefano Babic | 3292539 | 2012-09-05 21:47:42 +0000 | [diff] [blame] | 286 | return fsl_esdhc_initialize(bis, &esdhc_cfg); |
| 287 | } |
| 288 | |
| 289 | int board_mmc_getcd(struct mmc *mmc) |
| 290 | { |
| 291 | return !(mc9sdz60_reg_read(MC9SDZ60_REG_DES_FLAG) & 0x4); |
| 292 | } |
| 293 | #endif |