diff options
Diffstat (limited to 'arch/arm/mach-pxa/colibri-pxa270.c')
-rw-r--r-- | arch/arm/mach-pxa/colibri-pxa270.c | 176 |
1 files changed, 128 insertions, 48 deletions
diff --git a/arch/arm/mach-pxa/colibri-pxa270.c b/arch/arm/mach-pxa/colibri-pxa270.c index 061c45316de8..98673ac6efd0 100644 --- a/arch/arm/mach-pxa/colibri-pxa270.c +++ b/arch/arm/mach-pxa/colibri-pxa270.c | |||
@@ -3,6 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Support for Toradex PXA270 based Colibri module | 4 | * Support for Toradex PXA270 based Colibri module |
5 | * Daniel Mack <daniel@caiaq.de> | 5 | * Daniel Mack <daniel@caiaq.de> |
6 | * Marek Vasut <marek.vasut@gmail.com> | ||
6 | * | 7 | * |
7 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License version 2 as | 9 | * it under the terms of the GNU General Public License version 2 as |
@@ -10,49 +11,55 @@ | |||
10 | */ | 11 | */ |
11 | 12 | ||
12 | #include <linux/init.h> | 13 | #include <linux/init.h> |
13 | #include <linux/kernel.h> | ||
14 | #include <linux/platform_device.h> | ||
15 | #include <linux/sysdev.h> | ||
16 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
17 | #include <linux/bitops.h> | 15 | #include <linux/kernel.h> |
18 | #include <linux/ioport.h> | ||
19 | #include <linux/delay.h> | ||
20 | #include <linux/mtd/mtd.h> | 16 | #include <linux/mtd/mtd.h> |
21 | #include <linux/mtd/partitions.h> | 17 | #include <linux/mtd/partitions.h> |
22 | #include <linux/mtd/physmap.h> | 18 | #include <linux/mtd/physmap.h> |
23 | #include <linux/gpio.h> | 19 | #include <linux/platform_device.h> |
24 | #include <asm/mach-types.h> | 20 | #include <linux/sysdev.h> |
25 | #include <mach/hardware.h> | 21 | #include <linux/ucb1400.h> |
26 | #include <asm/irq.h> | 22 | |
27 | #include <asm/sizes.h> | ||
28 | #include <asm/mach/arch.h> | 23 | #include <asm/mach/arch.h> |
29 | #include <asm/mach/map.h> | ||
30 | #include <asm/mach/irq.h> | ||
31 | #include <asm/mach/flash.h> | 24 | #include <asm/mach/flash.h> |
25 | #include <asm/mach-types.h> | ||
26 | #include <asm/sizes.h> | ||
32 | 27 | ||
33 | #include <mach/pxa27x.h> | 28 | #include <mach/audio.h> |
34 | #include <mach/colibri.h> | 29 | #include <mach/colibri.h> |
30 | #include <mach/pxa27x.h> | ||
35 | 31 | ||
36 | #include "generic.h" | ||
37 | #include "devices.h" | 32 | #include "devices.h" |
33 | #include "generic.h" | ||
38 | 34 | ||
39 | /* | 35 | /****************************************************************************** |
40 | * GPIO configuration | 36 | * Pin configuration |
41 | */ | 37 | ******************************************************************************/ |
42 | static mfp_cfg_t colibri_pxa270_pin_config[] __initdata = { | 38 | static mfp_cfg_t colibri_pxa270_pin_config[] __initdata = { |
39 | /* Ethernet */ | ||
43 | GPIO78_nCS_2, /* Ethernet CS */ | 40 | GPIO78_nCS_2, /* Ethernet CS */ |
44 | GPIO114_GPIO, /* Ethernet IRQ */ | 41 | GPIO114_GPIO, /* Ethernet IRQ */ |
42 | |||
43 | /* AC97 */ | ||
44 | GPIO28_AC97_BITCLK, | ||
45 | GPIO29_AC97_SDATA_IN_0, | ||
46 | GPIO30_AC97_SDATA_OUT, | ||
47 | GPIO31_AC97_SYNC, | ||
48 | GPIO95_AC97_nRESET, | ||
49 | GPIO98_AC97_SYSCLK, | ||
50 | GPIO113_GPIO, /* Touchscreen IRQ */ | ||
45 | }; | 51 | }; |
46 | 52 | ||
47 | /* | 53 | /****************************************************************************** |
48 | * NOR flash | 54 | * NOR Flash |
49 | */ | 55 | ******************************************************************************/ |
56 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) | ||
50 | static struct mtd_partition colibri_partitions[] = { | 57 | static struct mtd_partition colibri_partitions[] = { |
51 | { | 58 | { |
52 | .name = "Bootloader", | 59 | .name = "Bootloader", |
53 | .offset = 0x00000000, | 60 | .offset = 0x00000000, |
54 | .size = 0x00040000, | 61 | .size = 0x00040000, |
55 | .mask_flags = MTD_WRITEABLE /* force read-only */ | 62 | .mask_flags = MTD_WRITEABLE /* force read-only */ |
56 | }, { | 63 | }, { |
57 | .name = "Kernel", | 64 | .name = "Kernel", |
58 | .offset = 0x00040000, | 65 | .offset = 0x00040000, |
@@ -90,50 +97,113 @@ static struct platform_device colibri_pxa270_flash_device = { | |||
90 | .num_resources = 1, | 97 | .num_resources = 1, |
91 | }; | 98 | }; |
92 | 99 | ||
93 | /* | 100 | static void __init colibri_pxa270_nor_init(void) |
94 | * DM9000 Ethernet | 101 | { |
95 | */ | 102 | platform_device_register(&colibri_pxa270_flash_device); |
96 | #if defined(CONFIG_DM9000) | 103 | } |
97 | static struct resource dm9000_resources[] = { | 104 | #else |
98 | [0] = { | 105 | static inline void colibri_pxa270_nor_init(void) {} |
99 | .start = COLIBRI_PXA270_ETH_PHYS, | 106 | #endif |
100 | .end = COLIBRI_PXA270_ETH_PHYS + 3, | 107 | |
108 | /****************************************************************************** | ||
109 | * Ethernet | ||
110 | ******************************************************************************/ | ||
111 | #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE) | ||
112 | static struct resource colibri_pxa270_dm9000_resources[] = { | ||
113 | { | ||
114 | .start = PXA_CS2_PHYS, | ||
115 | .end = PXA_CS2_PHYS + 3, | ||
101 | .flags = IORESOURCE_MEM, | 116 | .flags = IORESOURCE_MEM, |
102 | }, | 117 | }, |
103 | [1] = { | 118 | { |
104 | .start = COLIBRI_PXA270_ETH_PHYS + 4, | 119 | .start = PXA_CS2_PHYS + 4, |
105 | .end = COLIBRI_PXA270_ETH_PHYS + 4 + 500, | 120 | .end = PXA_CS2_PHYS + 4 + 500, |
106 | .flags = IORESOURCE_MEM, | 121 | .flags = IORESOURCE_MEM, |
107 | }, | 122 | }, |
108 | [2] = { | 123 | { |
109 | .start = COLIBRI_PXA270_ETH_IRQ, | 124 | .start = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ), |
110 | .end = COLIBRI_PXA270_ETH_IRQ, | 125 | .end = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ), |
111 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING, | 126 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING, |
112 | }, | 127 | }, |
113 | }; | 128 | }; |
114 | 129 | ||
115 | static struct platform_device dm9000_device = { | 130 | static struct platform_device colibri_pxa270_dm9000_device = { |
116 | .name = "dm9000", | 131 | .name = "dm9000", |
117 | .id = -1, | 132 | .id = -1, |
118 | .num_resources = ARRAY_SIZE(dm9000_resources), | 133 | .num_resources = ARRAY_SIZE(colibri_pxa270_dm9000_resources), |
119 | .resource = dm9000_resources, | 134 | .resource = colibri_pxa270_dm9000_resources, |
120 | }; | 135 | }; |
121 | #endif /* CONFIG_DM9000 */ | ||
122 | 136 | ||
123 | static struct platform_device *colibri_pxa270_devices[] __initdata = { | 137 | static void __init colibri_pxa270_eth_init(void) |
124 | &colibri_pxa270_flash_device, | 138 | { |
125 | #if defined(CONFIG_DM9000) | 139 | platform_device_register(&colibri_pxa270_dm9000_device); |
126 | &dm9000_device, | 140 | } |
141 | #else | ||
142 | static inline void colibri_pxa270_eth_init(void) {} | ||
127 | #endif | 143 | #endif |
144 | |||
145 | /****************************************************************************** | ||
146 | * Audio and Touchscreen | ||
147 | ******************************************************************************/ | ||
148 | #if defined(CONFIG_TOUCHSCREEN_UCB1400) || \ | ||
149 | defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE) | ||
150 | static pxa2xx_audio_ops_t colibri_pxa270_ac97_pdata = { | ||
151 | .reset_gpio = 95, | ||
152 | }; | ||
153 | |||
154 | static struct ucb1400_pdata colibri_pxa270_ucb1400_pdata = { | ||
155 | .irq = gpio_to_irq(GPIO113_COLIBRI_PXA270_TS_IRQ), | ||
156 | }; | ||
157 | |||
158 | static struct platform_device colibri_pxa270_ucb1400_device = { | ||
159 | .name = "ucb1400_core", | ||
160 | .id = -1, | ||
161 | .dev = { | ||
162 | .platform_data = &colibri_pxa270_ucb1400_pdata, | ||
163 | }, | ||
128 | }; | 164 | }; |
129 | 165 | ||
166 | static void __init colibri_pxa270_tsc_init(void) | ||
167 | { | ||
168 | pxa_set_ac97_info(&colibri_pxa270_ac97_pdata); | ||
169 | platform_device_register(&colibri_pxa270_ucb1400_device); | ||
170 | } | ||
171 | #else | ||
172 | static inline void colibri_pxa270_tsc_init(void) {} | ||
173 | #endif | ||
174 | |||
175 | static int colibri_pxa270_baseboard; | ||
176 | core_param(colibri_pxa270_baseboard, colibri_pxa270_baseboard, int, 0444); | ||
177 | |||
130 | static void __init colibri_pxa270_init(void) | 178 | static void __init colibri_pxa270_init(void) |
131 | { | 179 | { |
132 | pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa270_pin_config)); | 180 | pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa270_pin_config)); |
133 | pxa_set_ffuart_info(NULL); | 181 | |
134 | pxa_set_btuart_info(NULL); | 182 | colibri_pxa270_nor_init(); |
135 | pxa_set_stuart_info(NULL); | 183 | colibri_pxa270_eth_init(); |
136 | platform_add_devices(ARRAY_AND_SIZE(colibri_pxa270_devices)); | 184 | colibri_pxa270_tsc_init(); |
185 | |||
186 | switch (colibri_pxa270_baseboard) { | ||
187 | case COLIBRI_PXA270_EVALBOARD: | ||
188 | colibri_pxa270_evalboard_init(); | ||
189 | break; | ||
190 | case COLIBRI_PXA270_INCOME: | ||
191 | colibri_pxa270_income_boardinit(); | ||
192 | break; | ||
193 | default: | ||
194 | printk(KERN_ERR "Illegal colibri_pxa270_baseboard type %d\n", | ||
195 | colibri_pxa270_baseboard); | ||
196 | } | ||
197 | } | ||
198 | |||
199 | /* The "Income s.r.o. SH-Dmaster PXA270 SBC" board can be booted either | ||
200 | * with the INCOME mach type or with COLIBRI and the kernel parameter | ||
201 | * "colibri_pxa270_baseboard=1" | ||
202 | */ | ||
203 | static void __init colibri_pxa270_income_init(void) | ||
204 | { | ||
205 | colibri_pxa270_baseboard = COLIBRI_PXA270_INCOME; | ||
206 | colibri_pxa270_init(); | ||
137 | } | 207 | } |
138 | 208 | ||
139 | MACHINE_START(COLIBRI, "Toradex Colibri PXA270") | 209 | MACHINE_START(COLIBRI, "Toradex Colibri PXA270") |
@@ -146,3 +216,13 @@ MACHINE_START(COLIBRI, "Toradex Colibri PXA270") | |||
146 | .timer = &pxa_timer, | 216 | .timer = &pxa_timer, |
147 | MACHINE_END | 217 | MACHINE_END |
148 | 218 | ||
219 | MACHINE_START(INCOME, "Income s.r.o. SH-Dmaster PXA270 SBC") | ||
220 | .phys_io = 0x40000000, | ||
221 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | ||
222 | .boot_params = 0xa0000100, | ||
223 | .init_machine = colibri_pxa270_income_init, | ||
224 | .map_io = pxa_map_io, | ||
225 | .init_irq = pxa27x_init_irq, | ||
226 | .timer = &pxa_timer, | ||
227 | MACHINE_END | ||
228 | |||