diff options
| author | David Brownell <dbrownell@users.sourceforge.net> | 2008-12-10 20:35:26 -0500 |
|---|---|---|
| committer | Tony Lindgren <tony@atomide.com> | 2008-12-10 20:35:26 -0500 |
| commit | e918edf7c2f2270dcf18cdcbdf86174a013a124e (patch) | |
| tree | 36a5d45c3795ac188e32c09b427fa67068d6cacd | |
| parent | 40e3925ba15b604c9ff87154d77a914221d11cdc (diff) | |
ARM: OMAP: switch to gpio_direction_output
More conversion to the standard GPIO interfaces: stop using
omap_set_gpio_direction() entirely, and switch over to the
gpio_direction_output() call.
Note that because gpio_direction_output() includes the initial
value, this change isn't quite transparent.
- For the call sites which defined an initial value either
before or after setting the direction, that value was used.
When that value was previously assigned afterwards, this
could eliminate a brief output glitch ... and possibly
change behavior. In a few cases (LCDs) several values
were assigned together ... those were re-arranged to match
the explicit sequence provided.
- Some call sites didn't define such a value; so I chose an
initial "off/reset" value that seemed to default to "off".
In short, files touched by this patch might notice some small
changes in startup behavior (with trivial fixes).
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Tony Lindgren <tony@atomide.com>
| -rw-r--r-- | arch/arm/mach-omap1/board-h2.c | 2 | ||||
| -rw-r--r-- | arch/arm/mach-omap1/board-palmz71.c | 3 | ||||
| -rw-r--r-- | arch/arm/mach-omap1/board-sx1.c | 11 | ||||
| -rw-r--r-- | arch/arm/mach-omap1/board-voiceblue.c | 9 | ||||
| -rw-r--r-- | arch/arm/mach-omap1/leds.c | 4 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/board-apollon.c | 3 | ||||
| -rw-r--r-- | arch/arm/plat-omap/gpio.c | 14 | ||||
| -rw-r--r-- | arch/arm/plat-omap/include/mach/gpio.h | 1 |
8 files changed, 11 insertions, 36 deletions
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c index a2914ac4a202..7329ad549a98 100644 --- a/arch/arm/mach-omap1/board-h2.c +++ b/arch/arm/mach-omap1/board-h2.c | |||
| @@ -439,7 +439,7 @@ static void __init h2_init(void) | |||
| 439 | #if defined(CONFIG_OMAP_IR) || defined(CONFIG_OMAP_IR_MODULE) | 439 | #if defined(CONFIG_OMAP_IR) || defined(CONFIG_OMAP_IR_MODULE) |
| 440 | omap_writel(omap_readl(FUNC_MUX_CTRL_A) | 7, FUNC_MUX_CTRL_A); | 440 | omap_writel(omap_readl(FUNC_MUX_CTRL_A) | 7, FUNC_MUX_CTRL_A); |
| 441 | if (!(omap_request_gpio(H2_IRDA_FIRSEL_GPIO_PIN))) { | 441 | if (!(omap_request_gpio(H2_IRDA_FIRSEL_GPIO_PIN))) { |
| 442 | omap_set_gpio_direction(H2_IRDA_FIRSEL_GPIO_PIN, 0); | 442 | gpio_direction_output(H2_IRDA_FIRSEL_GPIO_PIN, 0); |
| 443 | h2_irda_data.transceiver_mode = h2_transceiver_mode; | 443 | h2_irda_data.transceiver_mode = h2_transceiver_mode; |
| 444 | } | 444 | } |
| 445 | #endif | 445 | #endif |
diff --git a/arch/arm/mach-omap1/board-palmz71.c b/arch/arm/mach-omap1/board-palmz71.c index 5a232adaefcc..dec20104eb58 100644 --- a/arch/arm/mach-omap1/board-palmz71.c +++ b/arch/arm/mach-omap1/board-palmz71.c | |||
| @@ -323,8 +323,7 @@ palmz71_gpio_setup(int early) | |||
| 323 | { | 323 | { |
| 324 | if (early) { | 324 | if (early) { |
| 325 | /* Only set GPIO1 so we have a working serial */ | 325 | /* Only set GPIO1 so we have a working serial */ |
| 326 | gpio_set_value(1, 1); | 326 | gpio_direction_output(1, 1); |
| 327 | omap_set_gpio_direction(1, 0); | ||
| 328 | } else { | 327 | } else { |
| 329 | /* Set MMC/SD host WP pin as input */ | 328 | /* Set MMC/SD host WP pin as input */ |
| 330 | if (omap_request_gpio(PALMZ71_MMC_WP_GPIO)) { | 329 | if (omap_request_gpio(PALMZ71_MMC_WP_GPIO)) { |
diff --git a/arch/arm/mach-omap1/board-sx1.c b/arch/arm/mach-omap1/board-sx1.c index 22305270381d..93bd395b9972 100644 --- a/arch/arm/mach-omap1/board-sx1.c +++ b/arch/arm/mach-omap1/board-sx1.c | |||
| @@ -436,14 +436,9 @@ static void __init omap_sx1_init(void) | |||
| 436 | omap_request_gpio(1); /* A_IRDA_OFF */ | 436 | omap_request_gpio(1); /* A_IRDA_OFF */ |
| 437 | omap_request_gpio(11); /* A_SWITCH */ | 437 | omap_request_gpio(11); /* A_SWITCH */ |
| 438 | omap_request_gpio(15); /* A_USB_ON */ | 438 | omap_request_gpio(15); /* A_USB_ON */ |
| 439 | omap_set_gpio_direction(1, 0);/* gpio1 -> output */ | 439 | gpio_direction_output(1, 1); /*A_IRDA_OFF = 1 */ |
| 440 | omap_set_gpio_direction(11, 0);/* gpio11 -> output */ | 440 | gpio_direction_output(11, 0); /*A_SWITCH = 0 */ |
| 441 | omap_set_gpio_direction(15, 0);/* gpio15 -> output */ | 441 | gpio_direction_output(15, 0); /*A_USB_ON = 0 */ |
| 442 | /* set GPIO data */ | ||
| 443 | gpio_set_value(1, 1);/*A_IRDA_OFF = 1 */ | ||
| 444 | gpio_set_value(11, 0);/*A_SWITCH = 0 */ | ||
| 445 | gpio_set_value(15, 0);/*A_USB_ON = 0 */ | ||
| 446 | |||
| 447 | } | 442 | } |
| 448 | /*----------------------------------------*/ | 443 | /*----------------------------------------*/ |
| 449 | static void __init omap_sx1_init_irq(void) | 444 | static void __init omap_sx1_init_irq(void) |
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c index 86e73b7bffa9..43b008f639f5 100644 --- a/arch/arm/mach-omap1/board-voiceblue.c +++ b/arch/arm/mach-omap1/board-voiceblue.c | |||
| @@ -171,8 +171,7 @@ static void __init voiceblue_init(void) | |||
| 171 | omap_request_gpio(0); | 171 | omap_request_gpio(0); |
| 172 | /* smc91x reset */ | 172 | /* smc91x reset */ |
| 173 | omap_request_gpio(7); | 173 | omap_request_gpio(7); |
| 174 | omap_set_gpio_direction(7, 0); | 174 | gpio_direction_output(7, 1); |
| 175 | gpio_set_value(7, 1); | ||
| 176 | udelay(2); /* wait at least 100ns */ | 175 | udelay(2); /* wait at least 100ns */ |
| 177 | gpio_set_value(7, 0); | 176 | gpio_set_value(7, 0); |
| 178 | mdelay(50); /* 50ms until PHY ready */ | 177 | mdelay(50); /* 50ms until PHY ready */ |
| @@ -180,8 +179,7 @@ static void __init voiceblue_init(void) | |||
| 180 | omap_request_gpio(8); | 179 | omap_request_gpio(8); |
| 181 | /* 16C554 reset*/ | 180 | /* 16C554 reset*/ |
| 182 | omap_request_gpio(6); | 181 | omap_request_gpio(6); |
| 183 | omap_set_gpio_direction(6, 0); | 182 | gpio_direction_output(6, 0); |
| 184 | gpio_set_value(6, 0); | ||
| 185 | /* 16C554 interrupt pins */ | 183 | /* 16C554 interrupt pins */ |
| 186 | omap_request_gpio(12); | 184 | omap_request_gpio(12); |
| 187 | omap_request_gpio(13); | 185 | omap_request_gpio(13); |
| @@ -244,8 +242,7 @@ static int wdt_gpio_state; | |||
| 244 | 242 | ||
| 245 | void voiceblue_wdt_enable(void) | 243 | void voiceblue_wdt_enable(void) |
| 246 | { | 244 | { |
| 247 | omap_set_gpio_direction(0, 0); | 245 | gpio_direction_output(0, 0); |
| 248 | gpio_set_value(0, 0); | ||
| 249 | gpio_set_value(0, 1); | 246 | gpio_set_value(0, 1); |
| 250 | gpio_set_value(0, 0); | 247 | gpio_set_value(0, 0); |
| 251 | wdt_gpio_state = 0; | 248 | wdt_gpio_state = 0; |
diff --git a/arch/arm/mach-omap1/leds.c b/arch/arm/mach-omap1/leds.c index 6cdad93c4a00..540434e38f22 100644 --- a/arch/arm/mach-omap1/leds.c +++ b/arch/arm/mach-omap1/leds.c | |||
| @@ -48,13 +48,13 @@ omap_leds_init(void) | |||
| 48 | */ | 48 | */ |
| 49 | omap_cfg_reg(P18_1610_GPIO3); | 49 | omap_cfg_reg(P18_1610_GPIO3); |
| 50 | if (omap_request_gpio(3) == 0) | 50 | if (omap_request_gpio(3) == 0) |
| 51 | omap_set_gpio_direction(3, 0); | 51 | gpio_direction_output(3, 1); |
| 52 | else | 52 | else |
| 53 | printk(KERN_WARNING "LED: can't get GPIO3/red?\n"); | 53 | printk(KERN_WARNING "LED: can't get GPIO3/red?\n"); |
| 54 | 54 | ||
| 55 | omap_cfg_reg(MPUIO4); | 55 | omap_cfg_reg(MPUIO4); |
| 56 | if (omap_request_gpio(OMAP_MPUIO(4)) == 0) | 56 | if (omap_request_gpio(OMAP_MPUIO(4)) == 0) |
| 57 | omap_set_gpio_direction(OMAP_MPUIO(4), 0); | 57 | gpio_direction_output(OMAP_MPUIO(4), 1); |
| 58 | else | 58 | else |
| 59 | printk(KERN_WARNING "LED: can't get MPUIO4/green?\n"); | 59 | printk(KERN_WARNING "LED: can't get MPUIO4/green?\n"); |
| 60 | } | 60 | } |
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c index abc916723702..ab6b8cd23eb4 100644 --- a/arch/arm/mach-omap2/board-apollon.c +++ b/arch/arm/mach-omap2/board-apollon.c | |||
| @@ -360,8 +360,7 @@ static void __init apollon_usb_init(void) | |||
| 360 | /* DEVICE_SUSPEND */ | 360 | /* DEVICE_SUSPEND */ |
| 361 | omap_cfg_reg(P21_242X_GPIO12); | 361 | omap_cfg_reg(P21_242X_GPIO12); |
| 362 | omap_request_gpio(12); | 362 | omap_request_gpio(12); |
| 363 | omap_set_gpio_direction(12, 0); /* OUT */ | 363 | gpio_direction_output(12, 0); |
| 364 | gpio_set_value(12, 0); | ||
| 365 | } | 364 | } |
| 366 | 365 | ||
| 367 | static void __init omap_apollon_init(void) | 366 | static void __init omap_apollon_init(void) |
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index c0322b56efe9..a6dbef476035 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c | |||
| @@ -333,19 +333,6 @@ static void _set_gpio_direction(struct gpio_bank *bank, int gpio, int is_input) | |||
| 333 | __raw_writel(l, reg); | 333 | __raw_writel(l, reg); |
| 334 | } | 334 | } |
| 335 | 335 | ||
| 336 | void omap_set_gpio_direction(int gpio, int is_input) | ||
| 337 | { | ||
| 338 | struct gpio_bank *bank; | ||
| 339 | unsigned long flags; | ||
| 340 | |||
| 341 | if (check_gpio(gpio) < 0) | ||
| 342 | return; | ||
| 343 | bank = get_gpio_bank(gpio); | ||
| 344 | spin_lock_irqsave(&bank->lock, flags); | ||
| 345 | _set_gpio_direction(bank, get_gpio_index(gpio), is_input); | ||
| 346 | spin_unlock_irqrestore(&bank->lock, flags); | ||
| 347 | } | ||
| 348 | |||
| 349 | static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable) | 336 | static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable) |
| 350 | { | 337 | { |
| 351 | void __iomem *reg = bank->base; | 338 | void __iomem *reg = bank->base; |
| @@ -1741,7 +1728,6 @@ static int __init omap_gpio_sysinit(void) | |||
| 1741 | 1728 | ||
| 1742 | EXPORT_SYMBOL(omap_request_gpio); | 1729 | EXPORT_SYMBOL(omap_request_gpio); |
| 1743 | EXPORT_SYMBOL(omap_free_gpio); | 1730 | EXPORT_SYMBOL(omap_free_gpio); |
| 1744 | EXPORT_SYMBOL(omap_set_gpio_direction); | ||
| 1745 | 1731 | ||
| 1746 | arch_initcall(omap_gpio_sysinit); | 1732 | arch_initcall(omap_gpio_sysinit); |
| 1747 | 1733 | ||
diff --git a/arch/arm/plat-omap/include/mach/gpio.h b/arch/arm/plat-omap/include/mach/gpio.h index d91ba328a309..552ad0c0ac4f 100644 --- a/arch/arm/plat-omap/include/mach/gpio.h +++ b/arch/arm/plat-omap/include/mach/gpio.h | |||
| @@ -73,7 +73,6 @@ | |||
| 73 | extern int omap_gpio_init(void); /* Call from board init only */ | 73 | extern int omap_gpio_init(void); /* Call from board init only */ |
| 74 | extern int omap_request_gpio(int gpio); | 74 | extern int omap_request_gpio(int gpio); |
| 75 | extern void omap_free_gpio(int gpio); | 75 | extern void omap_free_gpio(int gpio); |
| 76 | extern void omap_set_gpio_direction(int gpio, int is_input); | ||
| 77 | extern void omap2_gpio_prepare_for_retention(void); | 76 | extern void omap2_gpio_prepare_for_retention(void); |
| 78 | extern void omap2_gpio_resume_after_retention(void); | 77 | extern void omap2_gpio_resume_after_retention(void); |
| 79 | extern void omap_set_gpio_debounce(int gpio, int enable); | 78 | extern void omap_set_gpio_debounce(int gpio, int enable); |
