spitz.c 17 KB

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