spitz.c 16 KB

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