Linux 2.6.31.6
[linux/fpc-iii.git] / arch / arm / mach-pxa / pcm027.c
blob6abfa2979c61f32732d93ec8e5e258dba465c94e
1 /*
2 * linux/arch/arm/mach-pxa/pcm027.c
3 * Support for the Phytec phyCORE-PXA270 CPU card (aka PCM-027).
5 * Refer
6 * http://www.phytec.com/products/sbc/ARM-XScale/phyCORE-XScale-PXA270.html
7 * for additional hardware info
9 * Author: Juergen Kilb
10 * Created: April 05, 2005
11 * Copyright: Phytec Messtechnik GmbH
12 * e-Mail: armlinux@phytec.de
14 * based on Intel Mainstone Board
16 * Copyright 2007 Juergen Beisert @ Pengutronix (j.beisert@pengutronix.de)
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License version 2 as
20 * published by the Free Software Foundation.
23 #include <linux/irq.h>
24 #include <linux/platform_device.h>
25 #include <linux/mtd/physmap.h>
26 #include <linux/spi/spi.h>
27 #include <linux/spi/max7301.h>
28 #include <linux/leds.h>
30 #include <asm/mach-types.h>
31 #include <asm/mach/arch.h>
32 #include <mach/pxa27x.h>
33 #include <mach/pxa2xx_spi.h>
34 #include <mach/pcm027.h>
35 #include "generic.h"
38 * ABSTRACT:
40 * The PXA270 processor comes with a bunch of hardware on its silicon.
41 * Not all of this hardware can be used at the same time and not all
42 * is routed to module's connectors. Also it depends on the baseboard, what
43 * kind of hardware can be used in which way.
44 * -> So this file supports the main devices on the CPU card only!
45 * Refer pcm990-baseboard.c how to extend this features to get a full
46 * blown system with many common interfaces.
48 * The PCM-027 supports the following interfaces through its connectors and
49 * will be used in pcm990-baseboard.c:
51 * - LCD support
52 * - MMC support
53 * - IDE/CF card
54 * - FFUART
55 * - BTUART
56 * - IRUART
57 * - AC97
58 * - SSP
59 * - SSP3
61 * Claimed GPIOs:
62 * GPIO0 -> IRQ input from RTC
63 * GPIO2 -> SYS_ENA*)
64 * GPIO3 -> PWR_SCL
65 * GPIO4 -> PWR_SDA
66 * GPIO5 -> PowerCap0*)
67 * GPIO6 -> PowerCap1*)
68 * GPIO7 -> PowerCap2*)
69 * GPIO8 -> PowerCap3*)
70 * GPIO15 -> /CS1
71 * GPIO20 -> /CS2
72 * GPIO21 -> /CS3
73 * GPIO33 -> /CS5 network controller select
74 * GPIO52 -> IRQ from network controller
75 * GPIO78 -> /CS2
76 * GPIO80 -> /CS4
77 * GPIO90 -> LED0
78 * GPIO91 -> LED1
79 * GPIO114 -> IRQ from CAN controller
80 * GPIO117 -> SCL
81 * GPIO118 -> SDA
83 * *) CPU internal use only
86 static unsigned long pcm027_pin_config[] __initdata = {
87 /* Chip Selects */
88 GPIO20_nSDCS_2,
89 GPIO21_nSDCS_3,
90 GPIO15_nCS_1,
91 GPIO78_nCS_2,
92 GPIO80_nCS_4,
93 GPIO33_nCS_5, /* Ethernet */
95 /* I2C */
96 GPIO117_I2C_SCL,
97 GPIO118_I2C_SDA,
99 /* GPIO */
100 GPIO52_GPIO, /* IRQ from network controller */
101 #ifdef CONFIG_LEDS_GPIO
102 GPIO90_GPIO, /* PCM027_LED_CPU */
103 GPIO91_GPIO, /* PCM027_LED_HEART_BEAT */
104 #endif
105 GPIO114_GPIO, /* IRQ from CAN controller */
109 * SMC91x network controller specific stuff
111 static struct resource smc91x_resources[] = {
112 [0] = {
113 .start = PCM027_ETH_PHYS + 0x300,
114 .end = PCM027_ETH_PHYS + PCM027_ETH_SIZE,
115 .flags = IORESOURCE_MEM,
117 [1] = {
118 .start = PCM027_ETH_IRQ,
119 .end = PCM027_ETH_IRQ,
120 /* note: smc91x's driver doesn't use the trigger bits yet */
121 .flags = IORESOURCE_IRQ | PCM027_ETH_IRQ_EDGE,
125 static struct platform_device smc91x_device = {
126 .name = "smc91x",
127 .id = 0,
128 .num_resources = ARRAY_SIZE(smc91x_resources),
129 .resource = smc91x_resources,
133 * SPI host and devices
135 static struct pxa2xx_spi_master pxa_ssp_master_info = {
136 .num_chipselect = 1,
139 static struct max7301_platform_data max7301_info = {
140 .base = -1,
143 /* bus_num must match id in pxa2xx_set_spi_info() call */
144 static struct spi_board_info spi_board_info[] __initdata = {
146 .modalias = "max7301",
147 .platform_data = &max7301_info,
148 .max_speed_hz = 13000000,
149 .bus_num = 1,
150 .chip_select = 0,
151 .mode = SPI_MODE_0,
156 * NOR flash
158 static struct physmap_flash_data pcm027_flash_data = {
159 .width = 4,
162 static struct resource pcm027_flash_resource = {
163 .start = PCM027_FLASH_PHYS,
164 .end = PCM027_FLASH_PHYS + PCM027_FLASH_SIZE - 1 ,
165 .flags = IORESOURCE_MEM,
168 static struct platform_device pcm027_flash = {
169 .name = "physmap-flash",
170 .id = 0,
171 .dev = {
172 .platform_data = &pcm027_flash_data,
174 .resource = &pcm027_flash_resource,
175 .num_resources = 1,
178 #ifdef CONFIG_LEDS_GPIO
180 static struct gpio_led pcm027_led[] = {
182 .name = "led0:red", /* FIXME */
183 .gpio = PCM027_LED_CPU
186 .name = "led1:green", /* FIXME */
187 .gpio = PCM027_LED_HEARD_BEAT
191 static struct gpio_led_platform_data pcm027_led_data = {
192 .num_leds = ARRAY_SIZE(pcm027_led),
193 .leds = pcm027_led
196 static struct platform_device pcm027_led_dev = {
197 .name = "leds-gpio",
198 .id = 0,
199 .dev = {
200 .platform_data = &pcm027_led_data,
204 #endif /* CONFIG_LEDS_GPIO */
207 * declare the available device resources on this board
209 static struct platform_device *devices[] __initdata = {
210 &smc91x_device,
211 &pcm027_flash,
212 #ifdef CONFIG_LEDS_GPIO
213 &pcm027_led_dev
214 #endif
218 * pcm027_init - breath some life into the board
220 static void __init pcm027_init(void)
222 /* system bus arbiter setting
223 * - Core_Park
224 * - LCD_wt:DMA_wt:CORE_Wt = 2:3:4
226 ARB_CNTRL = ARB_CORE_PARK | 0x234;
228 pxa2xx_mfp_config(pcm027_pin_config, ARRAY_SIZE(pcm027_pin_config));
230 platform_add_devices(devices, ARRAY_SIZE(devices));
232 /* at last call the baseboard to initialize itself */
233 #ifdef CONFIG_MACH_PCM990_BASEBOARD
234 pcm990_baseboard_init();
235 #endif
237 pxa2xx_set_spi_info(1, &pxa_ssp_master_info);
238 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
241 static void __init pcm027_map_io(void)
243 pxa_map_io();
245 /* initialize sleep mode regs (wake-up sources, etc) */
246 PGSR0 = 0x01308000;
247 PGSR1 = 0x00CF0002;
248 PGSR2 = 0x0E294000;
249 PGSR3 = 0x0000C000;
250 PWER = 0x40000000 | PWER_GPIO0 | PWER_GPIO1;
251 PRER = 0x00000000;
252 PFER = 0x00000003;
255 MACHINE_START(PCM027, "Phytec Messtechnik GmbH phyCORE-PXA270")
256 /* Maintainer: Pengutronix */
257 .boot_params = 0xa0000100,
258 .phys_io = 0x40000000,
259 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
260 .map_io = pcm027_map_io,
261 .init_irq = pxa27x_init_irq,
262 .timer = &pxa_timer,
263 .init_machine = pcm027_init,
264 MACHINE_END