2 * linux/arch/arm/mach-pxa/zylonite_pxa320.c
4 * PXA320 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>
20 #include <asm/arch/gpio.h>
21 #include <asm/arch/mfp-pxa320.h>
22 #include <asm/arch/zylonite.h>
26 static mfp_cfg_t mfp_cfg[] __initdata = {
54 GPIO41_UART1_RXD | MFP_LPM_EDGE_FALL,
58 GPIO45_UART1_DSR | MFP_LPM_EDGE_FALL,
65 GPIO35_AC97_SDATA_IN_0,
66 GPIO37_AC97_SDATA_OUT,
79 GPIO105_KP_DKIN_0 | MFP_LPM_EDGE_BOTH,
80 GPIO106_KP_DKIN_1 | MFP_LPM_EDGE_BOTH,
81 GPIO113_KP_MKIN_0 | MFP_LPM_EDGE_BOTH,
82 GPIO114_KP_MKIN_1 | MFP_LPM_EDGE_BOTH,
83 GPIO115_KP_MKIN_2 | MFP_LPM_EDGE_BOTH,
84 GPIO116_KP_MKIN_3 | MFP_LPM_EDGE_BOTH,
85 GPIO117_KP_MKIN_4 | MFP_LPM_EDGE_BOTH,
86 GPIO118_KP_MKIN_5 | MFP_LPM_EDGE_BOTH,
87 GPIO119_KP_MKIN_6 | MFP_LPM_EDGE_BOTH,
88 GPIO120_KP_MKIN_7 | MFP_LPM_EDGE_BOTH,
104 GPIO19_MMC1_DAT1 | MFP_LPM_EDGE_BOTH,
108 GPIO23_MMC1_CMD,/* CMD0 for slot 0 */
109 GPIO31_GPIO, /* CMD1 default as GPIO for slot 0 */
113 GPIO25_MMC2_DAT1 | MFP_LPM_EDGE_BOTH,
120 #define NUM_LCD_DETECT_PINS 7
122 static int lcd_detect_pins[] __initdata = {
123 MFP_PIN_GPIO72, /* LCD_LDD_17 - ORIENT */
124 MFP_PIN_GPIO71, /* LCD_LDD_16 - LCDID[5] */
125 MFP_PIN_GPIO17_2, /* LCD_BIAS - LCDID[4] */
126 MFP_PIN_GPIO15_2, /* LCD_LCLK - LCDID[3] */
127 MFP_PIN_GPIO14_2, /* LCD_FCLK - LCDID[2] */
128 MFP_PIN_GPIO73, /* LCD_CS_N - LCDID[1] */
129 MFP_PIN_GPIO74, /* LCD_VSYNC - LCDID[0] */
131 * set the MFP_PIN_GPIO 14/15/17 to alternate function other than
132 * GPIO to avoid input level confliction with 14_2, 15_2, 17_2
139 static int lcd_detect_mfpr[] __initdata = {
140 /* AF0, DS 1X, Pull Neither, Edge Clear */
141 0x8440, 0x8440, 0x8440, 0x8440, 0x8440, 0x8440, 0x8440,
142 0xc442, /* Backlight, Pull-Up, AF2 */
147 static void __init zylonite_detect_lcd_panel(void)
149 unsigned long mfpr_save[ARRAY_SIZE(lcd_detect_pins)];
152 /* save the original MFP settings of these pins and configure them
153 * as GPIO Input, DS01X, Pull Neither, Edge Clear
155 for (i = 0; i < ARRAY_SIZE(lcd_detect_pins); i++) {
156 mfpr_save[i] = pxa3xx_mfp_read(lcd_detect_pins[i]);
157 pxa3xx_mfp_write(lcd_detect_pins[i], lcd_detect_mfpr[i]);
160 for (i = 0; i < NUM_LCD_DETECT_PINS; i++) {
162 gpio = mfp_to_gpio(lcd_detect_pins[i]);
163 gpio_direction_input(gpio);
165 if (gpio_get_value(gpio))
169 /* lcd id, flush out bit 1 */
172 /* lcd orientation, portrait or landscape */
173 lcd_orientation = (id >> 6) & 0x1;
175 /* restore the original MFP settings */
176 for (i = 0; i < ARRAY_SIZE(lcd_detect_pins); i++)
177 pxa3xx_mfp_write(lcd_detect_pins[i], mfpr_save[i]);
180 void __init zylonite_pxa320_init(void)
182 if (cpu_is_pxa320()) {
184 pxa3xx_mfp_config(ARRAY_AND_SIZE(mfp_cfg));
186 /* detect LCD panel */
187 zylonite_detect_lcd_panel();
189 /* GPIO pin assignment */
190 gpio_backlight = mfp_to_gpio(MFP_PIN_GPIO14);
191 gpio_eth_irq = mfp_to_gpio(MFP_PIN_GPIO9);
193 /* MMC card detect & write protect for controller 0 */
194 zylonite_mmc_slot[0].gpio_cd = mfp_to_gpio(MFP_PIN_GPIO1);
195 zylonite_mmc_slot[0].gpio_wp = mfp_to_gpio(MFP_PIN_GPIO5);
198 wm9713_irq = mfp_to_gpio(MFP_PIN_GPIO15);