blob: 7545a48ed88bf5e66c28ca8c859dfedddda9e7a4 [file] [log] [blame]
Daniel Mack4e4fc052008-01-23 14:54:50 +01001/*
Daniel Mack5c0dbb82009-03-13 16:37:08 +01002 * linux/arch/arm/mach-pxa/colibri-pxa270.c
Daniel Mack4e4fc052008-01-23 14:54:50 +01003 *
Daniel Mack5c0dbb82009-03-13 16:37:08 +01004 * Support for Toradex PXA270 based Colibri module
Daniel Mack4e4fc052008-01-23 14:54:50 +01005 * Daniel Mack <daniel@caiaq.de>
Marek Vasutf95bb542010-05-22 00:29:33 +02006 * Marek Vasut <marek.vasut@gmail.com>
Daniel Mack4e4fc052008-01-23 14:54:50 +01007 *
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>
Daniel Mack4e4fc052008-01-23 14:54:50 +010014#include <linux/interrupt.h>
Daniel Mack4c243c82010-05-22 00:29:38 +020015#include <linux/kernel.h>
Daniel Mack4e4fc052008-01-23 14:54:50 +010016#include <linux/mtd/mtd.h>
17#include <linux/mtd/partitions.h>
18#include <linux/mtd/physmap.h>
Daniel Mack4c243c82010-05-22 00:29:38 +020019#include <linux/platform_device.h>
Marek Vasut7cca84a2010-05-22 00:29:37 +020020#include <linux/ucb1400.h>
Daniel Mack4c243c82010-05-22 00:29:38 +020021
Daniel Mack4e4fc052008-01-23 14:54:50 +010022#include <asm/mach/arch.h>
Daniel Mack4e4fc052008-01-23 14:54:50 +010023#include <asm/mach/flash.h>
Daniel Mack4c243c82010-05-22 00:29:38 +020024#include <asm/mach-types.h>
25#include <asm/sizes.h>
Eric Miao51c62982009-01-02 23:17:22 +080026
Marek Vasut7cca84a2010-05-22 00:29:37 +020027#include <mach/audio.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010028#include <mach/colibri.h>
Daniel Mack4c243c82010-05-22 00:29:38 +020029#include <mach/pxa27x.h>
Daniel Mack4e4fc052008-01-23 14:54:50 +010030
Daniel Mack4e4fc052008-01-23 14:54:50 +010031#include "devices.h"
Daniel Mack4c243c82010-05-22 00:29:38 +020032#include "generic.h"
Daniel Mack4e4fc052008-01-23 14:54:50 +010033
Marek Vasutf95bb542010-05-22 00:29:33 +020034/******************************************************************************
Marek Vasut9b6956f2010-08-12 01:18:38 +020035 * Evaluation board MFP
36 ******************************************************************************/
Marek Vasuta3172e52010-08-12 01:45:05 +020037#ifdef CONFIG_MACH_COLIBRI_EVALBOARD
Marek Vasut9b6956f2010-08-12 01:18:38 +020038static mfp_cfg_t colibri_pxa270_evalboard_pin_config[] __initdata = {
39 /* MMC */
40 GPIO32_MMC_CLK,
41 GPIO92_MMC_DAT_0,
42 GPIO109_MMC_DAT_1,
43 GPIO110_MMC_DAT_2,
44 GPIO111_MMC_DAT_3,
45 GPIO112_MMC_CMD,
46 GPIO0_GPIO, /* SD detect */
47
48 /* FFUART */
49 GPIO39_FFUART_TXD,
50 GPIO34_FFUART_RXD,
51
52 /* UHC */
53 GPIO88_USBH1_PWR,
54 GPIO89_USBH1_PEN,
55 GPIO119_USBH2_PWR,
56 GPIO120_USBH2_PEN,
57
58 /* PCMCIA */
59 GPIO85_nPCE_1,
60 GPIO54_nPCE_2,
61 GPIO55_nPREG,
62 GPIO50_nPIOR,
63 GPIO51_nPIOW,
64 GPIO49_nPWE,
65 GPIO48_nPOE,
66 GPIO57_nIOIS16,
67 GPIO56_nPWAIT,
68 GPIO104_PSKTSEL,
69 GPIO53_GPIO, /* RESET */
70 GPIO83_GPIO, /* BVD1 */
71 GPIO82_GPIO, /* BVD2 */
72 GPIO1_GPIO, /* READY */
73 GPIO84_GPIO, /* DETECT */
74 GPIO107_GPIO, /* PPEN */
Marek Vasut072e1ae2010-08-12 01:30:39 +020075
76 /* I2C */
77 GPIO117_I2C_SCL,
78 GPIO118_I2C_SDA,
Marek Vasut9b6956f2010-08-12 01:18:38 +020079};
80#else
81static mfp_cfg_t colibri_pxa270_evalboard_pin_config[] __initdata = {};
82#endif
83
84#ifdef CONFIG_MACH_COLIBRI_PXA270_INCOME
85static mfp_cfg_t income_pin_config[] __initdata = {
86 /* MMC */
87 GPIO32_MMC_CLK,
88 GPIO92_MMC_DAT_0,
89 GPIO109_MMC_DAT_1,
90 GPIO110_MMC_DAT_2,
91 GPIO111_MMC_DAT_3,
92 GPIO112_MMC_CMD,
93 GPIO0_GPIO, /* SD detect */
94 GPIO1_GPIO, /* SD read-only */
95
96 /* FFUART */
97 GPIO39_FFUART_TXD,
98 GPIO34_FFUART_RXD,
99
100 /* BFUART */
101 GPIO42_BTUART_RXD,
102 GPIO43_BTUART_TXD,
103 GPIO45_BTUART_RTS,
104
105 /* STUART */
106 GPIO46_STUART_RXD,
107 GPIO47_STUART_TXD,
108
109 /* UHC */
110 GPIO88_USBH1_PWR,
111 GPIO89_USBH1_PEN,
112
113 /* LCD */
114 GPIOxx_LCD_TFT_16BPP,
115
116 /* PWM */
117 GPIO16_PWM0_OUT,
118
119 /* I2C */
120 GPIO117_I2C_SCL,
121 GPIO118_I2C_SDA,
122
123 /* LED */
124 GPIO54_GPIO, /* LED A */
125 GPIO55_GPIO, /* LED B */
126};
127#else
128static mfp_cfg_t income_pin_config[] __initdata = {};
129#endif
130
131/******************************************************************************
Marek Vasutf95bb542010-05-22 00:29:33 +0200132 * Pin configuration
133 ******************************************************************************/
Daniel Mack5c0dbb82009-03-13 16:37:08 +0100134static mfp_cfg_t colibri_pxa270_pin_config[] __initdata = {
Marek Vasutf95bb542010-05-22 00:29:33 +0200135 /* Ethernet */
Eric Miaoc0b15412008-08-08 14:59:03 +0800136 GPIO78_nCS_2, /* Ethernet CS */
137 GPIO114_GPIO, /* Ethernet IRQ */
Marek Vasutd01b8d62010-05-22 00:29:34 +0200138
Marek Vasut7cca84a2010-05-22 00:29:37 +0200139 /* AC97 */
140 GPIO28_AC97_BITCLK,
141 GPIO29_AC97_SDATA_IN_0,
142 GPIO30_AC97_SDATA_OUT,
143 GPIO31_AC97_SYNC,
144 GPIO95_AC97_nRESET,
145 GPIO98_AC97_SYSCLK,
146 GPIO113_GPIO, /* Touchscreen IRQ */
Eric Miaoc0b15412008-08-08 14:59:03 +0800147};
148
Marek Vasutf95bb542010-05-22 00:29:33 +0200149/******************************************************************************
150 * NOR Flash
151 ******************************************************************************/
152#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
Daniel Mack4e4fc052008-01-23 14:54:50 +0100153static struct mtd_partition colibri_partitions[] = {
154 {
155 .name = "Bootloader",
156 .offset = 0x00000000,
157 .size = 0x00040000,
Marek Vasutf95bb542010-05-22 00:29:33 +0200158 .mask_flags = MTD_WRITEABLE /* force read-only */
Daniel Mack4e4fc052008-01-23 14:54:50 +0100159 }, {
160 .name = "Kernel",
161 .offset = 0x00040000,
162 .size = 0x00400000,
163 .mask_flags = 0
164 }, {
165 .name = "Rootfs",
166 .offset = 0x00440000,
167 .size = MTDPART_SIZ_FULL,
168 .mask_flags = 0
169 }
170};
171
172static struct physmap_flash_data colibri_flash_data[] = {
173 {
174 .width = 4, /* bankwidth in bytes */
175 .parts = colibri_partitions,
176 .nr_parts = ARRAY_SIZE(colibri_partitions)
177 }
178};
179
Daniel Mack5c0dbb82009-03-13 16:37:08 +0100180static struct resource colibri_pxa270_flash_resource = {
Daniel Mack4e4fc052008-01-23 14:54:50 +0100181 .start = PXA_CS0_PHYS,
182 .end = PXA_CS0_PHYS + SZ_32M - 1,
183 .flags = IORESOURCE_MEM,
184};
185
Daniel Mack5c0dbb82009-03-13 16:37:08 +0100186static struct platform_device colibri_pxa270_flash_device = {
Daniel Mack4e4fc052008-01-23 14:54:50 +0100187 .name = "physmap-flash",
188 .id = 0,
189 .dev = {
190 .platform_data = colibri_flash_data,
191 },
Daniel Mack5c0dbb82009-03-13 16:37:08 +0100192 .resource = &colibri_pxa270_flash_resource,
Daniel Mack4e4fc052008-01-23 14:54:50 +0100193 .num_resources = 1,
194};
195
Marek Vasutf95bb542010-05-22 00:29:33 +0200196static void __init colibri_pxa270_nor_init(void)
197{
198 platform_device_register(&colibri_pxa270_flash_device);
199}
200#else
201static inline void colibri_pxa270_nor_init(void) {}
202#endif
203
204/******************************************************************************
205 * Ethernet
206 ******************************************************************************/
207#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
208static struct resource colibri_pxa270_dm9000_resources[] = {
Marek Vasut403d2972010-05-22 00:29:39 +0200209 {
Marek Vasutf95bb542010-05-22 00:29:33 +0200210 .start = PXA_CS2_PHYS,
211 .end = PXA_CS2_PHYS + 3,
Daniel Mack4e4fc052008-01-23 14:54:50 +0100212 .flags = IORESOURCE_MEM,
213 },
Marek Vasut403d2972010-05-22 00:29:39 +0200214 {
Marek Vasutf95bb542010-05-22 00:29:33 +0200215 .start = PXA_CS2_PHYS + 4,
216 .end = PXA_CS2_PHYS + 4 + 500,
Daniel Mack4e4fc052008-01-23 14:54:50 +0100217 .flags = IORESOURCE_MEM,
218 },
Marek Vasut403d2972010-05-22 00:29:39 +0200219 {
Marek Vasutf95bb542010-05-22 00:29:33 +0200220 .start = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ),
221 .end = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ),
Michael Abbottd0afc852008-05-14 16:29:24 -0700222 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
Daniel Mack4e4fc052008-01-23 14:54:50 +0100223 },
224};
225
Marek Vasutf95bb542010-05-22 00:29:33 +0200226static struct platform_device colibri_pxa270_dm9000_device = {
Daniel Mack4e4fc052008-01-23 14:54:50 +0100227 .name = "dm9000",
228 .id = -1,
Marek Vasutf95bb542010-05-22 00:29:33 +0200229 .num_resources = ARRAY_SIZE(colibri_pxa270_dm9000_resources),
230 .resource = colibri_pxa270_dm9000_resources,
Daniel Mack4e4fc052008-01-23 14:54:50 +0100231};
232
Marek Vasutf95bb542010-05-22 00:29:33 +0200233static void __init colibri_pxa270_eth_init(void)
234{
235 platform_device_register(&colibri_pxa270_dm9000_device);
236}
237#else
238static inline void colibri_pxa270_eth_init(void) {}
Daniel Mack5c0dbb82009-03-13 16:37:08 +0100239#endif
Daniel Mack4e4fc052008-01-23 14:54:50 +0100240
Marek Vasutd01b8d62010-05-22 00:29:34 +0200241/******************************************************************************
Marek Vasut7cca84a2010-05-22 00:29:37 +0200242 * Audio and Touchscreen
243 ******************************************************************************/
244#if defined(CONFIG_TOUCHSCREEN_UCB1400) || \
245 defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)
246static pxa2xx_audio_ops_t colibri_pxa270_ac97_pdata = {
247 .reset_gpio = 95,
248};
249
250static struct ucb1400_pdata colibri_pxa270_ucb1400_pdata = {
251 .irq = gpio_to_irq(GPIO113_COLIBRI_PXA270_TS_IRQ),
252};
253
254static struct platform_device colibri_pxa270_ucb1400_device = {
255 .name = "ucb1400_core",
256 .id = -1,
257 .dev = {
258 .platform_data = &colibri_pxa270_ucb1400_pdata,
259 },
260};
261
262static void __init colibri_pxa270_tsc_init(void)
263{
264 pxa_set_ac97_info(&colibri_pxa270_ac97_pdata);
265 platform_device_register(&colibri_pxa270_ucb1400_device);
266}
267#else
268static inline void colibri_pxa270_tsc_init(void) {}
269#endif
270
Daniel Mack4c243c82010-05-22 00:29:38 +0200271static int colibri_pxa270_baseboard;
272core_param(colibri_pxa270_baseboard, colibri_pxa270_baseboard, int, 0444);
273
Daniel Mack5c0dbb82009-03-13 16:37:08 +0100274static void __init colibri_pxa270_init(void)
Daniel Mack4e4fc052008-01-23 14:54:50 +0100275{
Daniel Mack5c0dbb82009-03-13 16:37:08 +0100276 pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa270_pin_config));
Marek Vasutf95bb542010-05-22 00:29:33 +0200277
278 colibri_pxa270_nor_init();
279 colibri_pxa270_eth_init();
Marek Vasut7cca84a2010-05-22 00:29:37 +0200280 colibri_pxa270_tsc_init();
Daniel Mack4c243c82010-05-22 00:29:38 +0200281
282 switch (colibri_pxa270_baseboard) {
Marek Vasuta3172e52010-08-12 01:45:05 +0200283 case COLIBRI_EVALBOARD:
Marek Vasut9b6956f2010-08-12 01:18:38 +0200284 pxa2xx_mfp_config(ARRAY_AND_SIZE(
285 colibri_pxa270_evalboard_pin_config));
Marek Vasuta3172e52010-08-12 01:45:05 +0200286 colibri_evalboard_init();
Daniel Mack4c243c82010-05-22 00:29:38 +0200287 break;
Marek Vasut403d2972010-05-22 00:29:39 +0200288 case COLIBRI_PXA270_INCOME:
Marek Vasut9b6956f2010-08-12 01:18:38 +0200289 pxa2xx_mfp_config(ARRAY_AND_SIZE(income_pin_config));
Marek Vasut403d2972010-05-22 00:29:39 +0200290 colibri_pxa270_income_boardinit();
291 break;
Daniel Mack4c243c82010-05-22 00:29:38 +0200292 default:
293 printk(KERN_ERR "Illegal colibri_pxa270_baseboard type %d\n",
294 colibri_pxa270_baseboard);
295 }
Daniel Mack4e4fc052008-01-23 14:54:50 +0100296}
297
Marek Vasut403d2972010-05-22 00:29:39 +0200298/* The "Income s.r.o. SH-Dmaster PXA270 SBC" board can be booted either
299 * with the INCOME mach type or with COLIBRI and the kernel parameter
300 * "colibri_pxa270_baseboard=1"
301 */
302static void __init colibri_pxa270_income_init(void)
303{
304 colibri_pxa270_baseboard = COLIBRI_PXA270_INCOME;
305 colibri_pxa270_init();
306}
307
Daniel Mack5c0dbb82009-03-13 16:37:08 +0100308MACHINE_START(COLIBRI, "Toradex Colibri PXA270")
Daniel Mack4e4fc052008-01-23 14:54:50 +0100309 .boot_params = COLIBRI_SDRAM_BASE + 0x100,
Daniel Mack5c0dbb82009-03-13 16:37:08 +0100310 .init_machine = colibri_pxa270_init,
Marek Vasut851982c2010-10-11 02:20:19 +0200311 .map_io = pxa27x_map_io,
Daniel Mack4e4fc052008-01-23 14:54:50 +0100312 .init_irq = pxa27x_init_irq,
313 .timer = &pxa_timer,
314MACHINE_END
Daniel Mack5c0dbb82009-03-13 16:37:08 +0100315
Marek Vasut403d2972010-05-22 00:29:39 +0200316MACHINE_START(INCOME, "Income s.r.o. SH-Dmaster PXA270 SBC")
Marek Vasut403d2972010-05-22 00:29:39 +0200317 .boot_params = 0xa0000100,
318 .init_machine = colibri_pxa270_income_init,
Marek Vasut851982c2010-10-11 02:20:19 +0200319 .map_io = pxa27x_map_io,
Marek Vasut403d2972010-05-22 00:29:39 +0200320 .init_irq = pxa27x_init_irq,
321 .timer = &pxa_timer,
322MACHINE_END
323