0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include <linux/module.h>
0014 #include <linux/kernel.h>
0015 #include <linux/init.h>
0016 #include <linux/gpio.h>
0017 #include <linux/soc/pxa/cpu.h>
0018
0019 #include "pxa320.h"
0020 #include "zylonite.h"
0021
0022 #include "generic.h"
0023
0024 static mfp_cfg_t mfp_cfg[] __initdata = {
0025
0026 GPIO6_2_LCD_LDD_0,
0027 GPIO7_2_LCD_LDD_1,
0028 GPIO8_2_LCD_LDD_2,
0029 GPIO9_2_LCD_LDD_3,
0030 GPIO10_2_LCD_LDD_4,
0031 GPIO11_2_LCD_LDD_5,
0032 GPIO12_2_LCD_LDD_6,
0033 GPIO13_2_LCD_LDD_7,
0034 GPIO63_LCD_LDD_8,
0035 GPIO64_LCD_LDD_9,
0036 GPIO65_LCD_LDD_10,
0037 GPIO66_LCD_LDD_11,
0038 GPIO67_LCD_LDD_12,
0039 GPIO68_LCD_LDD_13,
0040 GPIO69_LCD_LDD_14,
0041 GPIO70_LCD_LDD_15,
0042 GPIO71_LCD_LDD_16,
0043 GPIO72_LCD_LDD_17,
0044 GPIO73_LCD_CS_N,
0045 GPIO74_LCD_VSYNC,
0046 GPIO14_2_LCD_FCLK,
0047 GPIO15_2_LCD_LCLK,
0048 GPIO16_2_LCD_PCLK,
0049 GPIO17_2_LCD_BIAS,
0050 GPIO14_PWM3_OUT,
0051
0052
0053 GPIO41_UART1_RXD | MFP_LPM_EDGE_FALL,
0054 GPIO42_UART1_TXD,
0055 GPIO43_UART1_CTS,
0056 GPIO44_UART1_DCD,
0057 GPIO45_UART1_DSR | MFP_LPM_EDGE_FALL,
0058 GPIO46_UART1_RI,
0059 GPIO47_UART1_DTR,
0060 GPIO48_UART1_RTS,
0061
0062
0063 GPIO34_AC97_SYSCLK,
0064 GPIO35_AC97_SDATA_IN_0,
0065 GPIO37_AC97_SDATA_OUT,
0066 GPIO38_AC97_SYNC,
0067 GPIO39_AC97_BITCLK,
0068 GPIO40_AC97_nACRESET,
0069 GPIO36_GPIO,
0070
0071
0072 GPIO89_SSP3_SCLK,
0073 GPIO90_SSP3_FRM,
0074 GPIO91_SSP3_TXD,
0075 GPIO92_SSP3_RXD,
0076
0077
0078 GPIO15_GPIO,
0079
0080
0081 GPIO32_I2C_SCL,
0082 GPIO33_I2C_SDA,
0083
0084
0085 GPIO105_KP_DKIN_0 | MFP_LPM_EDGE_BOTH,
0086 GPIO106_KP_DKIN_1 | MFP_LPM_EDGE_BOTH,
0087 GPIO113_KP_MKIN_0 | MFP_LPM_EDGE_BOTH,
0088 GPIO114_KP_MKIN_1 | MFP_LPM_EDGE_BOTH,
0089 GPIO115_KP_MKIN_2 | MFP_LPM_EDGE_BOTH,
0090 GPIO116_KP_MKIN_3 | MFP_LPM_EDGE_BOTH,
0091 GPIO117_KP_MKIN_4 | MFP_LPM_EDGE_BOTH,
0092 GPIO118_KP_MKIN_5 | MFP_LPM_EDGE_BOTH,
0093 GPIO119_KP_MKIN_6 | MFP_LPM_EDGE_BOTH,
0094 GPIO120_KP_MKIN_7 | MFP_LPM_EDGE_BOTH,
0095 GPIO121_KP_MKOUT_0,
0096 GPIO122_KP_MKOUT_1,
0097 GPIO123_KP_MKOUT_2,
0098 GPIO124_KP_MKOUT_3,
0099 GPIO125_KP_MKOUT_4,
0100 GPIO126_KP_MKOUT_5,
0101 GPIO127_KP_MKOUT_6,
0102 GPIO5_2_KP_MKOUT_7,
0103
0104
0105 GPIO4_nCS3,
0106 GPIO90_GPIO,
0107
0108
0109 GPIO18_MMC1_DAT0,
0110 GPIO19_MMC1_DAT1 | MFP_LPM_EDGE_BOTH,
0111 GPIO20_MMC1_DAT2,
0112 GPIO21_MMC1_DAT3,
0113 GPIO22_MMC1_CLK,
0114 GPIO23_MMC1_CMD,
0115 GPIO31_GPIO,
0116
0117
0118 GPIO24_MMC2_DAT0,
0119 GPIO25_MMC2_DAT1 | MFP_LPM_EDGE_BOTH,
0120 GPIO26_MMC2_DAT2,
0121 GPIO27_MMC2_DAT3,
0122 GPIO28_MMC2_CLK,
0123 GPIO29_MMC2_CMD,
0124
0125
0126 GPIO2_2_USBH_PEN,
0127 GPIO3_2_USBH_PWR,
0128
0129
0130 GPIO1_2_GPIO | MFP_LPM_DRIVE_HIGH,
0131 GPIO4_2_GPIO | MFP_LPM_DRIVE_HIGH,
0132 };
0133
0134 #define NUM_LCD_DETECT_PINS 7
0135
0136 static int lcd_detect_pins[] __initdata = {
0137 MFP_PIN_GPIO72,
0138 MFP_PIN_GPIO71,
0139 MFP_PIN_GPIO17_2,
0140 MFP_PIN_GPIO15_2,
0141 MFP_PIN_GPIO14_2,
0142 MFP_PIN_GPIO73,
0143 MFP_PIN_GPIO74,
0144
0145
0146
0147
0148 MFP_PIN_GPIO14,
0149 MFP_PIN_GPIO15,
0150 MFP_PIN_GPIO17,
0151 };
0152
0153 static int lcd_detect_mfpr[] __initdata = {
0154
0155 0x8440, 0x8440, 0x8440, 0x8440, 0x8440, 0x8440, 0x8440,
0156 0xc442,
0157 0x8445,
0158 0x8445,
0159 };
0160
0161 static void __init zylonite_detect_lcd_panel(void)
0162 {
0163 unsigned long mfpr_save[ARRAY_SIZE(lcd_detect_pins)];
0164 int i, gpio, id = 0;
0165
0166
0167
0168
0169 for (i = 0; i < ARRAY_SIZE(lcd_detect_pins); i++) {
0170 mfpr_save[i] = pxa3xx_mfp_read(lcd_detect_pins[i]);
0171 pxa3xx_mfp_write(lcd_detect_pins[i], lcd_detect_mfpr[i]);
0172 }
0173
0174 for (i = 0; i < NUM_LCD_DETECT_PINS; i++) {
0175 id = id << 1;
0176 gpio = mfp_to_gpio(lcd_detect_pins[i]);
0177 gpio_request(gpio, "LCD_ID_PINS");
0178 gpio_direction_input(gpio);
0179
0180 if (gpio_get_value(gpio))
0181 id = id | 0x1;
0182 gpio_free(gpio);
0183 }
0184
0185
0186 lcd_id = id & 0x3d;
0187
0188
0189 lcd_orientation = (id >> 6) & 0x1;
0190
0191
0192 for (i = 0; i < ARRAY_SIZE(lcd_detect_pins); i++)
0193 pxa3xx_mfp_write(lcd_detect_pins[i], mfpr_save[i]);
0194 }
0195
0196 void __init zylonite_pxa320_init(void)
0197 {
0198 if (cpu_is_pxa320()) {
0199
0200 pxa3xx_mfp_config(ARRAY_AND_SIZE(mfp_cfg));
0201
0202
0203 zylonite_detect_lcd_panel();
0204
0205
0206 gpio_eth_irq = mfp_to_gpio(MFP_PIN_GPIO9);
0207 gpio_debug_led1 = mfp_to_gpio(MFP_PIN_GPIO1_2);
0208 gpio_debug_led2 = mfp_to_gpio(MFP_PIN_GPIO4_2);
0209
0210
0211 wm9713_irq = mfp_to_gpio(MFP_PIN_GPIO15);
0212 }
0213 }