spitz.c 17 KB

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