pxa gpio API cleanup
Subsystems (6)
cover pxa gpio API cleanup
These are mostly RFC, and there needs to be some cleanup still. Yet pasted here firstly so any significant issues can be found. Anyway, this might be the thing I'd like to get into .34, please help review.
Thanks.
[PATCH 01/16] [ARM] pxa/tosa: make use of the matrix keypad driver [PATCH 02/16] [ARM] pxa: use chip->ack() instead of accessing GEDR directly [PATCH 03/16] [ARM] pxa: simplify the LCD pin configuration for pxa25x platforms [PATCH 04/16] [ARM] pxa: simplify the LCD pin configuration for pxa27x platforms [PATCH 05/16] [ARM] pxa/cm-x270: avoid direct access of GPIO/MFP registers [PATCH 06/16] [ARM] pxa: fix the incorrect naming of AC97 reset pin config for pxa26x [PATCH 07/16] [ARM] pxa: remove the unnecessary restoring of MFP registers [PATCH 08/16] [ARM] pxa: introduce processor specific pxa27x_assert_ac97reset() [PATCH 09/16] [ARM] pxa: add the missing AC97 pin configurations
[PATCH 10/16] [ARM] pxa: remove now unnecessary pxa_gpio_mode() calls in ac97 [PATCH 11/16] gpio: introduce gpio_request_one() and friends
[PATCH 12/16] [ARM] pxa/corgi: use generic GPIO API and remove pxa_gpio_mode() [PATCH 13/16] [ARM] pxa/spitz: use generic GPIO API and remove pxa_gpio_mode() [PATCH 14/16] [ARM] pxa: fix irq suspend/resume for pxa25x
[PATCH 15/16] [ARM] pxa: add MFP_LPM_KEEP_OUTPUT flag to pin config [PATCH 16/16] [ARM] pxa/corgi: cleanup GPIO configurations and low power mode settings
PATCH 1/16 pxa/tosa: make use of the matrix keypad driver
--- arch/arm/mach-pxa/tosa.c | 117 ++++++++++++++++++++++++++++++++++++++------- 1 files changed, 98 insertions(+), 19 deletions(-)
arch/arm/mach-pxa/tosa.c +98 -19
@@ -32,6 +32,7 @@#include <linux/gpio.h> #include <linux/pda_power.h> #include <linux/spi/spi.h> +#include <linux/input/matrix_keypad.h> #include <asm/setup.h> #include <asm/mach-types.h>
@@ -131,24 +132,24 @@ static unsigned long tosa_pin_config[] = {GPIO45_BTUART_RTS ,/* Keybd */ -GPIO58_GPIO |MFP_LPM_DRIVE_LOW , -GPIO59_GPIO |MFP_LPM_DRIVE_LOW , -GPIO60_GPIO |MFP_LPM_DRIVE_LOW , -GPIO61_GPIO |MFP_LPM_DRIVE_LOW , -GPIO62_GPIO |MFP_LPM_DRIVE_LOW , -GPIO63_GPIO |MFP_LPM_DRIVE_LOW , -GPIO64_GPIO |MFP_LPM_DRIVE_LOW , -GPIO65_GPIO |MFP_LPM_DRIVE_LOW , -GPIO66_GPIO |MFP_LPM_DRIVE_LOW , -GPIO67_GPIO |MFP_LPM_DRIVE_LOW , -GPIO68_GPIO |MFP_LPM_DRIVE_LOW , -GPIO69_GPIO |MFP_LPM_DRIVE_LOW , -GPIO70_GPIO |MFP_LPM_DRIVE_LOW , -GPIO71_GPIO |MFP_LPM_DRIVE_LOW , -GPIO72_GPIO |MFP_LPM_DRIVE_LOW , -GPIO73_GPIO |MFP_LPM_DRIVE_LOW , -GPIO74_GPIO |MFP_LPM_DRIVE_LOW , -GPIO75_GPIO |MFP_LPM_DRIVE_LOW , +GPIO58_GPIO |MFP_LPM_DRIVE_LOW ,/* Column 0 */ +GPIO59_GPIO |MFP_LPM_DRIVE_LOW ,/* Column 1 */ +GPIO60_GPIO |MFP_LPM_DRIVE_LOW ,/* Column 2 */ +GPIO61_GPIO |MFP_LPM_DRIVE_LOW ,/* Column 3 */ +GPIO62_GPIO |MFP_LPM_DRIVE_LOW ,/* Column 4 */ +GPIO63_GPIO |MFP_LPM_DRIVE_LOW ,/* Column 5 */ +GPIO64_GPIO |MFP_LPM_DRIVE_LOW ,/* Column 6 */ +GPIO65_GPIO |MFP_LPM_DRIVE_LOW ,/* Column 7 */ +GPIO66_GPIO |MFP_LPM_DRIVE_LOW ,/* Column 8 */ +GPIO67_GPIO |MFP_LPM_DRIVE_LOW ,/* Column 9 */ +GPIO68_GPIO |MFP_LPM_DRIVE_LOW ,/* Column 10 */ +GPIO69_GPIO |MFP_LPM_DRIVE_LOW ,/* Row 0 */ +GPIO70_GPIO |MFP_LPM_DRIVE_LOW ,/* Row 1 */ +GPIO71_GPIO |MFP_LPM_DRIVE_LOW ,/* Row 2 */ +GPIO72_GPIO |MFP_LPM_DRIVE_LOW ,/* Row 3 */ +GPIO73_GPIO |MFP_LPM_DRIVE_LOW ,/* Row 4 */ +GPIO74_GPIO |MFP_LPM_DRIVE_LOW ,/* Row 5 */ +GPIO75_GPIO |MFP_LPM_DRIVE_LOW ,/* Row 6 */ /* SPI */ GPIO81_SSP2_CLK_OUT,
@@ -411,9 +412,87 @@ static struct platform_device tosa_power_device = {/* * Tosa Keyboard */ +static const uint32_t tosakbd_keymap[] = { +KEY (0 ,2 ,KEY_W ), +KEY (0 ,6 ,KEY_K ), +KEY (0 ,7 ,KEY_BACKSPACE ), +KEY (0 ,8 ,KEY_P ), +KEY (1 ,1 ,KEY_Q ), +KEY (1 ,2 ,KEY_E ), +KEY (1 ,3 ,KEY_T ), +KEY (1 ,4 ,KEY_Y ), +KEY (1 ,6 ,KEY_O ), +KEY (1 ,7 ,KEY_I ), +KEY (1 ,8 ,KEY_COMMA ), +KEY (2 ,1 ,KEY_A ), +KEY (2 ,2 ,KEY_D ), +KEY (2 ,3 ,KEY_G ), +KEY (2 ,4 ,KEY_U ), +KEY (2 ,6 ,KEY_L ), +KEY (2 ,7 ,KEY_ENTER ), +KEY (2 ,8 ,KEY_DOT ), +KEY (3 ,1 ,KEY_Z ), +KEY (3 ,2 ,KEY_C ), +KEY (3 ,3 ,KEY_V ), +KEY (3 ,4 ,KEY_J ), +KEY (3 ,5 ,TOSA_KEY_ADDRESSBOOK ), +KEY (3 ,6 ,TOSA_KEY_CANCEL ), +KEY (3 ,7 ,TOSA_KEY_CENTER ), +KEY (3 ,8 ,TOSA_KEY_OK ), +KEY (3 ,9 ,KEY_LEFTSHIFT ), +KEY (4 ,1 ,KEY_S ), +KEY (4 ,2 ,KEY_R ), +KEY (4 ,3 ,KEY_B ), +KEY (4 ,4 ,KEY_N ), +KEY (4 ,5 ,TOSA_KEY_CALENDAR ), +KEY (4 ,6 ,TOSA_KEY_HOMEPAGE ), +KEY (4 ,7 ,KEY_LEFTCTRL ), +KEY (4 ,8 ,TOSA_KEY_LIGHT ), +KEY (4 ,10 ,KEY_RIGHTSHIFT ), +KEY (5 ,1 ,KEY_TAB ), +KEY (5 ,2 ,KEY_SLASH ), +KEY (5 ,3 ,KEY_H ), +KEY (5 ,4 ,KEY_M ), +KEY (5 ,5 ,TOSA_KEY_MENU ), +KEY (5 ,7 ,KEY_UP ), +KEY (5 ,11 ,TOSA_KEY_FN ), +KEY (6 ,1 ,KEY_X ), +KEY (6 ,2 ,KEY_F ), +KEY (6 ,3 ,KEY_SPACE ), +KEY (6 ,4 ,KEY_APOSTROPHE ), +KEY (6 ,5 ,TOSA_KEY_MAIL ), +KEY (6 ,6 ,KEY_LEFT ), +KEY (6 ,7 ,KEY_DOWN ), +KEY (6 ,8 ,KEY_RIGHT ), +}; + +static struct matrix_keymap_data tosakbd_keymap_data = { + .keymap = tosakbd_keymap, + .keymap_size =ARRAY_SIZE (tosakbd_keymap), +}; + +static const int tosakbd_col_gpios[] = + {58 ,59 ,60 ,61 ,62 ,63 ,64 ,65 ,66 ,67 ,68 }; +static const int tosakbd_row_gpios[] = + {69 ,70 ,71 ,72 ,73 ,74 ,75 }; + +static struct matrix_keypad_platform_data tosakbd_pdata = { + .keymap_data = &tosakbd_keymap_data, + .row_gpios = tosakbd_row_gpios, + .col_gpios = tosakbd_col_gpios, + .num_row_gpios =ARRAY_SIZE (tosakbd_row_gpios), + .num_col_gpios =ARRAY_SIZE (tosakbd_col_gpios), + .col_scan_delay_us =10 , + .debounce_ms =10 , + .wakeup =1 , +}; +static struct platform_device tosakbd_device = { - .name ="tosa-keyboard" , + .name ="matrix-keypad" , .id =-1 , + .dev = { + .platform_data = &tosakbd_pdata, + }, };static struct gpio_keys_button tosa_gpio_keys[] = {
Signature · 1 line
1.6.3.3
PATCH 2/16 pxa: use chip->ack() instead of accessing GEDR directly
In reply to Eric Miao--- arch/arm/mach-pxa/cm-x2xx-pci.c | 2 +- arch/arm/mach-pxa/lpd270.c | 2 +- arch/arm/mach-pxa/lubbock.c | 2 +- arch/arm/mach-pxa/mainstone.c | 2 +- arch/arm/mach-pxa/pcm990-baseboard.c | 3 +-- arch/arm/mach-pxa/viper.c | 2 +- 6 files changed, 6 insertions(+), 7 deletions(-)
arch/arm/mach-pxa/cm-x2xx-pci.c +1 -1
@@ -59,7 +59,7 @@ void __init cmx2xx_pci_adjust_zones(int node, unsigned long *zone_size,static void cmx2xx_it8152_irq_demux (unsigned int irq,struct irq_desc *desc) {/* clear our parent irq */ -GEDR (cmx2xx_it8152_irq_gpio) =GPIO_bit (cmx2xx_it8152_irq_gpio); + desc->chip->ack (irq);it8152_irq_demux (irq, desc); }
arch/arm/mach-pxa/lpd270.c +1 -1
@@ -121,7 +121,7 @@ static void lpd270_irq_handler(unsigned int irq, struct irq_desc *desc) pending =__raw_readw (LPD270_INT_STATUS ) & lpd270_irq_enabled; do { - GEDR(0) = GPIO_bit(0); /* clear useless edge notification */ + desc->chip->ack(irq); /* clear useless edge notification */ if (likely(pending)) { irq = LPD270_IRQ(0) + __ffs(pending); generic_handle_irq(irq);
arch/arm/mach-pxa/lubbock.c +1 -1
@@ -158,7 +158,7 @@ static void lubbock_irq_handler(unsigned int irq, struct irq_desc *desc) {unsigned long pending =LUB_IRQ_SET_CLR & lubbock_irq_enabled; do { - GEDR(0) = GPIO_bit(0); /* clear our parent irq */ + desc->chip->ack(irq); /* clear our parent irq */ if (likely(pending)) { irq = LUBBOCK_IRQ(0) + __ffs(pending); generic_handle_irq(irq);
arch/arm/mach-pxa/mainstone.c +1 -1
@@ -162,7 +162,7 @@ static void mainstone_irq_handler(unsigned int irq, struct irq_desc *desc) {unsigned long pending =MST_INTSETCLR & mainstone_irq_enabled; do { - GEDR(0) = GPIO_bit(0); /* clear useless edge notification */ + desc->chip->ack(irq); /* clear useless edge notification */ if (likely(pending)) { irq = MAINSTONE_IRQ(0) + __ffs(pending); generic_handle_irq(irq);
arch/arm/mach-pxa/pcm990-baseboard.c +1 -2
@@ -259,8 +259,7 @@ static void pcm990_irq_handler(unsigned int irq, struct irq_desc *desc)unsigned long pending = (~PCM990_INTSETCLR ) & pcm990_irq_enabled; do { - GEDR(PCM990_CTRL_INT_IRQ_GPIO) = - GPIO_bit(PCM990_CTRL_INT_IRQ_GPIO); + desc->chip->ack(irq); /* clear our parent IRQ */ if (likely(pending)) { irq = PCM027_IRQ(0) + __ffs(pending); generic_handle_irq(irq);
arch/arm/mach-pxa/viper.c +1 -1
@@ -281,7 +281,7 @@ static void viper_irq_handler(unsigned int irq, struct irq_desc *desc) do { /* we're in a chained irq handler, * so ack the interrupt by hand */ - GEDR(VIPER_CPLD_GPIO) = GPIO_bit(VIPER_CPLD_GPIO); + desc->chip->ack(irq); if (likely(pending)) { irq = viper_bit_to_irq(__ffs(pending));
Signature · 1 line
1.6.3.3
PATCH 3/16 pxa: simplify the LCD pin configuration for pxa25x platforms
In reply to Eric MiaoThere are only limited possible LCD pin configurations for pxa25x platforms, simplify this by macro.
--- arch/arm/mach-pxa/cm-x255.c | 21 +---------------- arch/arm/mach-pxa/idp.c | 20 +---------------- arch/arm/mach-pxa/include/mach/mfp-pxa25x.h | 32 +++++++++++++++++++++++++++ arch/arm/mach-pxa/lubbock.c | 20 +---------------- arch/arm/mach-pxa/palmtc.c | 21 +---------------- arch/arm/mach-pxa/palmte2.c | 21 +---------------- arch/arm/mach-pxa/poodle.c | 21 +---------------- 7 files changed, 38 insertions(+), 118 deletions(-)
arch/arm/mach-pxa/cm-x255.c +1 -20
@@ -50,26 +50,7 @@ static unsigned long cmx255_pin_config[] = {GPIO47_STUART_TXD ,/* LCD */ -GPIO58_LCD_LDD_0 , -GPIO59_LCD_LDD_1 , -GPIO60_LCD_LDD_2 , -GPIO61_LCD_LDD_3 , -GPIO62_LCD_LDD_4 , -GPIO63_LCD_LDD_5 , -GPIO64_LCD_LDD_6 , -GPIO65_LCD_LDD_7 , -GPIO66_LCD_LDD_8 , -GPIO67_LCD_LDD_9 , -GPIO68_LCD_LDD_10 , -GPIO69_LCD_LDD_11 , -GPIO70_LCD_LDD_12 , -GPIO71_LCD_LDD_13 , -GPIO72_LCD_LDD_14 , -GPIO73_LCD_LDD_15 , -GPIO74_LCD_FCLK , -GPIO75_LCD_LCLK , -GPIO76_LCD_PCLK , -GPIO77_LCD_BIAS , + GPIOxx_LCD_TFT_16BPP,/* SSP1 */ GPIO23_SSP1_SCLK,
arch/arm/mach-pxa/idp.c +1 -19
@@ -47,25 +47,7 @@static unsigned long idp_pin_config[]__initdata = {/* LCD */ -GPIO58_LCD_LDD_0 , -GPIO59_LCD_LDD_1 , -GPIO60_LCD_LDD_2 , -GPIO61_LCD_LDD_3 , -GPIO62_LCD_LDD_4 , -GPIO63_LCD_LDD_5 , -GPIO64_LCD_LDD_6 , -GPIO65_LCD_LDD_7 , -GPIO66_LCD_LDD_8 , -GPIO67_LCD_LDD_9 , -GPIO68_LCD_LDD_10 , -GPIO69_LCD_LDD_11 , -GPIO70_LCD_LDD_12 , -GPIO71_LCD_LDD_13 , -GPIO72_LCD_LDD_14 , -GPIO73_LCD_LDD_15 , -GPIO74_LCD_FCLK , -GPIO75_LCD_LCLK , -GPIO76_LCD_PCLK , + GPIOxx_LCD_DSTN_16BPP,/* BTUART */ GPIO42_BTUART_RXD ,
arch/arm/mach-pxa/include/mach/mfp-pxa25x.h +32 -0
@@ -188,4 +188,36 @@#define GPIO31_ASSP_SFRM_OUT MFP_CFG_OUT(GPIO31, AF3, DRIVE_LOW)#endif +/* commonly used pin configurations */ +#define GPIOxx_LCD_16BPP \ + GPIO58_LCD_LDD_0, \ + GPIO59_LCD_LDD_1, \ + GPIO60_LCD_LDD_2, \ + GPIO61_LCD_LDD_3, \ + GPIO62_LCD_LDD_4, \ + GPIO63_LCD_LDD_5, \ + GPIO64_LCD_LDD_6, \ + GPIO65_LCD_LDD_7, \ + GPIO66_LCD_LDD_8, \ + GPIO67_LCD_LDD_9, \ + GPIO68_LCD_LDD_10, \ + GPIO69_LCD_LDD_11, \ + GPIO70_LCD_LDD_12, \ + GPIO71_LCD_LDD_13, \ + GPIO72_LCD_LDD_14, \ + GPIO73_LCD_LDD_15 + +#define GPIOxx_LCD_DSTN_16BPP \ + GPIOxx_LCD_16BPP, \ + GPIO74_LCD_FCLK, \ + GPIO75_LCD_LCLK, \ + GPIO76_LCD_PCLK + +#define GPIOxx_LCD_TFT_16BPP \ + GPIOxx_LCD_16BPP, \ + GPIO74_LCD_FCLK, \ + GPIO75_LCD_LCLK, \ + GPIO76_LCD_PCLK, \ + GPIO77_LCD_BIAS +#endif /* __ASM_ARCH_MFP_PXA25X_H */
arch/arm/mach-pxa/lubbock.c +1 -19
@@ -67,25 +67,7 @@ static unsigned long lubbock_pin_config[] __initdata = {GPIO26_SSP1_RXD ,/* LCD - 16bpp DSTN */ -GPIO58_LCD_LDD_0 , -GPIO59_LCD_LDD_1 , -GPIO60_LCD_LDD_2 , -GPIO61_LCD_LDD_3 , -GPIO62_LCD_LDD_4 , -GPIO63_LCD_LDD_5 , -GPIO64_LCD_LDD_6 , -GPIO65_LCD_LDD_7 , -GPIO66_LCD_LDD_8 , -GPIO67_LCD_LDD_9 , -GPIO68_LCD_LDD_10 , -GPIO69_LCD_LDD_11 , -GPIO70_LCD_LDD_12 , -GPIO71_LCD_LDD_13 , -GPIO72_LCD_LDD_14 , -GPIO73_LCD_LDD_15 , -GPIO74_LCD_FCLK , -GPIO75_LCD_LCLK , -GPIO76_LCD_PCLK , + GPIOxx_LCD_DSTN_16BPP,/* BTUART */ GPIO42_BTUART_RXD,
arch/arm/mach-pxa/palmtc.c +1 -20
@@ -84,26 +84,7 @@ static unsigned long palmtc_pin_config[] __initdata = {GPIO36_GPIO ,/* pullup */ /* LCD */ -GPIO58_LCD_LDD_0 , -GPIO59_LCD_LDD_1 , -GPIO60_LCD_LDD_2 , -GPIO61_LCD_LDD_3 , -GPIO62_LCD_LDD_4 , -GPIO63_LCD_LDD_5 , -GPIO64_LCD_LDD_6 , -GPIO65_LCD_LDD_7 , -GPIO66_LCD_LDD_8 , -GPIO67_LCD_LDD_9 , -GPIO68_LCD_LDD_10 , -GPIO69_LCD_LDD_11 , -GPIO70_LCD_LDD_12 , -GPIO71_LCD_LDD_13 , -GPIO72_LCD_LDD_14 , -GPIO73_LCD_LDD_15 , -GPIO74_LCD_FCLK , -GPIO75_LCD_LCLK , -GPIO76_LCD_PCLK , -GPIO77_LCD_BIAS , + GPIOxx_LCD_TFT_16BPP,/* MATRIX KEYPAD */ GPIO0_GPIO | WAKEUP_ON_EDGE_BOTH, /* in 0 */
arch/arm/mach-pxa/palmte2.c +1 -20
@@ -73,26 +73,7 @@ static unsigned long palmte2_pin_config[] __initdata = {GPIO47_FICP_TXD ,/* LCD */ -GPIO58_LCD_LDD_0 , -GPIO59_LCD_LDD_1 , -GPIO60_LCD_LDD_2 , -GPIO61_LCD_LDD_3 , -GPIO62_LCD_LDD_4 , -GPIO63_LCD_LDD_5 , -GPIO64_LCD_LDD_6 , -GPIO65_LCD_LDD_7 , -GPIO66_LCD_LDD_8 , -GPIO67_LCD_LDD_9 , -GPIO68_LCD_LDD_10 , -GPIO69_LCD_LDD_11 , -GPIO70_LCD_LDD_12 , -GPIO71_LCD_LDD_13 , -GPIO72_LCD_LDD_14 , -GPIO73_LCD_LDD_15 , -GPIO74_LCD_FCLK , -GPIO75_LCD_LCLK , -GPIO76_LCD_PCLK , -GPIO77_LCD_BIAS , + GPIOxx_LCD_TFT_16BPP,/* GPIO KEYS */ GPIO5_GPIO, /* notes */
arch/arm/mach-pxa/poodle.c +1 -20
@@ -91,26 +91,7 @@ static unsigned long poodle_pin_config[] __initdata = {GPIO35_FFUART_CTS ,/* LCD */ -GPIO58_LCD_LDD_0 , -GPIO59_LCD_LDD_1 , -GPIO60_LCD_LDD_2 , -GPIO61_LCD_LDD_3 , -GPIO62_LCD_LDD_4 , -GPIO63_LCD_LDD_5 , -GPIO64_LCD_LDD_6 , -GPIO65_LCD_LDD_7 , -GPIO66_LCD_LDD_8 , -GPIO67_LCD_LDD_9 , -GPIO68_LCD_LDD_10 , -GPIO69_LCD_LDD_11 , -GPIO70_LCD_LDD_12 , -GPIO71_LCD_LDD_13 , -GPIO72_LCD_LDD_14 , -GPIO73_LCD_LDD_15 , -GPIO74_LCD_FCLK , -GPIO75_LCD_LCLK , -GPIO76_LCD_PCLK , -GPIO77_LCD_BIAS , + GPIOxx_LCD_TFT_16BPP,/* PC Card */ GPIO48_nPOE,
Signature · 1 line
1.6.3.3
PATCH 4/16 pxa: simplify the LCD pin configuration for pxa27x platforms
In reply to Eric Miao--- arch/arm/mach-pxa/balloon3.c | 21 +-------------------- arch/arm/mach-pxa/cm-x270.c | 21 +-------------------- arch/arm/mach-pxa/em-x270.c | 21 +-------------------- arch/arm/mach-pxa/include/mach/mfp-pxa27x.h | 27 +++++++++++++++++++++++++++ arch/arm/mach-pxa/magician.c | 21 +-------------------- arch/arm/mach-pxa/mainstone.c | 21 +-------------------- arch/arm/mach-pxa/mioa701.c | 20 +------------------- arch/arm/mach-pxa/palmld.c | 21 +-------------------- arch/arm/mach-pxa/palmt5.c | 21 +-------------------- arch/arm/mach-pxa/palmtreo.c | 20 +------------------- arch/arm/mach-pxa/palmtx.c | 21 +-------------------- arch/arm/mach-pxa/palmz72.c | 22 ++-------------------- arch/arm/mach-pxa/spitz.c | 20 +------------------- arch/arm/mach-pxa/trizeps4.c | 21 +-------------------- 14 files changed, 41 insertions(+), 257 deletions(-)
arch/arm/mach-pxa/balloon3.c +1 -20
@@ -140,26 +140,7 @@ static void balloon3_backlight_power(int on)static unsigned long balloon3_lcd_pin_config[] = {/* LCD - 16bpp Active TFT */ -GPIO58_LCD_LDD_0 , -GPIO59_LCD_LDD_1 , -GPIO60_LCD_LDD_2 , -GPIO61_LCD_LDD_3 , -GPIO62_LCD_LDD_4 , -GPIO63_LCD_LDD_5 , -GPIO64_LCD_LDD_6 , -GPIO65_LCD_LDD_7 , -GPIO66_LCD_LDD_8 , -GPIO67_LCD_LDD_9 , -GPIO68_LCD_LDD_10 , -GPIO69_LCD_LDD_11 , -GPIO70_LCD_LDD_12 , -GPIO71_LCD_LDD_13 , -GPIO72_LCD_LDD_14 , -GPIO73_LCD_LDD_15 , -GPIO74_LCD_FCLK , -GPIO75_LCD_LCLK , -GPIO76_LCD_PCLK , -GPIO77_LCD_BIAS , + GPIOxx_LCD_TFT_16BPP,GPIO99_GPIO ,/* Backlight */ };
arch/arm/mach-pxa/cm-x270.c +1 -20
@@ -71,26 +71,7 @@ static unsigned long cmx270_pin_config[] = {GPIO111_MMC_DAT_3 ,/* LCD */ -GPIO58_LCD_LDD_0 , -GPIO59_LCD_LDD_1 , -GPIO60_LCD_LDD_2 , -GPIO61_LCD_LDD_3 , -GPIO62_LCD_LDD_4 , -GPIO63_LCD_LDD_5 , -GPIO64_LCD_LDD_6 , -GPIO65_LCD_LDD_7 , -GPIO66_LCD_LDD_8 , -GPIO67_LCD_LDD_9 , -GPIO68_LCD_LDD_10 , -GPIO69_LCD_LDD_11 , -GPIO70_LCD_LDD_12 , -GPIO71_LCD_LDD_13 , -GPIO72_LCD_LDD_14 , -GPIO73_LCD_LDD_15 , -GPIO74_LCD_FCLK , -GPIO75_LCD_LCLK , -GPIO76_LCD_PCLK , -GPIO77_LCD_BIAS , + GPIOxx_LCD_TFT_16BPP,/* I2C */ GPIO117_I2C_SCL,
arch/arm/mach-pxa/em-x270.c +1 -20
@@ -109,26 +109,7 @@ static unsigned long common_pin_config[] = {GPIO111_MMC_DAT_3 ,/* LCD */ -GPIO58_LCD_LDD_0 , -GPIO59_LCD_LDD_1 , -GPIO60_LCD_LDD_2 , -GPIO61_LCD_LDD_3 , -GPIO62_LCD_LDD_4 , -GPIO63_LCD_LDD_5 , -GPIO64_LCD_LDD_6 , -GPIO65_LCD_LDD_7 , -GPIO66_LCD_LDD_8 , -GPIO67_LCD_LDD_9 , -GPIO68_LCD_LDD_10 , -GPIO69_LCD_LDD_11 , -GPIO70_LCD_LDD_12 , -GPIO71_LCD_LDD_13 , -GPIO72_LCD_LDD_14 , -GPIO73_LCD_LDD_15 , -GPIO74_LCD_FCLK , -GPIO75_LCD_LCLK , -GPIO76_LCD_PCLK , -GPIO77_LCD_BIAS , + GPIOxx_LCD_TFT_16BPP,/* QCI */ GPIO84_CIF_FV,
arch/arm/mach-pxa/include/mach/mfp-pxa27x.h +27 -0
@@ -434,5 +434,32 @@#define GPIO112_nMSINS MFP_CFG_IN(GPIO112, AF2)#define GPIO32_MSSCLK MFP_CFG_OUT(GPIO32, AF1, DRIVE_LOW) +/* commonly used pin configurations */ +#define GPIOxx_LCD_16BPP \ + GPIO58_LCD_LDD_0, \ + GPIO59_LCD_LDD_1, \ + GPIO60_LCD_LDD_2, \ + GPIO61_LCD_LDD_3, \ + GPIO62_LCD_LDD_4, \ + GPIO63_LCD_LDD_5, \ + GPIO64_LCD_LDD_6, \ + GPIO65_LCD_LDD_7, \ + GPIO66_LCD_LDD_8, \ + GPIO67_LCD_LDD_9, \ + GPIO68_LCD_LDD_10, \ + GPIO69_LCD_LDD_11, \ + GPIO70_LCD_LDD_12, \ + GPIO71_LCD_LDD_13, \ + GPIO72_LCD_LDD_14, \ + GPIO73_LCD_LDD_15 + +#define GPIOxx_LCD_TFT_16BPP \ + GPIOxx_LCD_16BPP, \ + GPIO74_LCD_FCLK, \ + GPIO75_LCD_LCLK, \ + GPIO76_LCD_PCLK, \ + GPIO77_LCD_BIAS + +extern int keypad_set_wake (unsigned int on);#endif /* __ASM_ARCH_MFP_PXA27X_H */
arch/arm/mach-pxa/magician.c +1 -20
@@ -88,26 +88,7 @@ static unsigned long magician_pin_config[] __initdata = {GPIO112_MMC_CMD ,/* LCD */ -GPIO58_LCD_LDD_0 , -GPIO59_LCD_LDD_1 , -GPIO60_LCD_LDD_2 , -GPIO61_LCD_LDD_3 , -GPIO62_LCD_LDD_4 , -GPIO63_LCD_LDD_5 , -GPIO64_LCD_LDD_6 , -GPIO65_LCD_LDD_7 , -GPIO66_LCD_LDD_8 , -GPIO67_LCD_LDD_9 , -GPIO68_LCD_LDD_10 , -GPIO69_LCD_LDD_11 , -GPIO70_LCD_LDD_12 , -GPIO71_LCD_LDD_13 , -GPIO72_LCD_LDD_14 , -GPIO73_LCD_LDD_15 , -GPIO74_LCD_FCLK , -GPIO75_LCD_LCLK , -GPIO76_LCD_PCLK , -GPIO77_LCD_BIAS , + GPIOxx_LCD_TFT_16BPP,/* QCI */ GPIO12_CIF_DD_7,
arch/arm/mach-pxa/mainstone.c +1 -20
@@ -60,26 +60,7 @@ static unsigned long mainstone_pin_config[] = { GPIO15_nCS_1,/* LCD - 16bpp Active TFT */ -GPIO58_LCD_LDD_0 , -GPIO59_LCD_LDD_1 , -GPIO60_LCD_LDD_2 , -GPIO61_LCD_LDD_3 , -GPIO62_LCD_LDD_4 , -GPIO63_LCD_LDD_5 , -GPIO64_LCD_LDD_6 , -GPIO65_LCD_LDD_7 , -GPIO66_LCD_LDD_8 , -GPIO67_LCD_LDD_9 , -GPIO68_LCD_LDD_10 , -GPIO69_LCD_LDD_11 , -GPIO70_LCD_LDD_12 , -GPIO71_LCD_LDD_13 , -GPIO72_LCD_LDD_14 , -GPIO73_LCD_LDD_15 , -GPIO74_LCD_FCLK , -GPIO75_LCD_LCLK , -GPIO76_LCD_PCLK , -GPIO77_LCD_BIAS , + GPIOxx_LCD_TFT_16BPP, GPIO16_PWM0_OUT, /* Backlight *//* MMC */
arch/arm/mach-pxa/mioa701.c +1 -19
@@ -86,25 +86,7 @@ static unsigned long mioa701_pin_config[] = {MIO_CFG_OUT (GPIO22_USB_ENABLE ,AF0 ,DRIVE_LOW ),/* LCD */ -GPIO58_LCD_LDD_0 , -GPIO59_LCD_LDD_1 , -GPIO60_LCD_LDD_2 , -GPIO61_LCD_LDD_3 , -GPIO62_LCD_LDD_4 , -GPIO63_LCD_LDD_5 , -GPIO64_LCD_LDD_6 , -GPIO65_LCD_LDD_7 , -GPIO66_LCD_LDD_8 , -GPIO67_LCD_LDD_9 , -GPIO68_LCD_LDD_10 , -GPIO69_LCD_LDD_11 , -GPIO70_LCD_LDD_12 , -GPIO71_LCD_LDD_13 , -GPIO72_LCD_LDD_14 , -GPIO73_LCD_LDD_15 , -GPIO74_LCD_FCLK , -GPIO75_LCD_LCLK , -GPIO76_LCD_PCLK , + GPIOxx_LCD_TFT_16BPP,/* QCI */ GPIO12_CIF_DD_7,
arch/arm/mach-pxa/palmld.c +1 -20
@@ -83,26 +83,7 @@ static unsigned long palmld_pin_config[] __initdata = {GPIO105_KP_MKOUT_2 ,/* LCD */ -GPIO58_LCD_LDD_0 , -GPIO59_LCD_LDD_1 , -GPIO60_LCD_LDD_2 , -GPIO61_LCD_LDD_3 , -GPIO62_LCD_LDD_4 , -GPIO63_LCD_LDD_5 , -GPIO64_LCD_LDD_6 , -GPIO65_LCD_LDD_7 , -GPIO66_LCD_LDD_8 , -GPIO67_LCD_LDD_9 , -GPIO68_LCD_LDD_10 , -GPIO69_LCD_LDD_11 , -GPIO70_LCD_LDD_12 , -GPIO71_LCD_LDD_13 , -GPIO72_LCD_LDD_14 , -GPIO73_LCD_LDD_15 , -GPIO74_LCD_FCLK , -GPIO75_LCD_LCLK , -GPIO76_LCD_PCLK , -GPIO77_LCD_BIAS , + GPIOxx_LCD_TFT_16BPP,/* PWM */ GPIO16_PWM0_OUT,
arch/arm/mach-pxa/palmt5.c +1 -20
@@ -87,26 +87,7 @@ static unsigned long palmt5_pin_config[] __initdata = {GPIO105_KP_MKOUT_2 ,/* LCD */ -GPIO58_LCD_LDD_0 , -GPIO59_LCD_LDD_1 , -GPIO60_LCD_LDD_2 , -GPIO61_LCD_LDD_3 , -GPIO62_LCD_LDD_4 , -GPIO63_LCD_LDD_5 , -GPIO64_LCD_LDD_6 , -GPIO65_LCD_LDD_7 , -GPIO66_LCD_LDD_8 , -GPIO67_LCD_LDD_9 , -GPIO68_LCD_LDD_10 , -GPIO69_LCD_LDD_11 , -GPIO70_LCD_LDD_12 , -GPIO71_LCD_LDD_13 , -GPIO72_LCD_LDD_14 , -GPIO73_LCD_LDD_15 , -GPIO74_LCD_FCLK , -GPIO75_LCD_LCLK , -GPIO76_LCD_PCLK , -GPIO77_LCD_BIAS , + GPIOxx_LCD_TFT_16BPP,/* PWM */ GPIO16_PWM0_OUT,
arch/arm/mach-pxa/palmtreo.c +1 -19
@@ -99,25 +99,7 @@ static unsigned long treo_pin_config[] __initdata = {GPIO93_KP_DKIN_0 |WAKEUP_ON_LEVEL_HIGH ,/* Hotsync button */ /* LCD */ -GPIO58_LCD_LDD_0 , -GPIO59_LCD_LDD_1 , -GPIO60_LCD_LDD_2 , -GPIO61_LCD_LDD_3 , -GPIO62_LCD_LDD_4 , -GPIO63_LCD_LDD_5 , -GPIO64_LCD_LDD_6 , -GPIO65_LCD_LDD_7 , -GPIO66_LCD_LDD_8 , -GPIO67_LCD_LDD_9 , -GPIO68_LCD_LDD_10 , -GPIO69_LCD_LDD_11 , -GPIO70_LCD_LDD_12 , -GPIO71_LCD_LDD_13 , -GPIO72_LCD_LDD_14 , -GPIO73_LCD_LDD_15 , -GPIO74_LCD_FCLK , -GPIO75_LCD_LCLK , -GPIO76_LCD_PCLK , + GPIOxx_LCD_TFT_16BPP,/* Quick Capture Interface */ GPIO84_CIF_FV,
arch/arm/mach-pxa/palmtx.c +1 -20
@@ -110,26 +110,7 @@ static unsigned long palmtx_pin_config[] __initdata = {GPIO105_KP_MKOUT_2 ,/* LCD */ -GPIO58_LCD_LDD_0 , -GPIO59_LCD_LDD_1 , -GPIO60_LCD_LDD_2 , -GPIO61_LCD_LDD_3 , -GPIO62_LCD_LDD_4 , -GPIO63_LCD_LDD_5 , -GPIO64_LCD_LDD_6 , -GPIO65_LCD_LDD_7 , -GPIO66_LCD_LDD_8 , -GPIO67_LCD_LDD_9 , -GPIO68_LCD_LDD_10 , -GPIO69_LCD_LDD_11 , -GPIO70_LCD_LDD_12 , -GPIO71_LCD_LDD_13 , -GPIO72_LCD_LDD_14 , -GPIO73_LCD_LDD_15 , -GPIO74_LCD_FCLK , -GPIO75_LCD_LCLK , -GPIO76_LCD_PCLK , -GPIO77_LCD_BIAS , + GPIOxx_LCD_TFT_16BPP,/* FFUART */ GPIO34_FFUART_RXD,
arch/arm/mach-pxa/palmz72.c +2 -20
@@ -95,26 +95,8 @@ static unsigned long palmz72_pin_config[] __initdata = {GPIO105_KP_MKOUT_2 ,/* LCD */ -GPIO58_LCD_LDD_0 , -GPIO59_LCD_LDD_1 , -GPIO60_LCD_LDD_2 , -GPIO61_LCD_LDD_3 , -GPIO62_LCD_LDD_4 , -GPIO63_LCD_LDD_5 , -GPIO64_LCD_LDD_6 , -GPIO65_LCD_LDD_7 , -GPIO66_LCD_LDD_8 , -GPIO67_LCD_LDD_9 , -GPIO68_LCD_LDD_10 , -GPIO69_LCD_LDD_11 , -GPIO70_LCD_LDD_12 , -GPIO71_LCD_LDD_13 , -GPIO72_LCD_LDD_14 , -GPIO73_LCD_LDD_15 , -GPIO74_LCD_FCLK , -GPIO75_LCD_LCLK , -GPIO76_LCD_PCLK , -GPIO77_LCD_BIAS , + GPIOxx_LCD_TFT_16BPP, +GPIO20_GPIO ,/* bl power */ GPIO21_GPIO ,/* LCD border switch */ GPIO22_GPIO, /* LCD border color */
arch/arm/mach-pxa/spitz.c +1 -19
@@ -56,25 +56,7 @@ static unsigned long spitz_pin_config[] __initdata = { GPIO80_nCS_4,/* SCOOP #1 */ /* LCD - 16bpp Active TFT */ -GPIO58_LCD_LDD_0 , -GPIO59_LCD_LDD_1 , -GPIO60_LCD_LDD_2 , -GPIO61_LCD_LDD_3 , -GPIO62_LCD_LDD_4 , -GPIO63_LCD_LDD_5 , -GPIO64_LCD_LDD_6 , -GPIO65_LCD_LDD_7 , -GPIO66_LCD_LDD_8 , -GPIO67_LCD_LDD_9 , -GPIO68_LCD_LDD_10 , -GPIO69_LCD_LDD_11 , -GPIO70_LCD_LDD_12 , -GPIO71_LCD_LDD_13 , -GPIO72_LCD_LDD_14 , -GPIO73_LCD_LDD_15 , -GPIO74_LCD_FCLK , -GPIO75_LCD_LCLK , -GPIO76_LCD_PCLK , + GPIOxx_LCD_TFT_16BPP,/* PC Card */ GPIO48_nPOE,
arch/arm/mach-pxa/trizeps4.c +1 -20
@@ -73,26 +73,7 @@ static unsigned long trizeps4_pin_config[] __initdata = {GPIO0_GPIO |WAKEUP_ON_EDGE_RISE ,/* Logic irq */ /* LCD - 16bpp Active TFT */ -GPIO58_LCD_LDD_0 , -GPIO59_LCD_LDD_1 , -GPIO60_LCD_LDD_2 , -GPIO61_LCD_LDD_3 , -GPIO62_LCD_LDD_4 , -GPIO63_LCD_LDD_5 , -GPIO64_LCD_LDD_6 , -GPIO65_LCD_LDD_7 , -GPIO66_LCD_LDD_8 , -GPIO67_LCD_LDD_9 , -GPIO68_LCD_LDD_10 , -GPIO69_LCD_LDD_11 , -GPIO70_LCD_LDD_12 , -GPIO71_LCD_LDD_13 , -GPIO72_LCD_LDD_14 , -GPIO73_LCD_LDD_15 , -GPIO74_LCD_FCLK , -GPIO75_LCD_LCLK , -GPIO76_LCD_PCLK , -GPIO77_LCD_BIAS , + GPIOxx_LCD_TFT_16BPP,/* UART */ GPIO9_FFUART_CTS,
Signature · 1 line
1.6.3.3
PATCH 5/16 pxa/cm-x270: avoid direct access of GPIO/MFP registers
In reply to Eric Miao--- arch/arm/mach-pxa/cm-x270.c | 62 ++++++++++++++++++++++++++++++------------ 1 files changed, 44 insertions(+), 18 deletions(-)
arch/arm/mach-pxa/cm-x270.c +44 -18
@@ -178,31 +178,57 @@ static struct resource cmx270_2700G_resource[] = {static unsigned long save_lcd_regs[10 ]; +static unsigned long cmx270_marathon_on[] = { +GPIO58_GPIO , +GPIO59_GPIO , +GPIO60_GPIO , +GPIO61_GPIO , +GPIO62_GPIO , +GPIO63_GPIO , +GPIO64_GPIO , +GPIO65_GPIO , +GPIO66_GPIO , +GPIO67_GPIO , +GPIO68_GPIO , +GPIO69_GPIO , +GPIO70_GPIO , +GPIO71_GPIO , +GPIO72_GPIO , +GPIO73_GPIO , +GPIO74_GPIO , +GPIO75_GPIO , +GPIO76_GPIO , +GPIO77_GPIO , +}; + +static unsigned long cmx270_marathon_off[] = { + GPIOxx_LCD_TFT_16BPP, +}; +static int cmx270_marathon_probe (struct fb_info *fb) { -/* save PXA-270 pin settings before enabling 2700G */ - save_lcd_regs[0 ] =GPDR1 ; - save_lcd_regs[1 ] =GPDR2 ; - save_lcd_regs[2 ] =GAFR1_U ; - save_lcd_regs[3 ] =GAFR2_L ; - save_lcd_regs[4 ] =GAFR2_U ; - -/* Disable PXA-270 on-chip controller driving pins */ -GPDR1 &= ~(0xfc000000 ); -GPDR2 &= ~(0x00c03fff ); -GAFR1_U &= ~(0xfff00000 ); -GAFR2_L &= ~(0x0fffffff ); -GAFR2_U &= ~(0x0000f000 ); +int gpio, err; + +for (gpio =58 ; gpio <=77 ; gpio++) { + err =gpio_request (gpio,"LCD" ); +if (err) +return err; +gpio_direction_input (gpio); + } + +pxa2xx_mfp_config (ARRAY_AND_SIZE (cmx270_marathon_on));return 0 ; }static int cmx270_marathon_remove (struct fb_info *fb) { -GPDR1 = save_lcd_regs[0 ]; -GPDR2 = save_lcd_regs[1 ]; -GAFR1_U = save_lcd_regs[2 ]; -GAFR2_L = save_lcd_regs[3 ]; -GAFR2_U = save_lcd_regs[4 ]; +int gpio; + +pxa2xx_mfp_config (ARRAY_AND_SIZE (cmx270_marathon_off)); + +for (gpio =58 ; gpio <=77 ; gpio++) +gpio_free (gpio); +return 0 ; }
Signature · 1 line
1.6.3.3
PATCH 5/16 pxa/cm-x270: avoid direct access of GPIO/MFP registers
arch/arm/mach-pxa/cm-x270.c static struct resource cmx270_2700G_resource[] = { · line 179
Quoted 12 lines · Eric Miao
Signed-off-by Eric Miao <[email protected]>--- arch/arm/mach-pxa/cm-x270.c | 62 ++++++++++++++++++++++++++++++------------ 1 files changed, 44 insertions(+), 18 deletions(-)arch/arm/mach-pxa/cm-x270.c +0
-0@@ -178,31 +178,57 @@ static struct resource cmx270_2700G_resource[] = {static unsigned long save_lcd_regs[10 ];
This can be dropped as well.
Quoted 72 lines
arch/arm/mach-pxa/cm-x270.c +44
-18+static unsigned long cmx270_marathon_on[] = { +GPIO58_GPIO , +GPIO59_GPIO , +GPIO60_GPIO , +GPIO61_GPIO , +GPIO62_GPIO , +GPIO63_GPIO , +GPIO64_GPIO , +GPIO65_GPIO , +GPIO66_GPIO , +GPIO67_GPIO , +GPIO68_GPIO , +GPIO69_GPIO , +GPIO70_GPIO , +GPIO71_GPIO , +GPIO72_GPIO , +GPIO73_GPIO , +GPIO74_GPIO , +GPIO75_GPIO , +GPIO76_GPIO , +GPIO77_GPIO , +}; + +static unsigned long cmx270_marathon_off[] = { + GPIOxx_LCD_TFT_16BPP, +}; +static int cmx270_marathon_probe (struct fb_info *fb) { -/* save PXA-270 pin settings before enabling 2700G */ - save_lcd_regs[0 ] =GPDR1 ; - save_lcd_regs[1 ] =GPDR2 ; - save_lcd_regs[2 ] =GAFR1_U ; - save_lcd_regs[3 ] =GAFR2_L ; - save_lcd_regs[4 ] =GAFR2_U ; - -/* Disable PXA-270 on-chip controller driving pins */ -GPDR1 &= ~(0xfc000000 ); -GPDR2 &= ~(0x00c03fff ); -GAFR1_U &= ~(0xfff00000 ); -GAFR2_L &= ~(0x0fffffff ); -GAFR2_U &= ~(0x0000f000 ); +int gpio, err; + +for (gpio =58 ; gpio <=77 ; gpio++) { + err =gpio_request (gpio,"LCD" ); +if (err) +return err; +gpio_direction_input (gpio); + } + +pxa2xx_mfp_config (ARRAY_AND_SIZE (cmx270_marathon_on));return 0 ; }static int cmx270_marathon_remove (struct fb_info *fb) { -GPDR1 = save_lcd_regs[0 ]; -GPDR2 = save_lcd_regs[1 ]; -GAFR1_U = save_lcd_regs[2 ]; -GAFR2_L = save_lcd_regs[3 ]; -GAFR2_U = save_lcd_regs[4 ]; +int gpio; + +pxa2xx_mfp_config (ARRAY_AND_SIZE (cmx270_marathon_off)); + +for (gpio =58 ; gpio <=77 ; gpio++) +gpio_free (gpio); +return 0 ; }
Signature · 2 lines
Sincerely yours, Mike.
PATCH 5/16 pxa/cm-x270: avoid direct access of GPIO/MFP registers
Quoted 12 lines · Mike Rapoport
Quoted 11 lines · Eric Miao
Signed-off-by Eric Miao <[email protected]>---
?arch/arm/mach-pxa/cm-x270.c | ? 62 ++++++++++++++++++++++++++++++------------ ?1 files changed, 44 insertions(+), 18 deletions(-)arch/arm/mach-pxa/cm-x270.c +0
-0@@ -178,31 +178,57 @@ static struct resource cmx270_2700G_resource[] = {
Quoted 4 lines
arch/arm/mach-pxa/cm-x270.c static struct resource cmx270_2700G_resource[] = { · line 179
Quoted 1 line
arch/arm/mach-pxa/cm-x270.c +0
-0?static unsigned long save_lcd_regs[10];This can be dropped as well.
Thanks, patch updated as follows:
[ARM] pxa/cm-x270: avoid direct access of GPIO/MFP registers
arch/arm/mach-pxa/cm-x270.c +43 -19
@@ -176,33 +176,57 @@ static struct resource cmx270_2700G_resource[] = { }, }; -static unsigned long save_lcd_regs[10 ]; +static unsigned long cmx270_marathon_on[] = { +GPIO58_GPIO , +GPIO59_GPIO , +GPIO60_GPIO , +GPIO61_GPIO , +GPIO62_GPIO , +GPIO63_GPIO , +GPIO64_GPIO , +GPIO65_GPIO , +GPIO66_GPIO , +GPIO67_GPIO , +GPIO68_GPIO , +GPIO69_GPIO , +GPIO70_GPIO , +GPIO71_GPIO , +GPIO72_GPIO , +GPIO73_GPIO , +GPIO74_GPIO , +GPIO75_GPIO , +GPIO76_GPIO , +GPIO77_GPIO , +}; + +static unsigned long cmx270_marathon_off[] = { + GPIOxx_LCD_TFT_16BPP, +};static int cmx270_marathon_probe (struct fb_info *fb) { -/* save PXA-270 pin settings before enabling 2700G */ - save_lcd_regs[0 ] =GPDR1 ; - save_lcd_regs[1 ] =GPDR2 ; - save_lcd_regs[2 ] =GAFR1_U ; - save_lcd_regs[3 ] =GAFR2_L ; - save_lcd_regs[4 ] =GAFR2_U ; - -/* Disable PXA-270 on-chip controller driving pins */ -GPDR1 &= ~(0xfc000000 ); -GPDR2 &= ~(0x00c03fff ); -GAFR1_U &= ~(0xfff00000 ); -GAFR2_L &= ~(0x0fffffff ); -GAFR2_U &= ~(0x0000f000 ); +int gpio, err; + +for (gpio =58 ; gpio <=77 ; gpio++) { + err =gpio_request (gpio,"LCD" ); +if (err) +return err; +gpio_direction_input (gpio); + } + +pxa2xx_mfp_config (ARRAY_AND_SIZE (cmx270_marathon_on));return 0 ; }static int cmx270_marathon_remove (struct fb_info *fb) { -GPDR1 = save_lcd_regs[0 ]; -GPDR2 = save_lcd_regs[1 ]; -GAFR1_U = save_lcd_regs[2 ]; -GAFR2_L = save_lcd_regs[3 ]; -GAFR2_U = save_lcd_regs[4 ]; +int gpio; + +pxa2xx_mfp_config (ARRAY_AND_SIZE (cmx270_marathon_off)); + +for (gpio =58 ; gpio <=77 ; gpio++) +gpio_free (gpio); +return 0 ; }
PATCH 6/16 pxa: fix the incorrect naming of AC97 reset pin config for pxa26x
In reply to Eric MiaoGPIO89_AC97_nRESET is really a PXA26x specific option and was incorrectly named.
--- arch/arm/mach-pxa/include/mach/mfp-pxa25x.h | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
arch/arm/mach-pxa/include/mach/mfp-pxa25x.h +4 -2
@@ -169,7 +169,6 @@#define GPIO86_nSDCS2 MFP_CFG_OUT(GPIO86, AF0, DRIVE_HIGH)#define GPIO87_nSDCS3 MFP_CFG_OUT(GPIO87, AF0, DRIVE_HIGH)#define GPIO88_RDnWR MFP_CFG_OUT(GPIO88, AF0, DRIVE_HIGH) -#define GPIO89_nACRESET MFP_CFG_OUT(GPIO89, AF0, DRIVE_HIGH)/* USB */ #define GPIO9_USB_RCV MFP_CFG_IN(GPIO9, AF1)
@@ -186,7 +185,10 @@#define GPIO30_ASSP_TXD MFP_CFG_OUT(GPIO30, AF3, DRIVE_LOW)#define GPIO31_ASSP_SFRM_IN MFP_CFG_IN(GPIO31, AF1)#define GPIO31_ASSP_SFRM_OUT MFP_CFG_OUT(GPIO31, AF3, DRIVE_LOW) -#endif + +/* AC97 */ +#define GPIO89_AC97_nRESET MFP_CFG_OUT(GPIO89, AF0, DRIVE_HIGH) +#endif /* CONFIG_CPU_PXA26x */ /* commonly used pin configurations */ #define GPIOxx_LCD_16BPP \
Signature · 1 line
1.6.3.3
PATCH 7/16 pxa: remove the unnecessary restoring of MFP registers
In reply to Eric MiaoMFP registers are saved and restored by the mfp sys_device before all other platform devices, and it is unnecessary here.
--- sound/arm/pxa2xx-ac97-lib.c | 10 ---------- 1 files changed, 0 insertions(+), 10 deletions(-)
sound/arm/pxa2xx-ac97-lib.c +0 -10
@@ -345,16 +345,6 @@ EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_suspend);int pxa2xx_ac97_hw_resume (void ) { -if (cpu_is_pxa25x () ||cpu_is_pxa27x ()) { -pxa_gpio_mode (GPIO31_SYNC_AC97_MD ); -pxa_gpio_mode (GPIO30_SDATA_OUT_AC97_MD ); -pxa_gpio_mode (GPIO28_BITCLK_AC97_MD ); -pxa_gpio_mode (GPIO29_SDATA_IN_AC97_MD ); - } -if (cpu_is_pxa27x ()) { -/* Use GPIO 113 or 95 as AC97 Reset on Bulverde */ -set_resetgpio_mode (RESETGPIO_NORMAL_ALTFUNC ); - }clk_enable (ac97_clk);return 0 ; }
Signature · 1 line
1.6.3.3
PATCH 8/16 pxa: introduce processor specific pxa27x_assert_ac97reset()
In reply to Eric MiaoThis is really pxa27x specific and should be kept in pxa27x.c. With this newly introduced function, the original set_resetgpio_mode() is deprecated.
--- arch/arm/mach-pxa/pxa27x.c | 19 ++++++++++++++++ sound/arm/pxa2xx-ac97-lib.c | 50 +++++------------------------------------- 2 files changed, 25 insertions(+), 44 deletions(-)
arch/arm/mach-pxa/pxa27x.c +19 -0
@@ -40,6 +40,25 @@ void pxa27x_clear_otgph(void) }EXPORT_SYMBOL (pxa27x_clear_otgph); +static unsigned long ac97_reset_config[] = { + GPIO95_AC97_nRESET, +GPIO95_GPIO , + GPIO113_AC97_nRESET, +GPIO113_GPIO , +}; + +void pxa27x_assert_ac97reset (int reset_gpio,int on) +{ +if (reset_gpio ==113 ) +pxa2xx_mfp_config (on ? &ac97_reset_config[0 ] : + &ac97_reset_config[1 ],1 ); + +if (reset_gpio ==95 ) +pxa2xx_mfp_config (on ? &ac97_reset_config[2 ] : + &ac97_reset_config[3 ],1 ); +} +EXPORT_SYMBOL_GPL (pxa27x_assert_ac97reset); +/* Crystal clock: 13MHz */ #define BASE_CLK 13000000
sound/arm/pxa2xx-ac97-lib.c +6 -44
76 lines not on this page · raw message
Signature · 1 line
1.6.3.3
PATCH 9/16 pxa: add the missing AC97 pin configurations
In reply to Eric MiaoMissing AC97 pin configurations are added where pxa_set_ac97_info() are called for all pxa25x/pxa27x platforms. Where no exact configuration is provided, use the default as in sound/arm/pxa2xx-ac97-lib.c
--- arch/arm/mach-pxa/balloon3.c | 12 +++++++++++- arch/arm/mach-pxa/e740.c | 6 ++++++ arch/arm/mach-pxa/e750.c | 6 ++++++ arch/arm/mach-pxa/e800.c | 9 +++++++++ arch/arm/mach-pxa/lpd270.c | 4 ++++ arch/arm/mach-pxa/lubbock.c | 6 ++++++ arch/arm/mach-pxa/mainstone.c | 4 ++++ arch/arm/mach-pxa/mioa701.c | 4 ++++ arch/arm/mach-pxa/pcm990-baseboard.c | 6 ++++++ arch/arm/mach-pxa/trizeps4.c | 6 ++++++ arch/arm/mach-pxa/viper.c | 6 ++++++ arch/arm/mach-pxa/zeus.c | 6 ++++++ 12 files changed, 74 insertions(+), 1 deletions(-)
arch/arm/mach-pxa/balloon3.c +11 -1
@@ -132,6 +132,14 @@ static void __init balloon3_init_irq(void) "enabled\n", __func__, BALLOON3_AUX_NIRQ); } +static unsigned long balloon3_ac97_pin_config[] = { +GPIO28_AC97_BITCLK , +GPIO29_AC97_SDATA_IN_0 , +GPIO30_AC97_SDATA_OUT , +GPIO31_AC97_SYNC , + GPIO113_AC97_nRESET, +}; +static void balloon3_backlight_power (int on) {pr_debug ("%s: power is %s\n" , __func__, on ?"on" :"off" );
@@ -292,8 +300,10 @@ static void __init balloon3_init(void)pxa_set_stuart_info (NULL );pxa_set_i2c_info (NULL ); -if (balloon3_has (BALLOON3_FEATURE_AUDIO )) +if (balloon3_has (BALLOON3_FEATURE_AUDIO )) { +pxa2xx_mfp_config (ARRAY_AND_SIZE (balloon3_ac97_pin_config));pxa_set_ac97_info (NULL ); + }if (balloon3_has (BALLOON3_FEATURE_TOPPOLY )) {pxa2xx_mfp_config (ARRAY_AND_SIZE (balloon3_lcd_pin_config));
arch/arm/mach-pxa/e740.c +6 -0
@@ -134,6 +134,12 @@ static unsigned long e740_pin_config[] __initdata = {/* IrDA */ GPIO38_GPIO |MFP_LPM_DRIVE_HIGH , +/* AC97 */ +GPIO28_AC97_BITCLK , +GPIO29_AC97_SDATA_IN_0 , +GPIO30_AC97_SDATA_OUT , +GPIO31_AC97_SYNC , +/* Audio power control */ GPIO16_GPIO ,/* AC97 codec AVDD2 supply (analogue power) */ GPIO40_GPIO, /* Mic amp power */
arch/arm/mach-pxa/e750.c +6 -0
@@ -132,6 +132,12 @@ static unsigned long e750_pin_config[] __initdata = {/* IrDA */ GPIO38_GPIO |MFP_LPM_DRIVE_HIGH , +/* AC97 */ +GPIO28_AC97_BITCLK , +GPIO29_AC97_SDATA_IN_0 , +GPIO30_AC97_SDATA_OUT , +GPIO31_AC97_SYNC , +/* Audio power control */ GPIO4_GPIO ,/* Headphone amp power */ GPIO7_GPIO, /* Speaker amp power */
arch/arm/mach-pxa/e800.c +9 -0
@@ -35,6 +35,14 @@/* ------------------------ e800 LCD definitions ------------------------- */ +static unsigned long e800_pin_config[]__initdata = { +/* AC97 */ +GPIO28_AC97_BITCLK , +GPIO29_AC97_SDATA_IN_0 , +GPIO30_AC97_SDATA_OUT , +GPIO31_AC97_SYNC , +}; +static struct w100_gen_regs e800_lcd_regs = { .lcd_format =0x00008003 , .lcdd_cntl1 =0x02a00000 ,
@@ -195,6 +203,7 @@ static struct platform_device *devices[] __initdata = {static void __init e800_init (void ) { +pxa2xx_mfp_config (ARRAY_AND_SIZE (e800_pin_config));pxa_set_ffuart_info (NULL );pxa_set_btuart_info (NULL );pxa_set_stuart_info (NULL );
arch/arm/mach-pxa/lpd270.c +4 -0
@@ -83,6 +83,10 @@ static unsigned long lpd270_pin_config[] __initdata = {GPIO89_USBH1_PEN ,/* AC97 */ +GPIO28_AC97_BITCLK , +GPIO29_AC97_SDATA_IN_0 , +GPIO30_AC97_SDATA_OUT , +GPIO31_AC97_SYNC ,GPIO45_AC97_SYSCLK , GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH,
arch/arm/mach-pxa/lubbock.c +6 -0
@@ -66,6 +66,12 @@ static unsigned long lubbock_pin_config[] __initdata = {GPIO25_SSP1_TXD ,GPIO26_SSP1_RXD , +/* AC97 */ +GPIO28_AC97_BITCLK , +GPIO29_AC97_SDATA_IN_0 , +GPIO30_AC97_SDATA_OUT , +GPIO31_AC97_SYNC , +/* LCD - 16bpp DSTN */ GPIOxx_LCD_DSTN_16BPP,
arch/arm/mach-pxa/mainstone.c +4 -0
@@ -88,6 +88,10 @@ static unsigned long mainstone_pin_config[] = { GPIO57_nIOIS16,/* AC97 */ +GPIO28_AC97_BITCLK , +GPIO29_AC97_SDATA_IN_0 , +GPIO30_AC97_SDATA_OUT , +GPIO31_AC97_SYNC , GPIO45_AC97_SYSCLK,/* Keypad */
arch/arm/mach-pxa/mioa701.c +4 -0
@@ -137,6 +137,10 @@ static unsigned long mioa701_pin_config[] = {GPIO41_FFUART_RTS ,/* Sound */ +GPIO28_AC97_BITCLK , +GPIO29_AC97_SDATA_IN_0 , +GPIO30_AC97_SDATA_OUT , +GPIO31_AC97_SYNC ,GPIO89_AC97_SYSCLK , MIO_CFG_IN(GPIO12_HPJACK_INSERT, AF0),
arch/arm/mach-pxa/pcm990-baseboard.c +6 -0
@@ -58,6 +58,12 @@ static unsigned long pcm990_pin_config[] __initdata = {/* I2C */ GPIO117_I2C_SCL ,GPIO118_I2C_SDA , + +/* AC97 */ +GPIO28_AC97_BITCLK , +GPIO29_AC97_SDATA_IN_0 , +GPIO30_AC97_SDATA_OUT , + GPIO31_AC97_SYNC, };/*
arch/arm/mach-pxa/trizeps4.c +6 -0
@@ -72,6 +72,12 @@ static unsigned long trizeps4_pin_config[] __initdata = { GPIO79_nCS_3,/* Logic CS */ GPIO0_GPIO |WAKEUP_ON_EDGE_RISE ,/* Logic irq */ +/* AC97 */ +GPIO28_AC97_BITCLK , +GPIO29_AC97_SDATA_IN_0 , +GPIO30_AC97_SDATA_OUT , +GPIO31_AC97_SYNC , +/* LCD - 16bpp Active TFT */ GPIOxx_LCD_TFT_16BPP,
arch/arm/mach-pxa/viper.c +6 -0
@@ -711,6 +711,12 @@ static mfp_cfg_t viper_pin_config[] __initdata = { GPIO80_nCS_4, GPIO33_nCS_5, +/* AC97 */ +GPIO28_AC97_BITCLK , +GPIO29_AC97_SDATA_IN_0 , +GPIO30_AC97_SDATA_OUT , +GPIO31_AC97_SYNC , +/* FP Backlight */ GPIO9_GPIO ,/* VIPER_BCKLIGHT_EN_GPIO */ GPIO10_GPIO, /* VIPER_LCD_EN_GPIO */
arch/arm/mach-pxa/zeus.c +6 -0
@@ -686,6 +686,12 @@ static struct i2c_board_info __initdata zeus_i2c_devices[] = { };static mfp_cfg_t zeus_pin_config[]__initdata = { +/* AC97 */ +GPIO28_AC97_BITCLK , +GPIO29_AC97_SDATA_IN_0 , +GPIO30_AC97_SDATA_OUT , +GPIO31_AC97_SYNC , + GPIO15_nCS_1, GPIO78_nCS_2, GPIO80_nCS_4,
Signature · 1 line
1.6.3.3
PATCH 10/16 pxa: remove now unnecessary pxa_gpio_mode() calls in ac97
In reply to Eric MiaoNow most (if not all) PXA platforms have been switched to the new MFP API, it's rather safe to remove these unnecessary pxa_gpio_mode() calls in pxa2xx-ac97-lib.c now.
--- sound/arm/pxa2xx-ac97-lib.c | 8 -------- 1 files changed, 0 insertions(+), 8 deletions(-)
sound/arm/pxa2xx-ac97-lib.c +0 -8
@@ -22,7 +22,6 @@#include <asm/irq.h> #include <mach/regs-ac97.h> -#include <mach/pxa2xx-gpio.h> #include <mach/audio.h> static DEFINE_MUTEX (car_mutex);
@@ -338,13 +337,6 @@ int __devinit pxa2xx_ac97_hw_probe(struct platform_device *dev) reset_gpio =113 ; } -if (cpu_is_pxa25x () ||cpu_is_pxa27x ()) { -pxa_gpio_mode (GPIO31_SYNC_AC97_MD ); -pxa_gpio_mode (GPIO30_SDATA_OUT_AC97_MD ); -pxa_gpio_mode (GPIO28_BITCLK_AC97_MD ); -pxa_gpio_mode (GPIO29_SDATA_IN_AC97_MD ); - } -if (cpu_is_pxa27x ()) {/* Use GPIO 113 as AC97 Reset on Bulverde */ pxa27x_assert_ac97reset (reset_gpio,0 );
Signature · 1 line
1.6.3.3
PATCH 11/16 gpio: introduce gpio_request_one() and friends
In reply to Eric Miaogpio_request() without initial configuration of the GPIO is normally useless, introduce gpio_request_one() together with GPIOF_ flags for input/output direction and initial output level.
gpio_{request,free}_array() for multiple GPIOs.
--- drivers/gpio/gpiolib.c | 42 ++++++++++++++++++++++++++++++++++++++++++ include/asm-generic/gpio.h | 20 ++++++++++++++++++++ 2 files changed, 62 insertions(+), 0 deletions(-)
drivers/gpio/gpiolib.c +42 -0
@@ -1239,6 +1239,48 @@ void gpio_free(unsigned gpio) }EXPORT_SYMBOL_GPL (gpio_free); +int gpio_request_one (unsigned gpio,unsigned long flags,const char *label) +{ +int err; + + err =gpio_request (gpio, label); +if (err) +return err; + +if (flags &GPIOF_DIR_IN ) + err =gpio_direction_input (gpio); +else + err =gpio_direction_output (gpio, + (flags &GPIOF_INIT_HIGH ) ?1 :0 ); + +return err; +} +EXPORT_SYMBOL_GPL (gpio_request_one); + +int gpio_request_array (struct gpio *array,size_t num) +{ +int i, err; + +for (i =0 ; i < num; i++, array++) { + err =gpio_request_one (array->gpio, array->flags, array->label); +if (err) + goto err_free; + } +return 0 ; + +err_free: +while (i--) +gpio_free ((--array)->gpio); +return err; +} +EXPORT_SYMBOL_GPL (gpio_request_array); + +void gpio_free_array (struct gpio *array,size_t num) +{ +while (num--) +gpio_free ((array++)->gpio); +} +EXPORT_SYMBOL_GPL (gpio_free_array);/** * gpiochip_is_requested - return string iff signal was requested
include/asm-generic/gpio.h +20 -0
@@ -136,6 +136,26 @@ extern int __gpio_cansleep(unsigned gpio);extern int __gpio_to_irq (unsigned gpio); +#define GPIOF_DIR_OUT (0 << 0) +#define GPIOF_DIR_IN (1 << 0) + +#define GPIOF_INIT_LOW (0 << 1) +#define GPIOF_INIT_HIGH (1 << 1) + +#define GPIOF_IN (GPIOF_DIR_IN) +#define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW) +#define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH) + +struct gpio { +unsigned gpio; +unsigned long flags; +const char *label; +}; + +extern int gpio_request_one (unsigned gpio,unsigned long flags,const char *label); +extern int gpio_request_array (struct gpio *array,size_t num); +extern void gpio_free_array (struct gpio *array,size_t num); +#ifdef CONFIG_GPIO_SYSFS /*
Signature · 1 line
1.6.3.3
PATCH 12/16 pxa/corgi: use generic GPIO API and remove pxa_gpio_mode()
In reply to Eric Miao--- arch/arm/mach-pxa/corgi.c | 8 ++++++-- arch/arm/mach-pxa/corgi_pm.c | 38 +++++++++++++++++++------------------- 2 files changed, 25 insertions(+), 21 deletions(-)
arch/arm/mach-pxa/corgi.c +6 -2
@@ -130,11 +130,15 @@ static unsigned long corgi_pin_config[] __initdata = {/* GPIO */ GPIO9_GPIO ,/* CORGI_GPIO_nSD_DETECT */ GPIO7_GPIO ,/* CORGI_GPIO_nSD_WP */ -GPIO33_GPIO ,/* CORGI_GPIO_SD_PWR */ +GPIO21_GPIO ,/* CORGI_GPIO_ADC_TEMP */ GPIO22_GPIO ,/* CORGI_GPIO_IR_ON */ +GPIO33_GPIO ,/* CORGI_GPIO_SD_PWR */ +GPIO38_GPIO ,/* CORGI_GPIO_CHRG_ON */ +GPIO43_GPIO ,/* CORGI_GPIO_CHRG_UKN */ GPIO44_GPIO ,/* CORGI_GPIO_HSYNC */ - GPIO1_GPIO | WAKEUP_ON_EDGE_RISE, +GPIO0_GPIO |WAKEUP_ON_EDGE_BOTH ,/* CORGI_GPIO_KEY_INT */ + GPIO1_GPIO | WAKEUP_ON_EDGE_RISE, /* CORGI_GPIO_AC_IN */ };/*
arch/arm/mach-pxa/corgi_pm.c +19 -19
@@ -14,6 +14,7 @@#include <linux/init.h> #include <linux/kernel.h> #include <linux/delay.h> +#include <linux/gpio.h> #include <linux/interrupt.h> #include <linux/platform_device.h> #include <linux/apm-emulation.h>
@@ -25,7 +26,8 @@#include <mach/sharpsl.h> #include <mach/corgi.h> #include <mach/pxa2xx-regs.h> -#include <mach/pxa2xx-gpio.h> + +#include "generic.h" #include "sharpsl.h" #define SHARPSL_CHARGE_ON_VOLT 0x99/* 2.9V */
@@ -35,44 +37,42 @@#define SHARPSL_FATAL_ACIN_VOLT 182/* 3.45V */ #define SHARPSL_FATAL_NOACIN_VOLT 170/* 3.40V */ +static struct gpio charger_gpios[] = { + {CORGI_GPIO_ADC_TEMP_ON ,GPIOF_OUT_INIT_LOW ,"ADC Temp On" }, + {CORGI_GPIO_CHRG_ON ,GPIOF_OUT_INIT_LOW ,"Charger On" }, + {CORGI_GPIO_CHRG_UKN ,GPIOF_OUT_INIT_LOW ,"Charger Unknown" }, + {CORGI_GPIO_KEY_INT ,GPIOF_IN ,"Key Interrupt" }, +}; +static void corgi_charger_init (void ) { -pxa_gpio_mode (CORGI_GPIO_ADC_TEMP_ON |GPIO_OUT ); -pxa_gpio_mode (CORGI_GPIO_CHRG_ON |GPIO_OUT ); -pxa_gpio_mode (CORGI_GPIO_CHRG_UKN |GPIO_OUT ); -pxa_gpio_mode (CORGI_GPIO_KEY_INT |GPIO_IN ); +gpio_request_array (ARRAY_AND_SIZE (charger_gpios)); }static void corgi_measure_temp (int on) { -if (on) -GPSR (CORGI_GPIO_ADC_TEMP_ON ) =GPIO_bit (CORGI_GPIO_ADC_TEMP_ON ); -else -GPCR (CORGI_GPIO_ADC_TEMP_ON ) =GPIO_bit (CORGI_GPIO_ADC_TEMP_ON ); +gpio_set_value (CORGI_GPIO_ADC_TEMP_ON , on); }static void corgi_charge (int on) {if (on) {if (machine_is_corgi () && (sharpsl_pm.flags &SHARPSL_SUSPENDED )) { -GPCR (CORGI_GPIO_CHRG_ON ) =GPIO_bit (CORGI_GPIO_CHRG_ON ); -GPSR (CORGI_GPIO_CHRG_UKN ) =GPIO_bit (CORGI_GPIO_CHRG_UKN ); +gpio_set_value (CORGI_GPIO_CHRG_ON ,0 ); +gpio_set_value (CORGI_GPIO_CHRG_UKN ,1 ); }else { -GPSR (CORGI_GPIO_CHRG_ON ) =GPIO_bit (CORGI_GPIO_CHRG_ON ); -GPCR (CORGI_GPIO_CHRG_UKN ) =GPIO_bit (CORGI_GPIO_CHRG_UKN ); +gpio_set_value (CORGI_GPIO_CHRG_ON ,1 ); +gpio_set_value (CORGI_GPIO_CHRG_UKN ,0 ); } }else { -GPCR (CORGI_GPIO_CHRG_ON ) =GPIO_bit (CORGI_GPIO_CHRG_ON ); -GPCR (CORGI_GPIO_CHRG_UKN ) =GPIO_bit (CORGI_GPIO_CHRG_UKN ); +gpio_set_value (CORGI_GPIO_CHRG_ON ,0 ); +gpio_set_value (CORGI_GPIO_CHRG_UKN ,0 ); } }static void corgi_discharge (int on) { -if (on) -GPSR (CORGI_GPIO_DISCHARGE_ON ) =GPIO_bit (CORGI_GPIO_DISCHARGE_ON ); -else -GPCR (CORGI_GPIO_DISCHARGE_ON ) =GPIO_bit (CORGI_GPIO_DISCHARGE_ON ); +gpio_set_value (CORGI_GPIO_DISCHARGE_ON , on); }static void corgi_presuspend (void )
Signature · 1 line
1.6.3.3
PATCH 13/16 pxa/spitz: use generic GPIO API and remove pxa_gpio_mode()
In reply to Eric MiaoREVISIT: change to GPIO18 is ugly, need to make sure whether that's really necessary - GPIO18_RDY as an VLIO input signal - we don't normally need to do such kind of trick during low power mode.
--- arch/arm/mach-pxa/spitz.c | 4 +++- arch/arm/mach-pxa/spitz_pm.c | 28 +++++++++++++++++++++------- 2 files changed, 24 insertions(+), 8 deletions(-)
arch/arm/mach-pxa/spitz.c +3 -1
@@ -86,6 +86,7 @@ static unsigned long spitz_pin_config[] __initdata = {/* GPIOs */ GPIO9_GPIO ,/* SPITZ_GPIO_nSD_DETECT */ +GPIO16_GPIO ,/* SPITZ_GPIO_SYNC */ GPIO81_GPIO ,/* SPITZ_GPIO_nSD_WP */ GPIO41_GPIO ,/* SPITZ_GPIO_USB_CONNECT */ GPIO37_GPIO, /* SPITZ_GPIO_USB_HOST */
@@ -119,7 +120,8 @@ static unsigned long spitz_pin_config[] __initdata = {GPIO117_I2C_SCL ,GPIO118_I2C_SDA , - GPIO1_GPIO | WAKEUP_ON_EDGE_RISE, +GPIO0_GPIO |WAKEUP_ON_EDGE_RISE ,/* SPITZ_GPIO_KEY_INT */ + GPIO1_GPIO | WAKEUP_ON_EDGE_FALL, /* SPITZ_GPIO_RESET */ };/*
arch/arm/mach-pxa/spitz_pm.c +21 -7
@@ -24,9 +24,10 @@#include <mach/sharpsl.h> #include <mach/spitz.h> -#include <mach/pxa2xx-regs.h> -#include <mach/pxa2xx-gpio.h> +#include <mach/pxa27x.h> +#include "sharpsl.h" +#include "generic.h" #define SHARPSL_CHARGE_ON_VOLT 0x99/* 2.9V */ #define SHARPSL_CHARGE_ON_TEMP 0xe0/* 2.9V */
@@ -37,10 +38,17 @@static int spitz_last_ac_status; +static struct gpio spitz_charger_gpios[] = { + {SPITZ_GPIO_KEY_INT ,GPIOF_IN ,"Keyboard Interrupt" }, + {SPITZ_GPIO_SYNC ,GPIOF_IN ,"Sync" }, + {SPITZ_GPIO_ADC_TEMP_ON ,GPIOF_OUT_INIT_LOW ,"ADC Temp On" }, + {SPITZ_GPIO_JK_B ,GPIOF_OUT_INIT_LOW ,"JK B" }, + {SPITZ_GPIO_CHRG_ON ,GPIOF_OUT_INIT_LOW ,"Charger On" }, +}; +static void spitz_charger_init (void ) { -pxa_gpio_mode (SPITZ_GPIO_KEY_INT |GPIO_IN ); -pxa_gpio_mode (SPITZ_GPIO_SYNC |GPIO_IN ); +gpio_request_array (ARRAY_AND_SIZE (spitz_charger_gpios)); }static void spitz_measure_temp (int on)
@@ -76,6 +84,11 @@ static void spitz_discharge1(int on)gpio_set_value (SPITZ_GPIO_LED_GREEN , on); } +static unsigned long gpio18_config[] = { +GPIO18_RDY , +GPIO18_GPIO , +}; +static void spitz_presuspend (void ) { spitz_last_ac_status = sharpsl_pm.machinfo->read_devdata (SHARPSL_STATUS_ACIN );
@@ -97,7 +110,9 @@ static void spitz_presuspend(void)PGSR3 &= ~SPITZ_GPIO_G3_STROBE_BIT ;PGSR2 |=GPIO_bit (SPITZ_GPIO_KEY_STROBE0 ); -pxa_gpio_mode (GPIO18_RDY |GPIO_OUT |GPIO_DFLT_HIGH ); +pxa2xx_mfp_config (&gpio18_config[0 ],1 ); +gpio_request_one (18 ,GPIOF_OUT_INIT_HIGH ,"Unknown" ); +gpio_free (18 );PRER =GPIO_bit (SPITZ_GPIO_KEY_INT );PFER =GPIO_bit (SPITZ_GPIO_KEY_INT ) |GPIO_bit (SPITZ_GPIO_RESET );
@@ -114,8 +129,7 @@ static void spitz_presuspend(void)static void spitz_postsuspend (void ) { -pxa_gpio_mode (GPIO18_RDY_MD ); -pxa_gpio_mode (10 |GPIO_IN ); +pxa2xx_mfp_config (&gpio18_config[1 ],1 ); }static int spitz_should_wakeup (unsigned int resume_on_alarm)
Signature · 1 line
1.6.3.3
PATCH 14/16 pxa: fix irq suspend/resume for pxa25x
In reply to Eric MiaoPXA25x does not have IPR registers, saving and restoring should happen only for pxa27x and pxa3xx.
--- arch/arm/mach-pxa/irq.c | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-)
arch/arm/mach-pxa/irq.c +10 -4
@@ -164,8 +164,11 @@ static int pxa_irq_suspend(struct sys_device *dev, pm_message_t state) saved_icmr[i] =_ICMR (irq);_ICMR (irq) =0 ; } -for (i =0 ; i < pxa_internal_irq_nr; i++) - saved_ipr[i] =IPR (i); + +if (cpu_is_pxa27x () ||cpu_is_pxa3xx ()) { +for (i =0 ; i < pxa_internal_irq_nr; i++) + saved_ipr[i] =IPR (i); + }return 0 ; }
@@ -174,12 +177,15 @@ static int pxa_irq_resume(struct sys_device *dev) {int i, irq =PXA_IRQ (0 ); +if (cpu_is_pxa27x () ||cpu_is_pxa3xx ()) { +for (i =0 ; i < pxa_internal_irq_nr; i++) +IPR (i) = saved_ipr[i]; + } +for (i =0 ; irq <PXA_IRQ (pxa_internal_irq_nr); i++, irq +=32 ) {_ICMR (irq) = saved_icmr[i];_ICLR (irq) =0 ; } -for (i =0 ; i < pxa_internal_irq_nr; i++) -IPR (i) = saved_ipr[i];ICCR =1 ;return 0 ;
Signature · 1 line
1.6.3.3
PATCH 15/16 pxa: add MFP_LPM_KEEP_OUTPUT flag to pin config
In reply to Eric MiaoSome pins are expected to keep their last level during suspend, and introduce MFP_LPM_KEEP_OUTPUT for this.
--- arch/arm/mach-pxa/include/mach/mfp-pxa2xx.h | 2 ++ arch/arm/mach-pxa/mfp-pxa2xx.c | 11 +++++++++++ 2 files changed, 13 insertions(+), 0 deletions(-)
arch/arm/mach-pxa/include/mach/mfp-pxa2xx.h +2 -0
@@ -25,6 +25,8 @@#define MFP_DIR (x) (((x) >> 23) & 0x1)#define MFP_LPM_CAN_WAKEUP (0x1 << 24) +#define MFP_LPM_KEEP_OUTPUT (0x1 << 25) +#define WAKEUP_ON_EDGE_RISE (MFP_LPM_CAN_WAKEUP | MFP_LPM_EDGE_RISE)#define WAKEUP_ON_EDGE_FALL (MFP_LPM_CAN_WAKEUP | MFP_LPM_EDGE_FALL)#define WAKEUP_ON_EDGE_BOTH (MFP_LPM_CAN_WAKEUP | MFP_LPM_EDGE_BOTH)
arch/arm/mach-pxa/mfp-pxa2xx.c +11 -0
@@ -328,6 +328,17 @@ static int pxa2xx_mfp_suspend(struct sys_device *d, pm_message_t state) {int i; +/* set corresponding PGSR bit of those marked MFP_LPM_KEEP_OUTPUT */ +for (i =0 ; i < pxa_last_gpio; i++) { +if ((gpio_desc[i].config &MFP_LPM_KEEP_OUTPUT ) && + (GPDR (i) &GPIO_bit (i))) { +if (GPLR (i) &GPIO_bit (i)) +PGSR (i) |=GPIO_bit (i); +else +PGSR (i) &= ~GPIO_bit (i); + } + } +for (i =0 ; i <=gpio_to_bank (pxa_last_gpio); i++) { saved_gafr[0 ][i] =GAFR_L (i);
Signature · 1 line
1.6.3.3
PATCH 16/16 pxa/corgi: cleanup GPIO configurations and low power mode settings
In reply to Eric Miao--- arch/arm/mach-pxa/corgi.c | 52 +++++++++++++++++++++++++---------------- arch/arm/mach-pxa/corgi_pm.c | 39 ------------------------------- 2 files changed, 32 insertions(+), 59 deletions(-)
arch/arm/mach-pxa/corgi.c +32 -20
@@ -106,18 +106,18 @@ static unsigned long corgi_pin_config[] __initdata = {GPIO8_MMC_CS0 ,/* GPIO Matrix Keypad */ -GPIO66_GPIO ,/* column 0 */ -GPIO67_GPIO ,/* column 1 */ -GPIO68_GPIO ,/* column 2 */ -GPIO69_GPIO ,/* column 3 */ -GPIO70_GPIO ,/* column 4 */ -GPIO71_GPIO ,/* column 5 */ -GPIO72_GPIO ,/* column 6 */ -GPIO73_GPIO ,/* column 7 */ -GPIO74_GPIO ,/* column 8 */ -GPIO75_GPIO ,/* column 9 */ -GPIO76_GPIO ,/* column 10 */ -GPIO77_GPIO ,/* column 11 */ +GPIO66_GPIO |MFP_LPM_DRIVE_HIGH ,/* column 0 */ +GPIO67_GPIO |MFP_LPM_DRIVE_HIGH ,/* column 1 */ +GPIO68_GPIO |MFP_LPM_DRIVE_HIGH ,/* column 2 */ +GPIO69_GPIO |MFP_LPM_DRIVE_HIGH ,/* column 3 */ +GPIO70_GPIO |MFP_LPM_DRIVE_HIGH ,/* column 4 */ +GPIO71_GPIO |MFP_LPM_DRIVE_HIGH ,/* column 5 */ +GPIO72_GPIO |MFP_LPM_DRIVE_HIGH ,/* column 6 */ +GPIO73_GPIO |MFP_LPM_DRIVE_HIGH ,/* column 7 */ +GPIO74_GPIO |MFP_LPM_DRIVE_HIGH ,/* column 8 */ +GPIO75_GPIO |MFP_LPM_DRIVE_HIGH ,/* column 9 */ +GPIO76_GPIO |MFP_LPM_DRIVE_HIGH ,/* column 10 */ +GPIO77_GPIO |MFP_LPM_DRIVE_HIGH ,/* column 11 */ GPIO58_GPIO ,/* row 0 */ GPIO59_GPIO ,/* row 1 */ GPIO60_GPIO, /* row 2 */
@@ -128,17 +128,20 @@ static unsigned long corgi_pin_config[] __initdata = {GPIO65_GPIO ,/* row 7 */ /* GPIO */ -GPIO9_GPIO ,/* CORGI_GPIO_nSD_DETECT */ -GPIO7_GPIO ,/* CORGI_GPIO_nSD_WP */ -GPIO21_GPIO ,/* CORGI_GPIO_ADC_TEMP */ -GPIO22_GPIO ,/* CORGI_GPIO_IR_ON */ -GPIO33_GPIO ,/* CORGI_GPIO_SD_PWR */ -GPIO38_GPIO ,/* CORGI_GPIO_CHRG_ON */ -GPIO43_GPIO ,/* CORGI_GPIO_CHRG_UKN */ -GPIO44_GPIO ,/* CORGI_GPIO_HSYNC */ +GPIO9_GPIO ,/* CORGI_GPIO_nSD_DETECT */ +GPIO7_GPIO ,/* CORGI_GPIO_nSD_WP */ +GPIO11_GPIO |WAKEUP_ON_EDGE_BOTH ,/* CORGI_GPIO_MAIN_BAT_{LOW,COVER} */ +GPIO13_GPIO |MFP_LPM_KEEP_OUTPUT ,/* CORGI_GPIO_LED_ORANGE */ +GPIO21_GPIO ,/* CORGI_GPIO_ADC_TEMP */ +GPIO22_GPIO ,/* CORGI_GPIO_IR_ON */ +GPIO33_GPIO ,/* CORGI_GPIO_SD_PWR */ +GPIO38_GPIO |MFP_LPM_KEEP_OUTPUT ,/* CORGI_GPIO_CHRG_ON */ +GPIO43_GPIO |MFP_LPM_KEEP_OUTPUT ,/* CORGI_GPIO_CHRG_UKN */ +GPIO44_GPIO ,/* CORGI_GPIO_HSYNC */ GPIO0_GPIO |WAKEUP_ON_EDGE_BOTH ,/* CORGI_GPIO_KEY_INT */ GPIO1_GPIO |WAKEUP_ON_EDGE_RISE ,/* CORGI_GPIO_AC_IN */ + GPIO3_GPIO | WAKEUP_ON_EDGE_BOTH, /* CORGI_GPIO_WAKEUP */ };/*
@@ -675,6 +678,15 @@ static void __init corgi_init(void)pxa2xx_mfp_config (ARRAY_AND_SIZE (corgi_pin_config)); +/* allow wakeup from various GPIOs */ +gpio_set_wake (CORGI_GPIO_KEY_INT ,1 ); +gpio_set_wake (CORGI_GPIO_WAKEUP ,1 ); +gpio_set_wake (CORGI_GPIO_AC_IN ,1 ); +gpio_set_wake (CORGI_GPIO_CHRG_FULL ,1 ); + +if (!machine_is_corgi ()) +gpio_set_wake (CORGI_GPIO_MAIN_BAT_LOW ,1 ); +pxa_set_ffuart_info (NULL );pxa_set_btuart_info (NULL );pxa_set_stuart_info (NULL );
arch/arm/mach-pxa/corgi_pm.c +0 -39
@@ -77,45 +77,6 @@ static void corgi_discharge(int on)static void corgi_presuspend (void ) { -int i; -unsigned long wakeup_mask; - -/* charging , so CHARGE_ON bit is HIGH during OFF. */ -if (READ_GPIO_BIT (CORGI_GPIO_CHRG_ON )) -PGSR1 |=GPIO_bit (CORGI_GPIO_CHRG_ON ); -else -PGSR1 &= ~GPIO_bit (CORGI_GPIO_CHRG_ON ); - -if (READ_GPIO_BIT (CORGI_GPIO_LED_ORANGE )) -PGSR0 |=GPIO_bit (CORGI_GPIO_LED_ORANGE ); -else -PGSR0 &= ~GPIO_bit (CORGI_GPIO_LED_ORANGE ); - -if (READ_GPIO_BIT (CORGI_GPIO_CHRG_UKN )) -PGSR1 |=GPIO_bit (CORGI_GPIO_CHRG_UKN ); -else -PGSR1 &= ~GPIO_bit (CORGI_GPIO_CHRG_UKN ); - -/* Resume on keyboard power key */ -PGSR2 = (PGSR2 & ~CORGI_GPIO_ALL_STROBE_BIT ) |CORGI_GPIO_STROBE_BIT (0 ); - - wakeup_mask =GPIO_bit (CORGI_GPIO_KEY_INT ) |GPIO_bit (CORGI_GPIO_WAKEUP ) |GPIO_bit (CORGI_GPIO_AC_IN ) |GPIO_bit (CORGI_GPIO_CHRG_FULL ); - -if (!machine_is_corgi ()) - wakeup_mask |=GPIO_bit (CORGI_GPIO_MAIN_BAT_LOW ); - -PWER = wakeup_mask |PWER_RTC ; -PRER = wakeup_mask; -PFER = wakeup_mask; - -for (i =0 ; i <=15 ; i++) { -if (PRER &PFER &GPIO_bit (i)) { -if (GPLR0 &GPIO_bit (i) ) -PRER &= ~GPIO_bit (i); -else -PFER &= ~GPIO_bit (i); - } - } }static void corgi_postsuspend (void )
Signature · 1 line
1.6.3.3