blob: 9e7773fca01cf391abbe3ccf79e841c8f9f0ab47 [file] [log] [blame]
Richard Purdie0dd28f12005-09-13 01:25:34 -07001/*
2 * Support for Sharp SL-Cxx00 Series of PDAs
3 * Models: SL-C3000 (Spitz), SL-C1000 (Akita) and SL-C3100 (Borzoi)
4 *
5 * Copyright (c) 2005 Richard Purdie
6 *
7 * Based on Sharp's 2.4 kernel patches/lubbock.c
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 */
14
15#include <linux/kernel.h>
16#include <linux/init.h>
Russell Kingd052d1b2005-10-29 19:07:23 +010017#include <linux/platform_device.h>
Richard Purdie0dd28f12005-09-13 01:25:34 -070018#include <linux/delay.h>
19#include <linux/major.h>
20#include <linux/fs.h>
21#include <linux/interrupt.h>
22#include <linux/mmc/host.h>
Richard Purdie74617fb2006-06-19 19:57:12 +010023#include <linux/pm.h>
Richard Purdiec3f8f652007-09-03 00:27:00 +010024#include <linux/backlight.h>
Richard Purdie0dd28f12005-09-13 01:25:34 -070025
26#include <asm/setup.h>
27#include <asm/memory.h>
28#include <asm/mach-types.h>
29#include <asm/hardware.h>
30#include <asm/irq.h>
31#include <asm/io.h>
Richard Purdie74617fb2006-06-19 19:57:12 +010032#include <asm/system.h>
Richard Purdie0dd28f12005-09-13 01:25:34 -070033
34#include <asm/mach/arch.h>
35#include <asm/mach/map.h>
36#include <asm/mach/irq.h>
37
38#include <asm/arch/pxa-regs.h>
eric miaobb548dd2008-01-30 09:39:48 +010039#include <asm/arch/pxa2xx-regs.h>
Richard Purdiedc078452005-10-30 14:50:25 +000040#include <asm/arch/irda.h>
Richard Purdie0dd28f12005-09-13 01:25:34 -070041#include <asm/arch/mmc.h>
Richard Purdie3125c682006-01-05 20:44:52 +000042#include <asm/arch/ohci.h>
Richard Purdie0dd28f12005-09-13 01:25:34 -070043#include <asm/arch/udc.h>
Richard Purdie0dd28f12005-09-13 01:25:34 -070044#include <asm/arch/pxafb.h>
45#include <asm/arch/akita.h>
46#include <asm/arch/spitz.h>
47#include <asm/arch/sharpsl.h>
48
49#include <asm/mach/sharpsl_param.h>
50#include <asm/hardware/scoop.h>
51
52#include "generic.h"
Russell King46c41e62007-05-15 15:39:36 +010053#include "devices.h"
Richard Purdie0dd28f12005-09-13 01:25:34 -070054#include "sharpsl.h"
55
56/*
57 * Spitz SCOOP Device #1
58 */
59static struct resource spitz_scoop_resources[] = {
60 [0] = {
61 .start = 0x10800000,
62 .end = 0x10800fff,
63 .flags = IORESOURCE_MEM,
64 },
65};
66
67static struct scoop_config spitz_scoop_setup = {
68 .io_dir = SPITZ_SCP_IO_DIR,
69 .io_out = SPITZ_SCP_IO_OUT,
70 .suspend_clr = SPITZ_SCP_SUS_CLR,
71 .suspend_set = SPITZ_SCP_SUS_SET,
72};
73
74struct platform_device spitzscoop_device = {
75 .name = "sharp-scoop",
76 .id = 0,
77 .dev = {
78 .platform_data = &spitz_scoop_setup,
79 },
80 .num_resources = ARRAY_SIZE(spitz_scoop_resources),
81 .resource = spitz_scoop_resources,
82};
83
84/*
85 * Spitz SCOOP Device #2
86 */
87static struct resource spitz_scoop2_resources[] = {
88 [0] = {
89 .start = 0x08800040,
90 .end = 0x08800fff,
91 .flags = IORESOURCE_MEM,
92 },
93};
94
95static struct scoop_config spitz_scoop2_setup = {
96 .io_dir = SPITZ_SCP2_IO_DIR,
97 .io_out = SPITZ_SCP2_IO_OUT,
98 .suspend_clr = SPITZ_SCP2_SUS_CLR,
99 .suspend_set = SPITZ_SCP2_SUS_SET,
100};
101
102struct platform_device spitzscoop2_device = {
103 .name = "sharp-scoop",
104 .id = 1,
105 .dev = {
106 .platform_data = &spitz_scoop2_setup,
107 },
108 .num_resources = ARRAY_SIZE(spitz_scoop2_resources),
109 .resource = spitz_scoop2_resources,
110};
111
Richard Purdiea63ae442005-11-08 19:15:43 +0000112#define SPITZ_PWR_SD 0x01
113#define SPITZ_PWR_CF 0x02
114
115/* Power control is shared with between one of the CF slots and SD */
116static void spitz_card_pwr_ctrl(int device, unsigned short new_cpr)
117{
118 unsigned short cpr = read_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR);
119
120 if (new_cpr & 0x0007) {
121 set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CF_POWER);
122 if (!(cpr & 0x0002) && !(cpr & 0x0004))
123 mdelay(5);
124 if (device == SPITZ_PWR_CF)
125 cpr |= 0x0002;
126 if (device == SPITZ_PWR_SD)
127 cpr |= 0x0004;
128 write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr);
129 } else {
130 if (device == SPITZ_PWR_CF)
131 cpr &= ~0x0002;
132 if (device == SPITZ_PWR_SD)
133 cpr &= ~0x0004;
Richard Purdiea63ae442005-11-08 19:15:43 +0000134 if (!(cpr & 0x0002) && !(cpr & 0x0004)) {
Richard Purdie945b9572006-01-05 20:44:57 +0000135 write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, 0x0000);
Richard Purdiea63ae442005-11-08 19:15:43 +0000136 mdelay(1);
137 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CF_POWER);
Richard Purdie945b9572006-01-05 20:44:57 +0000138 } else {
139 write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr);
Richard Purdiea63ae442005-11-08 19:15:43 +0000140 }
141 }
142}
143
144static void spitz_pcmcia_init(void)
145{
146 /* Setup default state of GPIO outputs
147 before we enable them as outputs. */
148 GPSR(GPIO48_nPOE) = GPIO_bit(GPIO48_nPOE) |
149 GPIO_bit(GPIO49_nPWE) | GPIO_bit(GPIO50_nPIOR) |
150 GPIO_bit(GPIO51_nPIOW) | GPIO_bit(GPIO54_nPCE_2);
151 GPSR(GPIO85_nPCE_1) = GPIO_bit(GPIO85_nPCE_1);
152
153 pxa_gpio_mode(GPIO48_nPOE_MD);
154 pxa_gpio_mode(GPIO49_nPWE_MD);
155 pxa_gpio_mode(GPIO50_nPIOR_MD);
156 pxa_gpio_mode(GPIO51_nPIOW_MD);
157 pxa_gpio_mode(GPIO55_nPREG_MD);
158 pxa_gpio_mode(GPIO56_nPWAIT_MD);
159 pxa_gpio_mode(GPIO57_nIOIS16_MD);
160 pxa_gpio_mode(GPIO85_nPCE_1_MD);
161 pxa_gpio_mode(GPIO54_nPCE_2_MD);
162 pxa_gpio_mode(GPIO104_pSKTSEL_MD);
163}
164
165static void spitz_pcmcia_pwr(struct device *scoop, unsigned short cpr, int nr)
166{
167 /* Only need to override behaviour for slot 0 */
168 if (nr == 0)
169 spitz_card_pwr_ctrl(SPITZ_PWR_CF, cpr);
170 else
171 write_scoop_reg(scoop, SCOOP_CPR, cpr);
172}
173
Richard Purdie0dd28f12005-09-13 01:25:34 -0700174static struct scoop_pcmcia_dev spitz_pcmcia_scoop[] = {
175{
176 .dev = &spitzscoop_device.dev,
177 .irq = SPITZ_IRQ_GPIO_CF_IRQ,
178 .cd_irq = SPITZ_IRQ_GPIO_CF_CD,
179 .cd_irq_str = "PCMCIA0 CD",
180},{
181 .dev = &spitzscoop2_device.dev,
182 .irq = SPITZ_IRQ_GPIO_CF2_IRQ,
183 .cd_irq = -1,
184},
185};
186
Richard Purdiea63ae442005-11-08 19:15:43 +0000187static struct scoop_pcmcia_config spitz_pcmcia_config = {
188 .devs = &spitz_pcmcia_scoop[0],
189 .num_devs = 2,
190 .pcmcia_init = spitz_pcmcia_init,
191 .power_ctrl = spitz_pcmcia_pwr,
192};
193
194EXPORT_SYMBOL(spitzscoop_device);
195EXPORT_SYMBOL(spitzscoop2_device);
196
Richard Purdie0dd28f12005-09-13 01:25:34 -0700197
198/*
199 * Spitz SSP Device
200 *
201 * Set the parent as the scoop device because a lot of SSP devices
202 * also use scoop functions and this makes the power up/down order
203 * work correctly.
204 */
205struct platform_device spitzssp_device = {
206 .name = "corgi-ssp",
207 .dev = {
208 .parent = &spitzscoop_device.dev,
209 },
210 .id = -1,
211};
212
213struct corgissp_machinfo spitz_ssp_machinfo = {
214 .port = 2,
215 .cs_lcdcon = SPITZ_GPIO_LCDCON_CS,
216 .cs_ads7846 = SPITZ_GPIO_ADS7846_CS,
217 .cs_max1111 = SPITZ_GPIO_MAX1111_CS,
218 .clk_lcdcon = 520,
219 .clk_ads7846 = 14,
220 .clk_max1111 = 56,
221};
222
223
224/*
225 * Spitz Backlight Device
226 */
Richard Purdiec3f8f652007-09-03 00:27:00 +0100227static void spitz_bl_kick_battery(void)
228{
229 void (*kick_batt)(void);
230
231 kick_batt = symbol_get(sharpsl_battery_kick);
232 if (kick_batt) {
233 kick_batt();
234 symbol_put(sharpsl_battery_kick);
235 }
236}
237
238static struct generic_bl_info spitz_bl_machinfo = {
239 .name = "corgi-bl",
Richard Purdie2c0f5fb2006-03-31 02:31:51 -0800240 .default_intensity = 0x1f,
241 .limit_mask = 0x0b,
Richard Purdie0dd28f12005-09-13 01:25:34 -0700242 .max_intensity = 0x2f,
Richard Purdiec3f8f652007-09-03 00:27:00 +0100243 .kick_battery = spitz_bl_kick_battery,
Richard Purdie0dd28f12005-09-13 01:25:34 -0700244};
245
246static struct platform_device spitzbl_device = {
Richard Purdiec3f8f652007-09-03 00:27:00 +0100247 .name = "generic-bl",
Richard Purdie0dd28f12005-09-13 01:25:34 -0700248 .dev = {
249 .platform_data = &spitz_bl_machinfo,
250 },
251 .id = -1,
252};
253
254
255/*
256 * Spitz Keyboard Device
257 */
258static struct platform_device spitzkbd_device = {
259 .name = "spitz-keyboard",
260 .id = -1,
261};
262
263
264/*
Richard Purdie31791082006-03-31 02:31:09 -0800265 * Spitz LEDs
266 */
267static struct platform_device spitzled_device = {
268 .name = "spitz-led",
269 .id = -1,
270};
271
272/*
Richard Purdie0dd28f12005-09-13 01:25:34 -0700273 * Spitz Touch Screen Device
274 */
Richard Purdieca4d6cf2008-01-02 01:09:54 +0100275
276static unsigned long (*get_hsync_invperiod)(struct device *dev);
277
278static void inline sharpsl_wait_sync(int gpio)
279{
280 while((GPLR(gpio) & GPIO_bit(gpio)) == 0);
281 while((GPLR(gpio) & GPIO_bit(gpio)) != 0);
282}
283
284static struct device *spitz_pxafb_dev;
285
286static int is_pxafb_device(struct device * dev, void * data)
287{
288 struct platform_device *pdev = container_of(dev, struct platform_device, dev);
289
290 return (strncmp(pdev->name, "pxa2xx-fb", 9) == 0);
291}
292
293static unsigned long spitz_get_hsync_invperiod(void)
294{
295#ifdef CONFIG_FB_PXA
296 if (!spitz_pxafb_dev) {
297 spitz_pxafb_dev = bus_find_device(&platform_bus_type, NULL, NULL, is_pxafb_device);
298 if (!spitz_pxafb_dev)
299 return 0;
300 }
301 if (!get_hsync_invperiod)
302 get_hsync_invperiod = symbol_get(pxafb_get_hsync_time);
303 if (!get_hsync_invperiod)
304#endif
305 return 0;
306
307 return get_hsync_invperiod(spitz_pxafb_dev);
308}
309
310static void spitz_put_hsync(void)
311{
312 put_device(spitz_pxafb_dev);
313 if (get_hsync_invperiod)
314 symbol_put(pxafb_get_hsync_time);
315 spitz_pxafb_dev = NULL;
316 get_hsync_invperiod = NULL;
317}
318
319static void spitz_wait_hsync(void)
320{
321 sharpsl_wait_sync(SPITZ_GPIO_HSYNC);
322}
323
Richard Purdie0dd28f12005-09-13 01:25:34 -0700324static struct resource spitzts_resources[] = {
325 [0] = {
326 .start = SPITZ_IRQ_GPIO_TP_INT,
327 .end = SPITZ_IRQ_GPIO_TP_INT,
328 .flags = IORESOURCE_IRQ,
329 },
330};
331
332static struct corgits_machinfo spitz_ts_machinfo = {
Richard Purdieca4d6cf2008-01-02 01:09:54 +0100333 .get_hsync_invperiod = spitz_get_hsync_invperiod,
334 .put_hsync = spitz_put_hsync,
335 .wait_hsync = spitz_wait_hsync,
Richard Purdie0dd28f12005-09-13 01:25:34 -0700336};
337
338static struct platform_device spitzts_device = {
339 .name = "corgi-ts",
340 .dev = {
341 .parent = &spitzssp_device.dev,
342 .platform_data = &spitz_ts_machinfo,
343 },
344 .id = -1,
345 .num_resources = ARRAY_SIZE(spitzts_resources),
346 .resource = spitzts_resources,
347};
348
349
350/*
351 * MMC/SD Device
352 *
353 * The card detect interrupt isn't debounced so we delay it by 250ms
354 * to give the card a chance to fully insert/eject.
355 */
356
357static struct pxamci_platform_data spitz_mci_platform_data;
358
David Howells40220c12006-10-09 12:19:47 +0100359static int spitz_mci_init(struct device *dev, irq_handler_t spitz_detect_int, void *data)
Richard Purdie0dd28f12005-09-13 01:25:34 -0700360{
361 int err;
362
363 /* setup GPIO for PXA27x MMC controller */
364 pxa_gpio_mode(GPIO32_MMCCLK_MD);
365 pxa_gpio_mode(GPIO112_MMCCMD_MD);
366 pxa_gpio_mode(GPIO92_MMCDAT0_MD);
367 pxa_gpio_mode(GPIO109_MMCDAT1_MD);
368 pxa_gpio_mode(GPIO110_MMCDAT2_MD);
369 pxa_gpio_mode(GPIO111_MMCDAT3_MD);
370 pxa_gpio_mode(SPITZ_GPIO_nSD_DETECT | GPIO_IN);
371 pxa_gpio_mode(SPITZ_GPIO_nSD_WP | GPIO_IN);
372
373 spitz_mci_platform_data.detect_delay = msecs_to_jiffies(250);
374
Russell King9ded96f2006-01-08 01:02:07 -0800375 err = request_irq(SPITZ_IRQ_GPIO_nSD_DETECT, spitz_detect_int,
Thomas Gleixner52e405e2006-07-03 02:20:05 +0200376 IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
Russell King9ded96f2006-01-08 01:02:07 -0800377 "MMC card detect", data);
Russell King2687bd32008-01-23 14:05:58 +0000378 if (err)
Richard Purdie0dd28f12005-09-13 01:25:34 -0700379 printk(KERN_ERR "spitz_mci_init: MMC/SD: can't request MMC card detect IRQ\n");
Richard Purdie0dd28f12005-09-13 01:25:34 -0700380
Russell King2687bd32008-01-23 14:05:58 +0000381 return err;
Richard Purdie0dd28f12005-09-13 01:25:34 -0700382}
383
Richard Purdie0dd28f12005-09-13 01:25:34 -0700384static void spitz_mci_setpower(struct device *dev, unsigned int vdd)
385{
386 struct pxamci_platform_data* p_d = dev->platform_data;
387
Richard Purdiea63ae442005-11-08 19:15:43 +0000388 if (( 1 << vdd) & p_d->ocr_mask)
389 spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0004);
390 else
391 spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0000);
Richard Purdie0dd28f12005-09-13 01:25:34 -0700392}
393
394static int spitz_mci_get_ro(struct device *dev)
395{
396 return GPLR(SPITZ_GPIO_nSD_WP) & GPIO_bit(SPITZ_GPIO_nSD_WP);
397}
398
399static void spitz_mci_exit(struct device *dev, void *data)
400{
401 free_irq(SPITZ_IRQ_GPIO_nSD_DETECT, data);
402}
403
404static struct pxamci_platform_data spitz_mci_platform_data = {
405 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
406 .init = spitz_mci_init,
407 .get_ro = spitz_mci_get_ro,
408 .setpower = spitz_mci_setpower,
409 .exit = spitz_mci_exit,
410};
411
412
413/*
Richard Purdie3125c682006-01-05 20:44:52 +0000414 * USB Host (OHCI)
415 */
416static int spitz_ohci_init(struct device *dev)
417{
418 /* Only Port 2 is connected */
419 pxa_gpio_mode(SPITZ_GPIO_USB_CONNECT | GPIO_IN);
420 pxa_gpio_mode(SPITZ_GPIO_USB_HOST | GPIO_OUT);
421 pxa_gpio_mode(SPITZ_GPIO_USB_DEVICE | GPIO_IN);
422
423 /* Setup USB Port 2 Output Control Register */
424 UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
425
426 GPSR(SPITZ_GPIO_USB_HOST) = GPIO_bit(SPITZ_GPIO_USB_HOST);
427
428 UHCHR = (UHCHR) &
429 ~(UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSEP3 | UHCHR_SSE);
430
431 UHCRHDA |= UHCRHDA_NOCP;
432
433 return 0;
434}
435
436static struct pxaohci_platform_data spitz_ohci_platform_data = {
437 .port_mode = PMM_NPS_MODE,
438 .init = spitz_ohci_init,
Richard Purdie0c27c5d2006-06-08 22:44:07 +0100439 .power_budget = 150,
Richard Purdie3125c682006-01-05 20:44:52 +0000440};
441
442
443/*
Richard Purdiedc078452005-10-30 14:50:25 +0000444 * Irda
445 */
446static void spitz_irda_transceiver_mode(struct device *dev, int mode)
447{
448 if (mode & IR_OFF)
449 set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_IR_ON);
450 else
451 reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_IR_ON);
452}
453
Richard Purdie94cabd02005-11-12 18:53:48 +0000454#ifdef CONFIG_MACH_AKITA
455static void akita_irda_transceiver_mode(struct device *dev, int mode)
456{
457 if (mode & IR_OFF)
458 akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_IR_ON);
459 else
460 akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_IR_ON);
461}
462#endif
463
Richard Purdiedc078452005-10-30 14:50:25 +0000464static struct pxaficp_platform_data spitz_ficp_platform_data = {
465 .transceiver_cap = IR_SIRMODE | IR_OFF,
466 .transceiver_mode = spitz_irda_transceiver_mode,
467};
468
469
470/*
Richard Purdie0dd28f12005-09-13 01:25:34 -0700471 * Spitz PXA Framebuffer
472 */
Richard Purdied14b2722006-09-20 22:54:21 +0100473
Richard Purdieca4d6cf2008-01-02 01:09:54 +0100474static void spitz_lcd_power(int on, struct fb_var_screeninfo *var)
475{
476 if (on)
477 corgi_lcdtg_hw_init(var->xres);
478 else
479 corgi_lcdtg_suspend();
480}
481
Richard Purdied14b2722006-09-20 22:54:21 +0100482static struct pxafb_mode_info spitz_pxafb_modes[] = {
483{
484 .pixclock = 19231,
485 .xres = 480,
486 .yres = 640,
487 .bpp = 16,
488 .hsync_len = 40,
489 .left_margin = 46,
490 .right_margin = 125,
491 .vsync_len = 3,
492 .upper_margin = 1,
493 .lower_margin = 0,
494 .sync = 0,
495},{
496 .pixclock = 134617,
497 .xres = 240,
498 .yres = 320,
499 .bpp = 16,
500 .hsync_len = 20,
501 .left_margin = 20,
502 .right_margin = 46,
503 .vsync_len = 2,
504 .upper_margin = 1,
505 .lower_margin = 0,
506 .sync = 0,
507},
508};
509
510static struct pxafb_mach_info spitz_pxafb_info = {
511 .modes = &spitz_pxafb_modes[0],
512 .num_modes = 2,
513 .fixed_modes = 1,
514 .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act | LCCR0_LDDALT | LCCR0_OUC | LCCR0_CMDIM | LCCR0_RDSTM,
515 .lccr3 = LCCR3_PixRsEdg | LCCR3_OutEnH,
516 .pxafb_lcd_power = spitz_lcd_power,
Richard Purdie0dd28f12005-09-13 01:25:34 -0700517};
518
519
520static struct platform_device *devices[] __initdata = {
521 &spitzscoop_device,
522 &spitzssp_device,
523 &spitzkbd_device,
524 &spitzts_device,
525 &spitzbl_device,
Richard Purdie31791082006-03-31 02:31:09 -0800526 &spitzled_device,
Richard Purdie0dd28f12005-09-13 01:25:34 -0700527};
528
Richard Purdie74617fb2006-06-19 19:57:12 +0100529static void spitz_poweroff(void)
530{
531 RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR;
532
533 pxa_gpio_mode(SPITZ_GPIO_ON_RESET | GPIO_OUT);
534 GPSR(SPITZ_GPIO_ON_RESET) = GPIO_bit(SPITZ_GPIO_ON_RESET);
535
536 mdelay(1000);
537 arm_machine_restart('h');
538}
539
540static void spitz_restart(char mode)
541{
542 /* Bootloader magic for a reboot */
543 if((MSC0 & 0xffff0000) == 0x7ff00000)
544 MSC0 = (MSC0 & 0xffff) | 0x7ee00000;
545
546 spitz_poweroff();
547}
548
Richard Purdie0dd28f12005-09-13 01:25:34 -0700549static void __init common_init(void)
550{
Richard Purdie74617fb2006-06-19 19:57:12 +0100551 pm_power_off = spitz_poweroff;
552 arm_pm_restart = spitz_restart;
553
Richard Purdie0dd28f12005-09-13 01:25:34 -0700554 PMCR = 0x00;
555
556 /* setup sleep mode values */
557 PWER = 0x00000002;
558 PFER = 0x00000000;
559 PRER = 0x00000002;
560 PGSR0 = 0x0158C000;
561 PGSR1 = 0x00FF0080;
562 PGSR2 = 0x0001C004;
563
564 /* Stop 3.6MHz and drive HIGH to PCMCIA and CS */
565 PCFR |= PCFR_OPDE;
566
567 corgi_ssp_set_machinfo(&spitz_ssp_machinfo);
568
569 pxa_gpio_mode(SPITZ_GPIO_HSYNC | GPIO_IN);
570
571 platform_add_devices(devices, ARRAY_SIZE(devices));
572 pxa_set_mci_info(&spitz_mci_platform_data);
Richard Purdie3125c682006-01-05 20:44:52 +0000573 pxa_set_ohci_info(&spitz_ohci_platform_data);
Richard Purdiedc078452005-10-30 14:50:25 +0000574 pxa_set_ficp_info(&spitz_ficp_platform_data);
Richard Purdiecb38c562005-10-14 16:07:25 +0100575 set_pxa_fb_parent(&spitzssp_device.dev);
Richard Purdie0dd28f12005-09-13 01:25:34 -0700576 set_pxa_fb_info(&spitz_pxafb_info);
577}
578
Richard Purdieca4d6cf2008-01-02 01:09:54 +0100579#if defined(CONFIG_MACH_SPITZ) || defined(CONFIG_MACH_BORZOI)
580static void spitz_bl_set_intensity(int intensity)
581{
582 if (intensity > 0x10)
583 intensity += 0x10;
584
585 /* Bits 0-4 are accessed via the SSP interface */
586 corgi_ssp_blduty_set(intensity & 0x1f);
587
588 /* Bit 5 is via SCOOP */
589 if (intensity & 0x0020)
590 reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_CONT);
591 else
592 set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_CONT);
593
594 if (intensity)
595 set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_ON);
596 else
597 reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_ON);
598}
599
Richard Purdie0dd28f12005-09-13 01:25:34 -0700600static void __init spitz_init(void)
601{
Richard Purdiea63ae442005-11-08 19:15:43 +0000602 platform_scoop_config = &spitz_pcmcia_config;
603
Richard Purdie0dd28f12005-09-13 01:25:34 -0700604 spitz_bl_machinfo.set_bl_intensity = spitz_bl_set_intensity;
605
606 common_init();
607
608 platform_device_register(&spitzscoop2_device);
609}
Richard Purdieca4d6cf2008-01-02 01:09:54 +0100610#endif
Richard Purdie0dd28f12005-09-13 01:25:34 -0700611
Richard Purdie94cabd02005-11-12 18:53:48 +0000612#ifdef CONFIG_MACH_AKITA
613/*
614 * Akita IO Expander
615 */
616struct platform_device akitaioexp_device = {
617 .name = "akita-ioexp",
618 .id = -1,
619};
620
Richard Purdiebd8f1032006-03-26 21:40:27 +0100621EXPORT_SYMBOL_GPL(akitaioexp_device);
622
Richard Purdieca4d6cf2008-01-02 01:09:54 +0100623static void akita_bl_set_intensity(int intensity)
624{
625 if (intensity > 0x10)
626 intensity += 0x10;
627
628 /* Bits 0-4 are accessed via the SSP interface */
629 corgi_ssp_blduty_set(intensity & 0x1f);
630
631 /* Bit 5 is via IO-Expander */
632 if (intensity & 0x0020)
633 akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_CONT);
634 else
635 akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_CONT);
636
637 if (intensity)
638 akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_ON);
639 else
640 akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_ON);
641}
642
Richard Purdie94cabd02005-11-12 18:53:48 +0000643static void __init akita_init(void)
644{
645 spitz_ficp_platform_data.transceiver_mode = akita_irda_transceiver_mode;
646
647 /* We just pretend the second element of the array doesn't exist */
648 spitz_pcmcia_config.num_devs = 1;
649 platform_scoop_config = &spitz_pcmcia_config;
650 spitz_bl_machinfo.set_bl_intensity = akita_bl_set_intensity;
651
652 platform_device_register(&akitaioexp_device);
653
654 spitzscoop_device.dev.parent = &akitaioexp_device.dev;
655 common_init();
656}
657#endif
658
Richard Purdie0dd28f12005-09-13 01:25:34 -0700659static void __init fixup_spitz(struct machine_desc *desc,
660 struct tag *tags, char **cmdline, struct meminfo *mi)
661{
662 sharpsl_save_param();
663 mi->nr_banks = 1;
664 mi->bank[0].start = 0xa0000000;
665 mi->bank[0].node = 0;
666 mi->bank[0].size = (64*1024*1024);
667}
668
669#ifdef CONFIG_MACH_SPITZ
670MACHINE_START(SPITZ, "SHARP Spitz")
Richard Purdie0dd28f12005-09-13 01:25:34 -0700671 .phys_io = 0x40000000,
672 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
673 .fixup = fixup_spitz,
674 .map_io = pxa_map_io,
Eric Miaocd491042007-06-22 04:14:09 +0100675 .init_irq = pxa27x_init_irq,
Richard Purdie0dd28f12005-09-13 01:25:34 -0700676 .init_machine = spitz_init,
677 .timer = &pxa_timer,
678MACHINE_END
679#endif
680
681#ifdef CONFIG_MACH_BORZOI
682MACHINE_START(BORZOI, "SHARP Borzoi")
Richard Purdie0dd28f12005-09-13 01:25:34 -0700683 .phys_io = 0x40000000,
684 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
685 .fixup = fixup_spitz,
686 .map_io = pxa_map_io,
Eric Miaocd491042007-06-22 04:14:09 +0100687 .init_irq = pxa27x_init_irq,
Richard Purdie0dd28f12005-09-13 01:25:34 -0700688 .init_machine = spitz_init,
689 .timer = &pxa_timer,
690MACHINE_END
691#endif
Richard Purdie94cabd02005-11-12 18:53:48 +0000692
693#ifdef CONFIG_MACH_AKITA
694MACHINE_START(AKITA, "SHARP Akita")
Richard Purdie94cabd02005-11-12 18:53:48 +0000695 .phys_io = 0x40000000,
696 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
697 .fixup = fixup_spitz,
698 .map_io = pxa_map_io,
Eric Miaocd491042007-06-22 04:14:09 +0100699 .init_irq = pxa27x_init_irq,
Richard Purdie94cabd02005-11-12 18:53:48 +0000700 .init_machine = akita_init,
701 .timer = &pxa_timer,
702MACHINE_END
703#endif