1 // SPDX-License-Identifier: GPL-2.0-only
3 * linux/arch/arm/mach-pxa/colibri-pxa270.c
5 * Support for Toradex PXA270 based Colibri module
6 * Daniel Mack <daniel@caiaq.de>
7 * Marek Vasut <marek.vasut@gmail.com>
10 #include <linux/init.h>
11 #include <linux/interrupt.h>
12 #include <linux/moduleparam.h>
13 #include <linux/kernel.h>
14 #include <linux/mtd/mtd.h>
15 #include <linux/mtd/partitions.h>
16 #include <linux/mtd/physmap.h>
17 #include <linux/platform_device.h>
18 #include <linux/regulator/machine.h>
19 #include <linux/ucb1400.h>
21 #include <asm/mach/arch.h>
22 #include <asm/mach/flash.h>
23 #include <asm/mach-types.h>
24 #include <linux/sizes.h>
26 #include <mach/audio.h>
33 /******************************************************************************
34 * Evaluation board MFP
35 ******************************************************************************/
36 #ifdef CONFIG_MACH_COLIBRI_EVALBOARD
37 static mfp_cfg_t colibri_pxa270_evalboard_pin_config
[] __initdata
= {
45 GPIO0_GPIO
, /* SD detect */
68 GPIO53_GPIO
, /* RESET */
69 GPIO83_GPIO
, /* BVD1 */
70 GPIO82_GPIO
, /* BVD2 */
71 GPIO1_GPIO
, /* READY */
72 GPIO84_GPIO
, /* DETECT */
73 GPIO107_GPIO
, /* PPEN */
80 static mfp_cfg_t colibri_pxa270_evalboard_pin_config
[] __initdata
= {};
83 #ifdef CONFIG_MACH_COLIBRI_PXA270_INCOME
84 static mfp_cfg_t income_pin_config
[] __initdata
= {
92 GPIO0_GPIO
, /* SD detect */
93 GPIO1_GPIO
, /* SD read-only */
113 GPIOxx_LCD_TFT_16BPP
,
123 GPIO54_GPIO
, /* LED A */
124 GPIO55_GPIO
, /* LED B */
127 static mfp_cfg_t income_pin_config
[] __initdata
= {};
130 /******************************************************************************
132 ******************************************************************************/
133 static mfp_cfg_t colibri_pxa270_pin_config
[] __initdata
= {
135 GPIO78_nCS_2
, /* Ethernet CS */
136 GPIO114_GPIO
, /* Ethernet IRQ */
140 GPIO29_AC97_SDATA_IN_0
,
141 GPIO30_AC97_SDATA_OUT
,
145 GPIO113_GPIO
, /* Touchscreen IRQ */
148 /******************************************************************************
150 ******************************************************************************/
151 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
152 static struct mtd_partition colibri_partitions
[] = {
154 .name
= "Bootloader",
155 .offset
= 0x00000000,
157 .mask_flags
= MTD_WRITEABLE
/* force read-only */
160 .offset
= 0x00040000,
165 .offset
= 0x00440000,
166 .size
= MTDPART_SIZ_FULL
,
171 static struct physmap_flash_data colibri_flash_data
[] = {
173 .width
= 4, /* bankwidth in bytes */
174 .parts
= colibri_partitions
,
175 .nr_parts
= ARRAY_SIZE(colibri_partitions
)
179 static struct resource colibri_pxa270_flash_resource
= {
180 .start
= PXA_CS0_PHYS
,
181 .end
= PXA_CS0_PHYS
+ SZ_32M
- 1,
182 .flags
= IORESOURCE_MEM
,
185 static struct platform_device colibri_pxa270_flash_device
= {
186 .name
= "physmap-flash",
189 .platform_data
= colibri_flash_data
,
191 .resource
= &colibri_pxa270_flash_resource
,
195 static void __init
colibri_pxa270_nor_init(void)
197 platform_device_register(&colibri_pxa270_flash_device
);
200 static inline void colibri_pxa270_nor_init(void) {}
203 /******************************************************************************
205 ******************************************************************************/
206 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
207 static struct resource colibri_pxa270_dm9000_resources
[] = {
209 .start
= PXA_CS2_PHYS
,
210 .end
= PXA_CS2_PHYS
+ 3,
211 .flags
= IORESOURCE_MEM
,
214 .start
= PXA_CS2_PHYS
+ 4,
215 .end
= PXA_CS2_PHYS
+ 4 + 500,
216 .flags
= IORESOURCE_MEM
,
219 .start
= PXA_GPIO_TO_IRQ(GPIO114_COLIBRI_PXA270_ETH_IRQ
),
220 .end
= PXA_GPIO_TO_IRQ(GPIO114_COLIBRI_PXA270_ETH_IRQ
),
221 .flags
= IORESOURCE_IRQ
| IRQF_TRIGGER_RISING
,
225 static struct platform_device colibri_pxa270_dm9000_device
= {
228 .num_resources
= ARRAY_SIZE(colibri_pxa270_dm9000_resources
),
229 .resource
= colibri_pxa270_dm9000_resources
,
232 static void __init
colibri_pxa270_eth_init(void)
234 platform_device_register(&colibri_pxa270_dm9000_device
);
237 static inline void colibri_pxa270_eth_init(void) {}
240 /******************************************************************************
241 * Audio and Touchscreen
242 ******************************************************************************/
243 #if defined(CONFIG_TOUCHSCREEN_UCB1400) || \
244 defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)
245 static pxa2xx_audio_ops_t colibri_pxa270_ac97_pdata
= {
249 static struct ucb1400_pdata colibri_pxa270_ucb1400_pdata
= {
250 .irq
= PXA_GPIO_TO_IRQ(GPIO113_COLIBRI_PXA270_TS_IRQ
),
253 static struct platform_device colibri_pxa270_ucb1400_device
= {
254 .name
= "ucb1400_core",
257 .platform_data
= &colibri_pxa270_ucb1400_pdata
,
261 static void __init
colibri_pxa270_tsc_init(void)
263 pxa_set_ac97_info(&colibri_pxa270_ac97_pdata
);
264 platform_device_register(&colibri_pxa270_ucb1400_device
);
267 static inline void colibri_pxa270_tsc_init(void) {}
270 static int colibri_pxa270_baseboard
;
271 core_param(colibri_pxa270_baseboard
, colibri_pxa270_baseboard
, int, 0444);
273 static void __init
colibri_pxa270_init(void)
275 pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa270_pin_config
));
277 colibri_pxa270_nor_init();
278 colibri_pxa270_eth_init();
279 colibri_pxa270_tsc_init();
281 switch (colibri_pxa270_baseboard
) {
282 case COLIBRI_EVALBOARD
:
283 pxa2xx_mfp_config(ARRAY_AND_SIZE(
284 colibri_pxa270_evalboard_pin_config
));
285 colibri_evalboard_init();
287 case COLIBRI_PXA270_INCOME
:
288 pxa2xx_mfp_config(ARRAY_AND_SIZE(income_pin_config
));
289 colibri_pxa270_income_boardinit();
292 printk(KERN_ERR
"Illegal colibri_pxa270_baseboard type %d\n",
293 colibri_pxa270_baseboard
);
296 regulator_has_full_constraints();
299 /* The "Income s.r.o. SH-Dmaster PXA270 SBC" board can be booted either
300 * with the INCOME mach type or with COLIBRI and the kernel parameter
301 * "colibri_pxa270_baseboard=1"
303 static void __init
colibri_pxa270_income_init(void)
305 colibri_pxa270_baseboard
= COLIBRI_PXA270_INCOME
;
306 colibri_pxa270_init();
309 MACHINE_START(COLIBRI
, "Toradex Colibri PXA270")
310 .atag_offset
= 0x100,
311 .init_machine
= colibri_pxa270_init
,
312 .map_io
= pxa27x_map_io
,
313 .nr_irqs
= PXA_NR_IRQS
,
314 .init_irq
= pxa27x_init_irq
,
315 .handle_irq
= pxa27x_handle_irq
,
316 .init_time
= pxa_timer_init
,
317 .restart
= pxa_restart
,
320 MACHINE_START(INCOME
, "Income s.r.o. SH-Dmaster PXA270 SBC")
321 .atag_offset
= 0x100,
322 .init_machine
= colibri_pxa270_income_init
,
323 .map_io
= pxa27x_map_io
,
324 .nr_irqs
= PXA_NR_IRQS
,
325 .init_irq
= pxa27x_init_irq
,
326 .handle_irq
= pxa27x_handle_irq
,
327 .init_time
= pxa_timer_init
,
328 .restart
= pxa_restart
,