2 * linux/arch/arm/mach-pxa/zylonite_pxa300.c
4 * PXA300/PXA310 specific support code for the
5 * PXA3xx Development Platform (aka Zylonite)
7 * Copyright (C) 2007 Marvell Internation Ltd.
8 * 2007-08-21: eric miao <eric.miao@marvell.com>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
16 #include <linux/module.h>
17 #include <linux/kernel.h>
18 #include <linux/init.h>
19 #include <linux/i2c.h>
20 #include <linux/i2c/pca953x.h>
21 #include <linux/gpio.h>
23 #include <mach/pxa300.h>
25 #include <mach/zylonite.h>
29 /* PXA300/PXA310 common configurations */
30 static mfp_cfg_t common_mfp_cfg
[] __initdata
= {
56 GPIO20_PWM3_OUT
, /* backlight */
60 GPIO112_UART2_RXD
| MFP_LPM_EDGE_FALL
,
62 GPIO114_UART2_CTS
| MFP_LPM_EDGE_BOTH
,
66 GPIO110_UART3_RXD
| MFP_LPM_EDGE_FALL
,
72 GPIO25_AC97_SDATA_IN_0
,
73 GPIO27_AC97_SDATA_OUT
,
75 GPIO17_GPIO
, /* SDATA_IN_1 but unused - configure to GPIO */
87 GPIO107_KP_DKIN_0
| MFP_LPM_EDGE_BOTH
,
88 GPIO108_KP_DKIN_1
| MFP_LPM_EDGE_BOTH
,
89 GPIO115_KP_MKIN_0
| MFP_LPM_EDGE_BOTH
,
90 GPIO116_KP_MKIN_1
| MFP_LPM_EDGE_BOTH
,
91 GPIO117_KP_MKIN_2
| MFP_LPM_EDGE_BOTH
,
92 GPIO118_KP_MKIN_3
| MFP_LPM_EDGE_BOTH
,
93 GPIO119_KP_MKIN_4
| MFP_LPM_EDGE_BOTH
,
94 GPIO120_KP_MKIN_5
| MFP_LPM_EDGE_BOTH
,
95 GPIO2_2_KP_MKIN_6
| MFP_LPM_EDGE_BOTH
,
96 GPIO3_2_KP_MKIN_7
| MFP_LPM_EDGE_BOTH
,
108 GPIO4_MMC1_DAT1
| MFP_LPM_EDGE_BOTH
,
112 GPIO8_MMC1_CMD
, /* CMD0 for slot 0 */
113 GPIO15_GPIO
, /* CMD1 default as GPIO for slot 0 */
117 GPIO10_MMC2_DAT1
| MFP_LPM_EDGE_BOTH
,
132 GPIO18_GPIO
| MFP_PULL_HIGH
, /* GPIO Expander #0 INT_N */
133 GPIO19_GPIO
| MFP_PULL_HIGH
, /* GPIO Expander #1 INT_N */
136 static mfp_cfg_t pxa300_mfp_cfg
[] __initdata
= {
138 GPIO30_UART1_RXD
| MFP_LPM_EDGE_FALL
,
143 GPIO34_UART1_DSR
| MFP_LPM_EDGE_FALL
,
152 static mfp_cfg_t pxa310_mfp_cfg
[] __initdata
= {
154 GPIO99_UART1_RXD
| MFP_LPM_EDGE_FALL
,
165 GPIO8_2_MMC3_DAT1
| MFP_LPM_EDGE_BOTH
,
172 #define NUM_LCD_DETECT_PINS 7
174 static int lcd_detect_pins
[] __initdata
= {
175 MFP_PIN_GPIO71
, /* LCD_LDD_17 - ORIENT */
176 MFP_PIN_GPIO70
, /* LCD_LDD_16 - LCDID[5] */
177 MFP_PIN_GPIO75
, /* LCD_BIAS - LCDID[4] */
178 MFP_PIN_GPIO73
, /* LCD_LCLK - LCDID[3] */
179 MFP_PIN_GPIO72
, /* LCD_FCLK - LCDID[2] */
180 MFP_PIN_GPIO127
,/* LCD_CS_N - LCDID[1] */
181 MFP_PIN_GPIO76
, /* LCD_VSYNC - LCDID[0] */
184 static void __init
zylonite_detect_lcd_panel(void)
186 unsigned long mfpr_save
[NUM_LCD_DETECT_PINS
];
189 /* save the original MFP settings of these pins and configure
190 * them as GPIO Input, DS01X, Pull Neither, Edge Clear
192 for (i
= 0; i
< NUM_LCD_DETECT_PINS
; i
++) {
193 mfpr_save
[i
] = pxa3xx_mfp_read(lcd_detect_pins
[i
]);
194 pxa3xx_mfp_write(lcd_detect_pins
[i
], 0x8440);
197 for (i
= 0; i
< NUM_LCD_DETECT_PINS
; i
++) {
199 gpio
= mfp_to_gpio(lcd_detect_pins
[i
]);
200 gpio_request(gpio
, "LCD_ID_PINS");
201 gpio_direction_input(gpio
);
203 if (gpio_get_value(gpio
))
208 /* lcd id, flush out bit 1 */
211 /* lcd orientation, portrait or landscape */
212 lcd_orientation
= (id
>> 6) & 0x1;
214 /* restore the original MFP settings */
215 for (i
= 0; i
< NUM_LCD_DETECT_PINS
; i
++)
216 pxa3xx_mfp_write(lcd_detect_pins
[i
], mfpr_save
[i
]);
219 #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
220 static struct pca953x_platform_data gpio_exp
[] = {
229 static struct i2c_board_info zylonite_i2c_board_info
[] = {
233 .platform_data
= &gpio_exp
[0],
238 .platform_data
= &gpio_exp
[1],
243 static void __init
zylonite_init_i2c(void)
245 pxa_set_i2c_info(NULL
);
246 i2c_register_board_info(0, ARRAY_AND_SIZE(zylonite_i2c_board_info
));
249 static inline void zylonite_init_i2c(void) {}
252 void __init
zylonite_pxa300_init(void)
254 if (cpu_is_pxa300() || cpu_is_pxa310()) {
256 pxa3xx_mfp_config(ARRAY_AND_SIZE(common_mfp_cfg
));
258 /* detect LCD panel */
259 zylonite_detect_lcd_panel();
262 wm9713_irq
= mfp_to_gpio(MFP_PIN_GPIO26
);
267 if (cpu_is_pxa300()) {
268 pxa3xx_mfp_config(ARRAY_AND_SIZE(pxa300_mfp_cfg
));
269 gpio_eth_irq
= mfp_to_gpio(MFP_PIN_GPIO99
);
272 if (cpu_is_pxa310()) {
273 pxa3xx_mfp_config(ARRAY_AND_SIZE(pxa310_mfp_cfg
));
274 gpio_eth_irq
= mfp_to_gpio(MFP_PIN_GPIO102
);
277 /* GPIOs for Debug LEDs */
278 gpio_debug_led1
= EXT_GPIO(25);
279 gpio_debug_led2
= EXT_GPIO(26);