aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKV Sujith <sujithkv@ti.com>2013-08-18 01:18:59 -0400
committerSekhar Nori <nsekhar@ti.com>2013-09-24 01:18:44 -0400
commitf606d38de74a2f2d43d4a57317aaa8f05809fdef (patch)
tree17a92c10af8cd437090453952dc336d1cb2ef045
parent118150f22d6b4431a1fe2e715de314a5d93836f5 (diff)
ARM: davinci: da8xx: support gpio platform device
DaVinci GPIO driver now uses platform device model. Convert DA8XX SoC code to use the new model. Add da8xx_register_gpio() to create platform device for da8xx platforms. Signed-off-by: KV Sujith <sujithkv@ti.com> Signed-off-by: Philip Avinash <avinashphilip@ti.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> [nsekhar@ti.com: simplify commit message] Signed-off-by: Sekhar Nori <nsekhar@ti.com> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
-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/devices-da8xx.c26
-rw-r--r--arch/arm/mach-davinci/include/mach/da8xx.h3
4 files changed, 51 insertions, 10 deletions
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/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/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;