spitz.c 17 KB

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