ARM: 7103/1: plat-pxa: move PXA GPIO driver to GPIO subsystem
[deliverable/linux.git] / arch / arm / mach-mmp / gplugd.c
CommitLineData
f16e05c7
TU
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>
12
13#include <asm/mach/arch.h>
14#include <asm/mach-types.h>
15
16#include <mach/gpio.h>
17#include <mach/pxa168.h>
18#include <mach/mfp-pxa168.h>
19#include <mach/mfp-gplugd.h>
20
21#include "common.h"
22
23static unsigned long gplugd_pin_config[] __initdata = {
24 /* UART3 */
25 GPIO8_UART3_SOUT,
26 GPIO9_UART3_SIN,
27 GPI1O_UART3_CTS,
28 GPI11_UART3_RTS,
29
30 /* MMC2 */
31 GPIO28_MMC2_CMD,
32 GPIO29_MMC2_CLK,
33 GPIO30_MMC2_DAT0,
34 GPIO31_MMC2_DAT1,
35 GPIO32_MMC2_DAT2,
36 GPIO33_MMC2_DAT3,
37
38 /* LCD & HDMI clock selection GPIO: 0: 74.176MHz, 1: 74.25 MHz */
39 GPIO35_GPIO,
40 GPIO36_GPIO, /* CEC Interrupt */
41
42 /* MMC1 */
43 GPIO43_MMC1_CLK,
44 GPIO49_MMC1_CMD,
45 GPIO41_MMC1_DAT0,
46 GPIO40_MMC1_DAT1,
47 GPIO52_MMC1_DAT2,
48 GPIO51_MMC1_DAT3,
49 GPIO53_MMC1_CD,
50
51 /* LCD */
52 GPIO56_LCD_FCLK_RD,
53 GPIO57_LCD_LCLK_A0,
54 GPIO58_LCD_PCLK_WR,
55 GPIO59_LCD_DENA_BIAS,
56 GPIO60_LCD_DD0,
57 GPIO61_LCD_DD1,
58 GPIO62_LCD_DD2,
59 GPIO63_LCD_DD3,
60 GPIO64_LCD_DD4,
61 GPIO65_LCD_DD5,
62 GPIO66_LCD_DD6,
63 GPIO67_LCD_DD7,
64 GPIO68_LCD_DD8,
65 GPIO69_LCD_DD9,
66 GPIO70_LCD_DD10,
67 GPIO71_LCD_DD11,
68 GPIO72_LCD_DD12,
69 GPIO73_LCD_DD13,
70 GPIO74_LCD_DD14,
71 GPIO75_LCD_DD15,
72 GPIO76_LCD_DD16,
73 GPIO77_LCD_DD17,
74 GPIO78_LCD_DD18,
75 GPIO79_LCD_DD19,
76 GPIO80_LCD_DD20,
77 GPIO81_LCD_DD21,
78 GPIO82_LCD_DD22,
79 GPIO83_LCD_DD23,
80
81 /* GPIO */
82 GPIO84_GPIO,
83 GPIO85_GPIO,
84
85 /* Fast-Ethernet*/
86 GPIO86_TX_CLK,
87 GPIO87_TX_EN,
88 GPIO88_TX_DQ3,
89 GPIO89_TX_DQ2,
90 GPIO90_TX_DQ1,
91 GPIO91_TX_DQ0,
92 GPIO92_MII_CRS,
93 GPIO93_MII_COL,
94 GPIO94_RX_CLK,
95 GPIO95_RX_ER,
96 GPIO96_RX_DQ3,
97 GPIO97_RX_DQ2,
98 GPIO98_RX_DQ1,
99 GPIO99_RX_DQ0,
100 GPIO100_MII_MDC,
101 GPIO101_MII_MDIO,
102 GPIO103_RX_DV,
103 GPIO104_GPIO, /* Reset PHY */
104
105 /* RTC interrupt */
106 GPIO102_GPIO,
107
108 /* I2C */
109 GPIO105_CI2C_SDA,
110 GPIO106_CI2C_SCL,
111
112 /* Select JTAG */
113 GPIO109_GPIO,
114
115 /* I2S */
116 GPIO114_I2S_FRM,
117 GPIO115_I2S_BCLK,
118 GPIO116_I2S_TXD
119};
120
121static struct i2c_board_info gplugd_i2c_board_info[] = {
122 {
123 .type = "isl1208",
124 .addr = 0x6F,
125 }
126};
127
128/* Bring PHY out of reset by setting GPIO 104 */
129static int gplugd_eth_init(void)
130{
131 if (unlikely(gpio_request(104, "ETH_RESET_N"))) {
132 printk(KERN_ERR "Can't get hold of GPIO 104 to bring Ethernet "
133 "PHY out of reset\n");
134 return -EIO;
135 }
136
137 gpio_direction_output(104, 1);
138 gpio_free(104);
139 return 0;
140}
141
142struct pxa168_eth_platform_data gplugd_eth_platform_data = {
143 .port_number = 0,
144 .phy_addr = 0,
145 .speed = 0, /* Autonagotiation */
146 .init = gplugd_eth_init,
147};
148
149static void __init select_disp_freq(void)
150{
151 /* set GPIO 35 & clear GPIO 85 to set LCD External Clock to 74.25 MHz */
152 if (unlikely(gpio_request(35, "DISP_FREQ_SEL"))) {
153 printk(KERN_ERR "Can't get hold of GPIO 35 to select display "
154 "frequency\n");
155 } else {
156 gpio_direction_output(35, 1);
157 gpio_free(104);
158 }
159
160 if (unlikely(gpio_request(85, "DISP_FREQ_SEL_2"))) {
161 printk(KERN_ERR "Can't get hold of GPIO 85 to select display "
162 "frequency\n");
163 } else {
164 gpio_direction_output(85, 0);
165 gpio_free(104);
166 }
167}
168
169static void __init gplugd_init(void)
170{
171 mfp_config(ARRAY_AND_SIZE(gplugd_pin_config));
172
173 select_disp_freq();
174
175 /* on-chip devices */
176 pxa168_add_uart(3);
177 pxa168_add_ssp(0);
178 pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(gplugd_i2c_board_info));
179
180 pxa168_add_eth(&gplugd_eth_platform_data);
181}
182
183MACHINE_START(SHEEVAD, "PXA168-based GuruPlug Display (gplugD) Platform")
184 .map_io = mmp_map_io,
185 .nr_irqs = IRQ_BOARD_START,
186 .init_irq = pxa168_init_irq,
187 .timer = &pxa168_timer,
188 .init_machine = gplugd_init,
189MACHINE_END
This page took 0.03812 seconds and 5 git commands to generate.