1 // SPDX-License-Identifier: GPL-2.0-only
3 * linux/arch/arm/mach-pxa/zylonite_pxa320.c
5 * PXA320 specific support code for the
6 * PXA3xx Development Platform (aka Zylonite)
8 * Copyright (C) 2007 Marvell Internation Ltd.
9 * 2007-08-21: eric miao <eric.miao@marvell.com>
13 #include <linux/module.h>
14 #include <linux/kernel.h>
15 #include <linux/init.h>
16 #include <linux/gpio.h>
23 static mfp_cfg_t mfp_cfg
[] __initdata
= {
49 GPIO14_PWM3_OUT
, /* backlight */
52 GPIO41_UART1_RXD
| MFP_LPM_EDGE_FALL
,
56 GPIO45_UART1_DSR
| MFP_LPM_EDGE_FALL
,
63 GPIO35_AC97_SDATA_IN_0
,
64 GPIO37_AC97_SDATA_OUT
,
68 GPIO36_GPIO
, /* SDATA_IN_1 but unused - configure to GPIO */
84 GPIO105_KP_DKIN_0
| MFP_LPM_EDGE_BOTH
,
85 GPIO106_KP_DKIN_1
| MFP_LPM_EDGE_BOTH
,
86 GPIO113_KP_MKIN_0
| MFP_LPM_EDGE_BOTH
,
87 GPIO114_KP_MKIN_1
| MFP_LPM_EDGE_BOTH
,
88 GPIO115_KP_MKIN_2
| MFP_LPM_EDGE_BOTH
,
89 GPIO116_KP_MKIN_3
| MFP_LPM_EDGE_BOTH
,
90 GPIO117_KP_MKIN_4
| MFP_LPM_EDGE_BOTH
,
91 GPIO118_KP_MKIN_5
| MFP_LPM_EDGE_BOTH
,
92 GPIO119_KP_MKIN_6
| MFP_LPM_EDGE_BOTH
,
93 GPIO120_KP_MKIN_7
| MFP_LPM_EDGE_BOTH
,
109 GPIO19_MMC1_DAT1
| MFP_LPM_EDGE_BOTH
,
113 GPIO23_MMC1_CMD
,/* CMD0 for slot 0 */
114 GPIO31_GPIO
, /* CMD1 default as GPIO for slot 0 */
118 GPIO25_MMC2_DAT1
| MFP_LPM_EDGE_BOTH
,
129 GPIO1_2_GPIO
| MFP_LPM_DRIVE_HIGH
,
130 GPIO4_2_GPIO
| MFP_LPM_DRIVE_HIGH
,
133 #define NUM_LCD_DETECT_PINS 7
135 static int lcd_detect_pins
[] __initdata
= {
136 MFP_PIN_GPIO72
, /* LCD_LDD_17 - ORIENT */
137 MFP_PIN_GPIO71
, /* LCD_LDD_16 - LCDID[5] */
138 MFP_PIN_GPIO17_2
, /* LCD_BIAS - LCDID[4] */
139 MFP_PIN_GPIO15_2
, /* LCD_LCLK - LCDID[3] */
140 MFP_PIN_GPIO14_2
, /* LCD_FCLK - LCDID[2] */
141 MFP_PIN_GPIO73
, /* LCD_CS_N - LCDID[1] */
142 MFP_PIN_GPIO74
, /* LCD_VSYNC - LCDID[0] */
144 * set the MFP_PIN_GPIO 14/15/17 to alternate function other than
145 * GPIO to avoid input level confliction with 14_2, 15_2, 17_2
152 static int lcd_detect_mfpr
[] __initdata
= {
153 /* AF0, DS 1X, Pull Neither, Edge Clear */
154 0x8440, 0x8440, 0x8440, 0x8440, 0x8440, 0x8440, 0x8440,
155 0xc442, /* Backlight, Pull-Up, AF2 */
160 static void __init
zylonite_detect_lcd_panel(void)
162 unsigned long mfpr_save
[ARRAY_SIZE(lcd_detect_pins
)];
165 /* save the original MFP settings of these pins and configure them
166 * as GPIO Input, DS01X, Pull Neither, Edge Clear
168 for (i
= 0; i
< ARRAY_SIZE(lcd_detect_pins
); i
++) {
169 mfpr_save
[i
] = pxa3xx_mfp_read(lcd_detect_pins
[i
]);
170 pxa3xx_mfp_write(lcd_detect_pins
[i
], lcd_detect_mfpr
[i
]);
173 for (i
= 0; i
< NUM_LCD_DETECT_PINS
; i
++) {
175 gpio
= mfp_to_gpio(lcd_detect_pins
[i
]);
176 gpio_request(gpio
, "LCD_ID_PINS");
177 gpio_direction_input(gpio
);
179 if (gpio_get_value(gpio
))
184 /* lcd id, flush out bit 1 */
187 /* lcd orientation, portrait or landscape */
188 lcd_orientation
= (id
>> 6) & 0x1;
190 /* restore the original MFP settings */
191 for (i
= 0; i
< ARRAY_SIZE(lcd_detect_pins
); i
++)
192 pxa3xx_mfp_write(lcd_detect_pins
[i
], mfpr_save
[i
]);
195 void __init
zylonite_pxa320_init(void)
197 if (cpu_is_pxa320()) {
199 pxa3xx_mfp_config(ARRAY_AND_SIZE(mfp_cfg
));
201 /* detect LCD panel */
202 zylonite_detect_lcd_panel();
204 /* GPIO pin assignment */
205 gpio_eth_irq
= mfp_to_gpio(MFP_PIN_GPIO9
);
206 gpio_debug_led1
= mfp_to_gpio(MFP_PIN_GPIO1_2
);
207 gpio_debug_led2
= mfp_to_gpio(MFP_PIN_GPIO4_2
);
210 wm9713_irq
= mfp_to_gpio(MFP_PIN_GPIO15
);