diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-08-06 13:10:25 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-08-06 13:10:25 -0400 |
commit | f165eb77f49cb6f6e86e2f2f09183904b2965d19 (patch) | |
tree | db166579758930f52a1a625eb872bd96bd7ff88e /arch/arm/mach-pxa/spitz.c | |
parent | fc1caf6eafb30ea185720e29f7f5eccca61ecd60 (diff) | |
parent | a6cd7eb374647b572ae9e7dbfe49871e6996e8e0 (diff) |
Merge branch 'devel' of git://git.kernel.org/pub/scm/linux/kernel/git/ycmiao/pxa-linux-2.6 into devel-stable
Conflicts:
arch/arm/mach-pxa/palmt5.c
arch/arm/mach-pxa/palmtreo.c
Diffstat (limited to 'arch/arm/mach-pxa/spitz.c')
-rw-r--r-- | arch/arm/mach-pxa/spitz.c | 727 |
1 files changed, 427 insertions, 300 deletions
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 51756c723557..1cd99cb87bb1 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c | |||
@@ -18,14 +18,15 @@ | |||
18 | #include <linux/gpio_keys.h> | 18 | #include <linux/gpio_keys.h> |
19 | #include <linux/gpio.h> | 19 | #include <linux/gpio.h> |
20 | #include <linux/leds.h> | 20 | #include <linux/leds.h> |
21 | #include <linux/mtd/physmap.h> | ||
22 | #include <linux/i2c.h> | 21 | #include <linux/i2c.h> |
23 | #include <linux/i2c/pca953x.h> | 22 | #include <linux/i2c/pca953x.h> |
24 | #include <linux/spi/spi.h> | 23 | #include <linux/spi/spi.h> |
25 | #include <linux/spi/ads7846.h> | 24 | #include <linux/spi/ads7846.h> |
26 | #include <linux/spi/corgi_lcd.h> | 25 | #include <linux/spi/corgi_lcd.h> |
26 | #include <linux/mtd/physmap.h> | ||
27 | #include <linux/mtd/sharpsl.h> | 27 | #include <linux/mtd/sharpsl.h> |
28 | #include <linux/input/matrix_keypad.h> | 28 | #include <linux/input/matrix_keypad.h> |
29 | #include <linux/regulator/machine.h> | ||
29 | 30 | ||
30 | #include <asm/setup.h> | 31 | #include <asm/setup.h> |
31 | #include <asm/mach-types.h> | 32 | #include <asm/mach-types.h> |
@@ -33,22 +34,25 @@ | |||
33 | #include <asm/mach/sharpsl_param.h> | 34 | #include <asm/mach/sharpsl_param.h> |
34 | #include <asm/hardware/scoop.h> | 35 | #include <asm/hardware/scoop.h> |
35 | 36 | ||
36 | |||
37 | #include <mach/pxa27x.h> | 37 | #include <mach/pxa27x.h> |
38 | #include <mach/pxa27x-udc.h> | 38 | #include <mach/pxa27x-udc.h> |
39 | #include <mach/reset.h> | 39 | #include <mach/reset.h> |
40 | #include <plat/i2c.h> | ||
41 | #include <mach/irda.h> | 40 | #include <mach/irda.h> |
42 | #include <mach/mmc.h> | 41 | #include <mach/mmc.h> |
43 | #include <mach/ohci.h> | 42 | #include <mach/ohci.h> |
44 | #include <mach/pxafb.h> | 43 | #include <mach/pxafb.h> |
45 | #include <mach/pxa2xx_spi.h> | 44 | #include <mach/pxa2xx_spi.h> |
46 | #include <mach/spitz.h> | 45 | #include <mach/spitz.h> |
46 | #include <mach/sharpsl_pm.h> | ||
47 | |||
48 | #include <plat/i2c.h> | ||
47 | 49 | ||
48 | #include "generic.h" | 50 | #include "generic.h" |
49 | #include "devices.h" | 51 | #include "devices.h" |
50 | #include "sharpsl.h" | ||
51 | 52 | ||
53 | /****************************************************************************** | ||
54 | * Pin configuration | ||
55 | ******************************************************************************/ | ||
52 | static unsigned long spitz_pin_config[] __initdata = { | 56 | static unsigned long spitz_pin_config[] __initdata = { |
53 | /* Chip Selects */ | 57 | /* Chip Selects */ |
54 | GPIO78_nCS_2, /* SCOOP #2 */ | 58 | GPIO78_nCS_2, /* SCOOP #2 */ |
@@ -124,10 +128,13 @@ static unsigned long spitz_pin_config[] __initdata = { | |||
124 | GPIO1_GPIO | WAKEUP_ON_EDGE_FALL, /* SPITZ_GPIO_RESET */ | 128 | GPIO1_GPIO | WAKEUP_ON_EDGE_FALL, /* SPITZ_GPIO_RESET */ |
125 | }; | 129 | }; |
126 | 130 | ||
127 | /* | 131 | |
128 | * Spitz SCOOP Device #1 | 132 | /****************************************************************************** |
129 | */ | 133 | * Scoop GPIO expander |
130 | static struct resource spitz_scoop_resources[] = { | 134 | ******************************************************************************/ |
135 | #if defined(CONFIG_SHARP_SCOOP) || defined(CONFIG_SHARP_SCOOP_MODULE) | ||
136 | /* SCOOP Device #1 */ | ||
137 | static struct resource spitz_scoop_1_resources[] = { | ||
131 | [0] = { | 138 | [0] = { |
132 | .start = 0x10800000, | 139 | .start = 0x10800000, |
133 | .end = 0x10800fff, | 140 | .end = 0x10800fff, |
@@ -135,7 +142,7 @@ static struct resource spitz_scoop_resources[] = { | |||
135 | }, | 142 | }, |
136 | }; | 143 | }; |
137 | 144 | ||
138 | static struct scoop_config spitz_scoop_setup = { | 145 | static struct scoop_config spitz_scoop_1_setup = { |
139 | .io_dir = SPITZ_SCP_IO_DIR, | 146 | .io_dir = SPITZ_SCP_IO_DIR, |
140 | .io_out = SPITZ_SCP_IO_OUT, | 147 | .io_out = SPITZ_SCP_IO_OUT, |
141 | .suspend_clr = SPITZ_SCP_SUS_CLR, | 148 | .suspend_clr = SPITZ_SCP_SUS_CLR, |
@@ -143,20 +150,18 @@ static struct scoop_config spitz_scoop_setup = { | |||
143 | .gpio_base = SPITZ_SCP_GPIO_BASE, | 150 | .gpio_base = SPITZ_SCP_GPIO_BASE, |
144 | }; | 151 | }; |
145 | 152 | ||
146 | struct platform_device spitzscoop_device = { | 153 | struct platform_device spitz_scoop_1_device = { |
147 | .name = "sharp-scoop", | 154 | .name = "sharp-scoop", |
148 | .id = 0, | 155 | .id = 0, |
149 | .dev = { | 156 | .dev = { |
150 | .platform_data = &spitz_scoop_setup, | 157 | .platform_data = &spitz_scoop_1_setup, |
151 | }, | 158 | }, |
152 | .num_resources = ARRAY_SIZE(spitz_scoop_resources), | 159 | .num_resources = ARRAY_SIZE(spitz_scoop_1_resources), |
153 | .resource = spitz_scoop_resources, | 160 | .resource = spitz_scoop_1_resources, |
154 | }; | 161 | }; |
155 | 162 | ||
156 | /* | 163 | /* SCOOP Device #2 */ |
157 | * Spitz SCOOP Device #2 | 164 | static struct resource spitz_scoop_2_resources[] = { |
158 | */ | ||
159 | static struct resource spitz_scoop2_resources[] = { | ||
160 | [0] = { | 165 | [0] = { |
161 | .start = 0x08800040, | 166 | .start = 0x08800040, |
162 | .end = 0x08800fff, | 167 | .end = 0x08800fff, |
@@ -164,7 +169,7 @@ static struct resource spitz_scoop2_resources[] = { | |||
164 | }, | 169 | }, |
165 | }; | 170 | }; |
166 | 171 | ||
167 | static struct scoop_config spitz_scoop2_setup = { | 172 | static struct scoop_config spitz_scoop_2_setup = { |
168 | .io_dir = SPITZ_SCP2_IO_DIR, | 173 | .io_dir = SPITZ_SCP2_IO_DIR, |
169 | .io_out = SPITZ_SCP2_IO_OUT, | 174 | .io_out = SPITZ_SCP2_IO_OUT, |
170 | .suspend_clr = SPITZ_SCP2_SUS_CLR, | 175 | .suspend_clr = SPITZ_SCP2_SUS_CLR, |
@@ -172,82 +177,110 @@ static struct scoop_config spitz_scoop2_setup = { | |||
172 | .gpio_base = SPITZ_SCP2_GPIO_BASE, | 177 | .gpio_base = SPITZ_SCP2_GPIO_BASE, |
173 | }; | 178 | }; |
174 | 179 | ||
175 | struct platform_device spitzscoop2_device = { | 180 | struct platform_device spitz_scoop_2_device = { |
176 | .name = "sharp-scoop", | 181 | .name = "sharp-scoop", |
177 | .id = 1, | 182 | .id = 1, |
178 | .dev = { | 183 | .dev = { |
179 | .platform_data = &spitz_scoop2_setup, | 184 | .platform_data = &spitz_scoop_2_setup, |
180 | }, | 185 | }, |
181 | .num_resources = ARRAY_SIZE(spitz_scoop2_resources), | 186 | .num_resources = ARRAY_SIZE(spitz_scoop_2_resources), |
182 | .resource = spitz_scoop2_resources, | 187 | .resource = spitz_scoop_2_resources, |
183 | }; | 188 | }; |
184 | 189 | ||
185 | #define SPITZ_PWR_SD 0x01 | 190 | static void __init spitz_scoop_init(void) |
186 | #define SPITZ_PWR_CF 0x02 | 191 | { |
192 | platform_device_register(&spitz_scoop_1_device); | ||
193 | |||
194 | /* Akita doesn't have the second SCOOP chip */ | ||
195 | if (!machine_is_akita()) | ||
196 | platform_device_register(&spitz_scoop_2_device); | ||
197 | } | ||
187 | 198 | ||
188 | /* Power control is shared with between one of the CF slots and SD */ | 199 | /* Power control is shared with between one of the CF slots and SD */ |
189 | static void spitz_card_pwr_ctrl(int device, unsigned short new_cpr) | 200 | static void spitz_card_pwr_ctrl(uint8_t enable, uint8_t new_cpr) |
190 | { | 201 | { |
191 | unsigned short cpr = read_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR); | 202 | unsigned short cpr; |
203 | unsigned long flags; | ||
192 | 204 | ||
193 | if (new_cpr & 0x0007) { | 205 | if (new_cpr & 0x7) { |
194 | gpio_set_value(SPITZ_GPIO_CF_POWER, 1); | 206 | gpio_set_value(SPITZ_GPIO_CF_POWER, 1); |
195 | if (!(cpr & 0x0002) && !(cpr & 0x0004)) | 207 | mdelay(5); |
196 | mdelay(5); | 208 | } |
197 | if (device == SPITZ_PWR_CF) | 209 | |
198 | cpr |= 0x0002; | 210 | local_irq_save(flags); |
199 | if (device == SPITZ_PWR_SD) | 211 | |
200 | cpr |= 0x0004; | 212 | cpr = read_scoop_reg(&spitz_scoop_1_device.dev, SCOOP_CPR); |
201 | write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr); | 213 | |
202 | } else { | 214 | if (enable & new_cpr) |
203 | if (device == SPITZ_PWR_CF) | 215 | cpr |= new_cpr; |
204 | cpr &= ~0x0002; | 216 | else |
205 | if (device == SPITZ_PWR_SD) | 217 | cpr &= ~enable; |
206 | cpr &= ~0x0004; | 218 | |
207 | if (!(cpr & 0x0002) && !(cpr & 0x0004)) { | 219 | write_scoop_reg(&spitz_scoop_1_device.dev, SCOOP_CPR, cpr); |
208 | write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, 0x0000); | 220 | |
209 | mdelay(1); | 221 | local_irq_restore(flags); |
210 | gpio_set_value(SPITZ_GPIO_CF_POWER, 0); | 222 | |
211 | } else { | 223 | if (!(cpr & 0x7)) { |
212 | write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr); | 224 | mdelay(1); |
213 | } | 225 | gpio_set_value(SPITZ_GPIO_CF_POWER, 0); |
214 | } | 226 | } |
215 | } | 227 | } |
216 | 228 | ||
217 | static void spitz_pcmcia_pwr(struct device *scoop, unsigned short cpr, int nr) | 229 | #else |
230 | static inline void spitz_scoop_init(void) {} | ||
231 | static inline void spitz_card_pwr_ctrl(uint8_t enable, uint8_t new_cpr) {} | ||
232 | #endif | ||
233 | |||
234 | /****************************************************************************** | ||
235 | * PCMCIA | ||
236 | ******************************************************************************/ | ||
237 | #if defined(CONFIG_PCMCIA_PXA2XX) || defined(CONFIG_PCMCIA_PXA2XX_MODULE) | ||
238 | static void spitz_pcmcia_pwr(struct device *scoop, uint16_t cpr, int nr) | ||
218 | { | 239 | { |
219 | /* Only need to override behaviour for slot 0 */ | 240 | /* Only need to override behaviour for slot 0 */ |
220 | if (nr == 0) | 241 | if (nr == 0) |
221 | spitz_card_pwr_ctrl(SPITZ_PWR_CF, cpr); | 242 | spitz_card_pwr_ctrl( |
243 | cpr & (SCOOP_CPR_CF_3V | SCOOP_CPR_CF_XV), cpr); | ||
222 | else | 244 | else |
223 | write_scoop_reg(scoop, SCOOP_CPR, cpr); | 245 | write_scoop_reg(scoop, SCOOP_CPR, cpr); |
224 | } | 246 | } |
225 | 247 | ||
226 | static struct scoop_pcmcia_dev spitz_pcmcia_scoop[] = { | 248 | static struct scoop_pcmcia_dev spitz_pcmcia_scoop[] = { |
227 | { | 249 | { |
228 | .dev = &spitzscoop_device.dev, | 250 | .dev = &spitz_scoop_1_device.dev, |
229 | .irq = SPITZ_IRQ_GPIO_CF_IRQ, | 251 | .irq = SPITZ_IRQ_GPIO_CF_IRQ, |
230 | .cd_irq = SPITZ_IRQ_GPIO_CF_CD, | 252 | .cd_irq = SPITZ_IRQ_GPIO_CF_CD, |
231 | .cd_irq_str = "PCMCIA0 CD", | 253 | .cd_irq_str = "PCMCIA0 CD", |
232 | },{ | 254 | }, { |
233 | .dev = &spitzscoop2_device.dev, | 255 | .dev = &spitz_scoop_2_device.dev, |
234 | .irq = SPITZ_IRQ_GPIO_CF2_IRQ, | 256 | .irq = SPITZ_IRQ_GPIO_CF2_IRQ, |
235 | .cd_irq = -1, | 257 | .cd_irq = -1, |
236 | }, | 258 | }, |
237 | }; | 259 | }; |
238 | 260 | ||
239 | static struct scoop_pcmcia_config spitz_pcmcia_config = { | 261 | static struct scoop_pcmcia_config spitz_pcmcia_config = { |
240 | .devs = &spitz_pcmcia_scoop[0], | 262 | .devs = &spitz_pcmcia_scoop[0], |
241 | .num_devs = 2, | 263 | .num_devs = 2, |
242 | .power_ctrl = spitz_pcmcia_pwr, | 264 | .power_ctrl = spitz_pcmcia_pwr, |
243 | }; | 265 | }; |
244 | 266 | ||
245 | EXPORT_SYMBOL(spitzscoop_device); | 267 | static void __init spitz_pcmcia_init(void) |
246 | EXPORT_SYMBOL(spitzscoop2_device); | 268 | { |
269 | /* Akita has only one PCMCIA slot used */ | ||
270 | if (machine_is_akita()) | ||
271 | spitz_pcmcia_config.num_devs = 1; | ||
272 | |||
273 | platform_scoop_config = &spitz_pcmcia_config; | ||
274 | } | ||
275 | #else | ||
276 | static inline void spitz_pcmcia_init(void) {} | ||
277 | #endif | ||
278 | |||
279 | /****************************************************************************** | ||
280 | * GPIO keyboard | ||
281 | ******************************************************************************/ | ||
282 | #if defined(CONFIG_KEYBOARD_MATRIX) || defined(CONFIG_KEYBOARD_MATRIX_MODULE) | ||
247 | 283 | ||
248 | /* | ||
249 | * Spitz Keyboard Device | ||
250 | */ | ||
251 | #define SPITZ_KEY_CALENDAR KEY_F1 | 284 | #define SPITZ_KEY_CALENDAR KEY_F1 |
252 | #define SPITZ_KEY_ADDRESS KEY_F2 | 285 | #define SPITZ_KEY_ADDRESS KEY_F2 |
253 | #define SPITZ_KEY_FN KEY_F3 | 286 | #define SPITZ_KEY_FN KEY_F3 |
@@ -263,7 +296,7 @@ EXPORT_SYMBOL(spitzscoop2_device); | |||
263 | #define SPITZ_KEY_OK KEY_F11 | 296 | #define SPITZ_KEY_OK KEY_F11 |
264 | #define SPITZ_KEY_MENU KEY_F12 | 297 | #define SPITZ_KEY_MENU KEY_F12 |
265 | 298 | ||
266 | static const uint32_t spitzkbd_keymap[] = { | 299 | static const uint32_t spitz_keymap[] = { |
267 | KEY(0, 0, KEY_LEFTCTRL), | 300 | KEY(0, 0, KEY_LEFTCTRL), |
268 | KEY(0, 1, KEY_1), | 301 | KEY(0, 1, KEY_1), |
269 | KEY(0, 2, KEY_3), | 302 | KEY(0, 2, KEY_3), |
@@ -330,36 +363,47 @@ static const uint32_t spitzkbd_keymap[] = { | |||
330 | KEY(6, 8, KEY_RIGHT), | 363 | KEY(6, 8, KEY_RIGHT), |
331 | }; | 364 | }; |
332 | 365 | ||
333 | static const struct matrix_keymap_data spitzkbd_keymap_data = { | 366 | static const struct matrix_keymap_data spitz_keymap_data = { |
334 | .keymap = spitzkbd_keymap, | 367 | .keymap = spitz_keymap, |
335 | .keymap_size = ARRAY_SIZE(spitzkbd_keymap), | 368 | .keymap_size = ARRAY_SIZE(spitz_keymap), |
336 | }; | 369 | }; |
337 | 370 | ||
338 | static const uint32_t spitzkbd_row_gpios[] = | 371 | static const uint32_t spitz_row_gpios[] = |
339 | { 12, 17, 91, 34, 36, 38, 39 }; | 372 | { 12, 17, 91, 34, 36, 38, 39 }; |
340 | static const uint32_t spitzkbd_col_gpios[] = | 373 | static const uint32_t spitz_col_gpios[] = |
341 | { 88, 23, 24, 25, 26, 27, 52, 103, 107, 108, 114 }; | 374 | { 88, 23, 24, 25, 26, 27, 52, 103, 107, 108, 114 }; |
342 | 375 | ||
343 | static struct matrix_keypad_platform_data spitzkbd_pdata = { | 376 | static struct matrix_keypad_platform_data spitz_mkp_pdata = { |
344 | .keymap_data = &spitzkbd_keymap_data, | 377 | .keymap_data = &spitz_keymap_data, |
345 | .row_gpios = spitzkbd_row_gpios, | 378 | .row_gpios = spitz_row_gpios, |
346 | .col_gpios = spitzkbd_col_gpios, | 379 | .col_gpios = spitz_col_gpios, |
347 | .num_row_gpios = ARRAY_SIZE(spitzkbd_row_gpios), | 380 | .num_row_gpios = ARRAY_SIZE(spitz_row_gpios), |
348 | .num_col_gpios = ARRAY_SIZE(spitzkbd_col_gpios), | 381 | .num_col_gpios = ARRAY_SIZE(spitz_col_gpios), |
349 | .col_scan_delay_us = 10, | 382 | .col_scan_delay_us = 10, |
350 | .debounce_ms = 10, | 383 | .debounce_ms = 10, |
351 | .wakeup = 1, | 384 | .wakeup = 1, |
352 | }; | 385 | }; |
353 | 386 | ||
354 | static struct platform_device spitzkbd_device = { | 387 | static struct platform_device spitz_mkp_device = { |
355 | .name = "matrix-keypad", | 388 | .name = "matrix-keypad", |
356 | .id = -1, | 389 | .id = -1, |
357 | .dev = { | 390 | .dev = { |
358 | .platform_data = &spitzkbd_pdata, | 391 | .platform_data = &spitz_mkp_pdata, |
359 | }, | 392 | }, |
360 | }; | 393 | }; |
361 | 394 | ||
395 | static void __init spitz_mkp_init(void) | ||
396 | { | ||
397 | platform_device_register(&spitz_mkp_device); | ||
398 | } | ||
399 | #else | ||
400 | static inline void spitz_mkp_init(void) {} | ||
401 | #endif | ||
362 | 402 | ||
403 | /****************************************************************************** | ||
404 | * GPIO keys | ||
405 | ******************************************************************************/ | ||
406 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | ||
363 | static struct gpio_keys_button spitz_gpio_keys[] = { | 407 | static struct gpio_keys_button spitz_gpio_keys[] = { |
364 | { | 408 | { |
365 | .type = EV_PWR, | 409 | .type = EV_PWR, |
@@ -396,10 +440,18 @@ static struct platform_device spitz_gpio_keys_device = { | |||
396 | }, | 440 | }, |
397 | }; | 441 | }; |
398 | 442 | ||
443 | static void __init spitz_keys_init(void) | ||
444 | { | ||
445 | platform_device_register(&spitz_gpio_keys_device); | ||
446 | } | ||
447 | #else | ||
448 | static inline void spitz_keys_init(void) {} | ||
449 | #endif | ||
399 | 450 | ||
400 | /* | 451 | /****************************************************************************** |
401 | * Spitz LEDs | 452 | * LEDs |
402 | */ | 453 | ******************************************************************************/ |
454 | #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) | ||
403 | static struct gpio_led spitz_gpio_leds[] = { | 455 | static struct gpio_led spitz_gpio_leds[] = { |
404 | { | 456 | { |
405 | .name = "spitz:amber:charge", | 457 | .name = "spitz:amber:charge", |
@@ -418,20 +470,27 @@ static struct gpio_led_platform_data spitz_gpio_leds_info = { | |||
418 | .num_leds = ARRAY_SIZE(spitz_gpio_leds), | 470 | .num_leds = ARRAY_SIZE(spitz_gpio_leds), |
419 | }; | 471 | }; |
420 | 472 | ||
421 | static struct platform_device spitzled_device = { | 473 | static struct platform_device spitz_led_device = { |
422 | .name = "leds-gpio", | 474 | .name = "leds-gpio", |
423 | .id = -1, | 475 | .id = -1, |
424 | .dev = { | 476 | .dev = { |
425 | .platform_data = &spitz_gpio_leds_info, | 477 | .platform_data = &spitz_gpio_leds_info, |
426 | }, | 478 | }, |
427 | }; | 479 | }; |
428 | 480 | ||
429 | #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE) | 481 | static void __init spitz_leds_init(void) |
430 | static struct pxa2xx_spi_master spitz_spi_info = { | 482 | { |
431 | .num_chipselect = 3, | 483 | platform_device_register(&spitz_led_device); |
432 | }; | 484 | } |
485 | #else | ||
486 | static inline void spitz_leds_init(void) {} | ||
487 | #endif | ||
433 | 488 | ||
434 | static void spitz_wait_for_hsync(void) | 489 | /****************************************************************************** |
490 | * SSP Devices | ||
491 | ******************************************************************************/ | ||
492 | #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE) | ||
493 | static void spitz_ads7846_wait_for_hsync(void) | ||
435 | { | 494 | { |
436 | while (gpio_get_value(SPITZ_GPIO_HSYNC)) | 495 | while (gpio_get_value(SPITZ_GPIO_HSYNC)) |
437 | cpu_relax(); | 496 | cpu_relax(); |
@@ -447,7 +506,7 @@ static struct ads7846_platform_data spitz_ads7846_info = { | |||
447 | .y_plate_ohms = 486, | 506 | .y_plate_ohms = 486, |
448 | .pressure_max = 1024, | 507 | .pressure_max = 1024, |
449 | .gpio_pendown = SPITZ_GPIO_TP_INT, | 508 | .gpio_pendown = SPITZ_GPIO_TP_INT, |
450 | .wait_for_sync = spitz_wait_for_hsync, | 509 | .wait_for_sync = spitz_ads7846_wait_for_hsync, |
451 | }; | 510 | }; |
452 | 511 | ||
453 | static struct pxa2xx_spi_chip spitz_ads7846_chip = { | 512 | static struct pxa2xx_spi_chip spitz_ads7846_chip = { |
@@ -485,72 +544,88 @@ static struct pxa2xx_spi_chip spitz_max1111_chip = { | |||
485 | 544 | ||
486 | static struct spi_board_info spitz_spi_devices[] = { | 545 | static struct spi_board_info spitz_spi_devices[] = { |
487 | { | 546 | { |
488 | .modalias = "ads7846", | 547 | .modalias = "ads7846", |
489 | .max_speed_hz = 1200000, | 548 | .max_speed_hz = 1200000, |
490 | .bus_num = 2, | 549 | .bus_num = 2, |
491 | .chip_select = 0, | 550 | .chip_select = 0, |
492 | .platform_data = &spitz_ads7846_info, | 551 | .platform_data = &spitz_ads7846_info, |
493 | .controller_data= &spitz_ads7846_chip, | 552 | .controller_data = &spitz_ads7846_chip, |
494 | .irq = gpio_to_irq(SPITZ_GPIO_TP_INT), | 553 | .irq = gpio_to_irq(SPITZ_GPIO_TP_INT), |
495 | }, { | 554 | }, { |
496 | .modalias = "corgi-lcd", | 555 | .modalias = "corgi-lcd", |
497 | .max_speed_hz = 50000, | 556 | .max_speed_hz = 50000, |
498 | .bus_num = 2, | 557 | .bus_num = 2, |
499 | .chip_select = 1, | 558 | .chip_select = 1, |
500 | .platform_data = &spitz_lcdcon_info, | 559 | .platform_data = &spitz_lcdcon_info, |
501 | .controller_data= &spitz_lcdcon_chip, | 560 | .controller_data = &spitz_lcdcon_chip, |
502 | }, { | 561 | }, { |
503 | .modalias = "max1111", | 562 | .modalias = "max1111", |
504 | .max_speed_hz = 450000, | 563 | .max_speed_hz = 450000, |
505 | .bus_num = 2, | 564 | .bus_num = 2, |
506 | .chip_select = 2, | 565 | .chip_select = 2, |
507 | .controller_data= &spitz_max1111_chip, | 566 | .controller_data = &spitz_max1111_chip, |
508 | }, | 567 | }, |
509 | }; | 568 | }; |
510 | 569 | ||
511 | static void __init spitz_init_spi(void) | 570 | static struct pxa2xx_spi_master spitz_spi_info = { |
571 | .num_chipselect = 3, | ||
572 | }; | ||
573 | |||
574 | static void __init spitz_spi_init(void) | ||
512 | { | 575 | { |
576 | struct corgi_lcd_platform_data *lcd_data = &spitz_lcdcon_info; | ||
577 | |||
513 | if (machine_is_akita()) { | 578 | if (machine_is_akita()) { |
514 | spitz_lcdcon_info.gpio_backlight_cont = AKITA_GPIO_BACKLIGHT_CONT; | 579 | lcd_data->gpio_backlight_cont = AKITA_GPIO_BACKLIGHT_CONT; |
515 | spitz_lcdcon_info.gpio_backlight_on = AKITA_GPIO_BACKLIGHT_ON; | 580 | lcd_data->gpio_backlight_on = AKITA_GPIO_BACKLIGHT_ON; |
516 | } | 581 | } |
517 | 582 | ||
518 | pxa2xx_set_spi_info(2, &spitz_spi_info); | 583 | pxa2xx_set_spi_info(2, &spitz_spi_info); |
519 | spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices)); | 584 | spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices)); |
520 | } | 585 | } |
521 | #else | 586 | #else |
522 | static inline void spitz_init_spi(void) {} | 587 | static inline void spitz_spi_init(void) {} |
523 | #endif | 588 | #endif |
524 | 589 | ||
590 | /****************************************************************************** | ||
591 | * SD/MMC card controller | ||
592 | ******************************************************************************/ | ||
593 | #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) | ||
525 | /* | 594 | /* |
526 | * MMC/SD Device | 595 | * NOTE: The card detect interrupt isn't debounced so we delay it by 250ms to |
527 | * | 596 | * give the card a chance to fully insert/eject. |
528 | * The card detect interrupt isn't debounced so we delay it by 250ms | ||
529 | * to give the card a chance to fully insert/eject. | ||
530 | */ | 597 | */ |
531 | static void spitz_mci_setpower(struct device *dev, unsigned int vdd) | 598 | static void spitz_mci_setpower(struct device *dev, unsigned int vdd) |
532 | { | 599 | { |
533 | struct pxamci_platform_data* p_d = dev->platform_data; | 600 | struct pxamci_platform_data* p_d = dev->platform_data; |
534 | 601 | ||
535 | if (( 1 << vdd) & p_d->ocr_mask) | 602 | if ((1 << vdd) & p_d->ocr_mask) |
536 | spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0004); | 603 | spitz_card_pwr_ctrl(SCOOP_CPR_SD_3V, SCOOP_CPR_SD_3V); |
537 | else | 604 | else |
538 | spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0000); | 605 | spitz_card_pwr_ctrl(SCOOP_CPR_SD_3V, 0x0); |
539 | } | 606 | } |
540 | 607 | ||
541 | static struct pxamci_platform_data spitz_mci_platform_data = { | 608 | static struct pxamci_platform_data spitz_mci_platform_data = { |
542 | .detect_delay_ms = 250, | 609 | .detect_delay_ms = 250, |
543 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | 610 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
544 | .setpower = spitz_mci_setpower, | 611 | .setpower = spitz_mci_setpower, |
545 | .gpio_card_detect = SPITZ_GPIO_nSD_DETECT, | 612 | .gpio_card_detect = SPITZ_GPIO_nSD_DETECT, |
546 | .gpio_card_ro = SPITZ_GPIO_nSD_WP, | 613 | .gpio_card_ro = SPITZ_GPIO_nSD_WP, |
547 | .gpio_power = -1, | 614 | .gpio_power = -1, |
548 | }; | 615 | }; |
549 | 616 | ||
617 | static void __init spitz_mmc_init(void) | ||
618 | { | ||
619 | pxa_set_mci_info(&spitz_mci_platform_data); | ||
620 | } | ||
621 | #else | ||
622 | static inline void spitz_mmc_init(void) {} | ||
623 | #endif | ||
550 | 624 | ||
551 | /* | 625 | /****************************************************************************** |
552 | * USB Host (OHCI) | 626 | * USB Host |
553 | */ | 627 | ******************************************************************************/ |
628 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | ||
554 | static int spitz_ohci_init(struct device *dev) | 629 | static int spitz_ohci_init(struct device *dev) |
555 | { | 630 | { |
556 | int err; | 631 | int err; |
@@ -559,9 +634,7 @@ static int spitz_ohci_init(struct device *dev) | |||
559 | if (err) | 634 | if (err) |
560 | return err; | 635 | return err; |
561 | 636 | ||
562 | /* Only Port 2 is connected | 637 | /* Only Port 2 is connected, setup USB Port 2 Output Control Register */ |
563 | * Setup USB Port 2 Output Control Register | ||
564 | */ | ||
565 | UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE; | 638 | UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE; |
566 | 639 | ||
567 | return gpio_direction_output(SPITZ_GPIO_USB_HOST, 1); | 640 | return gpio_direction_output(SPITZ_GPIO_USB_HOST, 1); |
@@ -580,67 +653,95 @@ static struct pxaohci_platform_data spitz_ohci_platform_data = { | |||
580 | .power_budget = 150, | 653 | .power_budget = 150, |
581 | }; | 654 | }; |
582 | 655 | ||
656 | static void __init spitz_uhc_init(void) | ||
657 | { | ||
658 | pxa_set_ohci_info(&spitz_ohci_platform_data); | ||
659 | } | ||
660 | #else | ||
661 | static inline void spitz_uhc_init(void) {} | ||
662 | #endif | ||
583 | 663 | ||
584 | /* | 664 | /****************************************************************************** |
585 | * Irda | 665 | * IrDA |
586 | */ | 666 | ******************************************************************************/ |
587 | 667 | #if defined(CONFIG_PXA_FICP) || defined(CONFIG_PXA_FICP_MODULE) | |
588 | static struct pxaficp_platform_data spitz_ficp_platform_data = { | 668 | static struct pxaficp_platform_data spitz_ficp_platform_data = { |
589 | /* .gpio_pwdown is set in spitz_init() and akita_init() accordingly */ | ||
590 | .transceiver_cap = IR_SIRMODE | IR_OFF, | 669 | .transceiver_cap = IR_SIRMODE | IR_OFF, |
591 | }; | 670 | }; |
592 | 671 | ||
672 | static void __init spitz_irda_init(void) | ||
673 | { | ||
674 | if (machine_is_akita()) | ||
675 | spitz_ficp_platform_data.gpio_pwdown = AKITA_GPIO_IR_ON; | ||
676 | else | ||
677 | spitz_ficp_platform_data.gpio_pwdown = SPITZ_GPIO_IR_ON; | ||
593 | 678 | ||
594 | /* | 679 | pxa_set_ficp_info(&spitz_ficp_platform_data); |
595 | * Spitz PXA Framebuffer | 680 | } |
596 | */ | 681 | #else |
682 | static inline void spitz_irda_init(void) {} | ||
683 | #endif | ||
597 | 684 | ||
685 | /****************************************************************************** | ||
686 | * Framebuffer | ||
687 | ******************************************************************************/ | ||
688 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) | ||
598 | static struct pxafb_mode_info spitz_pxafb_modes[] = { | 689 | static struct pxafb_mode_info spitz_pxafb_modes[] = { |
599 | { | 690 | { |
600 | .pixclock = 19231, | 691 | .pixclock = 19231, |
601 | .xres = 480, | 692 | .xres = 480, |
602 | .yres = 640, | 693 | .yres = 640, |
603 | .bpp = 16, | 694 | .bpp = 16, |
604 | .hsync_len = 40, | 695 | .hsync_len = 40, |
605 | .left_margin = 46, | 696 | .left_margin = 46, |
606 | .right_margin = 125, | 697 | .right_margin = 125, |
607 | .vsync_len = 3, | 698 | .vsync_len = 3, |
608 | .upper_margin = 1, | 699 | .upper_margin = 1, |
609 | .lower_margin = 0, | 700 | .lower_margin = 0, |
610 | .sync = 0, | 701 | .sync = 0, |
611 | },{ | 702 | }, { |
612 | .pixclock = 134617, | 703 | .pixclock = 134617, |
613 | .xres = 240, | 704 | .xres = 240, |
614 | .yres = 320, | 705 | .yres = 320, |
615 | .bpp = 16, | 706 | .bpp = 16, |
616 | .hsync_len = 20, | 707 | .hsync_len = 20, |
617 | .left_margin = 20, | 708 | .left_margin = 20, |
618 | .right_margin = 46, | 709 | .right_margin = 46, |
619 | .vsync_len = 2, | 710 | .vsync_len = 2, |
620 | .upper_margin = 1, | 711 | .upper_margin = 1, |
621 | .lower_margin = 0, | 712 | .lower_margin = 0, |
622 | .sync = 0, | 713 | .sync = 0, |
623 | }, | 714 | }, |
624 | }; | 715 | }; |
625 | 716 | ||
626 | static struct pxafb_mach_info spitz_pxafb_info = { | 717 | static struct pxafb_mach_info spitz_pxafb_info = { |
627 | .modes = &spitz_pxafb_modes[0], | 718 | .modes = spitz_pxafb_modes, |
628 | .num_modes = 2, | 719 | .num_modes = ARRAY_SIZE(spitz_pxafb_modes), |
629 | .fixed_modes = 1, | 720 | .fixed_modes = 1, |
630 | .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_ALTERNATE_MAPPING, | 721 | .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_ALTERNATE_MAPPING, |
631 | }; | 722 | }; |
632 | 723 | ||
633 | static struct mtd_partition sharpsl_nand_partitions[] = { | 724 | static void __init spitz_lcd_init(void) |
725 | { | ||
726 | set_pxa_fb_info(&spitz_pxafb_info); | ||
727 | } | ||
728 | #else | ||
729 | static inline void spitz_lcd_init(void) {} | ||
730 | #endif | ||
731 | |||
732 | /****************************************************************************** | ||
733 | * Framebuffer | ||
734 | ******************************************************************************/ | ||
735 | #if defined(CONFIG_MTD_NAND_SHARPSL) || defined(CONFIG_MTD_NAND_SHARPSL_MODULE) | ||
736 | static struct mtd_partition spitz_nand_partitions[] = { | ||
634 | { | 737 | { |
635 | .name = "System Area", | 738 | .name = "System Area", |
636 | .offset = 0, | 739 | .offset = 0, |
637 | .size = 7 * 1024 * 1024, | 740 | .size = 7 * 1024 * 1024, |
638 | }, | 741 | }, { |
639 | { | ||
640 | .name = "Root Filesystem", | 742 | .name = "Root Filesystem", |
641 | .offset = 7 * 1024 * 1024, | 743 | .offset = 7 * 1024 * 1024, |
642 | }, | 744 | }, { |
643 | { | ||
644 | .name = "Home Filesystem", | 745 | .name = "Home Filesystem", |
645 | .offset = MTDPART_OFS_APPEND, | 746 | .offset = MTDPART_OFS_APPEND, |
646 | .size = MTDPART_SIZ_FULL, | 747 | .size = MTDPART_SIZ_FULL, |
@@ -649,37 +750,72 @@ static struct mtd_partition sharpsl_nand_partitions[] = { | |||
649 | 750 | ||
650 | static uint8_t scan_ff_pattern[] = { 0xff, 0xff }; | 751 | static uint8_t scan_ff_pattern[] = { 0xff, 0xff }; |
651 | 752 | ||
652 | static struct nand_bbt_descr sharpsl_bbt = { | 753 | static struct nand_bbt_descr spitz_nand_bbt = { |
653 | .options = 0, | 754 | .options = 0, |
654 | .offs = 4, | 755 | .offs = 4, |
655 | .len = 2, | 756 | .len = 2, |
656 | .pattern = scan_ff_pattern | 757 | .pattern = scan_ff_pattern |
758 | }; | ||
759 | |||
760 | static struct nand_ecclayout akita_oobinfo = { | ||
761 | .oobfree = { {0x08, 0x09} }, | ||
762 | .eccbytes = 24, | ||
763 | .eccpos = { | ||
764 | 0x05, 0x01, 0x02, 0x03, 0x06, 0x07, 0x15, 0x11, | ||
765 | 0x12, 0x13, 0x16, 0x17, 0x25, 0x21, 0x22, 0x23, | ||
766 | 0x26, 0x27, 0x35, 0x31, 0x32, 0x33, 0x36, 0x37, | ||
767 | }, | ||
657 | }; | 768 | }; |
658 | 769 | ||
659 | static struct sharpsl_nand_platform_data sharpsl_nand_platform_data = { | 770 | static struct sharpsl_nand_platform_data spitz_nand_pdata = { |
660 | .badblock_pattern = &sharpsl_bbt, | 771 | .badblock_pattern = &spitz_nand_bbt, |
661 | .partitions = sharpsl_nand_partitions, | 772 | .partitions = spitz_nand_partitions, |
662 | .nr_partitions = ARRAY_SIZE(sharpsl_nand_partitions), | 773 | .nr_partitions = ARRAY_SIZE(spitz_nand_partitions), |
663 | }; | 774 | }; |
664 | 775 | ||
665 | static struct resource sharpsl_nand_resources[] = { | 776 | static struct resource spitz_nand_resources[] = { |
666 | { | 777 | { |
667 | .start = 0x0C000000, | 778 | .start = PXA_CS3_PHYS, |
668 | .end = 0x0C000FFF, | 779 | .end = PXA_CS3_PHYS + SZ_4K - 1, |
669 | .flags = IORESOURCE_MEM, | 780 | .flags = IORESOURCE_MEM, |
670 | }, | 781 | }, |
671 | }; | 782 | }; |
672 | 783 | ||
673 | static struct platform_device sharpsl_nand_device = { | 784 | static struct platform_device spitz_nand_device = { |
674 | .name = "sharpsl-nand", | 785 | .name = "sharpsl-nand", |
675 | .id = -1, | 786 | .id = -1, |
676 | .resource = sharpsl_nand_resources, | 787 | .resource = spitz_nand_resources, |
677 | .num_resources = ARRAY_SIZE(sharpsl_nand_resources), | 788 | .num_resources = ARRAY_SIZE(spitz_nand_resources), |
678 | .dev.platform_data = &sharpsl_nand_platform_data, | 789 | .dev = { |
790 | .platform_data = &spitz_nand_pdata, | ||
791 | } | ||
679 | }; | 792 | }; |
680 | 793 | ||
794 | static void __init spitz_nand_init(void) | ||
795 | { | ||
796 | if (machine_is_spitz()) { | ||
797 | spitz_nand_partitions[1].size = 5 * 1024 * 1024; | ||
798 | } else if (machine_is_akita()) { | ||
799 | spitz_nand_partitions[1].size = 58 * 1024 * 1024; | ||
800 | spitz_nand_bbt.len = 1; | ||
801 | spitz_nand_pdata.ecc_layout = &akita_oobinfo; | ||
802 | } else if (machine_is_borzoi()) { | ||
803 | spitz_nand_partitions[1].size = 32 * 1024 * 1024; | ||
804 | spitz_nand_bbt.len = 1; | ||
805 | spitz_nand_pdata.ecc_layout = &akita_oobinfo; | ||
806 | } | ||
807 | |||
808 | platform_device_register(&spitz_nand_device); | ||
809 | } | ||
810 | #else | ||
811 | static inline void spitz_nand_init(void) {} | ||
812 | #endif | ||
681 | 813 | ||
682 | static struct mtd_partition sharpsl_rom_parts[] = { | 814 | /****************************************************************************** |
815 | * NOR Flash | ||
816 | ******************************************************************************/ | ||
817 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) | ||
818 | static struct mtd_partition spitz_rom_parts[] = { | ||
683 | { | 819 | { |
684 | .name ="Boot PROM Filesystem", | 820 | .name ="Boot PROM Filesystem", |
685 | .offset = 0x00140000, | 821 | .offset = 0x00140000, |
@@ -687,37 +823,105 @@ static struct mtd_partition sharpsl_rom_parts[] = { | |||
687 | }, | 823 | }, |
688 | }; | 824 | }; |
689 | 825 | ||
690 | static struct physmap_flash_data sharpsl_rom_data = { | 826 | static struct physmap_flash_data spitz_rom_data = { |
691 | .width = 2, | 827 | .width = 2, |
692 | .nr_parts = ARRAY_SIZE(sharpsl_rom_parts), | 828 | .nr_parts = ARRAY_SIZE(spitz_rom_parts), |
693 | .parts = sharpsl_rom_parts, | 829 | .parts = spitz_rom_parts, |
694 | }; | 830 | }; |
695 | 831 | ||
696 | static struct resource sharpsl_rom_resources[] = { | 832 | static struct resource spitz_rom_resources[] = { |
697 | { | 833 | { |
698 | .start = 0x00000000, | 834 | .start = PXA_CS0_PHYS, |
699 | .end = 0x007fffff, | 835 | .end = PXA_CS0_PHYS + SZ_8M - 1, |
700 | .flags = IORESOURCE_MEM, | 836 | .flags = IORESOURCE_MEM, |
701 | }, | 837 | }, |
702 | }; | 838 | }; |
703 | 839 | ||
704 | static struct platform_device sharpsl_rom_device = { | 840 | static struct platform_device spitz_rom_device = { |
705 | .name = "physmap-flash", | 841 | .name = "physmap-flash", |
706 | .id = -1, | 842 | .id = -1, |
707 | .resource = sharpsl_rom_resources, | 843 | .resource = spitz_rom_resources, |
708 | .num_resources = ARRAY_SIZE(sharpsl_rom_resources), | 844 | .num_resources = ARRAY_SIZE(spitz_rom_resources), |
709 | .dev.platform_data = &sharpsl_rom_data, | 845 | .dev = { |
846 | .platform_data = &spitz_rom_data, | ||
847 | }, | ||
710 | }; | 848 | }; |
711 | 849 | ||
712 | static struct platform_device *devices[] __initdata = { | 850 | static void __init spitz_nor_init(void) |
713 | &spitzscoop_device, | 851 | { |
714 | &spitzkbd_device, | 852 | platform_device_register(&spitz_rom_device); |
715 | &spitz_gpio_keys_device, | 853 | } |
716 | &spitzled_device, | 854 | #else |
717 | &sharpsl_nand_device, | 855 | static inline void spitz_nor_init(void) {} |
718 | &sharpsl_rom_device, | 856 | #endif |
857 | |||
858 | /****************************************************************************** | ||
859 | * GPIO expander | ||
860 | ******************************************************************************/ | ||
861 | #if defined(CONFIG_I2C_PXA) || defined(CONFIG_I2C_PXA_MODULE) | ||
862 | static struct pca953x_platform_data akita_pca953x_pdata = { | ||
863 | .gpio_base = AKITA_IOEXP_GPIO_BASE, | ||
719 | }; | 864 | }; |
720 | 865 | ||
866 | static struct i2c_board_info spitz_i2c_devs[] = { | ||
867 | { | ||
868 | .type = "wm8750", | ||
869 | .addr = 0x1b, | ||
870 | }, { | ||
871 | .type = "max7310", | ||
872 | .addr = 0x18, | ||
873 | .platform_data = &akita_pca953x_pdata, | ||
874 | }, | ||
875 | }; | ||
876 | |||
877 | static struct regulator_consumer_supply isl6271a_consumers[] = { | ||
878 | { | ||
879 | .supply = "vcc_core", | ||
880 | } | ||
881 | }; | ||
882 | |||
883 | static struct regulator_init_data isl6271a_info[] = { | ||
884 | { | ||
885 | .constraints = { | ||
886 | .name = "vcc_core range", | ||
887 | .min_uV = 850000, | ||
888 | .max_uV = 1600000, | ||
889 | .always_on = 1, | ||
890 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, | ||
891 | }, | ||
892 | .consumer_supplies = isl6271a_consumers, | ||
893 | .num_consumer_supplies = ARRAY_SIZE(isl6271a_consumers), | ||
894 | } | ||
895 | }; | ||
896 | |||
897 | static struct i2c_board_info spitz_pi2c_devs[] = { | ||
898 | { | ||
899 | .type = "isl6271a", | ||
900 | .addr = 0x0c, | ||
901 | .platform_data = &isl6271a_info, | ||
902 | }, | ||
903 | }; | ||
904 | |||
905 | static void __init spitz_i2c_init(void) | ||
906 | { | ||
907 | int size = ARRAY_SIZE(spitz_i2c_devs); | ||
908 | |||
909 | /* Only Akita has the max7310 chip */ | ||
910 | if (!machine_is_akita()) | ||
911 | size--; | ||
912 | |||
913 | pxa_set_i2c_info(NULL); | ||
914 | pxa27x_set_i2c_power_info(NULL); | ||
915 | i2c_register_board_info(0, spitz_i2c_devs, size); | ||
916 | i2c_register_board_info(1, ARRAY_AND_SIZE(spitz_pi2c_devs)); | ||
917 | } | ||
918 | #else | ||
919 | static inline void spitz_i2c_init(void) {} | ||
920 | #endif | ||
921 | |||
922 | /****************************************************************************** | ||
923 | * Machine init | ||
924 | ******************************************************************************/ | ||
721 | static void spitz_poweroff(void) | 925 | static void spitz_poweroff(void) |
722 | { | 926 | { |
723 | arm_machine_restart('g', NULL); | 927 | arm_machine_restart('g', NULL); |
@@ -726,26 +930,18 @@ static void spitz_poweroff(void) | |||
726 | static void spitz_restart(char mode, const char *cmd) | 930 | static void spitz_restart(char mode, const char *cmd) |
727 | { | 931 | { |
728 | /* Bootloader magic for a reboot */ | 932 | /* Bootloader magic for a reboot */ |
729 | if((MSC0 & 0xffff0000) == 0x7ff00000) | 933 | if ((MSC0 & 0xffff0000) == 0x7ff00000) |
730 | MSC0 = (MSC0 & 0xffff) | 0x7ee00000; | 934 | MSC0 = (MSC0 & 0xffff) | 0x7ee00000; |
731 | 935 | ||
732 | spitz_poweroff(); | 936 | spitz_poweroff(); |
733 | } | 937 | } |
734 | 938 | ||
735 | static void __init common_init(void) | 939 | static void __init spitz_init(void) |
736 | { | 940 | { |
737 | init_gpio_reset(SPITZ_GPIO_ON_RESET, 1, 0); | 941 | init_gpio_reset(SPITZ_GPIO_ON_RESET, 1, 0); |
738 | pm_power_off = spitz_poweroff; | 942 | pm_power_off = spitz_poweroff; |
739 | arm_pm_restart = spitz_restart; | 943 | arm_pm_restart = spitz_restart; |
740 | 944 | ||
741 | if (machine_is_spitz()) { | ||
742 | sharpsl_nand_partitions[1].size = 5 * 1024 * 1024; | ||
743 | } else if (machine_is_akita()) { | ||
744 | sharpsl_nand_partitions[1].size = 58 * 1024 * 1024; | ||
745 | } else if (machine_is_borzoi()) { | ||
746 | sharpsl_nand_partitions[1].size = 32 * 1024 * 1024; | ||
747 | } | ||
748 | |||
749 | PMCR = 0x00; | 945 | PMCR = 0x00; |
750 | 946 | ||
751 | /* Stop 3.6MHz and drive HIGH to PCMCIA and CS */ | 947 | /* Stop 3.6MHz and drive HIGH to PCMCIA and CS */ |
@@ -757,91 +953,22 @@ static void __init common_init(void) | |||
757 | pxa_set_btuart_info(NULL); | 953 | pxa_set_btuart_info(NULL); |
758 | pxa_set_stuart_info(NULL); | 954 | pxa_set_stuart_info(NULL); |
759 | 955 | ||
760 | spitz_init_spi(); | 956 | spitz_spi_init(); |
761 | 957 | spitz_scoop_init(); | |
762 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 958 | spitz_mkp_init(); |
763 | pxa_set_mci_info(&spitz_mci_platform_data); | 959 | spitz_keys_init(); |
764 | pxa_set_ohci_info(&spitz_ohci_platform_data); | 960 | spitz_leds_init(); |
765 | pxa_set_ficp_info(&spitz_ficp_platform_data); | 961 | spitz_mmc_init(); |
766 | set_pxa_fb_info(&spitz_pxafb_info); | 962 | spitz_pcmcia_init(); |
767 | pxa_set_i2c_info(NULL); | 963 | spitz_irda_init(); |
964 | spitz_uhc_init(); | ||
965 | spitz_lcd_init(); | ||
966 | spitz_nor_init(); | ||
967 | spitz_nand_init(); | ||
968 | spitz_i2c_init(); | ||
768 | } | 969 | } |
769 | 970 | ||
770 | #if defined(CONFIG_MACH_AKITA) || defined(CONFIG_MACH_BORZOI) | 971 | static void __init spitz_fixup(struct machine_desc *desc, |
771 | static struct nand_bbt_descr sharpsl_akita_bbt = { | ||
772 | .options = 0, | ||
773 | .offs = 4, | ||
774 | .len = 1, | ||
775 | .pattern = scan_ff_pattern | ||
776 | }; | ||
777 | |||
778 | static struct nand_ecclayout akita_oobinfo = { | ||
779 | .eccbytes = 24, | ||
780 | .eccpos = { | ||
781 | 0x5, 0x1, 0x2, 0x3, 0x6, 0x7, 0x15, 0x11, | ||
782 | 0x12, 0x13, 0x16, 0x17, 0x25, 0x21, 0x22, 0x23, | ||
783 | 0x26, 0x27, 0x35, 0x31, 0x32, 0x33, 0x36, 0x37}, | ||
784 | .oobfree = {{0x08, 0x09}} | ||
785 | }; | ||
786 | #endif | ||
787 | |||
788 | #if defined(CONFIG_MACH_SPITZ) || defined(CONFIG_MACH_BORZOI) | ||
789 | static void __init spitz_init(void) | ||
790 | { | ||
791 | spitz_ficp_platform_data.gpio_pwdown = SPITZ_GPIO_IR_ON; | ||
792 | |||
793 | #ifdef CONFIG_MACH_BORZOI | ||
794 | if (machine_is_borzoi()) { | ||
795 | sharpsl_nand_platform_data.badblock_pattern = &sharpsl_akita_bbt; | ||
796 | sharpsl_nand_platform_data.ecc_layout = &akita_oobinfo; | ||
797 | } | ||
798 | #endif | ||
799 | |||
800 | platform_scoop_config = &spitz_pcmcia_config; | ||
801 | |||
802 | common_init(); | ||
803 | |||
804 | platform_device_register(&spitzscoop2_device); | ||
805 | } | ||
806 | #endif | ||
807 | |||
808 | #ifdef CONFIG_MACH_AKITA | ||
809 | /* | ||
810 | * Akita IO Expander | ||
811 | */ | ||
812 | static struct pca953x_platform_data akita_ioexp = { | ||
813 | .gpio_base = AKITA_IOEXP_GPIO_BASE, | ||
814 | }; | ||
815 | |||
816 | static struct i2c_board_info akita_i2c_board_info[] = { | ||
817 | { | ||
818 | .type = "max7310", | ||
819 | .addr = 0x18, | ||
820 | .platform_data = &akita_ioexp, | ||
821 | }, { | ||
822 | .type = "wm8750", | ||
823 | .addr = 0x1b, | ||
824 | }, | ||
825 | }; | ||
826 | |||
827 | static void __init akita_init(void) | ||
828 | { | ||
829 | spitz_ficp_platform_data.gpio_pwdown = AKITA_GPIO_IR_ON; | ||
830 | |||
831 | sharpsl_nand_platform_data.badblock_pattern = &sharpsl_akita_bbt; | ||
832 | sharpsl_nand_platform_data.ecc_layout = &akita_oobinfo; | ||
833 | |||
834 | /* We just pretend the second element of the array doesn't exist */ | ||
835 | spitz_pcmcia_config.num_devs = 1; | ||
836 | platform_scoop_config = &spitz_pcmcia_config; | ||
837 | |||
838 | i2c_register_board_info(0, ARRAY_AND_SIZE(akita_i2c_board_info)); | ||
839 | |||
840 | common_init(); | ||
841 | } | ||
842 | #endif | ||
843 | |||
844 | static void __init fixup_spitz(struct machine_desc *desc, | ||
845 | struct tag *tags, char **cmdline, struct meminfo *mi) | 972 | struct tag *tags, char **cmdline, struct meminfo *mi) |
846 | { | 973 | { |
847 | sharpsl_save_param(); | 974 | sharpsl_save_param(); |
@@ -854,7 +981,7 @@ static void __init fixup_spitz(struct machine_desc *desc, | |||
854 | MACHINE_START(SPITZ, "SHARP Spitz") | 981 | MACHINE_START(SPITZ, "SHARP Spitz") |
855 | .phys_io = 0x40000000, | 982 | .phys_io = 0x40000000, |
856 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | 983 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
857 | .fixup = fixup_spitz, | 984 | .fixup = spitz_fixup, |
858 | .map_io = pxa_map_io, | 985 | .map_io = pxa_map_io, |
859 | .init_irq = pxa27x_init_irq, | 986 | .init_irq = pxa27x_init_irq, |
860 | .init_machine = spitz_init, | 987 | .init_machine = spitz_init, |
@@ -866,7 +993,7 @@ MACHINE_END | |||
866 | MACHINE_START(BORZOI, "SHARP Borzoi") | 993 | MACHINE_START(BORZOI, "SHARP Borzoi") |
867 | .phys_io = 0x40000000, | 994 | .phys_io = 0x40000000, |
868 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | 995 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
869 | .fixup = fixup_spitz, | 996 | .fixup = spitz_fixup, |
870 | .map_io = pxa_map_io, | 997 | .map_io = pxa_map_io, |
871 | .init_irq = pxa27x_init_irq, | 998 | .init_irq = pxa27x_init_irq, |
872 | .init_machine = spitz_init, | 999 | .init_machine = spitz_init, |
@@ -878,10 +1005,10 @@ MACHINE_END | |||
878 | MACHINE_START(AKITA, "SHARP Akita") | 1005 | MACHINE_START(AKITA, "SHARP Akita") |
879 | .phys_io = 0x40000000, | 1006 | .phys_io = 0x40000000, |
880 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | 1007 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
881 | .fixup = fixup_spitz, | 1008 | .fixup = spitz_fixup, |
882 | .map_io = pxa_map_io, | 1009 | .map_io = pxa_map_io, |
883 | .init_irq = pxa27x_init_irq, | 1010 | .init_irq = pxa27x_init_irq, |
884 | .init_machine = akita_init, | 1011 | .init_machine = spitz_init, |
885 | .timer = &pxa_timer, | 1012 | .timer = &pxa_timer, |
886 | MACHINE_END | 1013 | MACHINE_END |
887 | #endif | 1014 | #endif |