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>
24 #define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x)
26 static mfp_cfg_t mfp_cfg[] __initdata = {
65 GPIO35_AC97_SDATA_IN_0,
66 GPIO37_AC97_SDATA_OUT,
100 #define NUM_LCD_DETECT_PINS 7
102 static int lcd_detect_pins[] __initdata = {
103 MFP_PIN_GPIO72, /* LCD_LDD_17 - ORIENT */
104 MFP_PIN_GPIO71, /* LCD_LDD_16 - LCDID[5] */
105 MFP_PIN_GPIO17_2, /* LCD_BIAS - LCDID[4] */
106 MFP_PIN_GPIO15_2, /* LCD_LCLK - LCDID[3] */
107 MFP_PIN_GPIO14_2, /* LCD_FCLK - LCDID[2] */
108 MFP_PIN_GPIO73, /* LCD_CS_N - LCDID[1] */
109 MFP_PIN_GPIO74, /* LCD_VSYNC - LCDID[0] */
111 * set the MFP_PIN_GPIO 14/15/17 to alternate function other than
112 * GPIO to avoid input level confliction with 14_2, 15_2, 17_2
119 static int lcd_detect_mfpr[] __initdata = {
120 /* AF0, DS 1X, Pull Neither, Edge Clear */
121 0x8440, 0x8440, 0x8440, 0x8440, 0x8440, 0x8440, 0x8440,
122 0xc442, /* Backlight, Pull-Up, AF2 */
127 static void __init zylonite_detect_lcd_panel(void)
129 unsigned long mfpr_save[ARRAY_SIZE(lcd_detect_pins)];
132 /* save the original MFP settings of these pins and configure them
133 * as GPIO Input, DS01X, Pull Neither, Edge Clear
135 for (i = 0; i < ARRAY_SIZE(lcd_detect_pins); i++) {
136 mfpr_save[i] = pxa3xx_mfp_read(lcd_detect_pins[i]);
137 pxa3xx_mfp_write(lcd_detect_pins[i], lcd_detect_mfpr[i]);
140 for (i = 0; i < NUM_LCD_DETECT_PINS; i++) {
142 gpio = mfp_to_gpio(lcd_detect_pins[i]);
143 gpio_direction_input(gpio);
145 if (gpio_get_value(gpio))
149 /* lcd id, flush out bit 1 */
152 /* lcd orientation, portrait or landscape */
153 lcd_orientation = (id >> 6) & 0x1;
155 /* restore the original MFP settings */
156 for (i = 0; i < ARRAY_SIZE(lcd_detect_pins); i++)
157 pxa3xx_mfp_write(lcd_detect_pins[i], mfpr_save[i]);
160 void __init zylonite_pxa320_init(void)
162 if (cpu_is_pxa320()) {
164 pxa3xx_mfp_config(ARRAY_AND_SIZE(mfp_cfg));
166 /* detect LCD panel */
167 zylonite_detect_lcd_panel();
169 /* GPIO pin assignment */
170 gpio_backlight = mfp_to_gpio(MFP_PIN_GPIO14);
171 gpio_eth_irq = mfp_to_gpio(MFP_PIN_GPIO9);