spitz.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704
  1. /*
  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. #include <linux/kernel.h>
  15. #include <linux/init.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/delay.h>
  18. #include <linux/major.h>
  19. #include <linux/fs.h>
  20. #include <linux/interrupt.h>
  21. #include <linux/mmc/host.h>
  22. #include <linux/pm.h>
  23. #include <linux/backlight.h>
  24. #include <asm/setup.h>
  25. #include <asm/memory.h>
  26. #include <asm/mach-types.h>
  27. #include <asm/hardware.h>
  28. #include <asm/irq.h>
  29. #include <asm/io.h>
  30. #include <asm/system.h>
  31. #include <asm/mach/arch.h>
  32. #include <asm/mach/map.h>
  33. #include <asm/mach/irq.h>
  34. #include <asm/arch/pxa-regs.h>
  35. #include <asm/arch/pxa2xx-regs.h>
  36. #include <asm/arch/pxa2xx-gpio.h>
  37. #include <asm/arch/irda.h>
  38. #include <asm/arch/mmc.h>
  39. #include <asm/arch/ohci.h>
  40. #include <asm/arch/udc.h>
  41. #include <asm/arch/pxafb.h>
  42. #include <asm/arch/akita.h>
  43. #include <asm/arch/spitz.h>
  44. #include <asm/arch/sharpsl.h>
  45. #include <asm/mach/sharpsl_param.h>
  46. #include <asm/hardware/scoop.h>
  47. #include "generic.h"
  48. #include "devices.h"
  49. #include "sharpsl.h"
  50. /*
  51. * Spitz SCOOP Device #1
  52. */
  53. static struct resource spitz_scoop_resources[] = {
  54. [0] = {
  55. .start = 0x10800000,
  56. .end = 0x10800fff,
  57. .flags = IORESOURCE_MEM,
  58. },
  59. };
  60. static struct scoop_config spitz_scoop_setup = {
  61. .io_dir = SPITZ_SCP_IO_DIR,
  62. .io_out = SPITZ_SCP_IO_OUT,
  63. .suspend_clr = SPITZ_SCP_SUS_CLR,
  64. .suspend_set = SPITZ_SCP_SUS_SET,
  65. };
  66. struct platform_device spitzscoop_device = {
  67. .name = "sharp-scoop",
  68. .id = 0,
  69. .dev = {
  70. .platform_data = &spitz_scoop_setup,
  71. },
  72. .num_resources = ARRAY_SIZE(spitz_scoop_resources),
  73. .resource = spitz_scoop_resources,
  74. };
  75. /*
  76. * Spitz SCOOP Device #2
  77. */
  78. static struct resource spitz_scoop2_resources[] = {
  79. [0] = {
  80. .start = 0x08800040,
  81. .end = 0x08800fff,
  82. .flags = IORESOURCE_MEM,
  83. },
  84. };
  85. static struct scoop_config spitz_scoop2_setup = {
  86. .io_dir = SPITZ_SCP2_IO_DIR,
  87. .io_out = SPITZ_SCP2_IO_OUT,
  88. .suspend_clr = SPITZ_SCP2_SUS_CLR,
  89. .suspend_set = SPITZ_SCP2_SUS_SET,
  90. };
  91. struct platform_device spitzscoop2_device = {
  92. .name = "sharp-scoop",
  93. .id = 1,
  94. .dev = {
  95. .platform_data = &spitz_scoop2_setup,
  96. },
  97. .num_resources = ARRAY_SIZE(spitz_scoop2_resources),
  98. .resource = spitz_scoop2_resources,
  99. };
  100. #define SPITZ_PWR_SD 0x01
  101. #define SPITZ_PWR_CF 0x02
  102. /* Power control is shared with between one of the CF slots and SD */
  103. static void spitz_card_pwr_ctrl(int device, unsigned short new_cpr)
  104. {
  105. unsigned short cpr = read_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR);
  106. if (new_cpr & 0x0007) {
  107. set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CF_POWER);
  108. if (!(cpr & 0x0002) && !(cpr & 0x0004))
  109. mdelay(5);
  110. if (device == SPITZ_PWR_CF)
  111. cpr |= 0x0002;
  112. if (device == SPITZ_PWR_SD)
  113. cpr |= 0x0004;
  114. write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr);
  115. } else {
  116. if (device == SPITZ_PWR_CF)
  117. cpr &= ~0x0002;
  118. if (device == SPITZ_PWR_SD)
  119. cpr &= ~0x0004;
  120. if (!(cpr & 0x0002) && !(cpr & 0x0004)) {
  121. write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, 0x0000);
  122. mdelay(1);
  123. reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CF_POWER);
  124. } else {
  125. write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr);
  126. }
  127. }
  128. }
  129. static void spitz_pcmcia_init(void)
  130. {
  131. /* Setup default state of GPIO outputs
  132. before we enable them as outputs. */
  133. GPSR(GPIO48_nPOE) = GPIO_bit(GPIO48_nPOE) |
  134. GPIO_bit(GPIO49_nPWE) | GPIO_bit(GPIO50_nPIOR) |
  135. GPIO_bit(GPIO51_nPIOW) | GPIO_bit(GPIO54_nPCE_2);
  136. GPSR(GPIO85_nPCE_1) = GPIO_bit(GPIO85_nPCE_1);
  137. pxa_gpio_mode(GPIO48_nPOE_MD);
  138. pxa_gpio_mode(GPIO49_nPWE_MD);
  139. pxa_gpio_mode(GPIO50_nPIOR_MD);
  140. pxa_gpio_mode(GPIO51_nPIOW_MD);
  141. pxa_gpio_mode(GPIO55_nPREG_MD);
  142. pxa_gpio_mode(GPIO56_nPWAIT_MD);
  143. pxa_gpio_mode(GPIO57_nIOIS16_MD);
  144. pxa_gpio_mode(GPIO85_nPCE_1_MD);
  145. pxa_gpio_mode(GPIO54_nPCE_2_MD);
  146. pxa_gpio_mode(GPIO104_pSKTSEL_MD);
  147. }
  148. static void spitz_pcmcia_pwr(struct device *scoop, unsigned short cpr, int nr)
  149. {
  150. /* Only need to override behaviour for slot 0 */
  151. if (nr == 0)
  152. spitz_card_pwr_ctrl(SPITZ_PWR_CF, cpr);
  153. else
  154. write_scoop_reg(scoop, SCOOP_CPR, cpr);
  155. }
  156. static struct scoop_pcmcia_dev spitz_pcmcia_scoop[] = {
  157. {
  158. .dev = &spitzscoop_device.dev,
  159. .irq = SPITZ_IRQ_GPIO_CF_IRQ,
  160. .cd_irq = SPITZ_IRQ_GPIO_CF_CD,
  161. .cd_irq_str = "PCMCIA0 CD",
  162. },{
  163. .dev = &spitzscoop2_device.dev,
  164. .irq = SPITZ_IRQ_GPIO_CF2_IRQ,
  165. .cd_irq = -1,
  166. },
  167. };
  168. static struct scoop_pcmcia_config spitz_pcmcia_config = {
  169. .devs = &spitz_pcmcia_scoop[0],
  170. .num_devs = 2,
  171. .pcmcia_init = spitz_pcmcia_init,
  172. .power_ctrl = spitz_pcmcia_pwr,
  173. };
  174. EXPORT_SYMBOL(spitzscoop_device);
  175. EXPORT_SYMBOL(spitzscoop2_device);
  176. /*
  177. * Spitz SSP Device
  178. *
  179. * Set the parent as the scoop device because a lot of SSP devices
  180. * also use scoop functions and this makes the power up/down order
  181. * work correctly.
  182. */
  183. struct platform_device spitzssp_device = {
  184. .name = "corgi-ssp",
  185. .dev = {
  186. .parent = &spitzscoop_device.dev,
  187. },
  188. .id = -1,
  189. };
  190. struct corgissp_machinfo spitz_ssp_machinfo = {
  191. .port = 2,
  192. .cs_lcdcon = SPITZ_GPIO_LCDCON_CS,
  193. .cs_ads7846 = SPITZ_GPIO_ADS7846_CS,
  194. .cs_max1111 = SPITZ_GPIO_MAX1111_CS,
  195. .clk_lcdcon = 520,
  196. .clk_ads7846 = 14,
  197. .clk_max1111 = 56,
  198. };
  199. /*
  200. * Spitz Backlight Device
  201. */
  202. static void spitz_bl_kick_battery(void)
  203. {
  204. void (*kick_batt)(void);
  205. kick_batt = symbol_get(sharpsl_battery_kick);
  206. if (kick_batt) {
  207. kick_batt();
  208. symbol_put(sharpsl_battery_kick);
  209. }
  210. }
  211. static struct generic_bl_info spitz_bl_machinfo = {
  212. .name = "corgi-bl",
  213. .default_intensity = 0x1f,
  214. .limit_mask = 0x0b,
  215. .max_intensity = 0x2f,
  216. .kick_battery = spitz_bl_kick_battery,
  217. };
  218. static struct platform_device spitzbl_device = {
  219. .name = "generic-bl",
  220. .dev = {
  221. .platform_data = &spitz_bl_machinfo,
  222. },
  223. .id = -1,
  224. };
  225. /*
  226. * Spitz Keyboard Device
  227. */
  228. static struct platform_device spitzkbd_device = {
  229. .name = "spitz-keyboard",
  230. .id = -1,
  231. };
  232. /*
  233. * Spitz LEDs
  234. */
  235. static struct platform_device spitzled_device = {
  236. .name = "spitz-led",
  237. .id = -1,
  238. };
  239. /*
  240. * Spitz Touch Screen Device
  241. */
  242. static unsigned long (*get_hsync_invperiod)(struct device *dev);
  243. static void inline sharpsl_wait_sync(int gpio)
  244. {
  245. while((GPLR(gpio) & GPIO_bit(gpio)) == 0);
  246. while((GPLR(gpio) & GPIO_bit(gpio)) != 0);
  247. }
  248. static struct device *spitz_pxafb_dev;
  249. static int is_pxafb_device(struct device * dev, void * data)
  250. {
  251. struct platform_device *pdev = container_of(dev, struct platform_device, dev);
  252. return (strncmp(pdev->name, "pxa2xx-fb", 9) == 0);
  253. }
  254. static unsigned long spitz_get_hsync_invperiod(void)
  255. {
  256. #ifdef CONFIG_FB_PXA
  257. if (!spitz_pxafb_dev) {
  258. spitz_pxafb_dev = bus_find_device(&platform_bus_type, NULL, NULL, is_pxafb_device);
  259. if (!spitz_pxafb_dev)
  260. return 0;
  261. }
  262. if (!get_hsync_invperiod)
  263. get_hsync_invperiod = symbol_get(pxafb_get_hsync_time);
  264. if (!get_hsync_invperiod)
  265. #endif
  266. return 0;
  267. return get_hsync_invperiod(spitz_pxafb_dev);
  268. }
  269. static void spitz_put_hsync(void)
  270. {
  271. put_device(spitz_pxafb_dev);
  272. if (get_hsync_invperiod)
  273. symbol_put(pxafb_get_hsync_time);
  274. spitz_pxafb_dev = NULL;
  275. get_hsync_invperiod = NULL;
  276. }
  277. static void spitz_wait_hsync(void)
  278. {
  279. sharpsl_wait_sync(SPITZ_GPIO_HSYNC);
  280. }
  281. static struct resource spitzts_resources[] = {
  282. [0] = {
  283. .start = SPITZ_IRQ_GPIO_TP_INT,
  284. .end = SPITZ_IRQ_GPIO_TP_INT,
  285. .flags = IORESOURCE_IRQ,
  286. },
  287. };
  288. static struct corgits_machinfo spitz_ts_machinfo = {
  289. .get_hsync_invperiod = spitz_get_hsync_invperiod,
  290. .put_hsync = spitz_put_hsync,
  291. .wait_hsync = spitz_wait_hsync,
  292. };
  293. static struct platform_device spitzts_device = {
  294. .name = "corgi-ts",
  295. .dev = {
  296. .parent = &spitzssp_device.dev,
  297. .platform_data = &spitz_ts_machinfo,
  298. },
  299. .id = -1,
  300. .num_resources = ARRAY_SIZE(spitzts_resources),
  301. .resource = spitzts_resources,
  302. };
  303. /*
  304. * MMC/SD Device
  305. *
  306. * The card detect interrupt isn't debounced so we delay it by 250ms
  307. * to give the card a chance to fully insert/eject.
  308. */
  309. static struct pxamci_platform_data spitz_mci_platform_data;
  310. static int spitz_mci_init(struct device *dev, irq_handler_t spitz_detect_int, void *data)
  311. {
  312. int err;
  313. /* setup GPIO for PXA27x MMC controller */
  314. pxa_gpio_mode(GPIO32_MMCCLK_MD);
  315. pxa_gpio_mode(GPIO112_MMCCMD_MD);
  316. pxa_gpio_mode(GPIO92_MMCDAT0_MD);
  317. pxa_gpio_mode(GPIO109_MMCDAT1_MD);
  318. pxa_gpio_mode(GPIO110_MMCDAT2_MD);
  319. pxa_gpio_mode(GPIO111_MMCDAT3_MD);
  320. pxa_gpio_mode(SPITZ_GPIO_nSD_DETECT | GPIO_IN);
  321. pxa_gpio_mode(SPITZ_GPIO_nSD_WP | GPIO_IN);
  322. spitz_mci_platform_data.detect_delay = msecs_to_jiffies(250);
  323. err = request_irq(SPITZ_IRQ_GPIO_nSD_DETECT, spitz_detect_int,
  324. IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
  325. "MMC card detect", data);
  326. if (err)
  327. printk(KERN_ERR "spitz_mci_init: MMC/SD: can't request MMC card detect IRQ\n");
  328. return err;
  329. }
  330. static void spitz_mci_setpower(struct device *dev, unsigned int vdd)
  331. {
  332. struct pxamci_platform_data* p_d = dev->platform_data;
  333. if (( 1 << vdd) & p_d->ocr_mask)
  334. spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0004);
  335. else
  336. spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0000);
  337. }
  338. static int spitz_mci_get_ro(struct device *dev)
  339. {
  340. return GPLR(SPITZ_GPIO_nSD_WP) & GPIO_bit(SPITZ_GPIO_nSD_WP);
  341. }
  342. static void spitz_mci_exit(struct device *dev, void *data)
  343. {
  344. free_irq(SPITZ_IRQ_GPIO_nSD_DETECT, data);
  345. }
  346. static struct pxamci_platform_data spitz_mci_platform_data = {
  347. .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
  348. .init = spitz_mci_init,
  349. .get_ro = spitz_mci_get_ro,
  350. .setpower = spitz_mci_setpower,
  351. .exit = spitz_mci_exit,
  352. };
  353. /*
  354. * USB Host (OHCI)
  355. */
  356. static int spitz_ohci_init(struct device *dev)
  357. {
  358. /* Only Port 2 is connected */
  359. pxa_gpio_mode(SPITZ_GPIO_USB_CONNECT | GPIO_IN);
  360. pxa_gpio_mode(SPITZ_GPIO_USB_HOST | GPIO_OUT);
  361. pxa_gpio_mode(SPITZ_GPIO_USB_DEVICE | GPIO_IN);
  362. /* Setup USB Port 2 Output Control Register */
  363. UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
  364. GPSR(SPITZ_GPIO_USB_HOST) = GPIO_bit(SPITZ_GPIO_USB_HOST);
  365. UHCHR = (UHCHR) &
  366. ~(UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSEP3 | UHCHR_SSE);
  367. UHCRHDA |= UHCRHDA_NOCP;
  368. return 0;
  369. }
  370. static struct pxaohci_platform_data spitz_ohci_platform_data = {
  371. .port_mode = PMM_NPS_MODE,
  372. .init = spitz_ohci_init,
  373. .power_budget = 150,
  374. };
  375. /*
  376. * Irda
  377. */
  378. static void spitz_irda_transceiver_mode(struct device *dev, int mode)
  379. {
  380. if (mode & IR_OFF)
  381. set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_IR_ON);
  382. else
  383. reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_IR_ON);
  384. }
  385. #ifdef CONFIG_MACH_AKITA
  386. static void akita_irda_transceiver_mode(struct device *dev, int mode)
  387. {
  388. if (mode & IR_OFF)
  389. akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_IR_ON);
  390. else
  391. akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_IR_ON);
  392. }
  393. #endif
  394. static struct pxaficp_platform_data spitz_ficp_platform_data = {
  395. .transceiver_cap = IR_SIRMODE | IR_OFF,
  396. .transceiver_mode = spitz_irda_transceiver_mode,
  397. };
  398. /*
  399. * Spitz PXA Framebuffer
  400. */
  401. static void spitz_lcd_power(int on, struct fb_var_screeninfo *var)
  402. {
  403. if (on)
  404. corgi_lcdtg_hw_init(var->xres);
  405. else
  406. corgi_lcdtg_suspend();
  407. }
  408. static struct pxafb_mode_info spitz_pxafb_modes[] = {
  409. {
  410. .pixclock = 19231,
  411. .xres = 480,
  412. .yres = 640,
  413. .bpp = 16,
  414. .hsync_len = 40,
  415. .left_margin = 46,
  416. .right_margin = 125,
  417. .vsync_len = 3,
  418. .upper_margin = 1,
  419. .lower_margin = 0,
  420. .sync = 0,
  421. },{
  422. .pixclock = 134617,
  423. .xres = 240,
  424. .yres = 320,
  425. .bpp = 16,
  426. .hsync_len = 20,
  427. .left_margin = 20,
  428. .right_margin = 46,
  429. .vsync_len = 2,
  430. .upper_margin = 1,
  431. .lower_margin = 0,
  432. .sync = 0,
  433. },
  434. };
  435. static struct pxafb_mach_info spitz_pxafb_info = {
  436. .modes = &spitz_pxafb_modes[0],
  437. .num_modes = 2,
  438. .fixed_modes = 1,
  439. .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act | LCCR0_LDDALT | LCCR0_OUC | LCCR0_CMDIM | LCCR0_RDSTM,
  440. .lccr3 = LCCR3_PixRsEdg | LCCR3_OutEnH,
  441. .pxafb_lcd_power = spitz_lcd_power,
  442. };
  443. static struct platform_device *devices[] __initdata = {
  444. &spitzscoop_device,
  445. &spitzssp_device,
  446. &spitzkbd_device,
  447. &spitzts_device,
  448. &spitzbl_device,
  449. &spitzled_device,
  450. };
  451. static void spitz_poweroff(void)
  452. {
  453. RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR;
  454. pxa_gpio_mode(SPITZ_GPIO_ON_RESET | GPIO_OUT);
  455. GPSR(SPITZ_GPIO_ON_RESET) = GPIO_bit(SPITZ_GPIO_ON_RESET);
  456. mdelay(1000);
  457. arm_machine_restart('h');
  458. }
  459. static void spitz_restart(char mode)
  460. {
  461. /* Bootloader magic for a reboot */
  462. if((MSC0 & 0xffff0000) == 0x7ff00000)
  463. MSC0 = (MSC0 & 0xffff) | 0x7ee00000;
  464. spitz_poweroff();
  465. }
  466. static void __init common_init(void)
  467. {
  468. pm_power_off = spitz_poweroff;
  469. arm_pm_restart = spitz_restart;
  470. PMCR = 0x00;
  471. /* setup sleep mode values */
  472. PWER = 0x00000002;
  473. PFER = 0x00000000;
  474. PRER = 0x00000002;
  475. PGSR0 = 0x0158C000;
  476. PGSR1 = 0x00FF0080;
  477. PGSR2 = 0x0001C004;
  478. /* Stop 3.6MHz and drive HIGH to PCMCIA and CS */
  479. PCFR |= PCFR_OPDE;
  480. corgi_ssp_set_machinfo(&spitz_ssp_machinfo);
  481. pxa_gpio_mode(SPITZ_GPIO_HSYNC | GPIO_IN);
  482. platform_add_devices(devices, ARRAY_SIZE(devices));
  483. pxa_set_mci_info(&spitz_mci_platform_data);
  484. pxa_set_ohci_info(&spitz_ohci_platform_data);
  485. pxa_set_ficp_info(&spitz_ficp_platform_data);
  486. set_pxa_fb_parent(&spitzssp_device.dev);
  487. set_pxa_fb_info(&spitz_pxafb_info);
  488. }
  489. #if defined(CONFIG_MACH_SPITZ) || defined(CONFIG_MACH_BORZOI)
  490. static void spitz_bl_set_intensity(int intensity)
  491. {
  492. if (intensity > 0x10)
  493. intensity += 0x10;
  494. /* Bits 0-4 are accessed via the SSP interface */
  495. corgi_ssp_blduty_set(intensity & 0x1f);
  496. /* Bit 5 is via SCOOP */
  497. if (intensity & 0x0020)
  498. reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_CONT);
  499. else
  500. set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_CONT);
  501. if (intensity)
  502. set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_ON);
  503. else
  504. reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_ON);
  505. }
  506. static void __init spitz_init(void)
  507. {
  508. platform_scoop_config = &spitz_pcmcia_config;
  509. spitz_bl_machinfo.set_bl_intensity = spitz_bl_set_intensity;
  510. common_init();
  511. platform_device_register(&spitzscoop2_device);
  512. }
  513. #endif
  514. #ifdef CONFIG_MACH_AKITA
  515. /*
  516. * Akita IO Expander
  517. */
  518. struct platform_device akitaioexp_device = {
  519. .name = "akita-ioexp",
  520. .id = -1,
  521. };
  522. EXPORT_SYMBOL_GPL(akitaioexp_device);
  523. static void akita_bl_set_intensity(int intensity)
  524. {
  525. if (intensity > 0x10)
  526. intensity += 0x10;
  527. /* Bits 0-4 are accessed via the SSP interface */
  528. corgi_ssp_blduty_set(intensity & 0x1f);
  529. /* Bit 5 is via IO-Expander */
  530. if (intensity & 0x0020)
  531. akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_CONT);
  532. else
  533. akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_CONT);
  534. if (intensity)
  535. akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_ON);
  536. else
  537. akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_ON);
  538. }
  539. static void __init akita_init(void)
  540. {
  541. spitz_ficp_platform_data.transceiver_mode = akita_irda_transceiver_mode;
  542. /* We just pretend the second element of the array doesn't exist */
  543. spitz_pcmcia_config.num_devs = 1;
  544. platform_scoop_config = &spitz_pcmcia_config;
  545. spitz_bl_machinfo.set_bl_intensity = akita_bl_set_intensity;
  546. platform_device_register(&akitaioexp_device);
  547. spitzscoop_device.dev.parent = &akitaioexp_device.dev;
  548. common_init();
  549. }
  550. #endif
  551. static void __init fixup_spitz(struct machine_desc *desc,
  552. struct tag *tags, char **cmdline, struct meminfo *mi)
  553. {
  554. sharpsl_save_param();
  555. mi->nr_banks = 1;
  556. mi->bank[0].start = 0xa0000000;
  557. mi->bank[0].node = 0;
  558. mi->bank[0].size = (64*1024*1024);
  559. }
  560. #ifdef CONFIG_MACH_SPITZ
  561. MACHINE_START(SPITZ, "SHARP Spitz")
  562. .phys_io = 0x40000000,
  563. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  564. .fixup = fixup_spitz,
  565. .map_io = pxa_map_io,
  566. .init_irq = pxa27x_init_irq,
  567. .init_machine = spitz_init,
  568. .timer = &pxa_timer,
  569. MACHINE_END
  570. #endif
  571. #ifdef CONFIG_MACH_BORZOI
  572. MACHINE_START(BORZOI, "SHARP Borzoi")
  573. .phys_io = 0x40000000,
  574. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  575. .fixup = fixup_spitz,
  576. .map_io = pxa_map_io,
  577. .init_irq = pxa27x_init_irq,
  578. .init_machine = spitz_init,
  579. .timer = &pxa_timer,
  580. MACHINE_END
  581. #endif
  582. #ifdef CONFIG_MACH_AKITA
  583. MACHINE_START(AKITA, "SHARP Akita")
  584. .phys_io = 0x40000000,
  585. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  586. .fixup = fixup_spitz,
  587. .map_io = pxa_map_io,
  588. .init_irq = pxa27x_init_irq,
  589. .init_machine = akita_init,
  590. .timer = &pxa_timer,
  591. MACHINE_END
  592. #endif