diff options
author | Cyril Chemparathy <cyril@ti.com> | 2010-05-07 17:06:32 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@deeprootsystems.com> | 2010-05-13 13:05:22 -0400 |
commit | b8d44293952e4b32b8595d924a377351f3cd1565 (patch) | |
tree | 9d5e44f154f18ce9a5496e9f9198fd03e57c8a73 | |
parent | a6374f53405b719c767c6318fe052a6d8f32cd89 (diff) |
Davinci: gpio - use ioremap()
This patch modifies the gpio_base definition in davinci_soc_info to be a
physical address, which is then ioremap()ed by the gpio initialization
function.
Signed-off-by: Cyril Chemparathy <cyril@ti.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
-rw-r--r-- | arch/arm/mach-davinci/da830.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-davinci/da850.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-davinci/dm355.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-davinci/dm365.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-davinci/dm644x.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-davinci/dm646x.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-davinci/gpio.c | 18 | ||||
-rw-r--r-- | arch/arm/mach-davinci/include/mach/common.h | 2 |
8 files changed, 18 insertions, 14 deletions
diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c index 83879f894a21..4f5727f0dd11 100644 --- a/arch/arm/mach-davinci/da830.c +++ b/arch/arm/mach-davinci/da830.c | |||
@@ -1201,7 +1201,7 @@ static struct davinci_soc_info davinci_soc_info_da830 = { | |||
1201 | .intc_irq_num = DA830_N_CP_INTC_IRQ, | 1201 | .intc_irq_num = DA830_N_CP_INTC_IRQ, |
1202 | .timer_info = &da830_timer_info, | 1202 | .timer_info = &da830_timer_info, |
1203 | .gpio_type = GPIO_TYPE_DAVINCI, | 1203 | .gpio_type = GPIO_TYPE_DAVINCI, |
1204 | .gpio_base = IO_ADDRESS(DA8XX_GPIO_BASE), | 1204 | .gpio_base = DA8XX_GPIO_BASE, |
1205 | .gpio_num = 128, | 1205 | .gpio_num = 128, |
1206 | .gpio_irq = IRQ_DA8XX_GPIO0, | 1206 | .gpio_irq = IRQ_DA8XX_GPIO0, |
1207 | .serial_dev = &da8xx_serial_device, | 1207 | .serial_dev = &da8xx_serial_device, |
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c index 2b6dd59d72f2..cb7f66300525 100644 --- a/arch/arm/mach-davinci/da850.c +++ b/arch/arm/mach-davinci/da850.c | |||
@@ -1086,7 +1086,7 @@ static struct davinci_soc_info davinci_soc_info_da850 = { | |||
1086 | .intc_irq_num = DA850_N_CP_INTC_IRQ, | 1086 | .intc_irq_num = DA850_N_CP_INTC_IRQ, |
1087 | .timer_info = &da850_timer_info, | 1087 | .timer_info = &da850_timer_info, |
1088 | .gpio_type = GPIO_TYPE_DAVINCI, | 1088 | .gpio_type = GPIO_TYPE_DAVINCI, |
1089 | .gpio_base = IO_ADDRESS(DA8XX_GPIO_BASE), | 1089 | .gpio_base = DA8XX_GPIO_BASE, |
1090 | .gpio_num = 144, | 1090 | .gpio_num = 144, |
1091 | .gpio_irq = IRQ_DA8XX_GPIO0, | 1091 | .gpio_irq = IRQ_DA8XX_GPIO0, |
1092 | .serial_dev = &da8xx_serial_device, | 1092 | .serial_dev = &da8xx_serial_device, |
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c index 0c62a68a90a3..277041dcd9a1 100644 --- a/arch/arm/mach-davinci/dm355.c +++ b/arch/arm/mach-davinci/dm355.c | |||
@@ -855,7 +855,7 @@ static struct davinci_soc_info davinci_soc_info_dm355 = { | |||
855 | .intc_irq_num = DAVINCI_N_AINTC_IRQ, | 855 | .intc_irq_num = DAVINCI_N_AINTC_IRQ, |
856 | .timer_info = &dm355_timer_info, | 856 | .timer_info = &dm355_timer_info, |
857 | .gpio_type = GPIO_TYPE_DAVINCI, | 857 | .gpio_type = GPIO_TYPE_DAVINCI, |
858 | .gpio_base = IO_ADDRESS(DAVINCI_GPIO_BASE), | 858 | .gpio_base = DAVINCI_GPIO_BASE, |
859 | .gpio_num = 104, | 859 | .gpio_num = 104, |
860 | .gpio_irq = IRQ_DM355_GPIOBNK0, | 860 | .gpio_irq = IRQ_DM355_GPIOBNK0, |
861 | .serial_dev = &dm355_serial_device, | 861 | .serial_dev = &dm355_serial_device, |
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c index ed7645088052..ecdbc676b4dd 100644 --- a/arch/arm/mach-davinci/dm365.c +++ b/arch/arm/mach-davinci/dm365.c | |||
@@ -1060,7 +1060,7 @@ static struct davinci_soc_info davinci_soc_info_dm365 = { | |||
1060 | .intc_irq_num = DAVINCI_N_AINTC_IRQ, | 1060 | .intc_irq_num = DAVINCI_N_AINTC_IRQ, |
1061 | .timer_info = &dm365_timer_info, | 1061 | .timer_info = &dm365_timer_info, |
1062 | .gpio_type = GPIO_TYPE_DAVINCI, | 1062 | .gpio_type = GPIO_TYPE_DAVINCI, |
1063 | .gpio_base = IO_ADDRESS(DAVINCI_GPIO_BASE), | 1063 | .gpio_base = DAVINCI_GPIO_BASE, |
1064 | .gpio_num = 104, | 1064 | .gpio_num = 104, |
1065 | .gpio_irq = IRQ_DM365_GPIO0, | 1065 | .gpio_irq = IRQ_DM365_GPIO0, |
1066 | .gpio_unbanked = 8, /* really 16 ... skip muxed GPIOs */ | 1066 | .gpio_unbanked = 8, /* really 16 ... skip muxed GPIOs */ |
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c index 7f36c22a2684..beb315c04b75 100644 --- a/arch/arm/mach-davinci/dm644x.c +++ b/arch/arm/mach-davinci/dm644x.c | |||
@@ -746,7 +746,7 @@ static struct davinci_soc_info davinci_soc_info_dm644x = { | |||
746 | .intc_irq_num = DAVINCI_N_AINTC_IRQ, | 746 | .intc_irq_num = DAVINCI_N_AINTC_IRQ, |
747 | .timer_info = &dm644x_timer_info, | 747 | .timer_info = &dm644x_timer_info, |
748 | .gpio_type = GPIO_TYPE_DAVINCI, | 748 | .gpio_type = GPIO_TYPE_DAVINCI, |
749 | .gpio_base = IO_ADDRESS(DAVINCI_GPIO_BASE), | 749 | .gpio_base = DAVINCI_GPIO_BASE, |
750 | .gpio_num = 71, | 750 | .gpio_num = 71, |
751 | .gpio_irq = IRQ_GPIOBNK0, | 751 | .gpio_irq = IRQ_GPIOBNK0, |
752 | .serial_dev = &dm644x_serial_device, | 752 | .serial_dev = &dm644x_serial_device, |
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c index 8dd0afee7593..95fc981e45af 100644 --- a/arch/arm/mach-davinci/dm646x.c +++ b/arch/arm/mach-davinci/dm646x.c | |||
@@ -830,7 +830,7 @@ static struct davinci_soc_info davinci_soc_info_dm646x = { | |||
830 | .intc_irq_num = DAVINCI_N_AINTC_IRQ, | 830 | .intc_irq_num = DAVINCI_N_AINTC_IRQ, |
831 | .timer_info = &dm646x_timer_info, | 831 | .timer_info = &dm646x_timer_info, |
832 | .gpio_type = GPIO_TYPE_DAVINCI, | 832 | .gpio_type = GPIO_TYPE_DAVINCI, |
833 | .gpio_base = IO_ADDRESS(DAVINCI_GPIO_BASE), | 833 | .gpio_base = DAVINCI_GPIO_BASE, |
834 | .gpio_num = 43, /* Only 33 usable */ | 834 | .gpio_num = 43, /* Only 33 usable */ |
835 | .gpio_irq = IRQ_DM646X_GPIOBNK0, | 835 | .gpio_irq = IRQ_DM646X_GPIOBNK0, |
836 | .serial_dev = &dm646x_serial_device, | 836 | .serial_dev = &dm646x_serial_device, |
diff --git a/arch/arm/mach-davinci/gpio.c b/arch/arm/mach-davinci/gpio.c index 2efb4468ebd0..bf0ff587e46a 100644 --- a/arch/arm/mach-davinci/gpio.c +++ b/arch/arm/mach-davinci/gpio.c | |||
@@ -37,22 +37,22 @@ struct davinci_gpio_regs { | |||
37 | container_of(chip, struct davinci_gpio_controller, chip) | 37 | container_of(chip, struct davinci_gpio_controller, chip) |
38 | 38 | ||
39 | static struct davinci_gpio_controller chips[DIV_ROUND_UP(DAVINCI_N_GPIO, 32)]; | 39 | static struct davinci_gpio_controller chips[DIV_ROUND_UP(DAVINCI_N_GPIO, 32)]; |
40 | static void __iomem *gpio_base; | ||
40 | 41 | ||
41 | static struct davinci_gpio_regs __iomem __init *gpio2regs(unsigned gpio) | 42 | static struct davinci_gpio_regs __iomem __init *gpio2regs(unsigned gpio) |
42 | { | 43 | { |
43 | void __iomem *ptr; | 44 | void __iomem *ptr; |
44 | void __iomem *base = davinci_soc_info.gpio_base; | ||
45 | 45 | ||
46 | if (gpio < 32 * 1) | 46 | if (gpio < 32 * 1) |
47 | ptr = base + 0x10; | 47 | ptr = gpio_base + 0x10; |
48 | else if (gpio < 32 * 2) | 48 | else if (gpio < 32 * 2) |
49 | ptr = base + 0x38; | 49 | ptr = gpio_base + 0x38; |
50 | else if (gpio < 32 * 3) | 50 | else if (gpio < 32 * 3) |
51 | ptr = base + 0x60; | 51 | ptr = gpio_base + 0x60; |
52 | else if (gpio < 32 * 4) | 52 | else if (gpio < 32 * 4) |
53 | ptr = base + 0x88; | 53 | ptr = gpio_base + 0x88; |
54 | else if (gpio < 32 * 5) | 54 | else if (gpio < 32 * 5) |
55 | ptr = base + 0xb0; | 55 | ptr = gpio_base + 0xb0; |
56 | else | 56 | else |
57 | ptr = NULL; | 57 | ptr = NULL; |
58 | return ptr; | 58 | return ptr; |
@@ -157,6 +157,10 @@ static int __init davinci_gpio_setup(void) | |||
157 | if (WARN_ON(DAVINCI_N_GPIO < ngpio)) | 157 | if (WARN_ON(DAVINCI_N_GPIO < ngpio)) |
158 | ngpio = DAVINCI_N_GPIO; | 158 | ngpio = DAVINCI_N_GPIO; |
159 | 159 | ||
160 | gpio_base = ioremap(soc_info->gpio_base, SZ_4K); | ||
161 | if (WARN_ON(!gpio_base)) | ||
162 | return -ENOMEM; | ||
163 | |||
160 | for (i = 0, base = 0; base < ngpio; i++, base += 32) { | 164 | for (i = 0, base = 0; base < ngpio; i++, base += 32) { |
161 | chips[i].chip.label = "DaVinci"; | 165 | chips[i].chip.label = "DaVinci"; |
162 | 166 | ||
@@ -445,7 +449,7 @@ done: | |||
445 | /* BINTEN -- per-bank interrupt enable. genirq would also let these | 449 | /* BINTEN -- per-bank interrupt enable. genirq would also let these |
446 | * bits be set/cleared dynamically. | 450 | * bits be set/cleared dynamically. |
447 | */ | 451 | */ |
448 | __raw_writel(binten, soc_info->gpio_base + 0x08); | 452 | __raw_writel(binten, gpio_base + 0x08); |
449 | 453 | ||
450 | printk(KERN_INFO "DaVinci: %d gpio irqs\n", irq - gpio_to_irq(0)); | 454 | printk(KERN_INFO "DaVinci: %d gpio irqs\n", irq - gpio_to_irq(0)); |
451 | 455 | ||
diff --git a/arch/arm/mach-davinci/include/mach/common.h b/arch/arm/mach-davinci/include/mach/common.h index a58bd88ba02d..2dd2226507a7 100644 --- a/arch/arm/mach-davinci/include/mach/common.h +++ b/arch/arm/mach-davinci/include/mach/common.h | |||
@@ -60,7 +60,7 @@ struct davinci_soc_info { | |||
60 | unsigned long intc_irq_num; | 60 | unsigned long intc_irq_num; |
61 | struct davinci_timer_info *timer_info; | 61 | struct davinci_timer_info *timer_info; |
62 | int gpio_type; | 62 | int gpio_type; |
63 | void __iomem *gpio_base; | 63 | u32 gpio_base; |
64 | unsigned gpio_num; | 64 | unsigned gpio_num; |
65 | unsigned gpio_irq; | 65 | unsigned gpio_irq; |
66 | unsigned gpio_unbanked; | 66 | unsigned gpio_unbanked; |