Tanmay Upadhyay | f16e05c | 2011-05-02 11:30:00 +0530 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-mmp/gplugd.c |
| 3 | * |
| 4 | * Support for the Marvell PXA168-based GuruPlug Display (gplugD) Platform. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * publishhed by the Free Software Foundation. |
| 9 | */ |
| 10 | |
| 11 | #include <linux/init.h> |
Haojian Zhuang | e71dc5f7 | 2013-03-15 16:27:53 +0800 | [diff] [blame] | 12 | #include <linux/platform_device.h> |
Linus Walleij | f55be1b | 2011-09-28 09:11:30 +0100 | [diff] [blame] | 13 | #include <linux/gpio.h> |
Haojian Zhuang | b8f649f | 2013-04-09 18:12:04 +0800 | [diff] [blame] | 14 | #include <linux/gpio-pxa.h> |
Tanmay Upadhyay | f16e05c | 2011-05-02 11:30:00 +0530 | [diff] [blame] | 15 | |
| 16 | #include <asm/mach/arch.h> |
| 17 | #include <asm/mach-types.h> |
| 18 | |
Arnd Bergmann | b501fd7 | 2014-04-15 20:38:32 +0200 | [diff] [blame] | 19 | #include "irqs.h" |
| 20 | #include "pxa168.h" |
| 21 | #include "mfp-pxa168.h" |
Tanmay Upadhyay | f16e05c | 2011-05-02 11:30:00 +0530 | [diff] [blame] | 22 | |
| 23 | #include "common.h" |
| 24 | |
| 25 | static unsigned long gplugd_pin_config[] __initdata = { |
| 26 | /* UART3 */ |
Tanmay Upadhyay | 3647a40 | 2011-07-14 15:07:15 +0530 | [diff] [blame] | 27 | GPIO8_UART3_TXD, |
| 28 | GPIO9_UART3_RXD, |
| 29 | GPIO1O_UART3_CTS, |
| 30 | GPIO11_UART3_RTS, |
| 31 | |
| 32 | /* USB OTG PEN */ |
| 33 | GPIO18_GPIO, |
Tanmay Upadhyay | f16e05c | 2011-05-02 11:30:00 +0530 | [diff] [blame] | 34 | |
| 35 | /* MMC2 */ |
| 36 | GPIO28_MMC2_CMD, |
| 37 | GPIO29_MMC2_CLK, |
| 38 | GPIO30_MMC2_DAT0, |
| 39 | GPIO31_MMC2_DAT1, |
| 40 | GPIO32_MMC2_DAT2, |
| 41 | GPIO33_MMC2_DAT3, |
| 42 | |
| 43 | /* LCD & HDMI clock selection GPIO: 0: 74.176MHz, 1: 74.25 MHz */ |
| 44 | GPIO35_GPIO, |
| 45 | GPIO36_GPIO, /* CEC Interrupt */ |
| 46 | |
| 47 | /* MMC1 */ |
| 48 | GPIO43_MMC1_CLK, |
| 49 | GPIO49_MMC1_CMD, |
| 50 | GPIO41_MMC1_DAT0, |
| 51 | GPIO40_MMC1_DAT1, |
| 52 | GPIO52_MMC1_DAT2, |
| 53 | GPIO51_MMC1_DAT3, |
| 54 | GPIO53_MMC1_CD, |
| 55 | |
| 56 | /* LCD */ |
| 57 | GPIO56_LCD_FCLK_RD, |
| 58 | GPIO57_LCD_LCLK_A0, |
| 59 | GPIO58_LCD_PCLK_WR, |
| 60 | GPIO59_LCD_DENA_BIAS, |
| 61 | GPIO60_LCD_DD0, |
| 62 | GPIO61_LCD_DD1, |
| 63 | GPIO62_LCD_DD2, |
| 64 | GPIO63_LCD_DD3, |
| 65 | GPIO64_LCD_DD4, |
| 66 | GPIO65_LCD_DD5, |
| 67 | GPIO66_LCD_DD6, |
| 68 | GPIO67_LCD_DD7, |
| 69 | GPIO68_LCD_DD8, |
| 70 | GPIO69_LCD_DD9, |
| 71 | GPIO70_LCD_DD10, |
| 72 | GPIO71_LCD_DD11, |
| 73 | GPIO72_LCD_DD12, |
| 74 | GPIO73_LCD_DD13, |
| 75 | GPIO74_LCD_DD14, |
| 76 | GPIO75_LCD_DD15, |
| 77 | GPIO76_LCD_DD16, |
| 78 | GPIO77_LCD_DD17, |
| 79 | GPIO78_LCD_DD18, |
| 80 | GPIO79_LCD_DD19, |
| 81 | GPIO80_LCD_DD20, |
| 82 | GPIO81_LCD_DD21, |
| 83 | GPIO82_LCD_DD22, |
| 84 | GPIO83_LCD_DD23, |
| 85 | |
| 86 | /* GPIO */ |
| 87 | GPIO84_GPIO, |
| 88 | GPIO85_GPIO, |
| 89 | |
| 90 | /* Fast-Ethernet*/ |
| 91 | GPIO86_TX_CLK, |
| 92 | GPIO87_TX_EN, |
| 93 | GPIO88_TX_DQ3, |
| 94 | GPIO89_TX_DQ2, |
| 95 | GPIO90_TX_DQ1, |
| 96 | GPIO91_TX_DQ0, |
| 97 | GPIO92_MII_CRS, |
| 98 | GPIO93_MII_COL, |
| 99 | GPIO94_RX_CLK, |
| 100 | GPIO95_RX_ER, |
| 101 | GPIO96_RX_DQ3, |
| 102 | GPIO97_RX_DQ2, |
| 103 | GPIO98_RX_DQ1, |
| 104 | GPIO99_RX_DQ0, |
| 105 | GPIO100_MII_MDC, |
| 106 | GPIO101_MII_MDIO, |
| 107 | GPIO103_RX_DV, |
| 108 | GPIO104_GPIO, /* Reset PHY */ |
| 109 | |
| 110 | /* RTC interrupt */ |
| 111 | GPIO102_GPIO, |
| 112 | |
| 113 | /* I2C */ |
| 114 | GPIO105_CI2C_SDA, |
| 115 | GPIO106_CI2C_SCL, |
| 116 | |
Tanmay Upadhyay | 3647a40 | 2011-07-14 15:07:15 +0530 | [diff] [blame] | 117 | /* SPI NOR Flash on SSP2 */ |
| 118 | GPIO107_SSP2_RXD, |
| 119 | GPIO108_SSP2_TXD, |
| 120 | GPIO110_GPIO, /* SPI_CSn */ |
| 121 | GPIO111_SSP2_CLK, |
| 122 | |
Tanmay Upadhyay | f16e05c | 2011-05-02 11:30:00 +0530 | [diff] [blame] | 123 | /* Select JTAG */ |
| 124 | GPIO109_GPIO, |
| 125 | |
| 126 | /* I2S */ |
| 127 | GPIO114_I2S_FRM, |
| 128 | GPIO115_I2S_BCLK, |
| 129 | GPIO116_I2S_TXD |
| 130 | }; |
| 131 | |
Haojian Zhuang | b8f649f | 2013-04-09 18:12:04 +0800 | [diff] [blame] | 132 | static struct pxa_gpio_platform_data pxa168_gpio_pdata = { |
| 133 | .irq_base = MMP_GPIO_TO_IRQ(0), |
| 134 | }; |
| 135 | |
Tanmay Upadhyay | f16e05c | 2011-05-02 11:30:00 +0530 | [diff] [blame] | 136 | static struct i2c_board_info gplugd_i2c_board_info[] = { |
| 137 | { |
| 138 | .type = "isl1208", |
| 139 | .addr = 0x6F, |
| 140 | } |
| 141 | }; |
| 142 | |
| 143 | /* Bring PHY out of reset by setting GPIO 104 */ |
| 144 | static int gplugd_eth_init(void) |
| 145 | { |
| 146 | if (unlikely(gpio_request(104, "ETH_RESET_N"))) { |
| 147 | printk(KERN_ERR "Can't get hold of GPIO 104 to bring Ethernet " |
| 148 | "PHY out of reset\n"); |
| 149 | return -EIO; |
| 150 | } |
| 151 | |
| 152 | gpio_direction_output(104, 1); |
| 153 | gpio_free(104); |
| 154 | return 0; |
| 155 | } |
| 156 | |
| 157 | struct pxa168_eth_platform_data gplugd_eth_platform_data = { |
| 158 | .port_number = 0, |
| 159 | .phy_addr = 0, |
| 160 | .speed = 0, /* Autonagotiation */ |
Sebastian Hesselbarth | e7de17a | 2014-10-22 20:26:45 +0200 | [diff] [blame] | 161 | .intf = PHY_INTERFACE_MODE_RMII, |
Tanmay Upadhyay | f16e05c | 2011-05-02 11:30:00 +0530 | [diff] [blame] | 162 | .init = gplugd_eth_init, |
| 163 | }; |
| 164 | |
| 165 | static void __init select_disp_freq(void) |
| 166 | { |
| 167 | /* set GPIO 35 & clear GPIO 85 to set LCD External Clock to 74.25 MHz */ |
| 168 | if (unlikely(gpio_request(35, "DISP_FREQ_SEL"))) { |
| 169 | printk(KERN_ERR "Can't get hold of GPIO 35 to select display " |
| 170 | "frequency\n"); |
| 171 | } else { |
| 172 | gpio_direction_output(35, 1); |
Tanmay Upadhyay | 4c22ea8 | 2011-07-14 15:07:16 +0530 | [diff] [blame] | 173 | gpio_free(35); |
Tanmay Upadhyay | f16e05c | 2011-05-02 11:30:00 +0530 | [diff] [blame] | 174 | } |
| 175 | |
| 176 | if (unlikely(gpio_request(85, "DISP_FREQ_SEL_2"))) { |
| 177 | printk(KERN_ERR "Can't get hold of GPIO 85 to select display " |
| 178 | "frequency\n"); |
| 179 | } else { |
| 180 | gpio_direction_output(85, 0); |
Tanmay Upadhyay | 4c22ea8 | 2011-07-14 15:07:16 +0530 | [diff] [blame] | 181 | gpio_free(85); |
Tanmay Upadhyay | f16e05c | 2011-05-02 11:30:00 +0530 | [diff] [blame] | 182 | } |
| 183 | } |
| 184 | |
| 185 | static void __init gplugd_init(void) |
| 186 | { |
| 187 | mfp_config(ARRAY_AND_SIZE(gplugd_pin_config)); |
| 188 | |
| 189 | select_disp_freq(); |
| 190 | |
| 191 | /* on-chip devices */ |
| 192 | pxa168_add_uart(3); |
Eric Miao | e4b3bbe | 2011-11-11 20:11:14 +0800 | [diff] [blame] | 193 | pxa168_add_ssp(1); |
Tanmay Upadhyay | f16e05c | 2011-05-02 11:30:00 +0530 | [diff] [blame] | 194 | pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(gplugd_i2c_board_info)); |
Haojian Zhuang | b8f649f | 2013-04-09 18:12:04 +0800 | [diff] [blame] | 195 | platform_device_add_data(&pxa168_device_gpio, &pxa168_gpio_pdata, |
| 196 | sizeof(struct pxa_gpio_platform_data)); |
Haojian Zhuang | 157d264 | 2011-10-17 20:37:52 +0800 | [diff] [blame] | 197 | platform_device_register(&pxa168_device_gpio); |
Tanmay Upadhyay | f16e05c | 2011-05-02 11:30:00 +0530 | [diff] [blame] | 198 | |
| 199 | pxa168_add_eth(&gplugd_eth_platform_data); |
| 200 | } |
| 201 | |
Eric Miao | c149f6c | 2011-08-16 12:28:57 +0800 | [diff] [blame] | 202 | MACHINE_START(GPLUGD, "PXA168-based GuruPlug Display (gplugD) Platform") |
Tanmay Upadhyay | f16e05c | 2011-05-02 11:30:00 +0530 | [diff] [blame] | 203 | .map_io = mmp_map_io, |
Rob Herring | 8661fb9 | 2012-01-03 16:50:40 -0600 | [diff] [blame] | 204 | .nr_irqs = MMP_NR_IRQS, |
Tanmay Upadhyay | f16e05c | 2011-05-02 11:30:00 +0530 | [diff] [blame] | 205 | .init_irq = pxa168_init_irq, |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 206 | .init_time = pxa168_timer_init, |
Tanmay Upadhyay | f16e05c | 2011-05-02 11:30:00 +0530 | [diff] [blame] | 207 | .init_machine = gplugd_init, |
Russell King | 9854a38 | 2011-11-05 15:40:09 +0000 | [diff] [blame] | 208 | .restart = pxa168_restart, |
Tanmay Upadhyay | f16e05c | 2011-05-02 11:30:00 +0530 | [diff] [blame] | 209 | MACHINE_END |