- 根目录:
- arch
- arm
- mach-pxa
- zylonite_pxa320.c
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/gpio.h>
#include <mach/pxa320.h>
#include <mach/zylonite.h>
#include "generic.h"
static mfp_cfg_t mfp_cfg[] __initdata = {
GPIO6_2_LCD_LDD_0,
GPIO7_2_LCD_LDD_1,
GPIO8_2_LCD_LDD_2,
GPIO9_2_LCD_LDD_3,
GPIO10_2_LCD_LDD_4,
GPIO11_2_LCD_LDD_5,
GPIO12_2_LCD_LDD_6,
GPIO13_2_LCD_LDD_7,
GPIO63_LCD_LDD_8,
GPIO64_LCD_LDD_9,
GPIO65_LCD_LDD_10,
GPIO66_LCD_LDD_11,
GPIO67_LCD_LDD_12,
GPIO68_LCD_LDD_13,
GPIO69_LCD_LDD_14,
GPIO70_LCD_LDD_15,
GPIO71_LCD_LDD_16,
GPIO72_LCD_LDD_17,
GPIO73_LCD_CS_N,
GPIO74_LCD_VSYNC,
GPIO14_2_LCD_FCLK,
GPIO15_2_LCD_LCLK,
GPIO16_2_LCD_PCLK,
GPIO17_2_LCD_BIAS,
GPIO14_PWM3_OUT,
GPIO41_UART1_RXD | MFP_LPM_EDGE_FALL,
GPIO42_UART1_TXD,
GPIO43_UART1_CTS,
GPIO44_UART1_DCD,
GPIO45_UART1_DSR | MFP_LPM_EDGE_FALL,
GPIO46_UART1_RI,
GPIO47_UART1_DTR,
GPIO48_UART1_RTS,
GPIO34_AC97_SYSCLK,
GPIO35_AC97_SDATA_IN_0,
GPIO37_AC97_SDATA_OUT,
GPIO38_AC97_SYNC,
GPIO39_AC97_BITCLK,
GPIO40_AC97_nACRESET,
GPIO36_GPIO,
GPIO89_SSP3_SCLK,
GPIO90_SSP3_FRM,
GPIO91_SSP3_TXD,
GPIO92_SSP3_RXD,
GPIO15_GPIO,
GPIO32_I2C_SCL,
GPIO33_I2C_SDA,
GPIO105_KP_DKIN_0 | MFP_LPM_EDGE_BOTH,
GPIO106_KP_DKIN_1 | MFP_LPM_EDGE_BOTH,
GPIO113_KP_MKIN_0 | MFP_LPM_EDGE_BOTH,
GPIO114_KP_MKIN_1 | MFP_LPM_EDGE_BOTH,
GPIO115_KP_MKIN_2 | MFP_LPM_EDGE_BOTH,
GPIO116_KP_MKIN_3 | MFP_LPM_EDGE_BOTH,
GPIO117_KP_MKIN_4 | MFP_LPM_EDGE_BOTH,
GPIO118_KP_MKIN_5 | MFP_LPM_EDGE_BOTH,
GPIO119_KP_MKIN_6 | MFP_LPM_EDGE_BOTH,
GPIO120_KP_MKIN_7 | MFP_LPM_EDGE_BOTH,
GPIO121_KP_MKOUT_0,
GPIO122_KP_MKOUT_1,
GPIO123_KP_MKOUT_2,
GPIO124_KP_MKOUT_3,
GPIO125_KP_MKOUT_4,
GPIO126_KP_MKOUT_5,
GPIO127_KP_MKOUT_6,
GPIO5_2_KP_MKOUT_7,
GPIO4_nCS3,
GPIO90_GPIO,
GPIO18_MMC1_DAT0,
GPIO19_MMC1_DAT1 | MFP_LPM_EDGE_BOTH,
GPIO20_MMC1_DAT2,
GPIO21_MMC1_DAT3,
GPIO22_MMC1_CLK,
GPIO23_MMC1_CMD,
GPIO31_GPIO,
GPIO24_MMC2_DAT0,
GPIO25_MMC2_DAT1 | MFP_LPM_EDGE_BOTH,
GPIO26_MMC2_DAT2,
GPIO27_MMC2_DAT3,
GPIO28_MMC2_CLK,
GPIO29_MMC2_CMD,
GPIO2_2_USBH_PEN,
GPIO3_2_USBH_PWR,
GPIO1_2_GPIO | MFP_LPM_DRIVE_HIGH,
GPIO4_2_GPIO | MFP_LPM_DRIVE_HIGH,
};
#define NUM_LCD_DETECT_PINS 7
static int lcd_detect_pins[] __initdata = {
MFP_PIN_GPIO72,
MFP_PIN_GPIO71,
MFP_PIN_GPIO17_2,
MFP_PIN_GPIO15_2,
MFP_PIN_GPIO14_2,
MFP_PIN_GPIO73,
MFP_PIN_GPIO74,
MFP_PIN_GPIO14,
MFP_PIN_GPIO15,
MFP_PIN_GPIO17,
};
static int lcd_detect_mfpr[] __initdata = {
0x8440, 0x8440, 0x8440, 0x8440, 0x8440, 0x8440, 0x8440,
0xc442,
0x8445,
0x8445,
};
static void __init zylonite_detect_lcd_panel(void)
{
unsigned long mfpr_save[ARRAY_SIZE(lcd_detect_pins)];
int i, gpio, id = 0;
for (i = 0; i < ARRAY_SIZE(lcd_detect_pins); i++) {
mfpr_save[i] = pxa3xx_mfp_read(lcd_detect_pins[i]);
pxa3xx_mfp_write(lcd_detect_pins[i], lcd_detect_mfpr[i]);
}
for (i = 0; i < NUM_LCD_DETECT_PINS; i++) {
id = id << 1;
gpio = mfp_to_gpio(lcd_detect_pins[i]);
gpio_request(gpio, "LCD_ID_PINS");
gpio_direction_input(gpio);
if (gpio_get_value(gpio))
id = id | 0x1;
gpio_free(gpio);
}
lcd_id = id & 0x3d;
lcd_orientation = (id >> 6) & 0x1;
for (i = 0; i < ARRAY_SIZE(lcd_detect_pins); i++)
pxa3xx_mfp_write(lcd_detect_pins[i], mfpr_save[i]);
}
void __init zylonite_pxa320_init(void)
{
if (cpu_is_pxa320()) {
pxa3xx_mfp_config(ARRAY_AND_SIZE(mfp_cfg));
zylonite_detect_lcd_panel();
gpio_eth_irq = mfp_to_gpio(MFP_PIN_GPIO9);
gpio_debug_led1 = mfp_to_gpio(MFP_PIN_GPIO1_2);
gpio_debug_led2 = mfp_to_gpio(MFP_PIN_GPIO4_2);
wm9713_irq = mfp_to_gpio(MFP_PIN_GPIO15);
}
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
- 156
- 157
- 158
- 159
- 160
- 161
- 162
- 163
- 164
- 165
- 166
- 167
- 168
- 169
- 170
- 171
- 172
- 173
- 174
- 175
- 176
- 177
- 178
- 179
- 180
- 181
- 182
- 183
- 184
- 185
- 186
- 187
- 188
- 189
- 190
- 191
- 192
- 193
- 194
- 195
- 196
- 197
- 198
- 199
- 200
- 201
- 202
- 203
- 204
- 205
- 206
- 207
- 208
- 209
- 210
- 211
- 212
- 213
- 214
- 215