diff options
author | Kevin Hilman <khilman@ti.com> | 2011-04-22 17:37:16 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@ti.com> | 2011-06-16 14:14:13 -0400 |
commit | e5ff4440cf5206fbb99d9a354ed9024eb3da047d (patch) | |
tree | 79a085d5f2e99deb9a71d018c12738e247d23846 | |
parent | 9942da0e4b037a852b230208410141768d473deb (diff) |
gpio/omap: cleanup show revision, remove cpu_is checks, display only once
Remove cpu_is_* checks from gpio_show_revision() by passing in the
revision address offset from platform data. SoCs with no revision
register (15xx, 7xx, and all MPUIOs) use -1 (actually, USHRT_MAX) to
signify no register.
While here, all GPIO banks are assumed to be the same revision, so fix
show_revision() to only show the revision for the first bank it finds.
This removes duplicate GPIO revision prints during boot.
Thanks to Charulatha V <charu@ti.com> for finding/fixing a few -1s
that were missed in the original patch.
Signed-off-by: Kevin Hilman <khilman@ti.com>
-rw-r--r-- | arch/arm/mach-omap1/gpio15xx.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-omap1/gpio16xx.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-omap1/gpio7xx.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-omap2/gpio.c | 2 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/gpio.h | 1 | ||||
-rw-r--r-- | drivers/gpio/gpio-omap.c | 14 |
6 files changed, 15 insertions, 8 deletions
diff --git a/arch/arm/mach-omap1/gpio15xx.c b/arch/arm/mach-omap1/gpio15xx.c index 91756245e860..f79c6aef11af 100644 --- a/arch/arm/mach-omap1/gpio15xx.c +++ b/arch/arm/mach-omap1/gpio15xx.c | |||
@@ -35,6 +35,7 @@ static struct __initdata resource omap15xx_mpu_gpio_resources[] = { | |||
35 | }; | 35 | }; |
36 | 36 | ||
37 | static struct omap_gpio_reg_offs omap15xx_mpuio_regs = { | 37 | static struct omap_gpio_reg_offs omap15xx_mpuio_regs = { |
38 | .revision = USHRT_MAX, | ||
38 | .direction = OMAP_MPUIO_IO_CNTL, | 39 | .direction = OMAP_MPUIO_IO_CNTL, |
39 | .datain = OMAP_MPUIO_INPUT_LATCH, | 40 | .datain = OMAP_MPUIO_INPUT_LATCH, |
40 | .dataout = OMAP_MPUIO_OUTPUT, | 41 | .dataout = OMAP_MPUIO_OUTPUT, |
@@ -75,6 +76,7 @@ static struct __initdata resource omap15xx_gpio_resources[] = { | |||
75 | }; | 76 | }; |
76 | 77 | ||
77 | static struct omap_gpio_reg_offs omap15xx_gpio_regs = { | 78 | static struct omap_gpio_reg_offs omap15xx_gpio_regs = { |
79 | .revision = USHRT_MAX, | ||
78 | .direction = OMAP1510_GPIO_DIR_CONTROL, | 80 | .direction = OMAP1510_GPIO_DIR_CONTROL, |
79 | .datain = OMAP1510_GPIO_DATA_INPUT, | 81 | .datain = OMAP1510_GPIO_DATA_INPUT, |
80 | .dataout = OMAP1510_GPIO_DATA_OUTPUT, | 82 | .dataout = OMAP1510_GPIO_DATA_OUTPUT, |
diff --git a/arch/arm/mach-omap1/gpio16xx.c b/arch/arm/mach-omap1/gpio16xx.c index a6d4a71ea4af..c69b3b104286 100644 --- a/arch/arm/mach-omap1/gpio16xx.c +++ b/arch/arm/mach-omap1/gpio16xx.c | |||
@@ -38,6 +38,7 @@ static struct __initdata resource omap16xx_mpu_gpio_resources[] = { | |||
38 | }; | 38 | }; |
39 | 39 | ||
40 | static struct omap_gpio_reg_offs omap16xx_mpuio_regs = { | 40 | static struct omap_gpio_reg_offs omap16xx_mpuio_regs = { |
41 | .revision = USHRT_MAX, | ||
41 | .direction = OMAP_MPUIO_IO_CNTL, | 42 | .direction = OMAP_MPUIO_IO_CNTL, |
42 | .datain = OMAP_MPUIO_INPUT_LATCH, | 43 | .datain = OMAP_MPUIO_INPUT_LATCH, |
43 | .dataout = OMAP_MPUIO_OUTPUT, | 44 | .dataout = OMAP_MPUIO_OUTPUT, |
@@ -78,6 +79,7 @@ static struct __initdata resource omap16xx_gpio1_resources[] = { | |||
78 | }; | 79 | }; |
79 | 80 | ||
80 | static struct omap_gpio_reg_offs omap16xx_gpio_regs = { | 81 | static struct omap_gpio_reg_offs omap16xx_gpio_regs = { |
82 | .revision = OMAP1610_GPIO_REVISION, | ||
81 | .direction = OMAP1610_GPIO_DIRECTION, | 83 | .direction = OMAP1610_GPIO_DIRECTION, |
82 | .set_dataout = OMAP1610_GPIO_SET_DATAOUT, | 84 | .set_dataout = OMAP1610_GPIO_SET_DATAOUT, |
83 | .clr_dataout = OMAP1610_GPIO_CLEAR_DATAOUT, | 85 | .clr_dataout = OMAP1610_GPIO_CLEAR_DATAOUT, |
diff --git a/arch/arm/mach-omap1/gpio7xx.c b/arch/arm/mach-omap1/gpio7xx.c index 12bcd9f2864a..d7f2ad3e6ac7 100644 --- a/arch/arm/mach-omap1/gpio7xx.c +++ b/arch/arm/mach-omap1/gpio7xx.c | |||
@@ -40,6 +40,7 @@ static struct __initdata resource omap7xx_mpu_gpio_resources[] = { | |||
40 | }; | 40 | }; |
41 | 41 | ||
42 | static struct omap_gpio_reg_offs omap7xx_mpuio_regs = { | 42 | static struct omap_gpio_reg_offs omap7xx_mpuio_regs = { |
43 | .revision = USHRT_MAX, | ||
43 | .direction = OMAP_MPUIO_IO_CNTL / 2, | 44 | .direction = OMAP_MPUIO_IO_CNTL / 2, |
44 | .datain = OMAP_MPUIO_INPUT_LATCH / 2, | 45 | .datain = OMAP_MPUIO_INPUT_LATCH / 2, |
45 | .dataout = OMAP_MPUIO_OUTPUT / 2, | 46 | .dataout = OMAP_MPUIO_OUTPUT / 2, |
@@ -80,6 +81,7 @@ static struct __initdata resource omap7xx_gpio1_resources[] = { | |||
80 | }; | 81 | }; |
81 | 82 | ||
82 | static struct omap_gpio_reg_offs omap7xx_gpio_regs = { | 83 | static struct omap_gpio_reg_offs omap7xx_gpio_regs = { |
84 | .revision = USHRT_MAX, | ||
83 | .direction = OMAP7XX_GPIO_DIR_CONTROL, | 85 | .direction = OMAP7XX_GPIO_DIR_CONTROL, |
84 | .datain = OMAP7XX_GPIO_DATA_INPUT, | 86 | .datain = OMAP7XX_GPIO_DATA_INPUT, |
85 | .dataout = OMAP7XX_GPIO_DATA_OUTPUT, | 87 | .dataout = OMAP7XX_GPIO_DATA_OUTPUT, |
diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c index 316d930651f1..9a46d7773a48 100644 --- a/arch/arm/mach-omap2/gpio.c +++ b/arch/arm/mach-omap2/gpio.c | |||
@@ -71,6 +71,7 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused) | |||
71 | case 0: | 71 | case 0: |
72 | case 1: | 72 | case 1: |
73 | pdata->bank_type = METHOD_GPIO_24XX; | 73 | pdata->bank_type = METHOD_GPIO_24XX; |
74 | pdata->regs->revision = OMAP24XX_GPIO_REVISION; | ||
74 | pdata->regs->direction = OMAP24XX_GPIO_OE; | 75 | pdata->regs->direction = OMAP24XX_GPIO_OE; |
75 | pdata->regs->datain = OMAP24XX_GPIO_DATAIN; | 76 | pdata->regs->datain = OMAP24XX_GPIO_DATAIN; |
76 | pdata->regs->dataout = OMAP24XX_GPIO_DATAOUT; | 77 | pdata->regs->dataout = OMAP24XX_GPIO_DATAOUT; |
@@ -86,6 +87,7 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused) | |||
86 | break; | 87 | break; |
87 | case 2: | 88 | case 2: |
88 | pdata->bank_type = METHOD_GPIO_44XX; | 89 | pdata->bank_type = METHOD_GPIO_44XX; |
90 | pdata->regs->revision = OMAP4_GPIO_REVISION; | ||
89 | pdata->regs->direction = OMAP4_GPIO_OE; | 91 | pdata->regs->direction = OMAP4_GPIO_OE; |
90 | pdata->regs->datain = OMAP4_GPIO_DATAIN; | 92 | pdata->regs->datain = OMAP4_GPIO_DATAIN; |
91 | pdata->regs->dataout = OMAP4_GPIO_DATAOUT; | 93 | pdata->regs->dataout = OMAP4_GPIO_DATAOUT; |
diff --git a/arch/arm/plat-omap/include/plat/gpio.h b/arch/arm/plat-omap/include/plat/gpio.h index 7a3f067ee532..91e8de3db085 100644 --- a/arch/arm/plat-omap/include/plat/gpio.h +++ b/arch/arm/plat-omap/include/plat/gpio.h | |||
@@ -175,6 +175,7 @@ struct omap_gpio_dev_attr { | |||
175 | }; | 175 | }; |
176 | 176 | ||
177 | struct omap_gpio_reg_offs { | 177 | struct omap_gpio_reg_offs { |
178 | u16 revision; | ||
178 | u16 direction; | 179 | u16 direction; |
179 | u16 datain; | 180 | u16 datain; |
180 | u16 dataout; | 181 | u16 dataout; |
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index f212d236f908..501ca3d6a49e 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c | |||
@@ -984,19 +984,17 @@ static int gpio_2irq(struct gpio_chip *chip, unsigned offset) | |||
984 | 984 | ||
985 | static void __init omap_gpio_show_rev(struct gpio_bank *bank) | 985 | static void __init omap_gpio_show_rev(struct gpio_bank *bank) |
986 | { | 986 | { |
987 | static bool called; | ||
987 | u32 rev; | 988 | u32 rev; |
988 | 989 | ||
989 | if (cpu_is_omap16xx() && !(bank->method != METHOD_MPUIO)) | 990 | if (called || bank->regs->revision == USHRT_MAX) |
990 | rev = __raw_readw(bank->base + OMAP1610_GPIO_REVISION); | ||
991 | else if (cpu_is_omap24xx() || cpu_is_omap34xx()) | ||
992 | rev = __raw_readl(bank->base + OMAP24XX_GPIO_REVISION); | ||
993 | else if (cpu_is_omap44xx()) | ||
994 | rev = __raw_readl(bank->base + OMAP4_GPIO_REVISION); | ||
995 | else | ||
996 | return; | 991 | return; |
997 | 992 | ||
998 | printk(KERN_INFO "OMAP GPIO hardware version %d.%d\n", | 993 | rev = __raw_readw(bank->base + bank->regs->revision); |
994 | pr_info("OMAP GPIO hardware version %d.%d\n", | ||
999 | (rev >> 4) & 0x0f, rev & 0x0f); | 995 | (rev >> 4) & 0x0f, rev & 0x0f); |
996 | |||
997 | called = true; | ||
1000 | } | 998 | } |
1001 | 999 | ||
1002 | /* This lock class tells lockdep that GPIO irqs are in a different | 1000 | /* This lock class tells lockdep that GPIO irqs are in a different |