diff options
author | Daniel Mack <daniel@caiaq.de> | 2010-05-21 18:29:38 -0400 |
---|---|---|
committer | Eric Miao <eric.y.miao@gmail.com> | 2010-06-18 03:07:34 -0400 |
commit | 4c243c8584be9fbff9e11fc37fa2449448c5d442 (patch) | |
tree | 6ec6745dd0fad18ecd9ab2859e4d7b20b59ee030 /arch/arm/mach-pxa | |
parent | 7cca84abf49afe28f3e81531f79b2cb4dd6cba1b (diff) |
[ARM] pxa/colibri270: Split module and base board code
Follow the idea of several MX31 based boards and split code that is
related to the module from code that is baseboard specific. This makes
adding new base board support easier, while avoiding code duplication.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Acked-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
Diffstat (limited to 'arch/arm/mach-pxa')
-rw-r--r-- | arch/arm/mach-pxa/Kconfig | 4 | ||||
-rw-r--r-- | arch/arm/mach-pxa/Makefile | 3 | ||||
-rw-r--r-- | arch/arm/mach-pxa/colibri-pxa270-evalboard.c | 111 | ||||
-rw-r--r-- | arch/arm/mach-pxa/colibri-pxa270.c | 107 | ||||
-rw-r--r-- | arch/arm/mach-pxa/include/mach/colibri.h | 14 |
5 files changed, 151 insertions, 88 deletions
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig index 3b51741a4810..819b44fe4081 100644 --- a/arch/arm/mach-pxa/Kconfig +++ b/arch/arm/mach-pxa/Kconfig | |||
@@ -238,6 +238,10 @@ config MACH_COLIBRI | |||
238 | bool "Toradex Colibri PXA270" | 238 | bool "Toradex Colibri PXA270" |
239 | select PXA27x | 239 | select PXA27x |
240 | 240 | ||
241 | config MACH_COLIBRI_PXA270_EVALBOARD | ||
242 | bool "Toradex Colibri Evaluation Carrier Board support (PXA270)" | ||
243 | depends on MACH_COLIBRI | ||
244 | |||
241 | config MACH_COLIBRI300 | 245 | config MACH_COLIBRI300 |
242 | bool "Toradex Colibri PXA300/310" | 246 | bool "Toradex Colibri PXA300/310" |
243 | select PXA3xx | 247 | select PXA3xx |
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile index b8f1f4bc7ca7..4751c9de5c60 100644 --- a/arch/arm/mach-pxa/Makefile +++ b/arch/arm/mach-pxa/Makefile | |||
@@ -58,7 +58,8 @@ obj-$(CONFIG_MACH_TRIZEPS4) += trizeps4.o | |||
58 | obj-$(CONFIG_MACH_LOGICPD_PXA270) += lpd270.o | 58 | obj-$(CONFIG_MACH_LOGICPD_PXA270) += lpd270.o |
59 | obj-$(CONFIG_MACH_PCM027) += pcm027.o | 59 | obj-$(CONFIG_MACH_PCM027) += pcm027.o |
60 | obj-$(CONFIG_MACH_PCM990_BASEBOARD) += pcm990-baseboard.o | 60 | obj-$(CONFIG_MACH_PCM990_BASEBOARD) += pcm990-baseboard.o |
61 | obj-$(CONFIG_MACH_COLIBRI) += colibri-pxa270.o | 61 | obj-$(CONFIG_MACH_COLIBRI) += colibri-pxa270.o |
62 | obj-$(CONFIG_MACH_COLIBRI_PXA270_EVALBOARD) += colibri-pxa270-evalboard.o | ||
62 | obj-$(CONFIG_MACH_COLIBRI300) += colibri-pxa3xx.o colibri-pxa300.o | 63 | obj-$(CONFIG_MACH_COLIBRI300) += colibri-pxa3xx.o colibri-pxa300.o |
63 | obj-$(CONFIG_MACH_COLIBRI320) += colibri-pxa3xx.o colibri-pxa320.o | 64 | obj-$(CONFIG_MACH_COLIBRI320) += colibri-pxa3xx.o colibri-pxa320.o |
64 | obj-$(CONFIG_MACH_VPAC270) += vpac270.o | 65 | obj-$(CONFIG_MACH_VPAC270) += vpac270.o |
diff --git a/arch/arm/mach-pxa/colibri-pxa270-evalboard.c b/arch/arm/mach-pxa/colibri-pxa270-evalboard.c new file mode 100644 index 000000000000..0f3b632c3b14 --- /dev/null +++ b/arch/arm/mach-pxa/colibri-pxa270-evalboard.c | |||
@@ -0,0 +1,111 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-pxa/colibri-pxa270-evalboard.c | ||
3 | * | ||
4 | * Support for Toradex PXA270 based Colibri Evaluation Carrier Board | ||
5 | * Daniel Mack <daniel@caiaq.de> | ||
6 | * Marek Vasut <marek.vasut@gmail.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #include <linux/init.h> | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/sysdev.h> | ||
17 | #include <linux/interrupt.h> | ||
18 | #include <linux/gpio.h> | ||
19 | #include <asm/mach-types.h> | ||
20 | #include <mach/hardware.h> | ||
21 | #include <asm/mach/arch.h> | ||
22 | |||
23 | #include <mach/pxa27x.h> | ||
24 | #include <mach/colibri.h> | ||
25 | #include <mach/mmc.h> | ||
26 | #include <mach/ohci.h> | ||
27 | #include <mach/pxa27x-udc.h> | ||
28 | |||
29 | #include "generic.h" | ||
30 | #include "devices.h" | ||
31 | |||
32 | /****************************************************************************** | ||
33 | * Pin configuration | ||
34 | ******************************************************************************/ | ||
35 | static mfp_cfg_t colibri_pxa270_evalboard_pin_config[] __initdata = { | ||
36 | /* MMC */ | ||
37 | GPIO32_MMC_CLK, | ||
38 | GPIO92_MMC_DAT_0, | ||
39 | GPIO109_MMC_DAT_1, | ||
40 | GPIO110_MMC_DAT_2, | ||
41 | GPIO111_MMC_DAT_3, | ||
42 | GPIO112_MMC_CMD, | ||
43 | GPIO0_GPIO, /* SD detect */ | ||
44 | |||
45 | /* FFUART */ | ||
46 | GPIO39_FFUART_TXD, | ||
47 | GPIO34_FFUART_RXD, | ||
48 | |||
49 | /* UHC */ | ||
50 | GPIO88_USBH1_PWR, | ||
51 | GPIO89_USBH1_PEN, | ||
52 | GPIO119_USBH2_PWR, | ||
53 | GPIO120_USBH2_PEN, | ||
54 | }; | ||
55 | |||
56 | /****************************************************************************** | ||
57 | * SD/MMC card controller | ||
58 | ******************************************************************************/ | ||
59 | #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) | ||
60 | static struct pxamci_platform_data colibri_pxa270_mci_platform_data = { | ||
61 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | ||
62 | .gpio_power = -1, | ||
63 | .gpio_card_detect = GPIO0_COLIBRI_PXA270_SD_DETECT, | ||
64 | .gpio_card_ro = -1, | ||
65 | .detect_delay_ms = 200, | ||
66 | }; | ||
67 | |||
68 | static void __init colibri_pxa270_mmc_init(void) | ||
69 | { | ||
70 | pxa_set_mci_info(&colibri_pxa270_mci_platform_data); | ||
71 | } | ||
72 | #else | ||
73 | static inline void colibri_pxa270_mmc_init(void) {} | ||
74 | #endif | ||
75 | |||
76 | /****************************************************************************** | ||
77 | * USB Host | ||
78 | ******************************************************************************/ | ||
79 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | ||
80 | static int colibri_pxa270_ohci_init(struct device *dev) | ||
81 | { | ||
82 | UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE; | ||
83 | return 0; | ||
84 | } | ||
85 | |||
86 | static struct pxaohci_platform_data colibri_pxa270_ohci_info = { | ||
87 | .port_mode = PMM_PERPORT_MODE, | ||
88 | .flags = ENABLE_PORT1 | ENABLE_PORT2 | | ||
89 | POWER_CONTROL_LOW | POWER_SENSE_LOW, | ||
90 | .init = colibri_pxa270_ohci_init, | ||
91 | }; | ||
92 | |||
93 | static void __init colibri_pxa270_uhc_init(void) | ||
94 | { | ||
95 | pxa_set_ohci_info(&colibri_pxa270_ohci_info); | ||
96 | } | ||
97 | #else | ||
98 | static inline void colibri_pxa270_uhc_init(void) {} | ||
99 | #endif | ||
100 | |||
101 | void __init colibri_pxa270_evalboard_init(void) | ||
102 | { | ||
103 | pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa270_evalboard_pin_config)); | ||
104 | pxa_set_ffuart_info(NULL); | ||
105 | pxa_set_btuart_info(NULL); | ||
106 | pxa_set_stuart_info(NULL); | ||
107 | |||
108 | colibri_pxa270_mmc_init(); | ||
109 | colibri_pxa270_uhc_init(); | ||
110 | } | ||
111 | |||
diff --git a/arch/arm/mach-pxa/colibri-pxa270.c b/arch/arm/mach-pxa/colibri-pxa270.c index 99d511cf0a82..b4f53ccf3e80 100644 --- a/arch/arm/mach-pxa/colibri-pxa270.c +++ b/arch/arm/mach-pxa/colibri-pxa270.c | |||
@@ -11,36 +11,26 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <linux/kernel.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/sysdev.h> | ||
17 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
18 | #include <linux/bitops.h> | 15 | #include <linux/kernel.h> |
19 | #include <linux/ioport.h> | ||
20 | #include <linux/delay.h> | ||
21 | #include <linux/mtd/mtd.h> | 16 | #include <linux/mtd/mtd.h> |
22 | #include <linux/mtd/partitions.h> | 17 | #include <linux/mtd/partitions.h> |
23 | #include <linux/mtd/physmap.h> | 18 | #include <linux/mtd/physmap.h> |
24 | #include <linux/gpio.h> | 19 | #include <linux/platform_device.h> |
20 | #include <linux/sysdev.h> | ||
25 | #include <linux/ucb1400.h> | 21 | #include <linux/ucb1400.h> |
26 | #include <asm/mach-types.h> | 22 | |
27 | #include <mach/hardware.h> | ||
28 | #include <asm/irq.h> | ||
29 | #include <asm/sizes.h> | ||
30 | #include <asm/mach/arch.h> | 23 | #include <asm/mach/arch.h> |
31 | #include <asm/mach/map.h> | ||
32 | #include <asm/mach/irq.h> | ||
33 | #include <asm/mach/flash.h> | 24 | #include <asm/mach/flash.h> |
25 | #include <asm/mach-types.h> | ||
26 | #include <asm/sizes.h> | ||
34 | 27 | ||
35 | #include <mach/audio.h> | 28 | #include <mach/audio.h> |
36 | #include <mach/pxa27x.h> | ||
37 | #include <mach/colibri.h> | 29 | #include <mach/colibri.h> |
38 | #include <mach/mmc.h> | 30 | #include <mach/pxa27x.h> |
39 | #include <mach/ohci.h> | ||
40 | #include <mach/pxa27x-udc.h> | ||
41 | 31 | ||
42 | #include "generic.h" | ||
43 | #include "devices.h" | 32 | #include "devices.h" |
33 | #include "generic.h" | ||
44 | 34 | ||
45 | /****************************************************************************** | 35 | /****************************************************************************** |
46 | * Pin configuration | 36 | * Pin configuration |
@@ -50,25 +40,6 @@ static mfp_cfg_t colibri_pxa270_pin_config[] __initdata = { | |||
50 | GPIO78_nCS_2, /* Ethernet CS */ | 40 | GPIO78_nCS_2, /* Ethernet CS */ |
51 | GPIO114_GPIO, /* Ethernet IRQ */ | 41 | GPIO114_GPIO, /* Ethernet IRQ */ |
52 | 42 | ||
53 | /* MMC */ | ||
54 | GPIO32_MMC_CLK, | ||
55 | GPIO92_MMC_DAT_0, | ||
56 | GPIO109_MMC_DAT_1, | ||
57 | GPIO110_MMC_DAT_2, | ||
58 | GPIO111_MMC_DAT_3, | ||
59 | GPIO112_MMC_CMD, | ||
60 | GPIO0_GPIO, /* SD detect */ | ||
61 | |||
62 | /* FFUART */ | ||
63 | GPIO39_FFUART_TXD, | ||
64 | GPIO34_FFUART_RXD, | ||
65 | |||
66 | /* UHC */ | ||
67 | GPIO88_USBH1_PWR, | ||
68 | GPIO89_USBH1_PEN, | ||
69 | GPIO119_USBH2_PWR, | ||
70 | GPIO120_USBH2_PEN, | ||
71 | |||
72 | /* AC97 */ | 43 | /* AC97 */ |
73 | GPIO28_AC97_BITCLK, | 44 | GPIO28_AC97_BITCLK, |
74 | GPIO29_AC97_SDATA_IN_0, | 45 | GPIO29_AC97_SDATA_IN_0, |
@@ -172,51 +143,6 @@ static inline void colibri_pxa270_eth_init(void) {} | |||
172 | #endif | 143 | #endif |
173 | 144 | ||
174 | /****************************************************************************** | 145 | /****************************************************************************** |
175 | * SD/MMC card controller | ||
176 | ******************************************************************************/ | ||
177 | #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) | ||
178 | static struct pxamci_platform_data colibri_pxa270_mci_platform_data = { | ||
179 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | ||
180 | .gpio_power = -1, | ||
181 | .gpio_card_detect = GPIO0_COLIBRI_PXA270_SD_DETECT, | ||
182 | .gpio_card_ro = -1, | ||
183 | .detect_delay_ms = 200, | ||
184 | }; | ||
185 | |||
186 | static void __init colibri_pxa270_mmc_init(void) | ||
187 | { | ||
188 | pxa_set_mci_info(&colibri_pxa270_mci_platform_data); | ||
189 | } | ||
190 | #else | ||
191 | static inline void colibri_pxa270_mmc_init(void) {} | ||
192 | #endif | ||
193 | |||
194 | /****************************************************************************** | ||
195 | * USB Host | ||
196 | ******************************************************************************/ | ||
197 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | ||
198 | static int colibri_pxa270_ohci_init(struct device *dev) | ||
199 | { | ||
200 | UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE; | ||
201 | return 0; | ||
202 | } | ||
203 | |||
204 | static struct pxaohci_platform_data colibri_pxa270_ohci_info = { | ||
205 | .port_mode = PMM_PERPORT_MODE, | ||
206 | .flags = ENABLE_PORT1 | ENABLE_PORT2 | | ||
207 | POWER_CONTROL_LOW | POWER_SENSE_LOW, | ||
208 | .init = colibri_pxa270_ohci_init, | ||
209 | }; | ||
210 | |||
211 | static void __init colibri_pxa270_uhc_init(void) | ||
212 | { | ||
213 | pxa_set_ohci_info(&colibri_pxa270_ohci_info); | ||
214 | } | ||
215 | #else | ||
216 | static inline void colibri_pxa270_uhc_init(void) {} | ||
217 | #endif | ||
218 | |||
219 | /****************************************************************************** | ||
220 | * Audio and Touchscreen | 146 | * Audio and Touchscreen |
221 | ******************************************************************************/ | 147 | ******************************************************************************/ |
222 | #if defined(CONFIG_TOUCHSCREEN_UCB1400) || \ | 148 | #if defined(CONFIG_TOUCHSCREEN_UCB1400) || \ |
@@ -246,18 +172,25 @@ static void __init colibri_pxa270_tsc_init(void) | |||
246 | static inline void colibri_pxa270_tsc_init(void) {} | 172 | static inline void colibri_pxa270_tsc_init(void) {} |
247 | #endif | 173 | #endif |
248 | 174 | ||
175 | static int colibri_pxa270_baseboard; | ||
176 | core_param(colibri_pxa270_baseboard, colibri_pxa270_baseboard, int, 0444); | ||
177 | |||
249 | static void __init colibri_pxa270_init(void) | 178 | static void __init colibri_pxa270_init(void) |
250 | { | 179 | { |
251 | pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa270_pin_config)); | 180 | pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa270_pin_config)); |
252 | pxa_set_ffuart_info(NULL); | ||
253 | pxa_set_btuart_info(NULL); | ||
254 | pxa_set_stuart_info(NULL); | ||
255 | 181 | ||
256 | colibri_pxa270_nor_init(); | 182 | colibri_pxa270_nor_init(); |
257 | colibri_pxa270_eth_init(); | 183 | colibri_pxa270_eth_init(); |
258 | colibri_pxa270_mmc_init(); | ||
259 | colibri_pxa270_uhc_init(); | ||
260 | colibri_pxa270_tsc_init(); | 184 | colibri_pxa270_tsc_init(); |
185 | |||
186 | switch (colibri_pxa270_baseboard) { | ||
187 | case COLIBRI_PXA270_EVALBOARD: | ||
188 | colibri_pxa270_evalboard_init(); | ||
189 | break; | ||
190 | default: | ||
191 | printk(KERN_ERR "Illegal colibri_pxa270_baseboard type %d\n", | ||
192 | colibri_pxa270_baseboard); | ||
193 | } | ||
261 | } | 194 | } |
262 | 195 | ||
263 | MACHINE_START(COLIBRI, "Toradex Colibri PXA270") | 196 | MACHINE_START(COLIBRI, "Toradex Colibri PXA270") |
diff --git a/arch/arm/mach-pxa/include/mach/colibri.h b/arch/arm/mach-pxa/include/mach/colibri.h index 8579b1006791..6434f66824b3 100644 --- a/arch/arm/mach-pxa/include/mach/colibri.h +++ b/arch/arm/mach-pxa/include/mach/colibri.h | |||
@@ -5,6 +5,20 @@ | |||
5 | #include <mach/mfp.h> | 5 | #include <mach/mfp.h> |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * base board glue for PXA270 module | ||
9 | */ | ||
10 | |||
11 | enum { | ||
12 | COLIBRI_PXA270_EVALBOARD = 0, | ||
13 | }; | ||
14 | |||
15 | #if defined(CONFIG_MACH_COLIBRI_PXA270_EVALBOARD) | ||
16 | extern void colibri_pxa270_evalboard_init(void); | ||
17 | #else | ||
18 | static inline void colibri_pxa270_evalboard_init(void) {} | ||
19 | #endif | ||
20 | |||
21 | /* | ||
8 | * common settings for all modules | 22 | * common settings for all modules |
9 | */ | 23 | */ |
10 | 24 | ||