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>
21 #include <asm/arch/mfp-pxa300.h>
22 #include <asm/arch/zylonite.h>
24 #define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x)
26 /* PXA300/PXA310 common configurations */
27 static mfp_cfg_t common_mfp_cfg[] __initdata = {
56 GPIO112_UART2_RXD | MFP_LPM_EDGE_FALL,
58 GPIO114_UART2_CTS | MFP_LPM_EDGE_BOTH,
62 GPIO110_UART3_RXD | MFP_LPM_EDGE_FALL,
68 GPIO25_AC97_SDATA_IN_0,
69 GPIO27_AC97_SDATA_OUT,
73 GPIO107_KP_DKIN_0 | MFP_LPM_EDGE_BOTH,
74 GPIO108_KP_DKIN_1 | MFP_LPM_EDGE_BOTH,
75 GPIO115_KP_MKIN_0 | MFP_LPM_EDGE_BOTH,
76 GPIO116_KP_MKIN_1 | MFP_LPM_EDGE_BOTH,
77 GPIO117_KP_MKIN_2 | MFP_LPM_EDGE_BOTH,
78 GPIO118_KP_MKIN_3 | MFP_LPM_EDGE_BOTH,
79 GPIO119_KP_MKIN_4 | MFP_LPM_EDGE_BOTH,
80 GPIO120_KP_MKIN_5 | MFP_LPM_EDGE_BOTH,
81 GPIO2_2_KP_MKIN_6 | MFP_LPM_EDGE_BOTH,
82 GPIO3_2_KP_MKIN_7 | MFP_LPM_EDGE_BOTH,
94 GPIO4_MMC1_DAT1 | MFP_LPM_EDGE_BOTH,
98 GPIO8_MMC1_CMD, /* CMD0 for slot 0 */
99 GPIO15_GPIO, /* CMD1 default as GPIO for slot 0 */
103 GPIO10_MMC2_DAT1 | MFP_LPM_EDGE_BOTH,
110 static mfp_cfg_t pxa300_mfp_cfg[] __initdata = {
112 GPIO30_UART1_RXD | MFP_LPM_EDGE_FALL,
117 GPIO34_UART1_DSR | MFP_LPM_EDGE_FALL,
126 static mfp_cfg_t pxa310_mfp_cfg[] __initdata = {
128 GPIO99_UART1_RXD | MFP_LPM_EDGE_FALL,
139 GPIO8_2_MMC3_DAT1 | MFP_LPM_EDGE_BOTH,
146 #define NUM_LCD_DETECT_PINS 7
148 static int lcd_detect_pins[] __initdata = {
149 MFP_PIN_GPIO71, /* LCD_LDD_17 - ORIENT */
150 MFP_PIN_GPIO70, /* LCD_LDD_16 - LCDID[5] */
151 MFP_PIN_GPIO75, /* LCD_BIAS - LCDID[4] */
152 MFP_PIN_GPIO73, /* LCD_LCLK - LCDID[3] */
153 MFP_PIN_GPIO72, /* LCD_FCLK - LCDID[2] */
154 MFP_PIN_GPIO127,/* LCD_CS_N - LCDID[1] */
155 MFP_PIN_GPIO76, /* LCD_VSYNC - LCDID[0] */
158 static void __init zylonite_detect_lcd_panel(void)
160 unsigned long mfpr_save[NUM_LCD_DETECT_PINS];
163 /* save the original MFP settings of these pins and configure
164 * them as GPIO Input, DS01X, Pull Neither, Edge Clear
166 for (i = 0; i < NUM_LCD_DETECT_PINS; i++) {
167 mfpr_save[i] = pxa3xx_mfp_read(lcd_detect_pins[i]);
168 pxa3xx_mfp_write(lcd_detect_pins[i], 0x8440);
171 for (i = 0; i < NUM_LCD_DETECT_PINS; i++) {
173 gpio = mfp_to_gpio(lcd_detect_pins[i]);
174 gpio_direction_input(gpio);
176 if (gpio_get_value(gpio))
180 /* lcd id, flush out bit 1 */
183 /* lcd orientation, portrait or landscape */
184 lcd_orientation = (id >> 6) & 0x1;
186 /* restore the original MFP settings */
187 for (i = 0; i < NUM_LCD_DETECT_PINS; i++)
188 pxa3xx_mfp_write(lcd_detect_pins[i], mfpr_save[i]);
191 void __init zylonite_pxa300_init(void)
193 if (cpu_is_pxa300() || cpu_is_pxa310()) {
195 pxa3xx_mfp_config(ARRAY_AND_SIZE(common_mfp_cfg));
197 /* detect LCD panel */
198 zylonite_detect_lcd_panel();
200 /* GPIO pin assignment */
201 gpio_backlight = mfp_to_gpio(MFP_PIN_GPIO20);
203 /* MMC card detect & write protect for controller 0 */
204 zylonite_mmc_slot[0].gpio_cd = EXT_GPIO(0);
205 zylonite_mmc_slot[0].gpio_wp = EXT_GPIO(2);
208 if (cpu_is_pxa300()) {
209 pxa3xx_mfp_config(ARRAY_AND_SIZE(pxa300_mfp_cfg));
210 gpio_eth_irq = mfp_to_gpio(MFP_PIN_GPIO99);
213 if (cpu_is_pxa310()) {
214 pxa3xx_mfp_config(ARRAY_AND_SIZE(pxa310_mfp_cfg));
215 gpio_eth_irq = mfp_to_gpio(MFP_PIN_GPIO102);
217 /* MMC card detect & write protect for controller 2 */
218 zylonite_mmc_slot[2].gpio_cd = EXT_GPIO(30);
219 zylonite_mmc_slot[2].gpio_wp = EXT_GPIO(31);