hwmon: (applesmc) Ignore some temperature registers
[pandora-kernel.git] / arch / arm / mach-at91 / board-rsi-ews.c
1 /*
2  * board-rsi-ews.c
3  *
4  *  Copyright (C)
5  *  2005 SAN People,
6  *  2008-2011 R-S-I Elektrotechnik GmbH & Co. KG
7  *
8  * Licensed under GPLv2 or later.
9  */
10
11 #include <linux/types.h>
12 #include <linux/init.h>
13 #include <linux/mm.h>
14 #include <linux/module.h>
15 #include <linux/platform_device.h>
16 #include <linux/spi/spi.h>
17 #include <linux/mtd/physmap.h>
18
19 #include <asm/setup.h>
20 #include <asm/mach-types.h>
21 #include <asm/irq.h>
22
23 #include <asm/mach/arch.h>
24 #include <asm/mach/map.h>
25 #include <asm/mach/irq.h>
26
27 #include <mach/hardware.h>
28 #include <mach/board.h>
29
30 #include <linux/gpio.h>
31
32 #include "generic.h"
33
34 static void __init rsi_ews_init_early(void)
35 {
36         /* Initialize processor: 18.432 MHz crystal */
37         at91_initialize(18432000);
38 }
39
40 /*
41  * Ethernet
42  */
43 static struct macb_platform_data rsi_ews_eth_data __initdata = {
44         .phy_irq_pin    = AT91_PIN_PC4,
45         .is_rmii        = 1,
46 };
47
48 /*
49  * USB Host
50  */
51 static struct at91_usbh_data rsi_ews_usbh_data __initdata = {
52         .ports          = 1,
53         .vbus_pin       = {-EINVAL, -EINVAL},
54         .overcurrent_pin= {-EINVAL, -EINVAL},
55 };
56
57 /*
58  * SD/MC
59  */
60 static struct at91_mmc_data rsi_ews_mmc_data __initdata = {
61         .slot_b         = 0,
62         .wire4          = 1,
63         .det_pin        = AT91_PIN_PB27,
64         .wp_pin         = AT91_PIN_PB29,
65 };
66
67 /*
68  * I2C
69  */
70 static struct i2c_board_info rsi_ews_i2c_devices[] __initdata = {
71         {
72                 I2C_BOARD_INFO("ds1337", 0x68),
73         },
74         {
75                 I2C_BOARD_INFO("24c01", 0x50),
76         }
77 };
78
79 /*
80  * LEDs
81  */
82 static struct gpio_led rsi_ews_leds[] = {
83         {
84                 .name                   = "led0",
85                 .gpio                   = AT91_PIN_PB6,
86                 .active_low             = 0,
87         },
88         {
89                 .name                   = "led1",
90                 .gpio                   = AT91_PIN_PB7,
91                 .active_low             = 0,
92         },
93         {
94                 .name                   = "led2",
95                 .gpio                   = AT91_PIN_PB8,
96                 .active_low             = 0,
97         },
98         {
99                 .name                   = "led3",
100                 .gpio                   = AT91_PIN_PB9,
101                 .active_low             = 0,
102         },
103 };
104
105 /*
106  * DataFlash
107  */
108 static struct spi_board_info rsi_ews_spi_devices[] = {
109         {       /* DataFlash chip 1*/
110                 .modalias       = "mtd_dataflash",
111                 .chip_select    = 0,
112                 .max_speed_hz   = 5 * 1000 * 1000,
113         },
114         {       /* DataFlash chip 2*/
115                 .modalias       = "mtd_dataflash",
116                 .chip_select    = 1,
117                 .max_speed_hz   = 5 * 1000 * 1000,
118         },
119 };
120
121 /*
122  * NOR flash
123  */
124 static struct mtd_partition rsiews_nor_partitions[] = {
125         {
126                 .name           = "boot",
127                 .offset         = 0,
128                 .size           = 3 * SZ_128K,
129                 .mask_flags     = MTD_WRITEABLE
130         },
131         {
132                 .name           = "kernel",
133                 .offset         = MTDPART_OFS_NXTBLK,
134                 .size           = SZ_2M - (3 * SZ_128K)
135         },
136         {
137                 .name           = "root",
138                 .offset         = MTDPART_OFS_NXTBLK,
139                 .size           = SZ_8M
140         },
141         {
142                 .name           = "kernelupd",
143                 .offset         = MTDPART_OFS_NXTBLK,
144                 .size           = 3 * SZ_512K,
145                 .mask_flags     = MTD_WRITEABLE
146         },
147         {
148                 .name           = "rootupd",
149                 .offset         = MTDPART_OFS_NXTBLK,
150                 .size           = 9 * SZ_512K,
151                 .mask_flags     = MTD_WRITEABLE
152         },
153 };
154
155 static struct physmap_flash_data rsiews_nor_data = {
156         .width          = 2,
157         .parts          = rsiews_nor_partitions,
158         .nr_parts       = ARRAY_SIZE(rsiews_nor_partitions),
159 };
160
161 #define NOR_BASE        AT91_CHIPSELECT_0
162 #define NOR_SIZE        SZ_16M
163
164 static struct resource nor_flash_resources[] = {
165         {
166                 .start  = NOR_BASE,
167                 .end    = NOR_BASE + NOR_SIZE - 1,
168                 .flags  = IORESOURCE_MEM,
169         }
170 };
171
172 static struct platform_device rsiews_nor_flash = {
173         .name           = "physmap-flash",
174         .id             = 0,
175         .dev            = {
176                                 .platform_data  = &rsiews_nor_data,
177         },
178         .resource       = nor_flash_resources,
179         .num_resources  = ARRAY_SIZE(nor_flash_resources),
180 };
181
182 /*
183  * Init Func
184  */
185 static void __init rsi_ews_board_init(void)
186 {
187         /* Setup the LEDs */
188         at91_init_leds(AT91_PIN_PB6, AT91_PIN_PB9);
189
190         /* Serial */
191         /* DBGU on ttyS0. (Rx & Tx only) */
192         /* This one is for debugging */
193         at91_register_uart(0, 0, 0);
194
195         /* USART1 on ttyS2. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
196         /* Dialin/-out modem interface */
197         at91_register_uart(AT91RM9200_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS
198                            | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
199                            | ATMEL_UART_RI);
200
201         /* USART3 on ttyS4. (Rx, Tx, RTS) */
202         /* RS485 communication */
203         at91_register_uart(AT91RM9200_ID_US3, 4, ATMEL_UART_RTS);
204         at91_add_device_serial();
205         at91_set_gpio_output(AT91_PIN_PA21, 0);
206         /* Ethernet */
207         at91_add_device_eth(&rsi_ews_eth_data);
208         /* USB Host */
209         at91_add_device_usbh(&rsi_ews_usbh_data);
210         /* I2C */
211         at91_add_device_i2c(rsi_ews_i2c_devices,
212                         ARRAY_SIZE(rsi_ews_i2c_devices));
213         /* SPI */
214         at91_add_device_spi(rsi_ews_spi_devices,
215                         ARRAY_SIZE(rsi_ews_spi_devices));
216         /* MMC */
217         at91_add_device_mmc(0, &rsi_ews_mmc_data);
218         /* NOR Flash */
219         platform_device_register(&rsiews_nor_flash);
220         /* LEDs */
221         at91_gpio_leds(rsi_ews_leds, ARRAY_SIZE(rsi_ews_leds));
222 }
223
224 MACHINE_START(RSI_EWS, "RSI EWS")
225         /* Maintainer: Josef Holzmayr <holzmayr@rsi-elektrotechnik.de> */
226         .timer          = &at91rm9200_timer,
227         .map_io         = at91_map_io,
228         .init_early     = rsi_ews_init_early,
229         .init_irq       = at91_init_irq_default,
230         .init_machine   = rsi_ews_board_init,
231 MACHINE_END