aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-davinci
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-11 03:05:37 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-11 03:05:37 -0500
commit53575aa99dc1584484b99c8173042d8370f6ed88 (patch)
tree06fd13c8847c1e97cd5080ea31cec47c4ad54963 /arch/arm/mach-davinci
parentd5aabbcaee6bb5fb57ea8c67714516af4d8238ce (diff)
parent3316dee245ef297155fa45b8d14263dfd6a9164b (diff)
Merge tag 'drivers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM driver updates from Olof Johansson: "Updates of SoC-near drivers and other driver updates that makes more sense to take through our tree. In this case it's involved: - Some Davinci driver updates that has required corresponding platform code changes (gpio mostly) - CCI bindings and a few driver updates - Marvell mvebu patches for PCI MSI support (could have gone through the PCI tree for this release, but they were acked by Bjorn for 3.12 so we kept them through arm-soc). - Marvell dove switch-over to DT-based PCIe configuration - Misc updates for Samsung platform dmaengine drivers" * tag 'drivers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (32 commits) ARM: S3C24XX: add dma pdata for s3c2410, s3c2440 and s3c2442 dmaengine: s3c24xx-dma: add support for the s3c2410 type of controller ARM: S3C24XX: Fix possible dma selection warning PCI: mvebu: make local functions static PCI: mvebu: add I/O access wrappers PCI: mvebu: Dynamically detect if the PEX link is up to enable hot plug ARM: mvebu: fix gated clock documentation ARM: dove: remove legacy pcie and clock init ARM: dove: switch to DT probed mbus address windows ARM: SAMSUNG: set s3c24xx_dma_filter for s3c64xx-spi0 device ARM: S3C24XX: add platform-devices for new dma driver for s3c2412 and s3c2443 dmaengine: add driver for Samsung s3c24xx SoCs ARM: S3C24XX: number the dma clocks PCI: mvebu: add support for Marvell Dove SoCs PCI: mvebu: add support for reset on GPIO PCI: mvebu: remove subsys_initcall PCI: mvebu: increment nports only for registered ports PCI: mvebu: move clock enable before register access PCI: mvebu: add support for MSI irqchip: armada-370-xp: implement MSI support ...
Diffstat (limited to 'arch/arm/mach-davinci')
-rw-r--r--arch/arm/mach-davinci/board-da830-evm.c14
-rw-r--r--arch/arm/mach-davinci/board-da850-evm.c6
-rw-r--r--arch/arm/mach-davinci/board-dm355-evm.c15
-rw-r--r--arch/arm/mach-davinci/board-dm355-leopard.c14
-rw-r--r--arch/arm/mach-davinci/board-dm365-evm.c6
-rw-r--r--arch/arm/mach-davinci/board-dm644x-evm.c5
-rw-r--r--arch/arm/mach-davinci/board-dm646x-evm.c13
-rw-r--r--arch/arm/mach-davinci/board-neuros-osd2.c14
-rw-r--r--arch/arm/mach-davinci/board-omapl138-hawk.c6
-rw-r--r--arch/arm/mach-davinci/da830.c16
-rw-r--r--arch/arm/mach-davinci/da850.c16
-rw-r--r--arch/arm/mach-davinci/davinci.h7
-rw-r--r--arch/arm/mach-davinci/devices-da8xx.c26
-rw-r--r--arch/arm/mach-davinci/devices.c13
-rw-r--r--arch/arm/mach-davinci/dm355.c35
-rw-r--r--arch/arm/mach-davinci/dm365.c37
-rw-r--r--arch/arm/mach-davinci/dm644x.c30
-rw-r--r--arch/arm/mach-davinci/dm646x.c30
-rw-r--r--arch/arm/mach-davinci/include/mach/da8xx.h3
-rw-r--r--arch/arm/mach-davinci/include/mach/gpio-davinci.h91
-rw-r--r--arch/arm/mach-davinci/include/mach/gpio.h88
21 files changed, 251 insertions, 234 deletions
diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
index 30a44e2df47e..40f15f133c55 100644
--- a/arch/arm/mach-davinci/board-da830-evm.c
+++ b/arch/arm/mach-davinci/board-da830-evm.c
@@ -22,17 +22,19 @@
22#include <linux/mtd/partitions.h> 22#include <linux/mtd/partitions.h>
23#include <linux/spi/spi.h> 23#include <linux/spi/spi.h>
24#include <linux/spi/flash.h> 24#include <linux/spi/flash.h>
25#include <linux/platform_data/gpio-davinci.h>
26#include <linux/platform_data/mtd-davinci.h>
27#include <linux/platform_data/mtd-davinci-aemif.h>
28#include <linux/platform_data/spi-davinci.h>
29#include <linux/platform_data/usb-davinci.h>
25 30
26#include <asm/mach-types.h> 31#include <asm/mach-types.h>
27#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
28 33
34#include <mach/common.h>
29#include <mach/cp_intc.h> 35#include <mach/cp_intc.h>
30#include <mach/mux.h> 36#include <mach/mux.h>
31#include <linux/platform_data/mtd-davinci.h>
32#include <mach/da8xx.h> 37#include <mach/da8xx.h>
33#include <linux/platform_data/usb-davinci.h>
34#include <linux/platform_data/mtd-davinci-aemif.h>
35#include <linux/platform_data/spi-davinci.h>
36 38
37#define DA830_EVM_PHY_ID "" 39#define DA830_EVM_PHY_ID ""
38/* 40/*
@@ -591,6 +593,10 @@ static __init void da830_evm_init(void)
591 struct davinci_soc_info *soc_info = &davinci_soc_info; 593 struct davinci_soc_info *soc_info = &davinci_soc_info;
592 int ret; 594 int ret;
593 595
596 ret = da830_register_gpio();
597 if (ret)
598 pr_warn("da830_evm_init: GPIO init failed: %d\n", ret);
599
594 ret = da830_register_edma(da830_edma_rsv); 600 ret = da830_register_edma(da830_edma_rsv);
595 if (ret) 601 if (ret)
596 pr_warning("da830_evm_init: edma registration failed: %d\n", 602 pr_warning("da830_evm_init: edma registration failed: %d\n",
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index dd1fb24521aa..df16cb88a26b 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -28,6 +28,7 @@
28#include <linux/mtd/partitions.h> 28#include <linux/mtd/partitions.h>
29#include <linux/mtd/physmap.h> 29#include <linux/mtd/physmap.h>
30#include <linux/platform_device.h> 30#include <linux/platform_device.h>
31#include <linux/platform_data/gpio-davinci.h>
31#include <linux/platform_data/mtd-davinci.h> 32#include <linux/platform_data/mtd-davinci.h>
32#include <linux/platform_data/mtd-davinci-aemif.h> 33#include <linux/platform_data/mtd-davinci-aemif.h>
33#include <linux/platform_data/spi-davinci.h> 34#include <linux/platform_data/spi-davinci.h>
@@ -38,6 +39,7 @@
38#include <linux/spi/flash.h> 39#include <linux/spi/flash.h>
39#include <linux/wl12xx.h> 40#include <linux/wl12xx.h>
40 41
42#include <mach/common.h>
41#include <mach/cp_intc.h> 43#include <mach/cp_intc.h>
42#include <mach/da8xx.h> 44#include <mach/da8xx.h>
43#include <mach/mux.h> 45#include <mach/mux.h>
@@ -1437,6 +1439,10 @@ static __init void da850_evm_init(void)
1437{ 1439{
1438 int ret; 1440 int ret;
1439 1441
1442 ret = da850_register_gpio();
1443 if (ret)
1444 pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
1445
1440 ret = pmic_tps65070_init(); 1446 ret = pmic_tps65070_init();
1441 if (ret) 1447 if (ret)
1442 pr_warn("%s: TPS65070 PMIC init failed: %d\n", __func__, ret); 1448 pr_warn("%s: TPS65070 PMIC init failed: %d\n", __func__, ret);
diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c
index 42b23a3194a0..ecdc7d44fa70 100644
--- a/arch/arm/mach-davinci/board-dm355-evm.c
+++ b/arch/arm/mach-davinci/board-dm355-evm.c
@@ -22,15 +22,17 @@
22#include <media/tvp514x.h> 22#include <media/tvp514x.h>
23#include <linux/spi/spi.h> 23#include <linux/spi/spi.h>
24#include <linux/spi/eeprom.h> 24#include <linux/spi/eeprom.h>
25#include <linux/platform_data/gpio-davinci.h>
26#include <linux/platform_data/i2c-davinci.h>
27#include <linux/platform_data/mtd-davinci.h>
28#include <linux/platform_data/mmc-davinci.h>
29#include <linux/platform_data/usb-davinci.h>
25 30
26#include <asm/mach-types.h> 31#include <asm/mach-types.h>
27#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
28 33
29#include <linux/platform_data/i2c-davinci.h>
30#include <mach/serial.h> 34#include <mach/serial.h>
31#include <linux/platform_data/mtd-davinci.h> 35#include <mach/common.h>
32#include <linux/platform_data/mmc-davinci.h>
33#include <linux/platform_data/usb-davinci.h>
34 36
35#include "davinci.h" 37#include "davinci.h"
36 38
@@ -375,6 +377,11 @@ static struct spi_board_info dm355_evm_spi_info[] __initconst = {
375static __init void dm355_evm_init(void) 377static __init void dm355_evm_init(void)
376{ 378{
377 struct clk *aemif; 379 struct clk *aemif;
380 int ret;
381
382 ret = dm355_gpio_register();
383 if (ret)
384 pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
378 385
379 gpio_request(1, "dm9000"); 386 gpio_request(1, "dm9000");
380 gpio_direction_input(1); 387 gpio_direction_input(1);
diff --git a/arch/arm/mach-davinci/board-dm355-leopard.c b/arch/arm/mach-davinci/board-dm355-leopard.c
index 65a984c52df6..43bacbf15314 100644
--- a/arch/arm/mach-davinci/board-dm355-leopard.c
+++ b/arch/arm/mach-davinci/board-dm355-leopard.c
@@ -19,15 +19,16 @@
19#include <linux/clk.h> 19#include <linux/clk.h>
20#include <linux/spi/spi.h> 20#include <linux/spi/spi.h>
21#include <linux/spi/eeprom.h> 21#include <linux/spi/eeprom.h>
22#include <linux/platform_data/i2c-davinci.h>
23#include <linux/platform_data/mmc-davinci.h>
24#include <linux/platform_data/mtd-davinci.h>
25#include <linux/platform_data/usb-davinci.h>
22 26
23#include <asm/mach-types.h> 27#include <asm/mach-types.h>
24#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
25 29
26#include <linux/platform_data/i2c-davinci.h> 30#include <mach/common.h>
27#include <mach/serial.h> 31#include <mach/serial.h>
28#include <linux/platform_data/mtd-davinci.h>
29#include <linux/platform_data/mmc-davinci.h>
30#include <linux/platform_data/usb-davinci.h>
31 32
32#include "davinci.h" 33#include "davinci.h"
33 34
@@ -234,6 +235,11 @@ static struct spi_board_info dm355_leopard_spi_info[] __initconst = {
234static __init void dm355_leopard_init(void) 235static __init void dm355_leopard_init(void)
235{ 236{
236 struct clk *aemif; 237 struct clk *aemif;
238 int ret;
239
240 ret = dm355_gpio_register();
241 if (ret)
242 pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
237 243
238 gpio_request(9, "dm9000"); 244 gpio_request(9, "dm9000");
239 gpio_direction_input(9); 245 gpio_direction_input(9);
diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c
index 4078ba93776b..f4a6c18912ea 100644
--- a/arch/arm/mach-davinci/board-dm365-evm.c
+++ b/arch/arm/mach-davinci/board-dm365-evm.c
@@ -743,6 +743,12 @@ static struct spi_board_info dm365_evm_spi_info[] __initconst = {
743 743
744static __init void dm365_evm_init(void) 744static __init void dm365_evm_init(void)
745{ 745{
746 int ret;
747
748 ret = dm365_gpio_register();
749 if (ret)
750 pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
751
746 evm_init_i2c(); 752 evm_init_i2c();
747 davinci_serial_init(dm365_serial_device); 753 davinci_serial_init(dm365_serial_device);
748 754
diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
index 40bb9b5b87e8..9cc32c283b8b 100644
--- a/arch/arm/mach-davinci/board-dm644x-evm.c
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c
@@ -754,9 +754,14 @@ static int davinci_phy_fixup(struct phy_device *phydev)
754 754
755static __init void davinci_evm_init(void) 755static __init void davinci_evm_init(void)
756{ 756{
757 int ret;
757 struct clk *aemif_clk; 758 struct clk *aemif_clk;
758 struct davinci_soc_info *soc_info = &davinci_soc_info; 759 struct davinci_soc_info *soc_info = &davinci_soc_info;
759 760
761 ret = dm644x_gpio_register();
762 if (ret)
763 pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
764
760 aemif_clk = clk_get(NULL, "aemif"); 765 aemif_clk = clk_get(NULL, "aemif");
761 clk_prepare_enable(aemif_clk); 766 clk_prepare_enable(aemif_clk);
762 767
diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c
index 2bc3651d56cc..44b20191a9fe 100644
--- a/arch/arm/mach-davinci/board-dm646x-evm.c
+++ b/arch/arm/mach-davinci/board-dm646x-evm.c
@@ -33,17 +33,19 @@
33#include <linux/mtd/partitions.h> 33#include <linux/mtd/partitions.h>
34#include <linux/clk.h> 34#include <linux/clk.h>
35#include <linux/export.h> 35#include <linux/export.h>
36#include <linux/platform_data/gpio-davinci.h>
37#include <linux/platform_data/i2c-davinci.h>
38#include <linux/platform_data/mtd-davinci.h>
39#include <linux/platform_data/mtd-davinci-aemif.h>
36 40
37#include <asm/mach-types.h> 41#include <asm/mach-types.h>
38#include <asm/mach/arch.h> 42#include <asm/mach/arch.h>
39 43
40#include <mach/common.h> 44#include <mach/common.h>
45#include <mach/irqs.h>
41#include <mach/serial.h> 46#include <mach/serial.h>
42#include <linux/platform_data/i2c-davinci.h>
43#include <linux/platform_data/mtd-davinci.h>
44#include <mach/clock.h> 47#include <mach/clock.h>
45#include <mach/cdce949.h> 48#include <mach/cdce949.h>
46#include <linux/platform_data/mtd-davinci-aemif.h>
47 49
48#include "davinci.h" 50#include "davinci.h"
49#include "clock.h" 51#include "clock.h"
@@ -786,8 +788,13 @@ static struct edma_rsv_info dm646x_edma_rsv[] = {
786 788
787static __init void evm_init(void) 789static __init void evm_init(void)
788{ 790{
791 int ret;
789 struct davinci_soc_info *soc_info = &davinci_soc_info; 792 struct davinci_soc_info *soc_info = &davinci_soc_info;
790 793
794 ret = dm646x_gpio_register();
795 if (ret)
796 pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
797
791 evm_init_i2c(); 798 evm_init_i2c();
792 davinci_serial_init(dm646x_serial_device); 799 davinci_serial_init(dm646x_serial_device);
793 dm646x_init_mcasp0(&dm646x_evm_snd_data[0]); 800 dm646x_init_mcasp0(&dm646x_evm_snd_data[0]);
diff --git a/arch/arm/mach-davinci/board-neuros-osd2.c b/arch/arm/mach-davinci/board-neuros-osd2.c
index 46f336fca803..bb680af98374 100644
--- a/arch/arm/mach-davinci/board-neuros-osd2.c
+++ b/arch/arm/mach-davinci/board-neuros-osd2.c
@@ -26,17 +26,18 @@
26#include <linux/platform_device.h> 26#include <linux/platform_device.h>
27#include <linux/gpio.h> 27#include <linux/gpio.h>
28#include <linux/mtd/partitions.h> 28#include <linux/mtd/partitions.h>
29#include <linux/platform_data/gpio-davinci.h>
30#include <linux/platform_data/i2c-davinci.h>
31#include <linux/platform_data/mmc-davinci.h>
32#include <linux/platform_data/mtd-davinci.h>
33#include <linux/platform_data/usb-davinci.h>
29 34
30#include <asm/mach-types.h> 35#include <asm/mach-types.h>
31#include <asm/mach/arch.h> 36#include <asm/mach/arch.h>
32 37
33#include <mach/common.h> 38#include <mach/common.h>
34#include <linux/platform_data/i2c-davinci.h>
35#include <mach/serial.h> 39#include <mach/serial.h>
36#include <mach/mux.h> 40#include <mach/mux.h>
37#include <linux/platform_data/mtd-davinci.h>
38#include <linux/platform_data/mmc-davinci.h>
39#include <linux/platform_data/usb-davinci.h>
40 41
41#include "davinci.h" 42#include "davinci.h"
42 43
@@ -169,9 +170,14 @@ static struct davinci_mmc_config davinci_ntosd2_mmc_config = {
169 170
170static __init void davinci_ntosd2_init(void) 171static __init void davinci_ntosd2_init(void)
171{ 172{
173 int ret;
172 struct clk *aemif_clk; 174 struct clk *aemif_clk;
173 struct davinci_soc_info *soc_info = &davinci_soc_info; 175 struct davinci_soc_info *soc_info = &davinci_soc_info;
174 176
177 ret = dm644x_gpio_register();
178 if (ret)
179 pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
180
175 aemif_clk = clk_get(NULL, "aemif"); 181 aemif_clk = clk_get(NULL, "aemif");
176 clk_prepare_enable(aemif_clk); 182 clk_prepare_enable(aemif_clk);
177 183
diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c
index e0de2da41b5c..2aac51d0e853 100644
--- a/arch/arm/mach-davinci/board-omapl138-hawk.c
+++ b/arch/arm/mach-davinci/board-omapl138-hawk.c
@@ -13,10 +13,12 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/console.h> 14#include <linux/console.h>
15#include <linux/gpio.h> 15#include <linux/gpio.h>
16#include <linux/platform_data/gpio-davinci.h>
16 17
17#include <asm/mach-types.h> 18#include <asm/mach-types.h>
18#include <asm/mach/arch.h> 19#include <asm/mach/arch.h>
19 20
21#include <mach/common.h>
20#include <mach/cp_intc.h> 22#include <mach/cp_intc.h>
21#include <mach/da8xx.h> 23#include <mach/da8xx.h>
22#include <mach/mux.h> 24#include <mach/mux.h>
@@ -290,6 +292,10 @@ static __init void omapl138_hawk_init(void)
290{ 292{
291 int ret; 293 int ret;
292 294
295 ret = da850_register_gpio();
296 if (ret)
297 pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
298
293 davinci_serial_init(da8xx_serial_device); 299 davinci_serial_init(da8xx_serial_device);
294 300
295 omapl138_hawk_config_emac(); 301 omapl138_hawk_config_emac();
diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c
index d6c746e35ad9..0813b5167e05 100644
--- a/arch/arm/mach-davinci/da830.c
+++ b/arch/arm/mach-davinci/da830.c
@@ -11,6 +11,7 @@
11#include <linux/gpio.h> 11#include <linux/gpio.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/clk.h> 13#include <linux/clk.h>
14#include <linux/platform_data/gpio-davinci.h>
14 15
15#include <asm/mach/map.h> 16#include <asm/mach/map.h>
16 17
@@ -20,7 +21,6 @@
20#include <mach/common.h> 21#include <mach/common.h>
21#include <mach/time.h> 22#include <mach/time.h>
22#include <mach/da8xx.h> 23#include <mach/da8xx.h>
23#include <mach/gpio-davinci.h>
24 24
25#include "clock.h" 25#include "clock.h"
26#include "mux.h" 26#include "mux.h"
@@ -1151,6 +1151,16 @@ static struct davinci_id da830_ids[] = {
1151 }, 1151 },
1152}; 1152};
1153 1153
1154static struct davinci_gpio_platform_data da830_gpio_platform_data = {
1155 .ngpio = 128,
1156 .intc_irq_num = DA830_N_CP_INTC_IRQ,
1157};
1158
1159int __init da830_register_gpio(void)
1160{
1161 return da8xx_register_gpio(&da830_gpio_platform_data);
1162}
1163
1154static struct davinci_timer_instance da830_timer_instance[2] = { 1164static struct davinci_timer_instance da830_timer_instance[2] = {
1155 { 1165 {
1156 .base = DA8XX_TIMER64P0_BASE, 1166 .base = DA8XX_TIMER64P0_BASE,
@@ -1196,10 +1206,6 @@ static struct davinci_soc_info davinci_soc_info_da830 = {
1196 .intc_irq_prios = da830_default_priorities, 1206 .intc_irq_prios = da830_default_priorities,
1197 .intc_irq_num = DA830_N_CP_INTC_IRQ, 1207 .intc_irq_num = DA830_N_CP_INTC_IRQ,
1198 .timer_info = &da830_timer_info, 1208 .timer_info = &da830_timer_info,
1199 .gpio_type = GPIO_TYPE_DAVINCI,
1200 .gpio_base = DA8XX_GPIO_BASE,
1201 .gpio_num = 128,
1202 .gpio_irq = IRQ_DA8XX_GPIO0,
1203 .emac_pdata = &da8xx_emac_pdata, 1209 .emac_pdata = &da8xx_emac_pdata,
1204}; 1210};
1205 1211
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index f56e5fbfa2fd..352984e1528a 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -17,6 +17,7 @@
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/cpufreq.h> 18#include <linux/cpufreq.h>
19#include <linux/regulator/consumer.h> 19#include <linux/regulator/consumer.h>
20#include <linux/platform_data/gpio-davinci.h>
20 21
21#include <asm/mach/map.h> 22#include <asm/mach/map.h>
22 23
@@ -28,7 +29,6 @@
28#include <mach/da8xx.h> 29#include <mach/da8xx.h>
29#include <mach/cpufreq.h> 30#include <mach/cpufreq.h>
30#include <mach/pm.h> 31#include <mach/pm.h>
31#include <mach/gpio-davinci.h>
32 32
33#include "clock.h" 33#include "clock.h"
34#include "mux.h" 34#include "mux.h"
@@ -1281,6 +1281,16 @@ int __init da850_register_vpif_capture(struct vpif_capture_config
1281 return platform_device_register(&da850_vpif_capture_dev); 1281 return platform_device_register(&da850_vpif_capture_dev);
1282} 1282}
1283 1283
1284static struct davinci_gpio_platform_data da850_gpio_platform_data = {
1285 .ngpio = 144,
1286 .intc_irq_num = DA850_N_CP_INTC_IRQ,
1287};
1288
1289int __init da850_register_gpio(void)
1290{
1291 return da8xx_register_gpio(&da850_gpio_platform_data);
1292}
1293
1284static struct davinci_soc_info davinci_soc_info_da850 = { 1294static struct davinci_soc_info davinci_soc_info_da850 = {
1285 .io_desc = da850_io_desc, 1295 .io_desc = da850_io_desc,
1286 .io_desc_num = ARRAY_SIZE(da850_io_desc), 1296 .io_desc_num = ARRAY_SIZE(da850_io_desc),
@@ -1298,10 +1308,6 @@ static struct davinci_soc_info davinci_soc_info_da850 = {
1298 .intc_irq_prios = da850_default_priorities, 1308 .intc_irq_prios = da850_default_priorities,
1299 .intc_irq_num = DA850_N_CP_INTC_IRQ, 1309 .intc_irq_num = DA850_N_CP_INTC_IRQ,
1300 .timer_info = &da850_timer_info, 1310 .timer_info = &da850_timer_info,
1301 .gpio_type = GPIO_TYPE_DAVINCI,
1302 .gpio_base = DA8XX_GPIO_BASE,
1303 .gpio_num = 144,
1304 .gpio_irq = IRQ_DA8XX_GPIO0,
1305 .emac_pdata = &da8xx_emac_pdata, 1311 .emac_pdata = &da8xx_emac_pdata,
1306 .sram_dma = DA8XX_SHARED_RAM_BASE, 1312 .sram_dma = DA8XX_SHARED_RAM_BASE,
1307 .sram_len = SZ_128K, 1313 .sram_len = SZ_128K,
diff --git a/arch/arm/mach-davinci/davinci.h b/arch/arm/mach-davinci/davinci.h
index 2ab5d577186f..2eebc4338802 100644
--- a/arch/arm/mach-davinci/davinci.h
+++ b/arch/arm/mach-davinci/davinci.h
@@ -53,6 +53,9 @@ extern void __iomem *davinci_sysmod_base;
53#define DAVINCI_SYSMOD_VIRT(x) (davinci_sysmod_base + (x)) 53#define DAVINCI_SYSMOD_VIRT(x) (davinci_sysmod_base + (x))
54void davinci_map_sysmod(void); 54void davinci_map_sysmod(void);
55 55
56#define DAVINCI_GPIO_BASE 0x01C67000
57int davinci_gpio_register(struct resource *res, int size, void *pdata);
58
56/* DM355 base addresses */ 59/* DM355 base addresses */
57#define DM355_ASYNC_EMIF_CONTROL_BASE 0x01e10000 60#define DM355_ASYNC_EMIF_CONTROL_BASE 0x01e10000
58#define DM355_ASYNC_EMIF_DATA_CE0_BASE 0x02000000 61#define DM355_ASYNC_EMIF_DATA_CE0_BASE 0x02000000
@@ -82,6 +85,7 @@ void dm355_init_spi0(unsigned chipselect_mask,
82 const struct spi_board_info *info, unsigned len); 85 const struct spi_board_info *info, unsigned len);
83void dm355_init_asp1(u32 evt_enable, struct snd_platform_data *pdata); 86void dm355_init_asp1(u32 evt_enable, struct snd_platform_data *pdata);
84int dm355_init_video(struct vpfe_config *, struct vpbe_config *); 87int dm355_init_video(struct vpfe_config *, struct vpbe_config *);
88int dm355_gpio_register(void);
85 89
86/* DM365 function declarations */ 90/* DM365 function declarations */
87void dm365_init(void); 91void dm365_init(void);
@@ -92,11 +96,13 @@ void dm365_init_rtc(void);
92void dm365_init_spi0(unsigned chipselect_mask, 96void dm365_init_spi0(unsigned chipselect_mask,
93 const struct spi_board_info *info, unsigned len); 97 const struct spi_board_info *info, unsigned len);
94int dm365_init_video(struct vpfe_config *, struct vpbe_config *); 98int dm365_init_video(struct vpfe_config *, struct vpbe_config *);
99int dm365_gpio_register(void);
95 100
96/* DM644x function declarations */ 101/* DM644x function declarations */
97void dm644x_init(void); 102void dm644x_init(void);
98void dm644x_init_asp(struct snd_platform_data *pdata); 103void dm644x_init_asp(struct snd_platform_data *pdata);
99int dm644x_init_video(struct vpfe_config *, struct vpbe_config *); 104int dm644x_init_video(struct vpfe_config *, struct vpbe_config *);
105int dm644x_gpio_register(void);
100 106
101/* DM646x function declarations */ 107/* DM646x function declarations */
102void dm646x_init(void); 108void dm646x_init(void);
@@ -106,6 +112,7 @@ int dm646x_init_edma(struct edma_rsv_info *rsv);
106void dm646x_video_init(void); 112void dm646x_video_init(void);
107void dm646x_setup_vpif(struct vpif_display_config *, 113void dm646x_setup_vpif(struct vpif_display_config *,
108 struct vpif_capture_config *); 114 struct vpif_capture_config *);
115int dm646x_gpio_register(void);
109 116
110extern struct platform_device dm365_serial_device[]; 117extern struct platform_device dm365_serial_device[];
111extern struct platform_device dm355_serial_device[]; 118extern struct platform_device dm355_serial_device[];
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index 2e473fefd71e..c46eccbbd512 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -665,6 +665,32 @@ int __init da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata)
665 return platform_device_register(&da8xx_lcdc_device); 665 return platform_device_register(&da8xx_lcdc_device);
666} 666}
667 667
668static struct resource da8xx_gpio_resources[] = {
669 { /* registers */
670 .start = DA8XX_GPIO_BASE,
671 .end = DA8XX_GPIO_BASE + SZ_4K - 1,
672 .flags = IORESOURCE_MEM,
673 },
674 { /* interrupt */
675 .start = IRQ_DA8XX_GPIO0,
676 .end = IRQ_DA8XX_GPIO8,
677 .flags = IORESOURCE_IRQ,
678 },
679};
680
681static struct platform_device da8xx_gpio_device = {
682 .name = "davinci_gpio",
683 .id = -1,
684 .num_resources = ARRAY_SIZE(da8xx_gpio_resources),
685 .resource = da8xx_gpio_resources,
686};
687
688int __init da8xx_register_gpio(void *pdata)
689{
690 da8xx_gpio_device.dev.platform_data = pdata;
691 return platform_device_register(&da8xx_gpio_device);
692}
693
668static struct resource da8xx_mmcsd0_resources[] = { 694static struct resource da8xx_mmcsd0_resources[] = {
669 { /* registers */ 695 { /* registers */
670 .start = DA8XX_MMCSD0_BASE, 696 .start = DA8XX_MMCSD0_BASE,
diff --git a/arch/arm/mach-davinci/devices.c b/arch/arm/mach-davinci/devices.c
index 111573c0aad1..3996e98f52fb 100644
--- a/arch/arm/mach-davinci/devices.c
+++ b/arch/arm/mach-davinci/devices.c
@@ -318,6 +318,19 @@ static void davinci_init_wdt(void)
318 platform_device_register(&davinci_wdt_device); 318 platform_device_register(&davinci_wdt_device);
319} 319}
320 320
321static struct platform_device davinci_gpio_device = {
322 .name = "davinci_gpio",
323 .id = -1,
324};
325
326int davinci_gpio_register(struct resource *res, int size, void *pdata)
327{
328 davinci_gpio_device.resource = res;
329 davinci_gpio_device.num_resources = size;
330 davinci_gpio_device.dev.platform_data = pdata;
331 return platform_device_register(&davinci_gpio_device);
332}
333
321/*-------------------------------------------------------------------------*/ 334/*-------------------------------------------------------------------------*/
322 335
323/*-------------------------------------------------------------------------*/ 336/*-------------------------------------------------------------------------*/
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index 3eaa5f6b2160..ef9ff1fb6f52 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -13,8 +13,10 @@
13#include <linux/serial_8250.h> 13#include <linux/serial_8250.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/dma-mapping.h> 15#include <linux/dma-mapping.h>
16
17#include <linux/spi/spi.h> 16#include <linux/spi/spi.h>
17#include <linux/platform_data/edma.h>
18#include <linux/platform_data/gpio-davinci.h>
19#include <linux/platform_data/spi-davinci.h>
18 20
19#include <asm/mach/map.h> 21#include <asm/mach/map.h>
20 22
@@ -25,9 +27,6 @@
25#include <mach/time.h> 27#include <mach/time.h>
26#include <mach/serial.h> 28#include <mach/serial.h>
27#include <mach/common.h> 29#include <mach/common.h>
28#include <linux/platform_data/spi-davinci.h>
29#include <mach/gpio-davinci.h>
30#include <linux/platform_data/edma.h>
31 30
32#include "davinci.h" 31#include "davinci.h"
33#include "clock.h" 32#include "clock.h"
@@ -886,6 +885,30 @@ static struct platform_device dm355_vpbe_dev = {
886 }, 885 },
887}; 886};
888 887
888static struct resource dm355_gpio_resources[] = {
889 { /* registers */
890 .start = DAVINCI_GPIO_BASE,
891 .end = DAVINCI_GPIO_BASE + SZ_4K - 1,
892 .flags = IORESOURCE_MEM,
893 },
894 { /* interrupt */
895 .start = IRQ_DM355_GPIOBNK0,
896 .end = IRQ_DM355_GPIOBNK6,
897 .flags = IORESOURCE_IRQ,
898 },
899};
900
901static struct davinci_gpio_platform_data dm355_gpio_platform_data = {
902 .ngpio = 104,
903 .intc_irq_num = DAVINCI_N_AINTC_IRQ,
904};
905
906int __init dm355_gpio_register(void)
907{
908 return davinci_gpio_register(dm355_gpio_resources,
909 sizeof(dm355_gpio_resources),
910 &dm355_gpio_platform_data);
911}
889/*----------------------------------------------------------------------*/ 912/*----------------------------------------------------------------------*/
890 913
891static struct map_desc dm355_io_desc[] = { 914static struct map_desc dm355_io_desc[] = {
@@ -1005,10 +1028,6 @@ static struct davinci_soc_info davinci_soc_info_dm355 = {
1005 .intc_irq_prios = dm355_default_priorities, 1028 .intc_irq_prios = dm355_default_priorities,
1006 .intc_irq_num = DAVINCI_N_AINTC_IRQ, 1029 .intc_irq_num = DAVINCI_N_AINTC_IRQ,
1007 .timer_info = &dm355_timer_info, 1030 .timer_info = &dm355_timer_info,
1008 .gpio_type = GPIO_TYPE_DAVINCI,
1009 .gpio_base = DAVINCI_GPIO_BASE,
1010 .gpio_num = 104,
1011 .gpio_irq = IRQ_DM355_GPIOBNK0,
1012 .sram_dma = 0x00010000, 1031 .sram_dma = 0x00010000,
1013 .sram_len = SZ_32K, 1032 .sram_len = SZ_32K,
1014}; 1033};
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index c29e324eb0bb..1511a0680f9a 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -19,6 +19,9 @@
19#include <linux/dma-mapping.h> 19#include <linux/dma-mapping.h>
20#include <linux/spi/spi.h> 20#include <linux/spi/spi.h>
21#include <linux/platform_data/edma.h> 21#include <linux/platform_data/edma.h>
22#include <linux/platform_data/gpio-davinci.h>
23#include <linux/platform_data/keyscan-davinci.h>
24#include <linux/platform_data/spi-davinci.h>
22 25
23#include <asm/mach/map.h> 26#include <asm/mach/map.h>
24 27
@@ -29,9 +32,6 @@
29#include <mach/time.h> 32#include <mach/time.h>
30#include <mach/serial.h> 33#include <mach/serial.h>
31#include <mach/common.h> 34#include <mach/common.h>
32#include <linux/platform_data/keyscan-davinci.h>
33#include <linux/platform_data/spi-davinci.h>
34#include <mach/gpio-davinci.h>
35 35
36#include "davinci.h" 36#include "davinci.h"
37#include "clock.h" 37#include "clock.h"
@@ -698,6 +698,32 @@ void __init dm365_init_spi0(unsigned chipselect_mask,
698 platform_device_register(&dm365_spi0_device); 698 platform_device_register(&dm365_spi0_device);
699} 699}
700 700
701static struct resource dm365_gpio_resources[] = {
702 { /* registers */
703 .start = DAVINCI_GPIO_BASE,
704 .end = DAVINCI_GPIO_BASE + SZ_4K - 1,
705 .flags = IORESOURCE_MEM,
706 },
707 { /* interrupt */
708 .start = IRQ_DM365_GPIO0,
709 .end = IRQ_DM365_GPIO7,
710 .flags = IORESOURCE_IRQ,
711 },
712};
713
714static struct davinci_gpio_platform_data dm365_gpio_platform_data = {
715 .ngpio = 104,
716 .intc_irq_num = DAVINCI_N_AINTC_IRQ,
717 .gpio_unbanked = 8,
718};
719
720int __init dm365_gpio_register(void)
721{
722 return davinci_gpio_register(dm365_gpio_resources,
723 sizeof(dm365_gpio_resources),
724 &dm365_gpio_platform_data);
725}
726
701static struct emac_platform_data dm365_emac_pdata = { 727static struct emac_platform_data dm365_emac_pdata = {
702 .ctrl_reg_offset = DM365_EMAC_CNTRL_OFFSET, 728 .ctrl_reg_offset = DM365_EMAC_CNTRL_OFFSET,
703 .ctrl_mod_reg_offset = DM365_EMAC_CNTRL_MOD_OFFSET, 729 .ctrl_mod_reg_offset = DM365_EMAC_CNTRL_MOD_OFFSET,
@@ -1105,11 +1131,6 @@ static struct davinci_soc_info davinci_soc_info_dm365 = {
1105 .intc_irq_prios = dm365_default_priorities, 1131 .intc_irq_prios = dm365_default_priorities,
1106 .intc_irq_num = DAVINCI_N_AINTC_IRQ, 1132 .intc_irq_num = DAVINCI_N_AINTC_IRQ,
1107 .timer_info = &dm365_timer_info, 1133 .timer_info = &dm365_timer_info,
1108 .gpio_type = GPIO_TYPE_DAVINCI,
1109 .gpio_base = DAVINCI_GPIO_BASE,
1110 .gpio_num = 104,
1111 .gpio_irq = IRQ_DM365_GPIO0,
1112 .gpio_unbanked = 8, /* really 16 ... skip muxed GPIOs */
1113 .emac_pdata = &dm365_emac_pdata, 1134 .emac_pdata = &dm365_emac_pdata,
1114 .sram_dma = 0x00010000, 1135 .sram_dma = 0x00010000,
1115 .sram_len = SZ_32K, 1136 .sram_len = SZ_32K,
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index 4f74682293d6..143a3217e8ef 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -13,6 +13,7 @@
13#include <linux/serial_8250.h> 13#include <linux/serial_8250.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/platform_data/edma.h> 15#include <linux/platform_data/edma.h>
16#include <linux/platform_data/gpio-davinci.h>
16 17
17#include <asm/mach/map.h> 18#include <asm/mach/map.h>
18 19
@@ -23,7 +24,6 @@
23#include <mach/time.h> 24#include <mach/time.h>
24#include <mach/serial.h> 25#include <mach/serial.h>
25#include <mach/common.h> 26#include <mach/common.h>
26#include <mach/gpio-davinci.h>
27 27
28#include "davinci.h" 28#include "davinci.h"
29#include "clock.h" 29#include "clock.h"
@@ -771,6 +771,30 @@ static struct platform_device dm644x_vpbe_dev = {
771 }, 771 },
772}; 772};
773 773
774static struct resource dm644_gpio_resources[] = {
775 { /* registers */
776 .start = DAVINCI_GPIO_BASE,
777 .end = DAVINCI_GPIO_BASE + SZ_4K - 1,
778 .flags = IORESOURCE_MEM,
779 },
780 { /* interrupt */
781 .start = IRQ_GPIOBNK0,
782 .end = IRQ_GPIOBNK4,
783 .flags = IORESOURCE_IRQ,
784 },
785};
786
787static struct davinci_gpio_platform_data dm644_gpio_platform_data = {
788 .ngpio = 71,
789 .intc_irq_num = DAVINCI_N_AINTC_IRQ,
790};
791
792int __init dm644x_gpio_register(void)
793{
794 return davinci_gpio_register(dm644_gpio_resources,
795 sizeof(dm644_gpio_resources),
796 &dm644_gpio_platform_data);
797}
774/*----------------------------------------------------------------------*/ 798/*----------------------------------------------------------------------*/
775 799
776static struct map_desc dm644x_io_desc[] = { 800static struct map_desc dm644x_io_desc[] = {
@@ -897,10 +921,6 @@ static struct davinci_soc_info davinci_soc_info_dm644x = {
897 .intc_irq_prios = dm644x_default_priorities, 921 .intc_irq_prios = dm644x_default_priorities,
898 .intc_irq_num = DAVINCI_N_AINTC_IRQ, 922 .intc_irq_num = DAVINCI_N_AINTC_IRQ,
899 .timer_info = &dm644x_timer_info, 923 .timer_info = &dm644x_timer_info,
900 .gpio_type = GPIO_TYPE_DAVINCI,
901 .gpio_base = DAVINCI_GPIO_BASE,
902 .gpio_num = 71,
903 .gpio_irq = IRQ_GPIOBNK0,
904 .emac_pdata = &dm644x_emac_pdata, 924 .emac_pdata = &dm644x_emac_pdata,
905 .sram_dma = 0x00008000, 925 .sram_dma = 0x00008000,
906 .sram_len = SZ_16K, 926 .sram_len = SZ_16K,
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c
index 68f8d1f1aca1..2a73f299c1d0 100644
--- a/arch/arm/mach-davinci/dm646x.c
+++ b/arch/arm/mach-davinci/dm646x.c
@@ -14,6 +14,7 @@
14#include <linux/serial_8250.h> 14#include <linux/serial_8250.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/platform_data/edma.h> 16#include <linux/platform_data/edma.h>
17#include <linux/platform_data/gpio-davinci.h>
17 18
18#include <asm/mach/map.h> 19#include <asm/mach/map.h>
19 20
@@ -24,7 +25,6 @@
24#include <mach/time.h> 25#include <mach/time.h>
25#include <mach/serial.h> 26#include <mach/serial.h>
26#include <mach/common.h> 27#include <mach/common.h>
27#include <mach/gpio-davinci.h>
28 28
29#include "davinci.h" 29#include "davinci.h"
30#include "clock.h" 30#include "clock.h"
@@ -748,6 +748,30 @@ static struct platform_device vpif_capture_dev = {
748 .num_resources = ARRAY_SIZE(vpif_capture_resource), 748 .num_resources = ARRAY_SIZE(vpif_capture_resource),
749}; 749};
750 750
751static struct resource dm646x_gpio_resources[] = {
752 { /* registers */
753 .start = DAVINCI_GPIO_BASE,
754 .end = DAVINCI_GPIO_BASE + SZ_4K - 1,
755 .flags = IORESOURCE_MEM,
756 },
757 { /* interrupt */
758 .start = IRQ_DM646X_GPIOBNK0,
759 .end = IRQ_DM646X_GPIOBNK2,
760 .flags = IORESOURCE_IRQ,
761 },
762};
763
764static struct davinci_gpio_platform_data dm646x_gpio_platform_data = {
765 .ngpio = 43,
766 .intc_irq_num = DAVINCI_N_AINTC_IRQ,
767};
768
769int __init dm646x_gpio_register(void)
770{
771 return davinci_gpio_register(dm646x_gpio_resources,
772 sizeof(dm646x_gpio_resources),
773 &dm646x_gpio_platform_data);
774}
751/*----------------------------------------------------------------------*/ 775/*----------------------------------------------------------------------*/
752 776
753static struct map_desc dm646x_io_desc[] = { 777static struct map_desc dm646x_io_desc[] = {
@@ -874,10 +898,6 @@ static struct davinci_soc_info davinci_soc_info_dm646x = {
874 .intc_irq_prios = dm646x_default_priorities, 898 .intc_irq_prios = dm646x_default_priorities,
875 .intc_irq_num = DAVINCI_N_AINTC_IRQ, 899 .intc_irq_num = DAVINCI_N_AINTC_IRQ,
876 .timer_info = &dm646x_timer_info, 900 .timer_info = &dm646x_timer_info,
877 .gpio_type = GPIO_TYPE_DAVINCI,
878 .gpio_base = DAVINCI_GPIO_BASE,
879 .gpio_num = 43, /* Only 33 usable */
880 .gpio_irq = IRQ_DM646X_GPIOBNK0,
881 .emac_pdata = &dm646x_emac_pdata, 901 .emac_pdata = &dm646x_emac_pdata,
882 .sram_dma = 0x10010000, 902 .sram_dma = 0x10010000,
883 .sram_len = SZ_32K, 903 .sram_len = SZ_32K,
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index aae53072c0eb..39e58b48e826 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -97,6 +97,7 @@ int da8xx_register_mmcsd0(struct davinci_mmc_config *config);
97int da850_register_mmcsd1(struct davinci_mmc_config *config); 97int da850_register_mmcsd1(struct davinci_mmc_config *config);
98void da8xx_register_mcasp(int id, struct snd_platform_data *pdata); 98void da8xx_register_mcasp(int id, struct snd_platform_data *pdata);
99int da8xx_register_rtc(void); 99int da8xx_register_rtc(void);
100int da8xx_register_gpio(void *pdata);
100int da850_register_cpufreq(char *async_clk); 101int da850_register_cpufreq(char *async_clk);
101int da8xx_register_cpuidle(void); 102int da8xx_register_cpuidle(void);
102void __iomem *da8xx_get_mem_ctlr(void); 103void __iomem *da8xx_get_mem_ctlr(void);
@@ -110,6 +111,8 @@ int da850_register_vpif_capture
110void da8xx_restart(enum reboot_mode mode, const char *cmd); 111void da8xx_restart(enum reboot_mode mode, const char *cmd);
111void da8xx_rproc_reserve_cma(void); 112void da8xx_rproc_reserve_cma(void);
112int da8xx_register_rproc(void); 113int da8xx_register_rproc(void);
114int da850_register_gpio(void);
115int da830_register_gpio(void);
113 116
114extern struct platform_device da8xx_serial_device[]; 117extern struct platform_device da8xx_serial_device[];
115extern struct emac_platform_data da8xx_emac_pdata; 118extern struct emac_platform_data da8xx_emac_pdata;
diff --git a/arch/arm/mach-davinci/include/mach/gpio-davinci.h b/arch/arm/mach-davinci/include/mach/gpio-davinci.h
deleted file mode 100644
index 1fdd1fd35448..000000000000
--- a/arch/arm/mach-davinci/include/mach/gpio-davinci.h
+++ /dev/null
@@ -1,91 +0,0 @@
1/*
2 * TI DaVinci GPIO Support
3 *
4 * Copyright (c) 2006 David Brownell
5 * Copyright (c) 2007, MontaVista Software, Inc. <source@mvista.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef __DAVINCI_DAVINCI_GPIO_H
14#define __DAVINCI_DAVINCI_GPIO_H
15
16#include <linux/io.h>
17#include <linux/spinlock.h>
18
19#include <asm-generic/gpio.h>
20
21#include <mach/irqs.h>
22#include <mach/common.h>
23
24#define DAVINCI_GPIO_BASE 0x01C67000
25
26enum davinci_gpio_type {
27 GPIO_TYPE_DAVINCI = 0,
28 GPIO_TYPE_TNETV107X,
29};
30
31/*
32 * basic gpio routines
33 *
34 * board-specific init should be done by arch/.../.../board-XXX.c (maybe
35 * initializing banks together) rather than boot loaders; kexec() won't
36 * go through boot loaders.
37 *
38 * the gpio clock will be turned on when gpios are used, and you may also
39 * need to pay attention to PINMUX registers to be sure those pins are
40 * used as gpios, not with other peripherals.
41 *
42 * On-chip GPIOs are numbered 0..(DAVINCI_N_GPIO-1). For documentation,
43 * and maybe for later updates, code may write GPIO(N). These may be
44 * all 1.8V signals, all 3.3V ones, or a mix of the two. A given chip
45 * may not support all the GPIOs in that range.
46 *
47 * GPIOs can also be on external chips, numbered after the ones built-in
48 * to the DaVinci chip. For now, they won't be usable as IRQ sources.
49 */
50#define GPIO(X) (X) /* 0 <= X <= (DAVINCI_N_GPIO - 1) */
51
52/* Convert GPIO signal to GPIO pin number */
53#define GPIO_TO_PIN(bank, gpio) (16 * (bank) + (gpio))
54
55struct davinci_gpio_controller {
56 struct gpio_chip chip;
57 int irq_base;
58 spinlock_t lock;
59 void __iomem *regs;
60 void __iomem *set_data;
61 void __iomem *clr_data;
62 void __iomem *in_data;
63};
64
65/* The __gpio_to_controller() and __gpio_mask() functions inline to constants
66 * with constant parameters; or in outlined code they execute at runtime.
67 *
68 * You'd access the controller directly when reading or writing more than
69 * one gpio value at a time, and to support wired logic where the value
70 * being driven by the cpu need not match the value read back.
71 *
72 * These are NOT part of the cross-platform GPIO interface
73 */
74static inline struct davinci_gpio_controller *
75__gpio_to_controller(unsigned gpio)
76{
77 struct davinci_gpio_controller *ctlrs = davinci_soc_info.gpio_ctlrs;
78 int index = gpio / 32;
79
80 if (!ctlrs || index >= davinci_soc_info.gpio_ctlrs_num)
81 return NULL;
82
83 return ctlrs + index;
84}
85
86static inline u32 __gpio_mask(unsigned gpio)
87{
88 return 1 << (gpio % 32);
89}
90
91#endif /* __DAVINCI_DAVINCI_GPIO_H */
diff --git a/arch/arm/mach-davinci/include/mach/gpio.h b/arch/arm/mach-davinci/include/mach/gpio.h
deleted file mode 100644
index 960e9de47e1e..000000000000
--- a/arch/arm/mach-davinci/include/mach/gpio.h
+++ /dev/null
@@ -1,88 +0,0 @@
1/*
2 * TI DaVinci GPIO Support
3 *
4 * Copyright (c) 2006 David Brownell
5 * Copyright (c) 2007, MontaVista Software, Inc. <source@mvista.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef __DAVINCI_GPIO_H
14#define __DAVINCI_GPIO_H
15
16#include <asm-generic/gpio.h>
17
18#define __ARM_GPIOLIB_COMPLEX
19
20/* The inline versions use the static inlines in the driver header */
21#include "gpio-davinci.h"
22
23/*
24 * The get/set/clear functions will inline when called with constant
25 * parameters referencing built-in GPIOs, for low-overhead bitbanging.
26 *
27 * gpio_set_value() will inline only on traditional Davinci style controllers
28 * with distinct set/clear registers.
29 *
30 * Otherwise, calls with variable parameters or referencing external
31 * GPIOs (e.g. on GPIO expander chips) use outlined functions.
32 */
33static inline void gpio_set_value(unsigned gpio, int value)
34{
35 if (__builtin_constant_p(value) && gpio < davinci_soc_info.gpio_num) {
36 struct davinci_gpio_controller *ctlr;
37 u32 mask;
38
39 ctlr = __gpio_to_controller(gpio);
40
41 if (ctlr->set_data != ctlr->clr_data) {
42 mask = __gpio_mask(gpio);
43 if (value)
44 __raw_writel(mask, ctlr->set_data);
45 else
46 __raw_writel(mask, ctlr->clr_data);
47 return;
48 }
49 }
50
51 __gpio_set_value(gpio, value);
52}
53
54/* Returns zero or nonzero; works for gpios configured as inputs OR
55 * as outputs, at least for built-in GPIOs.
56 *
57 * NOTE: for built-in GPIOs, changes in reported values are synchronized
58 * to the GPIO clock. This is easily seen after calling gpio_set_value()
59 * and then immediately gpio_get_value(), where the gpio_get_value() will
60 * return the old value until the GPIO clock ticks and the new value gets
61 * latched.
62 */
63static inline int gpio_get_value(unsigned gpio)
64{
65 struct davinci_gpio_controller *ctlr;
66
67 if (!__builtin_constant_p(gpio) || gpio >= davinci_soc_info.gpio_num)
68 return __gpio_get_value(gpio);
69
70 ctlr = __gpio_to_controller(gpio);
71 return __gpio_mask(gpio) & __raw_readl(ctlr->in_data);
72}
73
74static inline int gpio_cansleep(unsigned gpio)
75{
76 if (__builtin_constant_p(gpio) && gpio < davinci_soc_info.gpio_num)
77 return 0;
78 else
79 return __gpio_cansleep(gpio);
80}
81
82static inline int irq_to_gpio(unsigned irq)
83{
84 /* don't support the reverse mapping */
85 return -ENOSYS;
86}
87
88#endif /* __DAVINCI_GPIO_H */