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 = {
68 GPIO25_AC97_SDATA_IN_0,
69 GPIO27_AC97_SDATA_OUT,
93 static mfp_cfg_t pxa300_mfp_cfg[] __initdata = {
109 static mfp_cfg_t pxa310_mfp_cfg[] __initdata = {
121 #define NUM_LCD_DETECT_PINS 7
123 static int lcd_detect_pins[] __initdata = {
124 MFP_PIN_GPIO71, /* LCD_LDD_17 - ORIENT */
125 MFP_PIN_GPIO70, /* LCD_LDD_16 - LCDID[5] */
126 MFP_PIN_GPIO75, /* LCD_BIAS - LCDID[4] */
127 MFP_PIN_GPIO73, /* LCD_LCLK - LCDID[3] */
128 MFP_PIN_GPIO72, /* LCD_FCLK - LCDID[2] */
129 MFP_PIN_GPIO127,/* LCD_CS_N - LCDID[1] */
130 MFP_PIN_GPIO76, /* LCD_VSYNC - LCDID[0] */
133 static void __init zylonite_detect_lcd_panel(void)
135 unsigned long mfpr_save[NUM_LCD_DETECT_PINS];
138 /* save the original MFP settings of these pins and configure
139 * them as GPIO Input, DS01X, Pull Neither, Edge Clear
141 for (i = 0; i < NUM_LCD_DETECT_PINS; i++) {
142 mfpr_save[i] = pxa3xx_mfp_read(lcd_detect_pins[i]);
143 pxa3xx_mfp_write(lcd_detect_pins[i], 0x8440);
146 for (i = 0; i < NUM_LCD_DETECT_PINS; i++) {
148 gpio = mfp_to_gpio(lcd_detect_pins[i]);
149 gpio_direction_input(gpio);
151 if (gpio_get_value(gpio))
155 /* lcd id, flush out bit 1 */
158 /* lcd orientation, portrait or landscape */
159 lcd_orientation = (id >> 6) & 0x1;
161 /* restore the original MFP settings */
162 for (i = 0; i < NUM_LCD_DETECT_PINS; i++)
163 pxa3xx_mfp_write(lcd_detect_pins[i], mfpr_save[i]);
166 void __init zylonite_pxa300_init(void)
168 if (cpu_is_pxa300() || cpu_is_pxa310()) {
170 pxa3xx_mfp_config(ARRAY_AND_SIZE(common_mfp_cfg));
172 /* detect LCD panel */
173 zylonite_detect_lcd_panel();
175 /* GPIO pin assignment */
176 gpio_backlight = mfp_to_gpio(MFP_PIN_GPIO20);
179 if (cpu_is_pxa300()) {
180 pxa3xx_mfp_config(ARRAY_AND_SIZE(pxa300_mfp_cfg));
181 gpio_eth_irq = mfp_to_gpio(MFP_PIN_GPIO99);
184 if (cpu_is_pxa310()) {
185 pxa3xx_mfp_config(ARRAY_AND_SIZE(pxa310_mfp_cfg));
186 gpio_eth_irq = mfp_to_gpio(MFP_PIN_GPIO102);