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