aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-davinci
diff options
context:
space:
mode:
authorPhilip Avinash <avinashphilip@ti.com>2013-08-18 01:19:00 -0400
committerSekhar Nori <nsekhar@ti.com>2013-09-24 02:33:34 -0400
commit9cc1515cbd2155df8530ba8438b0b5bfdff50117 (patch)
treec119d4660ab09b8d643b5fe73a6c308dd927811a /arch/arm/mach-davinci
parentf606d38de74a2f2d43d4a57317aaa8f05809fdef (diff)
ARM: davinci: support gpio platform device
DaVinci GPIO driver now uses platform device model. Add a GPIO platform register API to convert the traditional DaVinci SoCs to use the new model. While at it, also group related include files together wherever that was not the case. Signed-off-by: Philip Avinash <avinashphilip@ti.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> [nsekhar@ti.com: move function declaration to local header, simplify commit message, merge SoC specific portions from other patches into this patch] Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Diffstat (limited to 'arch/arm/mach-davinci')
-rw-r--r--arch/arm/mach-davinci/davinci.h7
-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/gpio-davinci.h2
7 files changed, 126 insertions, 28 deletions
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.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/gpio-davinci.h b/arch/arm/mach-davinci/include/mach/gpio-davinci.h
index 551ba43a763e..0d63b24cefc9 100644
--- a/arch/arm/mach-davinci/include/mach/gpio-davinci.h
+++ b/arch/arm/mach-davinci/include/mach/gpio-davinci.h
@@ -21,8 +21,6 @@
21#include <mach/irqs.h> 21#include <mach/irqs.h>
22#include <mach/common.h> 22#include <mach/common.h>
23 23
24#define DAVINCI_GPIO_BASE 0x01C67000
25
26enum davinci_gpio_type { 24enum davinci_gpio_type {
27 GPIO_TYPE_DAVINCI = 0, 25 GPIO_TYPE_DAVINCI = 0,
28 GPIO_TYPE_TNETV107X, 26 GPIO_TYPE_TNETV107X,