Thomas Gleixner | 1621633 | 2019-05-19 15:51:31 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 2 | /* |
| 3 | * Copyright 2007 Robert Schwebel <r.schwebel@pengutronix.de>, Pengutronix |
| 4 | * Copyright (C) 2009 Sascha Hauer (kernel@pengutronix.de) |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <linux/platform_device.h> |
| 8 | #include <linux/io.h> |
| 9 | #include <linux/i2c.h> |
Bartosz Golaszewski | 6a7836b | 2018-04-04 15:16:26 +0200 | [diff] [blame] | 10 | #include <linux/property.h> |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 11 | #include <linux/dma-mapping.h> |
| 12 | #include <linux/spi/spi.h> |
| 13 | #include <linux/spi/eeprom.h> |
| 14 | #include <linux/irq.h> |
Sascha Hauer | c8a6885 | 2010-02-08 16:42:28 +0100 | [diff] [blame] | 15 | #include <linux/delay.h> |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 16 | #include <linux/gpio.h> |
Sascha Hauer | eee7c49 | 2010-02-03 17:13:29 +0100 | [diff] [blame] | 17 | #include <linux/usb/otg.h> |
| 18 | #include <linux/usb/ulpi.h> |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 19 | |
| 20 | #include <asm/mach/arch.h> |
| 21 | #include <asm/mach-types.h> |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 22 | #include <asm/mach/time.h> |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 23 | |
Shawn Guo | e337247 | 2012-09-13 21:01:00 +0800 | [diff] [blame] | 24 | #include "common.h" |
Uwe Kleine-König | 0e7a29a | 2010-06-16 07:35:31 +0200 | [diff] [blame] | 25 | #include "devices-imx27.h" |
Shawn Guo | 641dfe8 | 2014-05-19 20:41:52 +0800 | [diff] [blame] | 26 | #include "ehci.h" |
Shawn Guo | 50f2de6 | 2012-09-14 14:14:45 +0800 | [diff] [blame] | 27 | #include "hardware.h" |
Shawn Guo | 267dd34 | 2012-09-13 13:26:00 +0800 | [diff] [blame] | 28 | #include "iomux-mx27.h" |
Shawn Guo | 39ef634 | 2012-09-13 21:46:09 +0800 | [diff] [blame] | 29 | #include "ulpi.h" |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 30 | |
Sascha Hauer | eee7c49 | 2010-02-03 17:13:29 +0100 | [diff] [blame] | 31 | #define OTG_PHY_CS_GPIO (GPIO_PORTB + 23) |
| 32 | #define USBH2_PHY_CS_GPIO (GPIO_PORTB + 24) |
Luotao Fu | b725aba | 2010-06-18 09:23:19 +0200 | [diff] [blame] | 33 | #define SPI1_SS0 (GPIO_PORTD + 28) |
| 34 | #define SPI1_SS1 (GPIO_PORTD + 27) |
| 35 | #define SD2_CD (GPIO_PORTC + 29) |
Sascha Hauer | eee7c49 | 2010-02-03 17:13:29 +0100 | [diff] [blame] | 36 | |
Uwe Kleine-König | 6c80ee5 | 2010-09-28 21:53:31 +0200 | [diff] [blame] | 37 | static const int pca100_pins[] __initconst = { |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 38 | /* UART1 */ |
| 39 | PE12_PF_UART1_TXD, |
| 40 | PE13_PF_UART1_RXD, |
| 41 | PE14_PF_UART1_CTS, |
| 42 | PE15_PF_UART1_RTS, |
| 43 | /* SDHC */ |
| 44 | PB4_PF_SD2_D0, |
| 45 | PB5_PF_SD2_D1, |
| 46 | PB6_PF_SD2_D2, |
| 47 | PB7_PF_SD2_D3, |
| 48 | PB8_PF_SD2_CMD, |
| 49 | PB9_PF_SD2_CLK, |
Luotao Fu | b725aba | 2010-06-18 09:23:19 +0200 | [diff] [blame] | 50 | SD2_CD | GPIO_GPIO | GPIO_IN, |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 51 | /* FEC */ |
| 52 | PD0_AIN_FEC_TXD0, |
| 53 | PD1_AIN_FEC_TXD1, |
| 54 | PD2_AIN_FEC_TXD2, |
| 55 | PD3_AIN_FEC_TXD3, |
| 56 | PD4_AOUT_FEC_RX_ER, |
| 57 | PD5_AOUT_FEC_RXD1, |
| 58 | PD6_AOUT_FEC_RXD2, |
| 59 | PD7_AOUT_FEC_RXD3, |
| 60 | PD8_AF_FEC_MDIO, |
| 61 | PD9_AIN_FEC_MDC, |
| 62 | PD10_AOUT_FEC_CRS, |
| 63 | PD11_AOUT_FEC_TX_CLK, |
| 64 | PD12_AOUT_FEC_RXD0, |
| 65 | PD13_AOUT_FEC_RX_DV, |
| 66 | PD14_AOUT_FEC_RX_CLK, |
| 67 | PD15_AOUT_FEC_COL, |
| 68 | PD16_AIN_FEC_TX_ER, |
| 69 | PF23_AIN_FEC_TX_EN, |
| 70 | /* SSI1 */ |
| 71 | PC20_PF_SSI1_FS, |
| 72 | PC21_PF_SSI1_RXD, |
| 73 | PC22_PF_SSI1_TXD, |
| 74 | PC23_PF_SSI1_CLK, |
| 75 | /* onboard I2C */ |
| 76 | PC5_PF_I2C2_SDA, |
| 77 | PC6_PF_I2C2_SCL, |
| 78 | /* external I2C */ |
| 79 | PD17_PF_I2C_DATA, |
| 80 | PD18_PF_I2C_CLK, |
| 81 | /* SPI1 */ |
| 82 | PD25_PF_CSPI1_RDY, |
| 83 | PD29_PF_CSPI1_SCLK, |
| 84 | PD30_PF_CSPI1_MISO, |
| 85 | PD31_PF_CSPI1_MOSI, |
Sascha Hauer | eee7c49 | 2010-02-03 17:13:29 +0100 | [diff] [blame] | 86 | /* OTG */ |
| 87 | OTG_PHY_CS_GPIO | GPIO_GPIO | GPIO_OUT, |
| 88 | PC7_PF_USBOTG_DATA5, |
| 89 | PC8_PF_USBOTG_DATA6, |
| 90 | PC9_PF_USBOTG_DATA0, |
| 91 | PC10_PF_USBOTG_DATA2, |
| 92 | PC11_PF_USBOTG_DATA1, |
| 93 | PC12_PF_USBOTG_DATA4, |
| 94 | PC13_PF_USBOTG_DATA3, |
| 95 | PE0_PF_USBOTG_NXT, |
| 96 | PE1_PF_USBOTG_STP, |
| 97 | PE2_PF_USBOTG_DIR, |
| 98 | PE24_PF_USBOTG_CLK, |
| 99 | PE25_PF_USBOTG_DATA7, |
| 100 | /* USBH2 */ |
| 101 | USBH2_PHY_CS_GPIO | GPIO_GPIO | GPIO_OUT, |
| 102 | PA0_PF_USBH2_CLK, |
| 103 | PA1_PF_USBH2_DIR, |
| 104 | PA2_PF_USBH2_DATA7, |
| 105 | PA3_PF_USBH2_NXT, |
| 106 | PA4_PF_USBH2_STP, |
| 107 | PD19_AF_USBH2_DATA4, |
| 108 | PD20_AF_USBH2_DATA3, |
| 109 | PD21_AF_USBH2_DATA6, |
| 110 | PD22_AF_USBH2_DATA0, |
| 111 | PD23_AF_USBH2_DATA2, |
| 112 | PD24_AF_USBH2_DATA1, |
| 113 | PD26_AF_USBH2_DATA5, |
Luotao Fu | 42216fc | 2010-06-18 09:23:18 +0200 | [diff] [blame] | 114 | /* display */ |
| 115 | PA5_PF_LSCLK, |
| 116 | PA6_PF_LD0, |
| 117 | PA7_PF_LD1, |
| 118 | PA8_PF_LD2, |
| 119 | PA9_PF_LD3, |
| 120 | PA10_PF_LD4, |
| 121 | PA11_PF_LD5, |
| 122 | PA12_PF_LD6, |
| 123 | PA13_PF_LD7, |
| 124 | PA14_PF_LD8, |
| 125 | PA15_PF_LD9, |
| 126 | PA16_PF_LD10, |
| 127 | PA17_PF_LD11, |
| 128 | PA18_PF_LD12, |
| 129 | PA19_PF_LD13, |
| 130 | PA20_PF_LD14, |
| 131 | PA21_PF_LD15, |
| 132 | PA22_PF_LD16, |
| 133 | PA23_PF_LD17, |
| 134 | PA26_PF_PS, |
| 135 | PA28_PF_HSYNC, |
| 136 | PA29_PF_VSYNC, |
| 137 | PA31_PF_OE_ACD, |
Luotao Fu | b725aba | 2010-06-18 09:23:19 +0200 | [diff] [blame] | 138 | /* free GPIO */ |
| 139 | GPIO_PORTC | 31 | GPIO_GPIO | GPIO_IN, /* GPIO0_IRQ */ |
| 140 | GPIO_PORTC | 25 | GPIO_GPIO | GPIO_IN, /* GPIO1_IRQ */ |
| 141 | GPIO_PORTE | 5 | GPIO_GPIO | GPIO_IN, /* GPIO2_IRQ */ |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 142 | }; |
| 143 | |
Uwe Kleine-König | d5dac4a | 2010-06-23 09:36:01 +0200 | [diff] [blame] | 144 | static const struct imxuart_platform_data uart_pdata __initconst = { |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 145 | .flags = IMXUART_HAVE_RTSCTS, |
| 146 | }; |
| 147 | |
Uwe Kleine-König | 0e7a29a | 2010-06-16 07:35:31 +0200 | [diff] [blame] | 148 | static const struct mxc_nand_platform_data |
| 149 | pca100_nand_board_info __initconst = { |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 150 | .width = 1, |
| 151 | .hw_ecc = 1, |
| 152 | }; |
| 153 | |
Uwe Kleine-König | c698715 | 2010-06-16 17:25:40 +0200 | [diff] [blame] | 154 | static const struct imxi2c_platform_data pca100_i2c1_data __initconst = { |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 155 | .bitrate = 100000, |
| 156 | }; |
| 157 | |
Bartosz Golaszewski | 6a7836b | 2018-04-04 15:16:26 +0200 | [diff] [blame] | 158 | static const struct property_entry board_eeprom_properties[] = { |
| 159 | PROPERTY_ENTRY_U32("pagesize", 32), |
| 160 | { } |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 161 | }; |
| 162 | |
| 163 | static struct i2c_board_info pca100_i2c_devices[] = { |
| 164 | { |
Bartosz Golaszewski | 6a7836b | 2018-04-04 15:16:26 +0200 | [diff] [blame] | 165 | I2C_BOARD_INFO("24c32", 0x52), /* E0=0, E1=1, E2=0 */ |
| 166 | .properties = board_eeprom_properties, |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 167 | }, { |
Uwe Kleine-König | bd9e310 | 2010-09-28 22:04:01 +0200 | [diff] [blame] | 168 | I2C_BOARD_INFO("pcf8563", 0x51), |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 169 | }, { |
| 170 | I2C_BOARD_INFO("lm75", 0x4a), |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 171 | } |
| 172 | }; |
| 173 | |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 174 | static struct spi_eeprom at25320 = { |
| 175 | .name = "at25320an", |
| 176 | .byte_len = 4096, |
| 177 | .page_size = 32, |
| 178 | .flags = EE_ADDR2, |
| 179 | }; |
| 180 | |
| 181 | static struct spi_board_info pca100_spi_board_info[] __initdata = { |
| 182 | { |
| 183 | .modalias = "at25", |
| 184 | .max_speed_hz = 30000, |
| 185 | .bus_num = 0, |
| 186 | .chip_select = 1, |
| 187 | .platform_data = &at25320, |
| 188 | }, |
| 189 | }; |
| 190 | |
Luotao Fu | b725aba | 2010-06-18 09:23:19 +0200 | [diff] [blame] | 191 | static int pca100_spi_cs[] = {SPI1_SS0, SPI1_SS1}; |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 192 | |
Uwe Kleine-König | 7536cf9 | 2010-06-22 09:00:22 +0200 | [diff] [blame] | 193 | static const struct spi_imx_master pca100_spi0_data __initconst = { |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 194 | .chipselect = pca100_spi_cs, |
| 195 | .num_chipselect = ARRAY_SIZE(pca100_spi_cs), |
| 196 | }; |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 197 | |
Sascha Hauer | c8a6885 | 2010-02-08 16:42:28 +0100 | [diff] [blame] | 198 | static void pca100_ac97_warm_reset(struct snd_ac97 *ac97) |
| 199 | { |
| 200 | mxc_gpio_mode(GPIO_PORTC | 20 | GPIO_GPIO | GPIO_OUT); |
| 201 | gpio_set_value(GPIO_PORTC + 20, 1); |
| 202 | udelay(2); |
| 203 | gpio_set_value(GPIO_PORTC + 20, 0); |
| 204 | mxc_gpio_mode(PC20_PF_SSI1_FS); |
| 205 | msleep(2); |
| 206 | } |
| 207 | |
| 208 | static void pca100_ac97_cold_reset(struct snd_ac97 *ac97) |
| 209 | { |
| 210 | mxc_gpio_mode(GPIO_PORTC | 20 | GPIO_GPIO | GPIO_OUT); /* FS */ |
| 211 | gpio_set_value(GPIO_PORTC + 20, 0); |
| 212 | mxc_gpio_mode(GPIO_PORTC | 22 | GPIO_GPIO | GPIO_OUT); /* TX */ |
| 213 | gpio_set_value(GPIO_PORTC + 22, 0); |
| 214 | mxc_gpio_mode(GPIO_PORTC | 28 | GPIO_GPIO | GPIO_OUT); /* reset */ |
| 215 | gpio_set_value(GPIO_PORTC + 28, 0); |
| 216 | udelay(10); |
| 217 | gpio_set_value(GPIO_PORTC + 28, 1); |
| 218 | mxc_gpio_mode(PC20_PF_SSI1_FS); |
| 219 | mxc_gpio_mode(PC22_PF_SSI1_TXD); |
| 220 | msleep(2); |
| 221 | } |
| 222 | |
Uwe Kleine-König | 4697bb92 | 2010-08-25 17:37:45 +0200 | [diff] [blame] | 223 | static const struct imx_ssi_platform_data pca100_ssi_pdata __initconst = { |
Sascha Hauer | c8a6885 | 2010-02-08 16:42:28 +0100 | [diff] [blame] | 224 | .ac97_reset = pca100_ac97_cold_reset, |
| 225 | .ac97_warm_reset = pca100_ac97_warm_reset, |
| 226 | .flags = IMX_SSI_USE_AC97, |
| 227 | }; |
| 228 | |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 229 | static int pca100_sdhc2_init(struct device *dev, irq_handler_t detect_irq, |
| 230 | void *data) |
| 231 | { |
| 232 | int ret; |
| 233 | |
Shawn Guo | 438196c | 2011-12-05 10:12:28 +0800 | [diff] [blame] | 234 | ret = request_irq(gpio_to_irq(IMX_GPIO_NR(3, 29)), detect_irq, |
Juan Solano | d4e7d94 | 2014-05-07 17:09:59 +0200 | [diff] [blame] | 235 | IRQF_TRIGGER_FALLING, "imx-mmc-detect", data); |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 236 | if (ret) |
| 237 | printk(KERN_ERR |
Masanari Iida | 77d84ff | 2013-12-09 00:22:53 +0900 | [diff] [blame] | 238 | "pca100: Failed to request irq for sd/mmc detection\n"); |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 239 | |
| 240 | return ret; |
| 241 | } |
| 242 | |
| 243 | static void pca100_sdhc2_exit(struct device *dev, void *data) |
| 244 | { |
Shawn Guo | 438196c | 2011-12-05 10:12:28 +0800 | [diff] [blame] | 245 | free_irq(gpio_to_irq(IMX_GPIO_NR(3, 29)), data); |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 246 | } |
| 247 | |
Uwe Kleine-König | 9d3d945 | 2010-11-05 17:26:09 +0100 | [diff] [blame] | 248 | static const struct imxmmc_platform_data sdhc_pdata __initconst = { |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 249 | .init = pca100_sdhc2_init, |
| 250 | .exit = pca100_sdhc2_exit, |
| 251 | }; |
| 252 | |
Sascha Hauer | eee7c49 | 2010-02-03 17:13:29 +0100 | [diff] [blame] | 253 | static int otg_phy_init(struct platform_device *pdev) |
| 254 | { |
| 255 | gpio_set_value(OTG_PHY_CS_GPIO, 0); |
Sascha Hauer | 4bd597b | 2011-01-03 11:30:28 +0100 | [diff] [blame] | 256 | |
| 257 | mdelay(10); |
| 258 | |
| 259 | return mx27_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI); |
Sascha Hauer | eee7c49 | 2010-02-03 17:13:29 +0100 | [diff] [blame] | 260 | } |
| 261 | |
Uwe Kleine-König | 2eb42d5 | 2010-11-05 18:52:09 +0100 | [diff] [blame] | 262 | static struct mxc_usbh_platform_data otg_pdata __initdata = { |
Sascha Hauer | eee7c49 | 2010-02-03 17:13:29 +0100 | [diff] [blame] | 263 | .init = otg_phy_init, |
| 264 | .portsc = MXC_EHCI_MODE_ULPI, |
Sascha Hauer | eee7c49 | 2010-02-03 17:13:29 +0100 | [diff] [blame] | 265 | }; |
| 266 | |
| 267 | static int usbh2_phy_init(struct platform_device *pdev) |
| 268 | { |
| 269 | gpio_set_value(USBH2_PHY_CS_GPIO, 0); |
Sascha Hauer | 4bd597b | 2011-01-03 11:30:28 +0100 | [diff] [blame] | 270 | |
| 271 | mdelay(10); |
| 272 | |
| 273 | return mx27_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI); |
Sascha Hauer | eee7c49 | 2010-02-03 17:13:29 +0100 | [diff] [blame] | 274 | } |
| 275 | |
Uwe Kleine-König | 2eb42d5 | 2010-11-05 18:52:09 +0100 | [diff] [blame] | 276 | static struct mxc_usbh_platform_data usbh2_pdata __initdata = { |
Sascha Hauer | eee7c49 | 2010-02-03 17:13:29 +0100 | [diff] [blame] | 277 | .init = usbh2_phy_init, |
| 278 | .portsc = MXC_EHCI_MODE_ULPI, |
Sascha Hauer | eee7c49 | 2010-02-03 17:13:29 +0100 | [diff] [blame] | 279 | }; |
| 280 | |
Uwe Kleine-König | bd455ed | 2010-11-09 17:52:14 +0100 | [diff] [blame] | 281 | static const struct fsl_usb2_platform_data otg_device_pdata __initconst = { |
Sascha Hauer | eee7c49 | 2010-02-03 17:13:29 +0100 | [diff] [blame] | 282 | .operating_mode = FSL_USB2_DR_DEVICE, |
| 283 | .phy_mode = FSL_USB2_PHY_ULPI, |
| 284 | }; |
| 285 | |
Benoît Thébaudeau | 33a264d | 2012-06-12 19:46:43 +0200 | [diff] [blame] | 286 | static bool otg_mode_host __initdata; |
Sascha Hauer | eee7c49 | 2010-02-03 17:13:29 +0100 | [diff] [blame] | 287 | |
| 288 | static int __init pca100_otg_mode(char *options) |
| 289 | { |
| 290 | if (!strcmp(options, "host")) |
Benoît Thébaudeau | 33a264d | 2012-06-12 19:46:43 +0200 | [diff] [blame] | 291 | otg_mode_host = true; |
Sascha Hauer | eee7c49 | 2010-02-03 17:13:29 +0100 | [diff] [blame] | 292 | else if (!strcmp(options, "device")) |
Benoît Thébaudeau | 33a264d | 2012-06-12 19:46:43 +0200 | [diff] [blame] | 293 | otg_mode_host = false; |
Sascha Hauer | eee7c49 | 2010-02-03 17:13:29 +0100 | [diff] [blame] | 294 | else |
| 295 | pr_info("otg_mode neither \"host\" nor \"device\". " |
| 296 | "Defaulting to device\n"); |
Benoît Thébaudeau | 33a264d | 2012-06-12 19:46:43 +0200 | [diff] [blame] | 297 | return 1; |
Sascha Hauer | eee7c49 | 2010-02-03 17:13:29 +0100 | [diff] [blame] | 298 | } |
| 299 | __setup("otg_mode=", pca100_otg_mode); |
| 300 | |
Luotao Fu | 42216fc | 2010-06-18 09:23:18 +0200 | [diff] [blame] | 301 | /* framebuffer info */ |
| 302 | static struct imx_fb_videomode pca100_fb_modes[] = { |
| 303 | { |
| 304 | .mode = { |
| 305 | .name = "EMERGING-ETV570G0DHU", |
| 306 | .refresh = 60, |
| 307 | .xres = 640, |
| 308 | .yres = 480, |
| 309 | .pixclock = 39722, /* in ps (25.175 MHz) */ |
| 310 | .hsync_len = 30, |
| 311 | .left_margin = 114, |
| 312 | .right_margin = 16, |
| 313 | .vsync_len = 3, |
| 314 | .upper_margin = 32, |
| 315 | .lower_margin = 0, |
| 316 | }, |
| 317 | /* |
| 318 | * TFT |
| 319 | * Pixel pol active high |
| 320 | * HSYNC active low |
| 321 | * VSYNC active low |
| 322 | * use HSYNC for ACD count |
| 323 | * line clock disable while idle |
| 324 | * always enable line clock even if no data |
| 325 | */ |
| 326 | .pcr = 0xf0c08080, |
| 327 | .bpp = 16, |
| 328 | }, |
| 329 | }; |
| 330 | |
Uwe Kleine-König | ad851bf | 2010-11-04 17:07:48 +0100 | [diff] [blame] | 331 | static const struct imx_fb_platform_data pca100_fb_data __initconst = { |
Luotao Fu | 42216fc | 2010-06-18 09:23:18 +0200 | [diff] [blame] | 332 | .mode = pca100_fb_modes, |
| 333 | .num_modes = ARRAY_SIZE(pca100_fb_modes), |
| 334 | |
| 335 | .pwmr = 0x00A903FF, |
| 336 | .lscr1 = 0x00120300, |
| 337 | .dmacr = 0x00020010, |
| 338 | }; |
| 339 | |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 340 | static void __init pca100_init(void) |
| 341 | { |
| 342 | int ret; |
| 343 | |
Shawn Guo | b78d8e5 | 2011-06-06 00:07:55 +0800 | [diff] [blame] | 344 | imx27_soc_init(); |
| 345 | |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 346 | ret = mxc_gpio_setup_multiple_pins(pca100_pins, |
| 347 | ARRAY_SIZE(pca100_pins), "PCA100"); |
| 348 | if (ret) |
| 349 | printk(KERN_ERR "pca100: Failed to setup pins (%d)\n", ret); |
| 350 | |
Uwe Kleine-König | d5dac4a | 2010-06-23 09:36:01 +0200 | [diff] [blame] | 351 | imx27_add_imx_uart0(&uart_pdata); |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 352 | |
Uwe Kleine-König | 0e7a29a | 2010-06-16 07:35:31 +0200 | [diff] [blame] | 353 | imx27_add_mxc_nand(&pca100_nand_board_info); |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 354 | |
| 355 | /* only the i2c master 1 is used on this CPU card */ |
| 356 | i2c_register_board_info(1, pca100_i2c_devices, |
| 357 | ARRAY_SIZE(pca100_i2c_devices)); |
| 358 | |
Uwe Kleine-König | 77a406d | 2010-08-25 12:19:50 +0200 | [diff] [blame] | 359 | imx27_add_imx_i2c(1, &pca100_i2c1_data); |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 360 | |
Luotao Fu | b725aba | 2010-06-18 09:23:19 +0200 | [diff] [blame] | 361 | mxc_gpio_mode(GPIO_PORTD | 28 | GPIO_GPIO | GPIO_IN); |
| 362 | mxc_gpio_mode(GPIO_PORTD | 27 | GPIO_GPIO | GPIO_IN); |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 363 | spi_register_board_info(pca100_spi_board_info, |
| 364 | ARRAY_SIZE(pca100_spi_board_info)); |
Uwe Kleine-König | 4df772d | 2010-08-10 21:18:57 +0100 | [diff] [blame] | 365 | imx27_add_spi_imx0(&pca100_spi0_data); |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 366 | |
Vladimir Zapolskiy | 23fe1fd | 2016-09-19 04:37:31 +0300 | [diff] [blame] | 367 | imx27_add_imx_fb(&pca100_fb_data); |
| 368 | |
| 369 | imx27_add_fec(NULL); |
| 370 | imx27_add_imx2_wdt(); |
| 371 | imx27_add_mxc_w1(); |
| 372 | } |
| 373 | |
| 374 | static void __init pca100_late_init(void) |
| 375 | { |
| 376 | imx27_add_imx_ssi(0, &pca100_ssi_pdata); |
| 377 | |
| 378 | imx27_add_mxc_mmc(1, &sdhc_pdata); |
| 379 | |
Sascha Hauer | eee7c49 | 2010-02-03 17:13:29 +0100 | [diff] [blame] | 380 | gpio_request(OTG_PHY_CS_GPIO, "usb-otg-cs"); |
| 381 | gpio_direction_output(OTG_PHY_CS_GPIO, 1); |
| 382 | gpio_request(USBH2_PHY_CS_GPIO, "usb-host2-cs"); |
| 383 | gpio_direction_output(USBH2_PHY_CS_GPIO, 1); |
| 384 | |
Sascha Hauer | eee7c49 | 2010-02-03 17:13:29 +0100 | [diff] [blame] | 385 | if (otg_mode_host) { |
Sascha Hauer | 48f6b09 | 2011-03-02 09:27:42 +0100 | [diff] [blame] | 386 | otg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS | |
| 387 | ULPI_OTG_DRVVBUS_EXT); |
Sascha Hauer | eee7c49 | 2010-02-03 17:13:29 +0100 | [diff] [blame] | 388 | |
Sascha Hauer | 48f6b09 | 2011-03-02 09:27:42 +0100 | [diff] [blame] | 389 | if (otg_pdata.otg) |
| 390 | imx27_add_mxc_ehci_otg(&otg_pdata); |
| 391 | } else { |
| 392 | gpio_set_value(OTG_PHY_CS_GPIO, 0); |
| 393 | imx27_add_fsl_usb2_udc(&otg_device_pdata); |
Sascha Hauer | eee7c49 | 2010-02-03 17:13:29 +0100 | [diff] [blame] | 394 | } |
| 395 | |
Markus Pargmann | 794987a | 2013-06-06 14:41:57 +0200 | [diff] [blame] | 396 | usbh2_pdata.otg = imx_otg_ulpi_create( |
| 397 | ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); |
Sascha Hauer | eee7c49 | 2010-02-03 17:13:29 +0100 | [diff] [blame] | 398 | |
Sascha Hauer | 48f6b09 | 2011-03-02 09:27:42 +0100 | [diff] [blame] | 399 | if (usbh2_pdata.otg) |
| 400 | imx27_add_mxc_ehci_hs(2, &usbh2_pdata); |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 401 | } |
| 402 | |
| 403 | static void __init pca100_timer_init(void) |
| 404 | { |
| 405 | mx27_clocks_init(26000000); |
| 406 | } |
| 407 | |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 408 | MACHINE_START(PCA100, "phyCARD-i.MX27") |
Nicolas Pitre | dc8f190 | 2011-07-05 22:38:12 -0400 | [diff] [blame] | 409 | .atag_offset = 0x100, |
Uwe Kleine-König | 3dac219 | 2011-02-07 16:35:19 +0100 | [diff] [blame] | 410 | .map_io = mx27_map_io, |
| 411 | .init_early = imx27_init_early, |
| 412 | .init_irq = mx27_init_irq, |
Vladimir Zapolskiy | 23fe1fd | 2016-09-19 04:37:31 +0300 | [diff] [blame] | 413 | .init_machine = pca100_init, |
| 414 | .init_late = pca100_late_init, |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 415 | .init_time = pca100_timer_init, |
Russell King | 65ea788 | 2011-11-06 17:12:08 +0000 | [diff] [blame] | 416 | .restart = mxc_restart, |
Luotao Fu | 3373169 | 2009-08-06 11:19:39 +0200 | [diff] [blame] | 417 | MACHINE_END |