aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-omap.c
diff options
context:
space:
mode:
authorCharulatha V <charu@ti.com>2011-08-30 14:32:21 -0400
committerTarun Kanti DebBarma <tarun.kanti@ti.com>2012-02-06 03:43:43 -0500
commitd0d665a896c5b9a0aa60e8bac15c270cb59aa9e7 (patch)
treede66912f404bbf0987427e4b0bfc772ebb963e3e /drivers/gpio/gpio-omap.c
parentd3901eaf1fc289e8175faa8c7c460d542b6eb7dd (diff)
gpio/omap: remove bank->method & METHOD_* macros
The only bank->type (method) used in the OMAP GPIO driver is MPUIO type as they need to be handled separately. Identify the same using a flag and remove all METHOD_* macros. mpuio_init() function is defined under #ifdefs. It is required only in case of MPUIO bank type and only when PM operations are supported by it. This is applicable only in case of OMAP16xx SoC's MPUIO GPIO bank type. For all the other cases it is a dummy function. Hence clean up the same and remove all the OMAP SoC specific #ifdefs. Signed-off-by: Charulatha V <charu@ti.com> Signed-off-by: Tarun Kanti DebBarma <tarun.kanti@ti.com> Reviewed-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Acked-by: Tony Lindgren <tony@atomide.com> Reviewed-by: Kevin Hilman <khilman@ti.com> Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'drivers/gpio/gpio-omap.c')
-rw-r--r--drivers/gpio/gpio-omap.c38
1 files changed, 6 insertions, 32 deletions
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 38beccc9e655..951d78435812 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -49,7 +49,6 @@ struct gpio_bank {
49 void __iomem *base; 49 void __iomem *base;
50 u16 irq; 50 u16 irq;
51 u16 virtual_irq_start; 51 u16 virtual_irq_start;
52 int method;
53 u32 suspend_wakeup; 52 u32 suspend_wakeup;
54 u32 saved_wakeup; 53 u32 saved_wakeup;
55 u32 non_wakeup_gpios; 54 u32 non_wakeup_gpios;
@@ -66,6 +65,7 @@ struct gpio_bank {
66 u32 mod_usage; 65 u32 mod_usage;
67 u32 dbck_enable_mask; 66 u32 dbck_enable_mask;
68 struct device *dev; 67 struct device *dev;
68 bool is_mpuio;
69 bool dbck_flag; 69 bool dbck_flag;
70 bool loses_context; 70 bool loses_context;
71 int stride; 71 int stride;
@@ -693,14 +693,6 @@ static struct irq_chip gpio_irq_chip = {
693 693
694/*---------------------------------------------------------------------*/ 694/*---------------------------------------------------------------------*/
695 695
696#ifdef CONFIG_ARCH_OMAP1
697
698#define bank_is_mpuio(bank) ((bank)->method == METHOD_MPUIO)
699
700#ifdef CONFIG_ARCH_OMAP16XX
701
702#include <linux/platform_device.h>
703
704static int omap_mpuio_suspend_noirq(struct device *dev) 696static int omap_mpuio_suspend_noirq(struct device *dev)
705{ 697{
706 struct platform_device *pdev = to_platform_device(dev); 698 struct platform_device *pdev = to_platform_device(dev);
@@ -762,23 +754,8 @@ static inline void mpuio_init(struct gpio_bank *bank)
762 (void) platform_device_register(&omap_mpuio_device); 754 (void) platform_device_register(&omap_mpuio_device);
763} 755}
764 756
765#else
766static inline void mpuio_init(struct gpio_bank *bank) {}
767#endif /* 16xx */
768
769#else
770
771#define bank_is_mpuio(bank) 0
772static inline void mpuio_init(struct gpio_bank *bank) {}
773
774#endif
775
776/*---------------------------------------------------------------------*/ 757/*---------------------------------------------------------------------*/
777 758
778/* REVISIT these are stupid implementations! replace by ones that
779 * don't switch on METHOD_* and which mostly avoid spinlocks
780 */
781
782static int gpio_input(struct gpio_chip *chip, unsigned offset) 759static int gpio_input(struct gpio_chip *chip, unsigned offset)
783{ 760{
784 struct gpio_bank *bank; 761 struct gpio_bank *bank;
@@ -899,7 +876,7 @@ static void omap_gpio_mod_init(struct gpio_bank *bank)
899 if (bank->width == 16) 876 if (bank->width == 16)
900 l = 0xffff; 877 l = 0xffff;
901 878
902 if (bank_is_mpuio(bank)) { 879 if (bank->is_mpuio) {
903 __raw_writel(l, bank->base + bank->regs->irqenable); 880 __raw_writel(l, bank->base + bank->regs->irqenable);
904 return; 881 return;
905 } 882 }
@@ -951,7 +928,6 @@ static void __devinit omap_gpio_chip_init(struct gpio_bank *bank)
951 int j; 928 int j;
952 static int gpio; 929 static int gpio;
953 930
954 bank->mod_usage = 0;
955 /* 931 /*
956 * REVISIT eventually switch from OMAP-specific gpio structs 932 * REVISIT eventually switch from OMAP-specific gpio structs
957 * over to the generic ones 933 * over to the generic ones
@@ -964,12 +940,10 @@ static void __devinit omap_gpio_chip_init(struct gpio_bank *bank)
964 bank->chip.set_debounce = gpio_debounce; 940 bank->chip.set_debounce = gpio_debounce;
965 bank->chip.set = gpio_set; 941 bank->chip.set = gpio_set;
966 bank->chip.to_irq = gpio_2irq; 942 bank->chip.to_irq = gpio_2irq;
967 if (bank_is_mpuio(bank)) { 943 if (bank->is_mpuio) {
968 bank->chip.label = "mpuio"; 944 bank->chip.label = "mpuio";
969#ifdef CONFIG_ARCH_OMAP16XX
970 if (bank->regs->wkup_en) 945 if (bank->regs->wkup_en)
971 bank->chip.dev = &omap_mpuio_device.dev; 946 bank->chip.dev = &omap_mpuio_device.dev;
972#endif
973 bank->chip.base = OMAP_MPUIO(0); 947 bank->chip.base = OMAP_MPUIO(0);
974 } else { 948 } else {
975 bank->chip.label = "gpio"; 949 bank->chip.label = "gpio";
@@ -984,7 +958,7 @@ static void __devinit omap_gpio_chip_init(struct gpio_bank *bank)
984 j < bank->virtual_irq_start + bank->width; j++) { 958 j < bank->virtual_irq_start + bank->width; j++) {
985 irq_set_lockdep_class(j, &gpio_lock_class); 959 irq_set_lockdep_class(j, &gpio_lock_class);
986 irq_set_chip_data(j, bank); 960 irq_set_chip_data(j, bank);
987 if (bank_is_mpuio(bank)) { 961 if (bank->is_mpuio) {
988 omap_mpuio_alloc_gc(bank, j, bank->width); 962 omap_mpuio_alloc_gc(bank, j, bank->width);
989 } else { 963 } else {
990 irq_set_chip(j, &gpio_irq_chip); 964 irq_set_chip(j, &gpio_irq_chip);
@@ -1028,11 +1002,11 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev)
1028 1002
1029 pdata = pdev->dev.platform_data; 1003 pdata = pdev->dev.platform_data;
1030 bank->virtual_irq_start = pdata->virtual_irq_start; 1004 bank->virtual_irq_start = pdata->virtual_irq_start;
1031 bank->method = pdata->bank_type;
1032 bank->dev = &pdev->dev; 1005 bank->dev = &pdev->dev;
1033 bank->dbck_flag = pdata->dbck_flag; 1006 bank->dbck_flag = pdata->dbck_flag;
1034 bank->stride = pdata->bank_stride; 1007 bank->stride = pdata->bank_stride;
1035 bank->width = pdata->bank_width; 1008 bank->width = pdata->bank_width;
1009 bank->is_mpuio = pdata->is_mpuio;
1036 bank->non_wakeup_gpios = pdata->non_wakeup_gpios; 1010 bank->non_wakeup_gpios = pdata->non_wakeup_gpios;
1037 bank->loses_context = pdata->loses_context; 1011 bank->loses_context = pdata->loses_context;
1038 bank->get_context_loss_count = pdata->get_context_loss_count; 1012 bank->get_context_loss_count = pdata->get_context_loss_count;
@@ -1065,7 +1039,7 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev)
1065 pm_runtime_enable(bank->dev); 1039 pm_runtime_enable(bank->dev);
1066 pm_runtime_get_sync(bank->dev); 1040 pm_runtime_get_sync(bank->dev);
1067 1041
1068 if (bank_is_mpuio(bank)) 1042 if (bank->is_mpuio)
1069 mpuio_init(bank); 1043 mpuio_init(bank);
1070 1044
1071 omap_gpio_mod_init(bank); 1045 omap_gpio_mod_init(bank);