diff options
author | Stephen Warren <swarren@nvidia.com> | 2011-10-11 18:16:12 -0400 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2011-10-11 20:19:56 -0400 |
commit | 940dd96fe9dec5b6ba4bb7ebc33212ff66db243c (patch) | |
tree | 50b4f28a9740e14211bae3751e6c7ae3d38e8402 /arch/arm/mach-tegra | |
parent | 976d167615b64e14bc1491ca51d424e2ba9a5e84 (diff) |
arm/tegra: Prep boards for gpio/pinmux conversion to pdevs
The Tegra GPIO driver will be converted from static registration via
postcore_initcall() to be a platform device later in this patch series.
A new Tegra pinmux platform device will also be added.
Prepare for this by modifying all boards to register the appropriate
platform devices before-hand, so that when the drivers are converted,
those devices will be probed, and git bisectability will be maintained.
v2: Add resource definitions for GPIO and pinmux
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'arch/arm/mach-tegra')
-rw-r--r-- | arch/arm/mach-tegra/board-harmony-pinmux.c | 8 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-paz00-pinmux.c | 8 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-seaboard-pinmux.c | 9 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-trimslice-pinmux.c | 7 | ||||
-rw-r--r-- | arch/arm/mach-tegra/devices.c | 84 | ||||
-rw-r--r-- | arch/arm/mach-tegra/devices.h | 2 |
6 files changed, 116 insertions, 2 deletions
diff --git a/arch/arm/mach-tegra/board-harmony-pinmux.c b/arch/arm/mach-tegra/board-harmony-pinmux.c index 4d63e2e97a8d..e99b45618cd0 100644 --- a/arch/arm/mach-tegra/board-harmony-pinmux.c +++ b/arch/arm/mach-tegra/board-harmony-pinmux.c | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | #include "gpio-names.h" | 21 | #include "gpio-names.h" |
22 | #include "board-harmony.h" | 22 | #include "board-harmony.h" |
23 | #include "devices.h" | ||
23 | 24 | ||
24 | static struct tegra_pingroup_config harmony_pinmux[] = { | 25 | static struct tegra_pingroup_config harmony_pinmux[] = { |
25 | {TEGRA_PINGROUP_ATA, TEGRA_MUX_IDE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, | 26 | {TEGRA_PINGROUP_ATA, TEGRA_MUX_IDE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, |
@@ -140,6 +141,11 @@ static struct tegra_pingroup_config harmony_pinmux[] = { | |||
140 | {TEGRA_PINGROUP_XM2D, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, | 141 | {TEGRA_PINGROUP_XM2D, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, |
141 | }; | 142 | }; |
142 | 143 | ||
144 | static struct platform_device *pinmux_devices[] = { | ||
145 | &tegra_gpio_device, | ||
146 | &tegra_pinmux_device, | ||
147 | }; | ||
148 | |||
143 | static struct tegra_gpio_table gpio_table[] = { | 149 | static struct tegra_gpio_table gpio_table[] = { |
144 | { .gpio = TEGRA_GPIO_SD2_CD, .enable = true }, | 150 | { .gpio = TEGRA_GPIO_SD2_CD, .enable = true }, |
145 | { .gpio = TEGRA_GPIO_SD2_WP, .enable = true }, | 151 | { .gpio = TEGRA_GPIO_SD2_WP, .enable = true }, |
@@ -155,6 +161,8 @@ static struct tegra_gpio_table gpio_table[] = { | |||
155 | 161 | ||
156 | void harmony_pinmux_init(void) | 162 | void harmony_pinmux_init(void) |
157 | { | 163 | { |
164 | platform_add_devices(pinmux_devices, ARRAY_SIZE(pinmux_devices)); | ||
165 | |||
158 | tegra_pinmux_config_table(harmony_pinmux, ARRAY_SIZE(harmony_pinmux)); | 166 | tegra_pinmux_config_table(harmony_pinmux, ARRAY_SIZE(harmony_pinmux)); |
159 | 167 | ||
160 | tegra_gpio_config(gpio_table, ARRAY_SIZE(gpio_table)); | 168 | tegra_gpio_config(gpio_table, ARRAY_SIZE(gpio_table)); |
diff --git a/arch/arm/mach-tegra/board-paz00-pinmux.c b/arch/arm/mach-tegra/board-paz00-pinmux.c index bdd2627dd87b..43633f4d4bcf 100644 --- a/arch/arm/mach-tegra/board-paz00-pinmux.c +++ b/arch/arm/mach-tegra/board-paz00-pinmux.c | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | #include "gpio-names.h" | 21 | #include "gpio-names.h" |
22 | #include "board-paz00.h" | 22 | #include "board-paz00.h" |
23 | #include "devices.h" | ||
23 | 24 | ||
24 | static struct tegra_pingroup_config paz00_pinmux[] = { | 25 | static struct tegra_pingroup_config paz00_pinmux[] = { |
25 | {TEGRA_PINGROUP_ATA, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, | 26 | {TEGRA_PINGROUP_ATA, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, |
@@ -140,6 +141,11 @@ static struct tegra_pingroup_config paz00_pinmux[] = { | |||
140 | {TEGRA_PINGROUP_XM2D, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, | 141 | {TEGRA_PINGROUP_XM2D, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, |
141 | }; | 142 | }; |
142 | 143 | ||
144 | static struct platform_device *pinmux_devices[] = { | ||
145 | &tegra_gpio_device, | ||
146 | &tegra_pinmux_device, | ||
147 | }; | ||
148 | |||
143 | static struct tegra_gpio_table gpio_table[] = { | 149 | static struct tegra_gpio_table gpio_table[] = { |
144 | { .gpio = TEGRA_GPIO_SD1_CD, .enable = true }, | 150 | { .gpio = TEGRA_GPIO_SD1_CD, .enable = true }, |
145 | { .gpio = TEGRA_GPIO_SD1_WP, .enable = true }, | 151 | { .gpio = TEGRA_GPIO_SD1_WP, .enable = true }, |
@@ -149,6 +155,8 @@ static struct tegra_gpio_table gpio_table[] = { | |||
149 | 155 | ||
150 | void paz00_pinmux_init(void) | 156 | void paz00_pinmux_init(void) |
151 | { | 157 | { |
158 | platform_add_devices(pinmux_devices, ARRAY_SIZE(pinmux_devices)); | ||
159 | |||
152 | tegra_pinmux_config_table(paz00_pinmux, ARRAY_SIZE(paz00_pinmux)); | 160 | tegra_pinmux_config_table(paz00_pinmux, ARRAY_SIZE(paz00_pinmux)); |
153 | 161 | ||
154 | tegra_gpio_config(gpio_table, ARRAY_SIZE(gpio_table)); | 162 | tegra_gpio_config(gpio_table, ARRAY_SIZE(gpio_table)); |
diff --git a/arch/arm/mach-tegra/board-seaboard-pinmux.c b/arch/arm/mach-tegra/board-seaboard-pinmux.c index 0bda495e9742..9c0f6d7527b9 100644 --- a/arch/arm/mach-tegra/board-seaboard-pinmux.c +++ b/arch/arm/mach-tegra/board-seaboard-pinmux.c | |||
@@ -21,6 +21,7 @@ | |||
21 | 21 | ||
22 | #include "gpio-names.h" | 22 | #include "gpio-names.h" |
23 | #include "board-seaboard.h" | 23 | #include "board-seaboard.h" |
24 | #include "devices.h" | ||
24 | 25 | ||
25 | #define DEFAULT_DRIVE(_name) \ | 26 | #define DEFAULT_DRIVE(_name) \ |
26 | { \ | 27 | { \ |
@@ -157,8 +158,10 @@ static __initdata struct tegra_pingroup_config seaboard_pinmux[] = { | |||
157 | {TEGRA_PINGROUP_XM2D, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, | 158 | {TEGRA_PINGROUP_XM2D, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, |
158 | }; | 159 | }; |
159 | 160 | ||
160 | 161 | static struct platform_device *pinmux_devices[] = { | |
161 | 162 | &tegra_gpio_device, | |
163 | &tegra_pinmux_device, | ||
164 | }; | ||
162 | 165 | ||
163 | static struct tegra_gpio_table gpio_table[] = { | 166 | static struct tegra_gpio_table gpio_table[] = { |
164 | { .gpio = TEGRA_GPIO_SD2_CD, .enable = true }, | 167 | { .gpio = TEGRA_GPIO_SD2_CD, .enable = true }, |
@@ -171,6 +174,8 @@ static struct tegra_gpio_table gpio_table[] = { | |||
171 | 174 | ||
172 | void __init seaboard_pinmux_init(void) | 175 | void __init seaboard_pinmux_init(void) |
173 | { | 176 | { |
177 | platform_add_devices(pinmux_devices, ARRAY_SIZE(pinmux_devices)); | ||
178 | |||
174 | tegra_pinmux_config_table(seaboard_pinmux, ARRAY_SIZE(seaboard_pinmux)); | 179 | tegra_pinmux_config_table(seaboard_pinmux, ARRAY_SIZE(seaboard_pinmux)); |
175 | 180 | ||
176 | tegra_drive_pinmux_config_table(seaboard_drive_pinmux, | 181 | tegra_drive_pinmux_config_table(seaboard_drive_pinmux, |
diff --git a/arch/arm/mach-tegra/board-trimslice-pinmux.c b/arch/arm/mach-tegra/board-trimslice-pinmux.c index 47c596cdbf32..8417ba77f765 100644 --- a/arch/arm/mach-tegra/board-trimslice-pinmux.c +++ b/arch/arm/mach-tegra/board-trimslice-pinmux.c | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include "gpio-names.h" | 23 | #include "gpio-names.h" |
24 | #include "board-trimslice.h" | 24 | #include "board-trimslice.h" |
25 | #include "devices.h" | ||
25 | 26 | ||
26 | static __initdata struct tegra_pingroup_config trimslice_pinmux[] = { | 27 | static __initdata struct tegra_pingroup_config trimslice_pinmux[] = { |
27 | {TEGRA_PINGROUP_ATA, TEGRA_MUX_IDE, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, | 28 | {TEGRA_PINGROUP_ATA, TEGRA_MUX_IDE, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, |
@@ -142,6 +143,11 @@ static __initdata struct tegra_pingroup_config trimslice_pinmux[] = { | |||
142 | {TEGRA_PINGROUP_XM2D, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, | 143 | {TEGRA_PINGROUP_XM2D, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, |
143 | }; | 144 | }; |
144 | 145 | ||
146 | static struct platform_device *pinmux_devices[] = { | ||
147 | &tegra_gpio_device, | ||
148 | &tegra_pinmux_device, | ||
149 | }; | ||
150 | |||
145 | static struct tegra_gpio_table gpio_table[] = { | 151 | static struct tegra_gpio_table gpio_table[] = { |
146 | { .gpio = TRIMSLICE_GPIO_SD4_CD, .enable = true }, /* mmc4 cd */ | 152 | { .gpio = TRIMSLICE_GPIO_SD4_CD, .enable = true }, /* mmc4 cd */ |
147 | { .gpio = TRIMSLICE_GPIO_SD4_WP, .enable = true }, /* mmc4 wp */ | 153 | { .gpio = TRIMSLICE_GPIO_SD4_WP, .enable = true }, /* mmc4 wp */ |
@@ -152,6 +158,7 @@ static struct tegra_gpio_table gpio_table[] = { | |||
152 | 158 | ||
153 | void __init trimslice_pinmux_init(void) | 159 | void __init trimslice_pinmux_init(void) |
154 | { | 160 | { |
161 | platform_add_devices(pinmux_devices, ARRAY_SIZE(pinmux_devices)); | ||
155 | tegra_pinmux_config_table(trimslice_pinmux, ARRAY_SIZE(trimslice_pinmux)); | 162 | tegra_pinmux_config_table(trimslice_pinmux, ARRAY_SIZE(trimslice_pinmux)); |
156 | tegra_gpio_config(gpio_table, ARRAY_SIZE(gpio_table)); | 163 | tegra_gpio_config(gpio_table, ARRAY_SIZE(gpio_table)); |
157 | } | 164 | } |
diff --git a/arch/arm/mach-tegra/devices.c b/arch/arm/mach-tegra/devices.c index 57e35d20c24c..240d5dc58928 100644 --- a/arch/arm/mach-tegra/devices.c +++ b/arch/arm/mach-tegra/devices.c | |||
@@ -31,6 +31,90 @@ | |||
31 | #include <mach/usb_phy.h> | 31 | #include <mach/usb_phy.h> |
32 | #include "gpio-names.h" | 32 | #include "gpio-names.h" |
33 | 33 | ||
34 | static struct resource gpio_resource[] = { | ||
35 | [0] = { | ||
36 | .start = TEGRA_GPIO_BASE, | ||
37 | .end = TEGRA_GPIO_BASE + TEGRA_GPIO_SIZE-1, | ||
38 | .flags = IORESOURCE_MEM, | ||
39 | }, | ||
40 | [1] = { | ||
41 | .start = INT_GPIO1, | ||
42 | .end = INT_GPIO1, | ||
43 | .flags = IORESOURCE_IRQ, | ||
44 | }, | ||
45 | [2] = { | ||
46 | .start = INT_GPIO2, | ||
47 | .end = INT_GPIO2, | ||
48 | .flags = IORESOURCE_IRQ, | ||
49 | }, | ||
50 | [3] = { | ||
51 | .start = INT_GPIO3, | ||
52 | .end = INT_GPIO3, | ||
53 | .flags = IORESOURCE_IRQ, | ||
54 | }, | ||
55 | [4] = { | ||
56 | .start = INT_GPIO4, | ||
57 | .end = INT_GPIO4, | ||
58 | .flags = IORESOURCE_IRQ, | ||
59 | }, | ||
60 | [5] = { | ||
61 | .start = INT_GPIO5, | ||
62 | .end = INT_GPIO5, | ||
63 | .flags = IORESOURCE_IRQ, | ||
64 | }, | ||
65 | [6] = { | ||
66 | .start = INT_GPIO6, | ||
67 | .end = INT_GPIO6, | ||
68 | .flags = IORESOURCE_IRQ, | ||
69 | }, | ||
70 | [7] = { | ||
71 | .start = INT_GPIO7, | ||
72 | .end = INT_GPIO7, | ||
73 | .flags = IORESOURCE_IRQ, | ||
74 | }, | ||
75 | }; | ||
76 | |||
77 | struct platform_device tegra_gpio_device = { | ||
78 | .name = "tegra-gpio", | ||
79 | .id = -1, | ||
80 | .resource = gpio_resource, | ||
81 | .num_resources = ARRAY_SIZE(gpio_resource), | ||
82 | }; | ||
83 | |||
84 | static struct resource pinmux_resource[] = { | ||
85 | [0] = { | ||
86 | /* Tri-state registers */ | ||
87 | .start = TEGRA_APB_MISC_BASE + 0x14, | ||
88 | .end = TEGRA_APB_MISC_BASE + 0x20 + 3, | ||
89 | .flags = IORESOURCE_MEM, | ||
90 | }, | ||
91 | [1] = { | ||
92 | /* Mux registers */ | ||
93 | .start = TEGRA_APB_MISC_BASE + 0x80, | ||
94 | .end = TEGRA_APB_MISC_BASE + 0x9c + 3, | ||
95 | .flags = IORESOURCE_MEM, | ||
96 | }, | ||
97 | [2] = { | ||
98 | /* Pull-up/down registers */ | ||
99 | .start = TEGRA_APB_MISC_BASE + 0xa0, | ||
100 | .end = TEGRA_APB_MISC_BASE + 0xb0 + 3, | ||
101 | .flags = IORESOURCE_MEM, | ||
102 | }, | ||
103 | [3] = { | ||
104 | /* Pad control registers */ | ||
105 | .start = TEGRA_APB_MISC_BASE + 0x868, | ||
106 | .end = TEGRA_APB_MISC_BASE + 0x90c + 3, | ||
107 | .flags = IORESOURCE_MEM, | ||
108 | }, | ||
109 | }; | ||
110 | |||
111 | struct platform_device tegra_pinmux_device = { | ||
112 | .name = "tegra-pinmux", | ||
113 | .id = -1, | ||
114 | .resource = pinmux_resource, | ||
115 | .num_resources = ARRAY_SIZE(pinmux_resource), | ||
116 | }; | ||
117 | |||
34 | static struct resource i2c_resource1[] = { | 118 | static struct resource i2c_resource1[] = { |
35 | [0] = { | 119 | [0] = { |
36 | .start = INT_I2C, | 120 | .start = INT_I2C, |
diff --git a/arch/arm/mach-tegra/devices.h b/arch/arm/mach-tegra/devices.h index 4a7dc0a097d6..873ecb2f8ae6 100644 --- a/arch/arm/mach-tegra/devices.h +++ b/arch/arm/mach-tegra/devices.h | |||
@@ -21,6 +21,8 @@ | |||
21 | 21 | ||
22 | #include <linux/platform_device.h> | 22 | #include <linux/platform_device.h> |
23 | 23 | ||
24 | extern struct platform_device tegra_gpio_device; | ||
25 | extern struct platform_device tegra_pinmux_device; | ||
24 | extern struct platform_device tegra_sdhci_device1; | 26 | extern struct platform_device tegra_sdhci_device1; |
25 | extern struct platform_device tegra_sdhci_device2; | 27 | extern struct platform_device tegra_sdhci_device2; |
26 | extern struct platform_device tegra_sdhci_device3; | 28 | extern struct platform_device tegra_sdhci_device3; |