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