aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap
diff options
context:
space:
mode:
authorDavid Brownell <dbrownell@users.sourceforge.net>2008-12-10 20:35:25 -0500
committerTony Lindgren <tony@atomide.com>2008-12-10 20:35:25 -0500
commit0b84b5ca43a9c86cfad848c135fdbf7c72af68fa (patch)
tree9eb6f9cfb74c245bdb68be9c8814778ddc2ff1f4 /arch/arm/plat-omap
parenta007b7096feea2d865ad3e7177eb8be34041bef9 (diff)
ARM: OMAP: switch to standard gpio get/set calls
This patch replaces some legacy OMAP GPIO calls with the "new" (not really, any more!) calls that work on most platforms. The calls addressed by this patch are the simple ones to get and set values ... for code that's in mainline, including the implementations of those calls. Except for the declarations and definitions of those calls, all of these changes were performed by a simple SED script. Plus, a few "if() set() else set()" branches were merged by hand. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/plat-omap')
-rw-r--r--arch/arm/plat-omap/debug-leds.c10
-rw-r--r--arch/arm/plat-omap/gpio.c21
-rw-r--r--arch/arm/plat-omap/include/mach/gpio.h2
3 files changed, 8 insertions, 25 deletions
diff --git a/arch/arm/plat-omap/debug-leds.c b/arch/arm/plat-omap/debug-leds.c
index 2f4c0cabfd34..be4eefda4767 100644
--- a/arch/arm/plat-omap/debug-leds.c
+++ b/arch/arm/plat-omap/debug-leds.c
@@ -83,8 +83,8 @@ static void h2p2_dbg_leds_event(led_event_t evt)
83 /* all leds off during suspend or shutdown */ 83 /* all leds off during suspend or shutdown */
84 84
85 if (!(machine_is_omap_perseus2() || machine_is_omap_h4())) { 85 if (!(machine_is_omap_perseus2() || machine_is_omap_h4())) {
86 omap_set_gpio_dataout(GPIO_TIMER, 0); 86 gpio_set_value(GPIO_TIMER, 0);
87 omap_set_gpio_dataout(GPIO_IDLE, 0); 87 gpio_set_value(GPIO_IDLE, 0);
88 } 88 }
89 89
90 __raw_writew(~0, &fpga->leds); 90 __raw_writew(~0, &fpga->leds);
@@ -107,7 +107,7 @@ static void h2p2_dbg_leds_event(led_event_t evt)
107 if (machine_is_omap_perseus2() || machine_is_omap_h4()) 107 if (machine_is_omap_perseus2() || machine_is_omap_h4())
108 hw_led_state ^= H2P2_DBG_FPGA_P2_LED_TIMER; 108 hw_led_state ^= H2P2_DBG_FPGA_P2_LED_TIMER;
109 else { 109 else {
110 omap_set_gpio_dataout(GPIO_TIMER, 110 gpio_set_value(GPIO_TIMER,
111 led_state & LED_TIMER_ON); 111 led_state & LED_TIMER_ON);
112 goto done; 112 goto done;
113 } 113 }
@@ -121,7 +121,7 @@ static void h2p2_dbg_leds_event(led_event_t evt)
121 if (machine_is_omap_perseus2() || machine_is_omap_h4()) 121 if (machine_is_omap_perseus2() || machine_is_omap_h4())
122 hw_led_state &= ~H2P2_DBG_FPGA_P2_LED_IDLE; 122 hw_led_state &= ~H2P2_DBG_FPGA_P2_LED_IDLE;
123 else { 123 else {
124 omap_set_gpio_dataout(GPIO_IDLE, 1); 124 gpio_set_value(GPIO_IDLE, 1);
125 goto done; 125 goto done;
126 } 126 }
127 127
@@ -131,7 +131,7 @@ static void h2p2_dbg_leds_event(led_event_t evt)
131 if (machine_is_omap_perseus2() || machine_is_omap_h4()) 131 if (machine_is_omap_perseus2() || machine_is_omap_h4())
132 hw_led_state |= H2P2_DBG_FPGA_P2_LED_IDLE; 132 hw_led_state |= H2P2_DBG_FPGA_P2_LED_IDLE;
133 else { 133 else {
134 omap_set_gpio_dataout(GPIO_IDLE, 0); 134 gpio_set_value(GPIO_IDLE, 0);
135 goto done; 135 goto done;
136 } 136 }
137 137
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index e07ab233e783..c0322b56efe9 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -407,20 +407,7 @@ static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable)
407 __raw_writel(l, reg); 407 __raw_writel(l, reg);
408} 408}
409 409
410void omap_set_gpio_dataout(int gpio, int enable) 410static int __omap_get_gpio_datain(int gpio)
411{
412 struct gpio_bank *bank;
413 unsigned long flags;
414
415 if (check_gpio(gpio) < 0)
416 return;
417 bank = get_gpio_bank(gpio);
418 spin_lock_irqsave(&bank->lock, flags);
419 _set_gpio_dataout(bank, get_gpio_index(gpio), enable);
420 spin_unlock_irqrestore(&bank->lock, flags);
421}
422
423int omap_get_gpio_datain(int gpio)
424{ 411{
425 struct gpio_bank *bank; 412 struct gpio_bank *bank;
426 void __iomem *reg; 413 void __iomem *reg;
@@ -1258,7 +1245,7 @@ static int gpio_input(struct gpio_chip *chip, unsigned offset)
1258 1245
1259static int gpio_get(struct gpio_chip *chip, unsigned offset) 1246static int gpio_get(struct gpio_chip *chip, unsigned offset)
1260{ 1247{
1261 return omap_get_gpio_datain(chip->base + offset); 1248 return __omap_get_gpio_datain(chip->base + offset);
1262} 1249}
1263 1250
1264static int gpio_output(struct gpio_chip *chip, unsigned offset, int value) 1251static int gpio_output(struct gpio_chip *chip, unsigned offset, int value)
@@ -1755,8 +1742,6 @@ static int __init omap_gpio_sysinit(void)
1755EXPORT_SYMBOL(omap_request_gpio); 1742EXPORT_SYMBOL(omap_request_gpio);
1756EXPORT_SYMBOL(omap_free_gpio); 1743EXPORT_SYMBOL(omap_free_gpio);
1757EXPORT_SYMBOL(omap_set_gpio_direction); 1744EXPORT_SYMBOL(omap_set_gpio_direction);
1758EXPORT_SYMBOL(omap_set_gpio_dataout);
1759EXPORT_SYMBOL(omap_get_gpio_datain);
1760 1745
1761arch_initcall(omap_gpio_sysinit); 1746arch_initcall(omap_gpio_sysinit);
1762 1747
@@ -1814,7 +1799,7 @@ static int dbg_gpio_show(struct seq_file *s, void *unused)
1814 continue; 1799 continue;
1815 1800
1816 irq = bank->virtual_irq_start + j; 1801 irq = bank->virtual_irq_start + j;
1817 value = omap_get_gpio_datain(gpio); 1802 value = gpio_get_value(gpio);
1818 is_in = gpio_is_input(bank, mask); 1803 is_in = gpio_is_input(bank, mask);
1819 1804
1820 if (bank_is_mpuio(bank)) 1805 if (bank_is_mpuio(bank))
diff --git a/arch/arm/plat-omap/include/mach/gpio.h b/arch/arm/plat-omap/include/mach/gpio.h
index 5f996f350c84..d91ba328a309 100644
--- a/arch/arm/plat-omap/include/mach/gpio.h
+++ b/arch/arm/plat-omap/include/mach/gpio.h
@@ -74,8 +74,6 @@ extern int omap_gpio_init(void); /* Call from board init only */
74extern int omap_request_gpio(int gpio); 74extern int omap_request_gpio(int gpio);
75extern void omap_free_gpio(int gpio); 75extern void omap_free_gpio(int gpio);
76extern void omap_set_gpio_direction(int gpio, int is_input); 76extern void omap_set_gpio_direction(int gpio, int is_input);
77extern void omap_set_gpio_dataout(int gpio, int enable);
78extern int omap_get_gpio_datain(int gpio);
79extern void omap2_gpio_prepare_for_retention(void); 77extern void omap2_gpio_prepare_for_retention(void);
80extern void omap2_gpio_resume_after_retention(void); 78extern void omap2_gpio_resume_after_retention(void);
81extern void omap_set_gpio_debounce(int gpio, int enable); 79extern void omap_set_gpio_debounce(int gpio, int enable);