spitz.c 16 KB

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