corgi.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725
  1. /*
  2. * Support for Sharp SL-C7xx PDAs
  3. * Models: SL-C700 (Corgi), SL-C750 (Shepherd), SL-C760 (Husky)
  4. *
  5. * Copyright (c) 2004-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/major.h>
  18. #include <linux/fs.h>
  19. #include <linux/interrupt.h>
  20. #include <linux/mmc/host.h>
  21. #include <linux/mtd/physmap.h>
  22. #include <linux/pm.h>
  23. #include <linux/gpio.h>
  24. #include <linux/backlight.h>
  25. #include <linux/io.h>
  26. #include <linux/spi/spi.h>
  27. #include <linux/spi/ads7846.h>
  28. #include <linux/spi/corgi_lcd.h>
  29. #include <linux/mtd/sharpsl.h>
  30. #include <video/w100fb.h>
  31. #include <asm/setup.h>
  32. #include <asm/memory.h>
  33. #include <asm/mach-types.h>
  34. #include <mach/hardware.h>
  35. #include <asm/irq.h>
  36. #include <asm/system.h>
  37. #include <asm/mach/arch.h>
  38. #include <asm/mach/map.h>
  39. #include <asm/mach/irq.h>
  40. #include <mach/pxa-regs.h>
  41. #include <mach/pxa2xx-regs.h>
  42. #include <mach/mfp-pxa25x.h>
  43. #include <mach/i2c.h>
  44. #include <mach/irda.h>
  45. #include <mach/mmc.h>
  46. #include <mach/udc.h>
  47. #include <mach/pxa2xx_spi.h>
  48. #include <mach/corgi.h>
  49. #include <mach/sharpsl.h>
  50. #include <asm/mach/sharpsl_param.h>
  51. #include <asm/hardware/scoop.h>
  52. #include "generic.h"
  53. #include "devices.h"
  54. #include "sharpsl.h"
  55. static unsigned long corgi_pin_config[] __initdata = {
  56. /* Static Memory I/O */
  57. GPIO78_nCS_2, /* w100fb */
  58. GPIO80_nCS_4, /* scoop */
  59. /* SSP1 */
  60. GPIO23_SSP1_SCLK,
  61. GPIO25_SSP1_TXD,
  62. GPIO26_SSP1_RXD,
  63. GPIO24_GPIO, /* CORGI_GPIO_ADS7846_CS - SFRM as chip select */
  64. /* I2S */
  65. GPIO28_I2S_BITCLK_OUT,
  66. GPIO29_I2S_SDATA_IN,
  67. GPIO30_I2S_SDATA_OUT,
  68. GPIO31_I2S_SYNC,
  69. GPIO32_I2S_SYSCLK,
  70. /* Infra-Red */
  71. GPIO47_FICP_TXD,
  72. GPIO46_FICP_RXD,
  73. /* FFUART */
  74. GPIO40_FFUART_DTR,
  75. GPIO41_FFUART_RTS,
  76. GPIO39_FFUART_TXD,
  77. GPIO37_FFUART_DSR,
  78. GPIO34_FFUART_RXD,
  79. GPIO35_FFUART_CTS,
  80. /* PC Card */
  81. GPIO48_nPOE,
  82. GPIO49_nPWE,
  83. GPIO50_nPIOR,
  84. GPIO51_nPIOW,
  85. GPIO52_nPCE_1,
  86. GPIO53_nPCE_2,
  87. GPIO54_nPSKTSEL,
  88. GPIO55_nPREG,
  89. GPIO56_nPWAIT,
  90. GPIO57_nIOIS16,
  91. /* MMC */
  92. GPIO6_MMC_CLK,
  93. GPIO8_MMC_CS0,
  94. /* GPIO */
  95. GPIO9_GPIO, /* CORGI_GPIO_nSD_DETECT */
  96. GPIO7_GPIO, /* CORGI_GPIO_nSD_WP */
  97. GPIO33_GPIO, /* CORGI_GPIO_SD_PWR */
  98. GPIO22_GPIO, /* CORGI_GPIO_IR_ON */
  99. GPIO44_GPIO, /* CORGI_GPIO_HSYNC */
  100. GPIO1_GPIO | WAKEUP_ON_EDGE_RISE,
  101. };
  102. /*
  103. * Corgi SCOOP Device
  104. */
  105. static struct resource corgi_scoop_resources[] = {
  106. [0] = {
  107. .start = 0x10800000,
  108. .end = 0x10800fff,
  109. .flags = IORESOURCE_MEM,
  110. },
  111. };
  112. static struct scoop_config corgi_scoop_setup = {
  113. .io_dir = CORGI_SCOOP_IO_DIR,
  114. .io_out = CORGI_SCOOP_IO_OUT,
  115. .gpio_base = CORGI_SCOOP_GPIO_BASE,
  116. };
  117. struct platform_device corgiscoop_device = {
  118. .name = "sharp-scoop",
  119. .id = -1,
  120. .dev = {
  121. .platform_data = &corgi_scoop_setup,
  122. },
  123. .num_resources = ARRAY_SIZE(corgi_scoop_resources),
  124. .resource = corgi_scoop_resources,
  125. };
  126. static struct scoop_pcmcia_dev corgi_pcmcia_scoop[] = {
  127. {
  128. .dev = &corgiscoop_device.dev,
  129. .irq = CORGI_IRQ_GPIO_CF_IRQ,
  130. .cd_irq = CORGI_IRQ_GPIO_CF_CD,
  131. .cd_irq_str = "PCMCIA0 CD",
  132. },
  133. };
  134. static struct scoop_pcmcia_config corgi_pcmcia_config = {
  135. .devs = &corgi_pcmcia_scoop[0],
  136. .num_devs = 1,
  137. };
  138. EXPORT_SYMBOL(corgiscoop_device);
  139. static struct w100_mem_info corgi_fb_mem = {
  140. .ext_cntl = 0x00040003,
  141. .sdram_mode_reg = 0x00650021,
  142. .ext_timing_cntl = 0x10002a4a,
  143. .io_cntl = 0x7ff87012,
  144. .size = 0x1fffff,
  145. };
  146. static struct w100_gen_regs corgi_fb_regs = {
  147. .lcd_format = 0x00000003,
  148. .lcdd_cntl1 = 0x01CC0000,
  149. .lcdd_cntl2 = 0x0003FFFF,
  150. .genlcd_cntl1 = 0x00FFFF0D,
  151. .genlcd_cntl2 = 0x003F3003,
  152. .genlcd_cntl3 = 0x000102aa,
  153. };
  154. static struct w100_gpio_regs corgi_fb_gpio = {
  155. .init_data1 = 0x000000bf,
  156. .init_data2 = 0x00000000,
  157. .gpio_dir1 = 0x00000000,
  158. .gpio_oe1 = 0x03c0feff,
  159. .gpio_dir2 = 0x00000000,
  160. .gpio_oe2 = 0x00000000,
  161. };
  162. static struct w100_mode corgi_fb_modes[] = {
  163. {
  164. .xres = 480,
  165. .yres = 640,
  166. .left_margin = 0x56,
  167. .right_margin = 0x55,
  168. .upper_margin = 0x03,
  169. .lower_margin = 0x00,
  170. .crtc_ss = 0x82360056,
  171. .crtc_ls = 0xA0280000,
  172. .crtc_gs = 0x80280028,
  173. .crtc_vpos_gs = 0x02830002,
  174. .crtc_rev = 0x00400008,
  175. .crtc_dclk = 0xA0000000,
  176. .crtc_gclk = 0x8015010F,
  177. .crtc_goe = 0x80100110,
  178. .crtc_ps1_active = 0x41060010,
  179. .pll_freq = 75,
  180. .fast_pll_freq = 100,
  181. .sysclk_src = CLK_SRC_PLL,
  182. .sysclk_divider = 0,
  183. .pixclk_src = CLK_SRC_PLL,
  184. .pixclk_divider = 2,
  185. .pixclk_divider_rotated = 6,
  186. },{
  187. .xres = 240,
  188. .yres = 320,
  189. .left_margin = 0x27,
  190. .right_margin = 0x2e,
  191. .upper_margin = 0x01,
  192. .lower_margin = 0x00,
  193. .crtc_ss = 0x81170027,
  194. .crtc_ls = 0xA0140000,
  195. .crtc_gs = 0xC0140014,
  196. .crtc_vpos_gs = 0x00010141,
  197. .crtc_rev = 0x00400008,
  198. .crtc_dclk = 0xA0000000,
  199. .crtc_gclk = 0x8015010F,
  200. .crtc_goe = 0x80100110,
  201. .crtc_ps1_active = 0x41060010,
  202. .pll_freq = 0,
  203. .fast_pll_freq = 0,
  204. .sysclk_src = CLK_SRC_XTAL,
  205. .sysclk_divider = 0,
  206. .pixclk_src = CLK_SRC_XTAL,
  207. .pixclk_divider = 1,
  208. .pixclk_divider_rotated = 1,
  209. },
  210. };
  211. static struct w100fb_mach_info corgi_fb_info = {
  212. .init_mode = INIT_MODE_ROTATED,
  213. .mem = &corgi_fb_mem,
  214. .regs = &corgi_fb_regs,
  215. .modelist = &corgi_fb_modes[0],
  216. .num_modes = 2,
  217. .gpio = &corgi_fb_gpio,
  218. .xtal_freq = 12500000,
  219. .xtal_dbl = 0,
  220. };
  221. static struct resource corgi_fb_resources[] = {
  222. [0] = {
  223. .start = 0x08000000,
  224. .end = 0x08ffffff,
  225. .flags = IORESOURCE_MEM,
  226. },
  227. };
  228. static struct platform_device corgifb_device = {
  229. .name = "w100fb",
  230. .id = -1,
  231. .num_resources = ARRAY_SIZE(corgi_fb_resources),
  232. .resource = corgi_fb_resources,
  233. .dev = {
  234. .platform_data = &corgi_fb_info,
  235. },
  236. };
  237. /*
  238. * Corgi Keyboard Device
  239. */
  240. static struct platform_device corgikbd_device = {
  241. .name = "corgi-keyboard",
  242. .id = -1,
  243. };
  244. /*
  245. * Corgi LEDs
  246. */
  247. static struct gpio_led corgi_gpio_leds[] = {
  248. {
  249. .name = "corgi:amber:charge",
  250. .default_trigger = "sharpsl-charge",
  251. .gpio = CORGI_GPIO_LED_ORANGE,
  252. },
  253. {
  254. .name = "corgi:green:mail",
  255. .default_trigger = "nand-disk",
  256. .gpio = CORGI_GPIO_LED_GREEN,
  257. },
  258. };
  259. static struct gpio_led_platform_data corgi_gpio_leds_info = {
  260. .leds = corgi_gpio_leds,
  261. .num_leds = ARRAY_SIZE(corgi_gpio_leds),
  262. };
  263. static struct platform_device corgiled_device = {
  264. .name = "leds-gpio",
  265. .id = -1,
  266. .dev = {
  267. .platform_data = &corgi_gpio_leds_info,
  268. },
  269. };
  270. /*
  271. * MMC/SD Device
  272. *
  273. * The card detect interrupt isn't debounced so we delay it by 250ms
  274. * to give the card a chance to fully insert/eject.
  275. */
  276. static struct pxamci_platform_data corgi_mci_platform_data;
  277. static int corgi_mci_init(struct device *dev, irq_handler_t corgi_detect_int, void *data)
  278. {
  279. int err;
  280. err = gpio_request(CORGI_GPIO_nSD_DETECT, "nSD_DETECT");
  281. if (err)
  282. goto err_out;
  283. err = gpio_request(CORGI_GPIO_nSD_WP, "nSD_WP");
  284. if (err)
  285. goto err_free_1;
  286. err = gpio_request(CORGI_GPIO_SD_PWR, "SD_PWR");
  287. if (err)
  288. goto err_free_2;
  289. gpio_direction_input(CORGI_GPIO_nSD_DETECT);
  290. gpio_direction_input(CORGI_GPIO_nSD_WP);
  291. gpio_direction_output(CORGI_GPIO_SD_PWR, 0);
  292. corgi_mci_platform_data.detect_delay = msecs_to_jiffies(250);
  293. err = request_irq(CORGI_IRQ_GPIO_nSD_DETECT, corgi_detect_int,
  294. IRQF_DISABLED | IRQF_TRIGGER_RISING |
  295. IRQF_TRIGGER_FALLING,
  296. "MMC card detect", data);
  297. if (err) {
  298. pr_err("%s: MMC/SD: can't request MMC card detect IRQ\n",
  299. __func__);
  300. goto err_free_3;
  301. }
  302. return 0;
  303. err_free_3:
  304. gpio_free(CORGI_GPIO_SD_PWR);
  305. err_free_2:
  306. gpio_free(CORGI_GPIO_nSD_WP);
  307. err_free_1:
  308. gpio_free(CORGI_GPIO_nSD_DETECT);
  309. err_out:
  310. return err;
  311. }
  312. static void corgi_mci_setpower(struct device *dev, unsigned int vdd)
  313. {
  314. struct pxamci_platform_data* p_d = dev->platform_data;
  315. gpio_set_value(CORGI_GPIO_SD_PWR, ((1 << vdd) & p_d->ocr_mask));
  316. }
  317. static int corgi_mci_get_ro(struct device *dev)
  318. {
  319. return gpio_get_value(CORGI_GPIO_nSD_WP);
  320. }
  321. static void corgi_mci_exit(struct device *dev, void *data)
  322. {
  323. free_irq(CORGI_IRQ_GPIO_nSD_DETECT, data);
  324. gpio_free(CORGI_GPIO_SD_PWR);
  325. gpio_free(CORGI_GPIO_nSD_WP);
  326. gpio_free(CORGI_GPIO_nSD_DETECT);
  327. }
  328. static struct pxamci_platform_data corgi_mci_platform_data = {
  329. .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
  330. .init = corgi_mci_init,
  331. .get_ro = corgi_mci_get_ro,
  332. .setpower = corgi_mci_setpower,
  333. .exit = corgi_mci_exit,
  334. };
  335. /*
  336. * Irda
  337. */
  338. static void corgi_irda_transceiver_mode(struct device *dev, int mode)
  339. {
  340. gpio_set_value(CORGI_GPIO_IR_ON, mode & IR_OFF);
  341. pxa2xx_transceiver_mode(dev, mode);
  342. }
  343. static int corgi_irda_startup(struct device *dev)
  344. {
  345. int err;
  346. err = gpio_request(CORGI_GPIO_IR_ON, "IR_ON");
  347. if (err)
  348. return err;
  349. gpio_direction_output(CORGI_GPIO_IR_ON, 1);
  350. return 0;
  351. }
  352. static void corgi_irda_shutdown(struct device *dev)
  353. {
  354. gpio_free(CORGI_GPIO_IR_ON);
  355. }
  356. static struct pxaficp_platform_data corgi_ficp_platform_data = {
  357. .transceiver_cap = IR_SIRMODE | IR_OFF,
  358. .transceiver_mode = corgi_irda_transceiver_mode,
  359. .startup = corgi_irda_startup,
  360. .shutdown = corgi_irda_shutdown,
  361. };
  362. /*
  363. * USB Device Controller
  364. */
  365. static struct pxa2xx_udc_mach_info udc_info __initdata = {
  366. /* no connect GPIO; corgi can't tell connection status */
  367. .gpio_pullup = CORGI_GPIO_USB_PULLUP,
  368. };
  369. #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MASTER)
  370. static struct pxa2xx_spi_master corgi_spi_info = {
  371. .num_chipselect = 3,
  372. };
  373. static struct ads7846_platform_data corgi_ads7846_info = {
  374. .model = 7846,
  375. .vref_delay_usecs = 100,
  376. .x_plate_ohms = 419,
  377. .y_plate_ohms = 486,
  378. .gpio_pendown = CORGI_GPIO_TP_INT,
  379. };
  380. static void corgi_ads7846_cs(u32 command)
  381. {
  382. gpio_set_value(CORGI_GPIO_ADS7846_CS, !(command == PXA2XX_CS_ASSERT));
  383. }
  384. static struct pxa2xx_spi_chip corgi_ads7846_chip = {
  385. .cs_control = corgi_ads7846_cs,
  386. };
  387. static void corgi_bl_kick_battery(void)
  388. {
  389. void (*kick_batt)(void);
  390. kick_batt = symbol_get(sharpsl_battery_kick);
  391. if (kick_batt) {
  392. kick_batt();
  393. symbol_put(sharpsl_battery_kick);
  394. }
  395. }
  396. static struct corgi_lcd_platform_data corgi_lcdcon_info = {
  397. .init_mode = CORGI_LCD_MODE_VGA,
  398. .max_intensity = 0x2f,
  399. .default_intensity = 0x1f,
  400. .limit_mask = 0x0b,
  401. .gpio_backlight_cont = CORGI_GPIO_BACKLIGHT_CONT,
  402. .gpio_backlight_on = -1,
  403. .kick_battery = corgi_bl_kick_battery,
  404. };
  405. static void corgi_lcdcon_cs(u32 command)
  406. {
  407. gpio_set_value(CORGI_GPIO_LCDCON_CS, !(command == PXA2XX_CS_ASSERT));
  408. }
  409. static struct pxa2xx_spi_chip corgi_lcdcon_chip = {
  410. .cs_control = corgi_lcdcon_cs,
  411. };
  412. static void corgi_max1111_cs(u32 command)
  413. {
  414. gpio_set_value(CORGI_GPIO_MAX1111_CS, !(command == PXA2XX_CS_ASSERT));
  415. }
  416. static struct pxa2xx_spi_chip corgi_max1111_chip = {
  417. .cs_control = corgi_max1111_cs,
  418. };
  419. static struct spi_board_info corgi_spi_devices[] = {
  420. {
  421. .modalias = "ads7846",
  422. .max_speed_hz = 1200000,
  423. .bus_num = 1,
  424. .chip_select = 0,
  425. .platform_data = &corgi_ads7846_info,
  426. .controller_data= &corgi_ads7846_chip,
  427. .irq = gpio_to_irq(CORGI_GPIO_TP_INT),
  428. }, {
  429. .modalias = "corgi-lcd",
  430. .max_speed_hz = 50000,
  431. .bus_num = 1,
  432. .chip_select = 1,
  433. .platform_data = &corgi_lcdcon_info,
  434. .controller_data= &corgi_lcdcon_chip,
  435. }, {
  436. .modalias = "max1111",
  437. .max_speed_hz = 450000,
  438. .bus_num = 1,
  439. .chip_select = 2,
  440. .controller_data= &corgi_max1111_chip,
  441. },
  442. };
  443. static void __init corgi_init_spi(void)
  444. {
  445. int err;
  446. err = gpio_request(CORGI_GPIO_ADS7846_CS, "ADS7846_CS");
  447. if (err)
  448. return;
  449. err = gpio_request(CORGI_GPIO_LCDCON_CS, "LCDCON_CS");
  450. if (err)
  451. goto err_free_1;
  452. err = gpio_request(CORGI_GPIO_MAX1111_CS, "MAX1111_CS");
  453. if (err)
  454. goto err_free_2;
  455. gpio_direction_output(CORGI_GPIO_ADS7846_CS, 1);
  456. gpio_direction_output(CORGI_GPIO_LCDCON_CS, 1);
  457. gpio_direction_output(CORGI_GPIO_MAX1111_CS, 1);
  458. pxa2xx_set_spi_info(1, &corgi_spi_info);
  459. spi_register_board_info(ARRAY_AND_SIZE(corgi_spi_devices));
  460. return;
  461. err_free_2:
  462. gpio_free(CORGI_GPIO_LCDCON_CS);
  463. err_free_1:
  464. gpio_free(CORGI_GPIO_ADS7846_CS);
  465. }
  466. #else
  467. static inline void corgi_init_spi(void) {}
  468. #endif
  469. static struct mtd_partition sharpsl_nand_partitions[] = {
  470. {
  471. .name = "System Area",
  472. .offset = 0,
  473. .size = 7 * 1024 * 1024,
  474. },
  475. {
  476. .name = "Root Filesystem",
  477. .offset = 7 * 1024 * 1024,
  478. .size = 25 * 1024 * 1024,
  479. },
  480. {
  481. .name = "Home Filesystem",
  482. .offset = MTDPART_OFS_APPEND,
  483. .size = MTDPART_SIZ_FULL,
  484. },
  485. };
  486. static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
  487. static struct nand_bbt_descr sharpsl_bbt = {
  488. .options = 0,
  489. .offs = 4,
  490. .len = 2,
  491. .pattern = scan_ff_pattern
  492. };
  493. static struct sharpsl_nand_platform_data sharpsl_nand_platform_data = {
  494. .badblock_pattern = &sharpsl_bbt,
  495. .partitions = sharpsl_nand_partitions,
  496. .nr_partitions = ARRAY_SIZE(sharpsl_nand_partitions),
  497. };
  498. static struct resource sharpsl_nand_resources[] = {
  499. {
  500. .start = 0x0C000000,
  501. .end = 0x0C000FFF,
  502. .flags = IORESOURCE_MEM,
  503. },
  504. };
  505. static struct platform_device sharpsl_nand_device = {
  506. .name = "sharpsl-nand",
  507. .id = -1,
  508. .resource = sharpsl_nand_resources,
  509. .num_resources = ARRAY_SIZE(sharpsl_nand_resources),
  510. .dev.platform_data = &sharpsl_nand_platform_data,
  511. };
  512. static struct mtd_partition sharpsl_rom_parts[] = {
  513. {
  514. .name ="Boot PROM Filesystem",
  515. .offset = 0x00120000,
  516. .size = MTDPART_SIZ_FULL,
  517. },
  518. };
  519. static struct physmap_flash_data sharpsl_rom_data = {
  520. .width = 2,
  521. .nr_parts = ARRAY_SIZE(sharpsl_rom_parts),
  522. .parts = sharpsl_rom_parts,
  523. };
  524. static struct resource sharpsl_rom_resources[] = {
  525. {
  526. .start = 0x00000000,
  527. .end = 0x007fffff,
  528. .flags = IORESOURCE_MEM,
  529. },
  530. };
  531. static struct platform_device sharpsl_rom_device = {
  532. .name = "physmap-flash",
  533. .id = -1,
  534. .resource = sharpsl_rom_resources,
  535. .num_resources = ARRAY_SIZE(sharpsl_rom_resources),
  536. .dev.platform_data = &sharpsl_rom_data,
  537. };
  538. static struct platform_device *devices[] __initdata = {
  539. &corgiscoop_device,
  540. &corgifb_device,
  541. &corgikbd_device,
  542. &corgiled_device,
  543. &sharpsl_nand_device,
  544. &sharpsl_rom_device,
  545. };
  546. static void corgi_poweroff(void)
  547. {
  548. if (!machine_is_corgi())
  549. /* Green LED off tells the bootloader to halt */
  550. gpio_set_value(CORGI_GPIO_LED_GREEN, 0);
  551. arm_machine_restart('h');
  552. }
  553. static void corgi_restart(char mode)
  554. {
  555. if (!machine_is_corgi())
  556. /* Green LED on tells the bootloader to reboot */
  557. gpio_set_value(CORGI_GPIO_LED_GREEN, 1);
  558. arm_machine_restart('h');
  559. }
  560. static void __init corgi_init(void)
  561. {
  562. pm_power_off = corgi_poweroff;
  563. arm_pm_restart = corgi_restart;
  564. /* Stop 3.6MHz and drive HIGH to PCMCIA and CS */
  565. PCFR |= PCFR_OPDE;
  566. pxa2xx_mfp_config(ARRAY_AND_SIZE(corgi_pin_config));
  567. corgi_init_spi();
  568. pxa_set_udc_info(&udc_info);
  569. pxa_set_mci_info(&corgi_mci_platform_data);
  570. pxa_set_ficp_info(&corgi_ficp_platform_data);
  571. pxa_set_i2c_info(NULL);
  572. platform_scoop_config = &corgi_pcmcia_config;
  573. if (machine_is_husky())
  574. sharpsl_nand_partitions[1].size = 53 * 1024 * 1024;
  575. platform_add_devices(devices, ARRAY_SIZE(devices));
  576. }
  577. static void __init fixup_corgi(struct machine_desc *desc,
  578. struct tag *tags, char **cmdline, struct meminfo *mi)
  579. {
  580. sharpsl_save_param();
  581. mi->nr_banks=1;
  582. mi->bank[0].start = 0xa0000000;
  583. mi->bank[0].node = 0;
  584. if (machine_is_corgi())
  585. mi->bank[0].size = (32*1024*1024);
  586. else
  587. mi->bank[0].size = (64*1024*1024);
  588. }
  589. #ifdef CONFIG_MACH_CORGI
  590. MACHINE_START(CORGI, "SHARP Corgi")
  591. .phys_io = 0x40000000,
  592. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  593. .fixup = fixup_corgi,
  594. .map_io = pxa_map_io,
  595. .init_irq = pxa25x_init_irq,
  596. .init_machine = corgi_init,
  597. .timer = &pxa_timer,
  598. MACHINE_END
  599. #endif
  600. #ifdef CONFIG_MACH_SHEPHERD
  601. MACHINE_START(SHEPHERD, "SHARP Shepherd")
  602. .phys_io = 0x40000000,
  603. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  604. .fixup = fixup_corgi,
  605. .map_io = pxa_map_io,
  606. .init_irq = pxa25x_init_irq,
  607. .init_machine = corgi_init,
  608. .timer = &pxa_timer,
  609. MACHINE_END
  610. #endif
  611. #ifdef CONFIG_MACH_HUSKY
  612. MACHINE_START(HUSKY, "SHARP Husky")
  613. .phys_io = 0x40000000,
  614. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  615. .fixup = fixup_corgi,
  616. .map_io = pxa_map_io,
  617. .init_irq = pxa25x_init_irq,
  618. .init_machine = corgi_init,
  619. .timer = &pxa_timer,
  620. MACHINE_END
  621. #endif