eseries.c 25 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Hardware definitions for the Toshiba eseries PDAs
  4. *
  5. * Copyright (c) 2003 Ian Molton <[email protected]>
  6. */
  7. #include <linux/clkdev.h>
  8. #include <linux/kernel.h>
  9. #include <linux/init.h>
  10. #include <linux/clk-provider.h>
  11. #include <linux/gpio/machine.h>
  12. #include <linux/gpio.h>
  13. #include <linux/delay.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/mfd/tc6387xb.h>
  16. #include <linux/mfd/tc6393xb.h>
  17. #include <linux/mfd/t7l66xb.h>
  18. #include <linux/mtd/rawnand.h>
  19. #include <linux/mtd/partitions.h>
  20. #include <linux/memblock.h>
  21. #include <linux/gpio/machine.h>
  22. #include <video/w100fb.h>
  23. #include <asm/setup.h>
  24. #include <asm/mach/arch.h>
  25. #include <asm/mach-types.h>
  26. #include "pxa25x.h"
  27. #include "eseries-gpio.h"
  28. #include "eseries-irq.h"
  29. #include <linux/platform_data/asoc-pxa.h>
  30. #include <linux/platform_data/video-pxafb.h>
  31. #include "udc.h"
  32. #include <linux/platform_data/irda-pxaficp.h>
  33. #include "devices.h"
  34. #include "generic.h"
  35. /* Only e800 has 128MB RAM */
  36. void __init eseries_fixup(struct tag *tags, char **cmdline)
  37. {
  38. if (machine_is_e800())
  39. memblock_add(0xa0000000, SZ_128M);
  40. else
  41. memblock_add(0xa0000000, SZ_64M);
  42. }
  43. static struct gpiod_lookup_table e7xx_gpio_vbus_gpiod_table __maybe_unused = {
  44. .dev_id = "gpio-vbus",
  45. .table = {
  46. GPIO_LOOKUP("gpio-pxa", GPIO_E7XX_USB_DISC,
  47. "vbus", GPIO_ACTIVE_HIGH),
  48. GPIO_LOOKUP("gpio-pxa", GPIO_E7XX_USB_PULLUP,
  49. "pullup", GPIO_ACTIVE_LOW),
  50. { },
  51. },
  52. };
  53. static struct platform_device e7xx_gpio_vbus __maybe_unused = {
  54. .name = "gpio-vbus",
  55. .id = -1,
  56. };
  57. struct pxaficp_platform_data e7xx_ficp_platform_data = {
  58. .gpio_pwdown = GPIO_E7XX_IR_OFF,
  59. .transceiver_cap = IR_SIRMODE | IR_OFF,
  60. };
  61. int eseries_tmio_enable(struct platform_device *dev)
  62. {
  63. /* Reset - bring SUSPEND high before PCLR */
  64. gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
  65. gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 0);
  66. msleep(1);
  67. gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 1);
  68. msleep(1);
  69. gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 1);
  70. msleep(1);
  71. return 0;
  72. }
  73. void eseries_tmio_disable(struct platform_device *dev)
  74. {
  75. gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
  76. gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 0);
  77. }
  78. int eseries_tmio_suspend(struct platform_device *dev)
  79. {
  80. gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
  81. return 0;
  82. }
  83. int eseries_tmio_resume(struct platform_device *dev)
  84. {
  85. gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 1);
  86. msleep(1);
  87. return 0;
  88. }
  89. void eseries_get_tmio_gpios(void)
  90. {
  91. gpio_request(GPIO_ESERIES_TMIO_SUSPEND, NULL);
  92. gpio_request(GPIO_ESERIES_TMIO_PCLR, NULL);
  93. gpio_direction_output(GPIO_ESERIES_TMIO_SUSPEND, 0);
  94. gpio_direction_output(GPIO_ESERIES_TMIO_PCLR, 0);
  95. }
  96. /* TMIO controller uses the same resources on all e-series machines. */
  97. struct resource eseries_tmio_resources[] = {
  98. [0] = {
  99. .start = PXA_CS4_PHYS,
  100. .end = PXA_CS4_PHYS + 0x1fffff,
  101. .flags = IORESOURCE_MEM,
  102. },
  103. [1] = {
  104. .start = PXA_GPIO_TO_IRQ(GPIO_ESERIES_TMIO_IRQ),
  105. .end = PXA_GPIO_TO_IRQ(GPIO_ESERIES_TMIO_IRQ),
  106. .flags = IORESOURCE_IRQ,
  107. },
  108. };
  109. /* Some e-series hardware cannot control the 32K clock */
  110. static void __init __maybe_unused eseries_register_clks(void)
  111. {
  112. clk_register_fixed_rate(NULL, "CLK_CK32K", NULL, 0, 32768);
  113. }
  114. #ifdef CONFIG_MACH_E330
  115. /* -------------------- e330 tc6387xb parameters -------------------- */
  116. static struct tc6387xb_platform_data e330_tc6387xb_info = {
  117. .enable = &eseries_tmio_enable,
  118. .suspend = &eseries_tmio_suspend,
  119. .resume = &eseries_tmio_resume,
  120. };
  121. static struct platform_device e330_tc6387xb_device = {
  122. .name = "tc6387xb",
  123. .id = -1,
  124. .dev = {
  125. .platform_data = &e330_tc6387xb_info,
  126. },
  127. .num_resources = 2,
  128. .resource = eseries_tmio_resources,
  129. };
  130. /* --------------------------------------------------------------- */
  131. static struct platform_device *e330_devices[] __initdata = {
  132. &e330_tc6387xb_device,
  133. &e7xx_gpio_vbus,
  134. };
  135. static void __init e330_init(void)
  136. {
  137. pxa_set_ffuart_info(NULL);
  138. pxa_set_btuart_info(NULL);
  139. pxa_set_stuart_info(NULL);
  140. eseries_register_clks();
  141. eseries_get_tmio_gpios();
  142. gpiod_add_lookup_table(&e7xx_gpio_vbus_gpiod_table);
  143. platform_add_devices(ARRAY_AND_SIZE(e330_devices));
  144. }
  145. MACHINE_START(E330, "Toshiba e330")
  146. /* Maintainer: Ian Molton ([email protected]) */
  147. .atag_offset = 0x100,
  148. .map_io = pxa25x_map_io,
  149. .nr_irqs = ESERIES_NR_IRQS,
  150. .init_irq = pxa25x_init_irq,
  151. .handle_irq = pxa25x_handle_irq,
  152. .fixup = eseries_fixup,
  153. .init_machine = e330_init,
  154. .init_time = pxa_timer_init,
  155. .restart = pxa_restart,
  156. MACHINE_END
  157. #endif
  158. #ifdef CONFIG_MACH_E350
  159. /* -------------------- e350 t7l66xb parameters -------------------- */
  160. static struct t7l66xb_platform_data e350_t7l66xb_info = {
  161. .irq_base = IRQ_BOARD_START,
  162. .enable = &eseries_tmio_enable,
  163. .suspend = &eseries_tmio_suspend,
  164. .resume = &eseries_tmio_resume,
  165. };
  166. static struct platform_device e350_t7l66xb_device = {
  167. .name = "t7l66xb",
  168. .id = -1,
  169. .dev = {
  170. .platform_data = &e350_t7l66xb_info,
  171. },
  172. .num_resources = 2,
  173. .resource = eseries_tmio_resources,
  174. };
  175. /* ---------------------------------------------------------- */
  176. static struct platform_device *e350_devices[] __initdata = {
  177. &e350_t7l66xb_device,
  178. &e7xx_gpio_vbus,
  179. };
  180. static void __init e350_init(void)
  181. {
  182. pxa_set_ffuart_info(NULL);
  183. pxa_set_btuart_info(NULL);
  184. pxa_set_stuart_info(NULL);
  185. eseries_register_clks();
  186. eseries_get_tmio_gpios();
  187. gpiod_add_lookup_table(&e7xx_gpio_vbus_gpiod_table);
  188. platform_add_devices(ARRAY_AND_SIZE(e350_devices));
  189. }
  190. MACHINE_START(E350, "Toshiba e350")
  191. /* Maintainer: Ian Molton ([email protected]) */
  192. .atag_offset = 0x100,
  193. .map_io = pxa25x_map_io,
  194. .nr_irqs = ESERIES_NR_IRQS,
  195. .init_irq = pxa25x_init_irq,
  196. .handle_irq = pxa25x_handle_irq,
  197. .fixup = eseries_fixup,
  198. .init_machine = e350_init,
  199. .init_time = pxa_timer_init,
  200. .restart = pxa_restart,
  201. MACHINE_END
  202. #endif
  203. #ifdef CONFIG_MACH_E400
  204. /* ------------------------ E400 LCD definitions ------------------------ */
  205. static struct pxafb_mode_info e400_pxafb_mode_info = {
  206. .pixclock = 140703,
  207. .xres = 240,
  208. .yres = 320,
  209. .bpp = 16,
  210. .hsync_len = 4,
  211. .left_margin = 28,
  212. .right_margin = 8,
  213. .vsync_len = 3,
  214. .upper_margin = 5,
  215. .lower_margin = 6,
  216. .sync = 0,
  217. };
  218. static struct pxafb_mach_info e400_pxafb_mach_info = {
  219. .modes = &e400_pxafb_mode_info,
  220. .num_modes = 1,
  221. .lcd_conn = LCD_COLOR_TFT_16BPP,
  222. .lccr3 = 0,
  223. .pxafb_backlight_power = NULL,
  224. };
  225. /* ------------------------ E400 MFP config ----------------------------- */
  226. static unsigned long e400_pin_config[] __initdata = {
  227. /* Chip selects */
  228. GPIO15_nCS_1, /* CS1 - Flash */
  229. GPIO80_nCS_4, /* CS4 - TMIO */
  230. /* Clocks */
  231. GPIO12_32KHz,
  232. /* BTUART */
  233. GPIO42_BTUART_RXD,
  234. GPIO43_BTUART_TXD,
  235. GPIO44_BTUART_CTS,
  236. /* TMIO controller */
  237. GPIO19_GPIO, /* t7l66xb #PCLR */
  238. GPIO45_GPIO, /* t7l66xb #SUSPEND (NOT BTUART!) */
  239. /* wakeup */
  240. GPIO0_GPIO | WAKEUP_ON_EDGE_RISE,
  241. };
  242. /* ---------------------------------------------------------------------- */
  243. static struct mtd_partition partition_a = {
  244. .name = "Internal NAND flash",
  245. .offset = 0,
  246. .size = MTDPART_SIZ_FULL,
  247. };
  248. static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
  249. static struct nand_bbt_descr e400_t7l66xb_nand_bbt = {
  250. .options = 0,
  251. .offs = 4,
  252. .len = 2,
  253. .pattern = scan_ff_pattern
  254. };
  255. static struct tmio_nand_data e400_t7l66xb_nand_config = {
  256. .num_partitions = 1,
  257. .partition = &partition_a,
  258. .badblock_pattern = &e400_t7l66xb_nand_bbt,
  259. };
  260. static struct t7l66xb_platform_data e400_t7l66xb_info = {
  261. .irq_base = IRQ_BOARD_START,
  262. .enable = &eseries_tmio_enable,
  263. .suspend = &eseries_tmio_suspend,
  264. .resume = &eseries_tmio_resume,
  265. .nand_data = &e400_t7l66xb_nand_config,
  266. };
  267. static struct platform_device e400_t7l66xb_device = {
  268. .name = "t7l66xb",
  269. .id = -1,
  270. .dev = {
  271. .platform_data = &e400_t7l66xb_info,
  272. },
  273. .num_resources = 2,
  274. .resource = eseries_tmio_resources,
  275. };
  276. /* ---------------------------------------------------------- */
  277. static struct platform_device *e400_devices[] __initdata = {
  278. &e400_t7l66xb_device,
  279. &e7xx_gpio_vbus,
  280. };
  281. static void __init e400_init(void)
  282. {
  283. pxa2xx_mfp_config(ARRAY_AND_SIZE(e400_pin_config));
  284. pxa_set_ffuart_info(NULL);
  285. pxa_set_btuart_info(NULL);
  286. pxa_set_stuart_info(NULL);
  287. /* Fixme - e400 may have a switched clock */
  288. eseries_register_clks();
  289. eseries_get_tmio_gpios();
  290. pxa_set_fb_info(NULL, &e400_pxafb_mach_info);
  291. gpiod_add_lookup_table(&e7xx_gpio_vbus_gpiod_table);
  292. platform_add_devices(ARRAY_AND_SIZE(e400_devices));
  293. }
  294. MACHINE_START(E400, "Toshiba e400")
  295. /* Maintainer: Ian Molton ([email protected]) */
  296. .atag_offset = 0x100,
  297. .map_io = pxa25x_map_io,
  298. .nr_irqs = ESERIES_NR_IRQS,
  299. .init_irq = pxa25x_init_irq,
  300. .handle_irq = pxa25x_handle_irq,
  301. .fixup = eseries_fixup,
  302. .init_machine = e400_init,
  303. .init_time = pxa_timer_init,
  304. .restart = pxa_restart,
  305. MACHINE_END
  306. #endif
  307. #ifdef CONFIG_MACH_E740
  308. /* ------------------------ e740 video support --------------------------- */
  309. static struct w100_gen_regs e740_lcd_regs = {
  310. .lcd_format = 0x00008023,
  311. .lcdd_cntl1 = 0x0f000000,
  312. .lcdd_cntl2 = 0x0003ffff,
  313. .genlcd_cntl1 = 0x00ffff03,
  314. .genlcd_cntl2 = 0x003c0f03,
  315. .genlcd_cntl3 = 0x000143aa,
  316. };
  317. static struct w100_mode e740_lcd_mode = {
  318. .xres = 240,
  319. .yres = 320,
  320. .left_margin = 20,
  321. .right_margin = 28,
  322. .upper_margin = 9,
  323. .lower_margin = 8,
  324. .crtc_ss = 0x80140013,
  325. .crtc_ls = 0x81150110,
  326. .crtc_gs = 0x80050005,
  327. .crtc_vpos_gs = 0x000a0009,
  328. .crtc_rev = 0x0040010a,
  329. .crtc_dclk = 0xa906000a,
  330. .crtc_gclk = 0x80050108,
  331. .crtc_goe = 0x80050108,
  332. .pll_freq = 57,
  333. .pixclk_divider = 4,
  334. .pixclk_divider_rotated = 4,
  335. .pixclk_src = CLK_SRC_XTAL,
  336. .sysclk_divider = 1,
  337. .sysclk_src = CLK_SRC_PLL,
  338. .crtc_ps1_active = 0x41060010,
  339. };
  340. static struct w100_gpio_regs e740_w100_gpio_info = {
  341. .init_data1 = 0x21002103,
  342. .gpio_dir1 = 0xffffdeff,
  343. .gpio_oe1 = 0x03c00643,
  344. .init_data2 = 0x003f003f,
  345. .gpio_dir2 = 0xffffffff,
  346. .gpio_oe2 = 0x000000ff,
  347. };
  348. static struct w100fb_mach_info e740_fb_info = {
  349. .modelist = &e740_lcd_mode,
  350. .num_modes = 1,
  351. .regs = &e740_lcd_regs,
  352. .gpio = &e740_w100_gpio_info,
  353. .xtal_freq = 14318000,
  354. .xtal_dbl = 1,
  355. };
  356. static struct resource e740_fb_resources[] = {
  357. [0] = {
  358. .start = 0x0c000000,
  359. .end = 0x0cffffff,
  360. .flags = IORESOURCE_MEM,
  361. },
  362. };
  363. static struct platform_device e740_fb_device = {
  364. .name = "w100fb",
  365. .id = -1,
  366. .dev = {
  367. .platform_data = &e740_fb_info,
  368. },
  369. .num_resources = ARRAY_SIZE(e740_fb_resources),
  370. .resource = e740_fb_resources,
  371. };
  372. /* --------------------------- MFP Pin config -------------------------- */
  373. static unsigned long e740_pin_config[] __initdata = {
  374. /* Chip selects */
  375. GPIO15_nCS_1, /* CS1 - Flash */
  376. GPIO79_nCS_3, /* CS3 - IMAGEON */
  377. GPIO80_nCS_4, /* CS4 - TMIO */
  378. /* Clocks */
  379. GPIO12_32KHz,
  380. /* BTUART */
  381. GPIO42_BTUART_RXD,
  382. GPIO43_BTUART_TXD,
  383. GPIO44_BTUART_CTS,
  384. /* TMIO controller */
  385. GPIO19_GPIO, /* t7l66xb #PCLR */
  386. GPIO45_GPIO, /* t7l66xb #SUSPEND (NOT BTUART!) */
  387. /* UDC */
  388. GPIO13_GPIO,
  389. GPIO3_GPIO,
  390. /* IrDA */
  391. GPIO38_GPIO | MFP_LPM_DRIVE_HIGH,
  392. /* AC97 */
  393. GPIO28_AC97_BITCLK,
  394. GPIO29_AC97_SDATA_IN_0,
  395. GPIO30_AC97_SDATA_OUT,
  396. GPIO31_AC97_SYNC,
  397. /* Audio power control */
  398. GPIO16_GPIO, /* AC97 codec AVDD2 supply (analogue power) */
  399. GPIO40_GPIO, /* Mic amp power */
  400. GPIO41_GPIO, /* Headphone amp power */
  401. /* PC Card */
  402. GPIO8_GPIO, /* CD0 */
  403. GPIO44_GPIO, /* CD1 */
  404. GPIO11_GPIO, /* IRQ0 */
  405. GPIO6_GPIO, /* IRQ1 */
  406. GPIO27_GPIO, /* RST0 */
  407. GPIO24_GPIO, /* RST1 */
  408. GPIO20_GPIO, /* PWR0 */
  409. GPIO23_GPIO, /* PWR1 */
  410. GPIO48_nPOE,
  411. GPIO49_nPWE,
  412. GPIO50_nPIOR,
  413. GPIO51_nPIOW,
  414. GPIO52_nPCE_1,
  415. GPIO53_nPCE_2,
  416. GPIO54_nPSKTSEL,
  417. GPIO55_nPREG,
  418. GPIO56_nPWAIT,
  419. GPIO57_nIOIS16,
  420. /* wakeup */
  421. GPIO0_GPIO | WAKEUP_ON_EDGE_RISE,
  422. };
  423. /* -------------------- e740 t7l66xb parameters -------------------- */
  424. static struct t7l66xb_platform_data e740_t7l66xb_info = {
  425. .irq_base = IRQ_BOARD_START,
  426. .enable = &eseries_tmio_enable,
  427. .suspend = &eseries_tmio_suspend,
  428. .resume = &eseries_tmio_resume,
  429. };
  430. static struct platform_device e740_t7l66xb_device = {
  431. .name = "t7l66xb",
  432. .id = -1,
  433. .dev = {
  434. .platform_data = &e740_t7l66xb_info,
  435. },
  436. .num_resources = 2,
  437. .resource = eseries_tmio_resources,
  438. };
  439. static struct platform_device e740_audio_device = {
  440. .name = "e740-audio",
  441. .id = -1,
  442. };
  443. static struct gpiod_lookup_table e740_audio_gpio_table = {
  444. .dev_id = "e740-audio",
  445. .table = {
  446. GPIO_LOOKUP("gpio-pxa", GPIO_E740_WM9705_nAVDD2, "Audio power", GPIO_ACTIVE_HIGH),
  447. GPIO_LOOKUP("gpio-pxa", GPIO_E740_AMP_ON, "Output amp", GPIO_ACTIVE_HIGH),
  448. GPIO_LOOKUP("gpio-pxa", GPIO_E740_MIC_ON, "Mic amp", GPIO_ACTIVE_HIGH),
  449. { },
  450. },
  451. };
  452. /* ----------------------------------------------------------------------- */
  453. static struct platform_device *e740_devices[] __initdata = {
  454. &e740_fb_device,
  455. &e740_t7l66xb_device,
  456. &e7xx_gpio_vbus,
  457. &e740_audio_device,
  458. };
  459. static void __init e740_init(void)
  460. {
  461. pxa2xx_mfp_config(ARRAY_AND_SIZE(e740_pin_config));
  462. pxa_set_ffuart_info(NULL);
  463. pxa_set_btuart_info(NULL);
  464. pxa_set_stuart_info(NULL);
  465. eseries_register_clks();
  466. clk_add_alias("CLK_CK48M", e740_t7l66xb_device.name,
  467. "UDCCLK", &pxa25x_device_udc.dev),
  468. eseries_get_tmio_gpios();
  469. gpiod_add_lookup_table(&e7xx_gpio_vbus_gpiod_table);
  470. gpiod_add_lookup_table(&e740_audio_gpio_table);
  471. platform_add_devices(ARRAY_AND_SIZE(e740_devices));
  472. pxa_set_ac97_info(NULL);
  473. pxa_set_ficp_info(&e7xx_ficp_platform_data);
  474. }
  475. MACHINE_START(E740, "Toshiba e740")
  476. /* Maintainer: Ian Molton ([email protected]) */
  477. .atag_offset = 0x100,
  478. .map_io = pxa25x_map_io,
  479. .nr_irqs = ESERIES_NR_IRQS,
  480. .init_irq = pxa25x_init_irq,
  481. .handle_irq = pxa25x_handle_irq,
  482. .fixup = eseries_fixup,
  483. .init_machine = e740_init,
  484. .init_time = pxa_timer_init,
  485. .restart = pxa_restart,
  486. MACHINE_END
  487. #endif
  488. #ifdef CONFIG_MACH_E750
  489. /* ---------------------- E750 LCD definitions -------------------- */
  490. static struct w100_gen_regs e750_lcd_regs = {
  491. .lcd_format = 0x00008003,
  492. .lcdd_cntl1 = 0x00000000,
  493. .lcdd_cntl2 = 0x0003ffff,
  494. .genlcd_cntl1 = 0x00fff003,
  495. .genlcd_cntl2 = 0x003c0f03,
  496. .genlcd_cntl3 = 0x000143aa,
  497. };
  498. static struct w100_mode e750_lcd_mode = {
  499. .xres = 240,
  500. .yres = 320,
  501. .left_margin = 21,
  502. .right_margin = 22,
  503. .upper_margin = 5,
  504. .lower_margin = 4,
  505. .crtc_ss = 0x80150014,
  506. .crtc_ls = 0x8014000d,
  507. .crtc_gs = 0xc1000005,
  508. .crtc_vpos_gs = 0x00020147,
  509. .crtc_rev = 0x0040010a,
  510. .crtc_dclk = 0xa1700030,
  511. .crtc_gclk = 0x80cc0015,
  512. .crtc_goe = 0x80cc0015,
  513. .crtc_ps1_active = 0x61060017,
  514. .pll_freq = 57,
  515. .pixclk_divider = 4,
  516. .pixclk_divider_rotated = 4,
  517. .pixclk_src = CLK_SRC_XTAL,
  518. .sysclk_divider = 1,
  519. .sysclk_src = CLK_SRC_PLL,
  520. };
  521. static struct w100_gpio_regs e750_w100_gpio_info = {
  522. .init_data1 = 0x01192f1b,
  523. .gpio_dir1 = 0xd5ffdeff,
  524. .gpio_oe1 = 0x000020bf,
  525. .init_data2 = 0x010f010f,
  526. .gpio_dir2 = 0xffffffff,
  527. .gpio_oe2 = 0x000001cf,
  528. };
  529. static struct w100fb_mach_info e750_fb_info = {
  530. .modelist = &e750_lcd_mode,
  531. .num_modes = 1,
  532. .regs = &e750_lcd_regs,
  533. .gpio = &e750_w100_gpio_info,
  534. .xtal_freq = 14318000,
  535. .xtal_dbl = 1,
  536. };
  537. static struct resource e750_fb_resources[] = {
  538. [0] = {
  539. .start = 0x0c000000,
  540. .end = 0x0cffffff,
  541. .flags = IORESOURCE_MEM,
  542. },
  543. };
  544. static struct platform_device e750_fb_device = {
  545. .name = "w100fb",
  546. .id = -1,
  547. .dev = {
  548. .platform_data = &e750_fb_info,
  549. },
  550. .num_resources = ARRAY_SIZE(e750_fb_resources),
  551. .resource = e750_fb_resources,
  552. };
  553. /* -------------------- e750 MFP parameters -------------------- */
  554. static unsigned long e750_pin_config[] __initdata = {
  555. /* Chip selects */
  556. GPIO15_nCS_1, /* CS1 - Flash */
  557. GPIO79_nCS_3, /* CS3 - IMAGEON */
  558. GPIO80_nCS_4, /* CS4 - TMIO */
  559. /* Clocks */
  560. GPIO11_3_6MHz,
  561. /* BTUART */
  562. GPIO42_BTUART_RXD,
  563. GPIO43_BTUART_TXD,
  564. GPIO44_BTUART_CTS,
  565. /* TMIO controller */
  566. GPIO19_GPIO, /* t7l66xb #PCLR */
  567. GPIO45_GPIO, /* t7l66xb #SUSPEND (NOT BTUART!) */
  568. /* UDC */
  569. GPIO13_GPIO,
  570. GPIO3_GPIO,
  571. /* IrDA */
  572. GPIO38_GPIO | MFP_LPM_DRIVE_HIGH,
  573. /* AC97 */
  574. GPIO28_AC97_BITCLK,
  575. GPIO29_AC97_SDATA_IN_0,
  576. GPIO30_AC97_SDATA_OUT,
  577. GPIO31_AC97_SYNC,
  578. /* Audio power control */
  579. GPIO4_GPIO, /* Headphone amp power */
  580. GPIO7_GPIO, /* Speaker amp power */
  581. GPIO37_GPIO, /* Headphone detect */
  582. /* PC Card */
  583. GPIO8_GPIO, /* CD0 */
  584. GPIO44_GPIO, /* CD1 */
  585. /* GPIO11_GPIO, IRQ0 */
  586. GPIO6_GPIO, /* IRQ1 */
  587. GPIO27_GPIO, /* RST0 */
  588. GPIO24_GPIO, /* RST1 */
  589. GPIO20_GPIO, /* PWR0 */
  590. GPIO23_GPIO, /* PWR1 */
  591. GPIO48_nPOE,
  592. GPIO49_nPWE,
  593. GPIO50_nPIOR,
  594. GPIO51_nPIOW,
  595. GPIO52_nPCE_1,
  596. GPIO53_nPCE_2,
  597. GPIO54_nPSKTSEL,
  598. GPIO55_nPREG,
  599. GPIO56_nPWAIT,
  600. GPIO57_nIOIS16,
  601. /* wakeup */
  602. GPIO0_GPIO | WAKEUP_ON_EDGE_RISE,
  603. };
  604. /* ----------------- e750 tc6393xb parameters ------------------ */
  605. static struct tc6393xb_platform_data e750_tc6393xb_info = {
  606. .irq_base = IRQ_BOARD_START,
  607. .scr_pll2cr = 0x0cc1,
  608. .scr_gper = 0,
  609. .suspend = &eseries_tmio_suspend,
  610. .resume = &eseries_tmio_resume,
  611. .enable = &eseries_tmio_enable,
  612. .disable = &eseries_tmio_disable,
  613. };
  614. static struct platform_device e750_tc6393xb_device = {
  615. .name = "tc6393xb",
  616. .id = -1,
  617. .dev = {
  618. .platform_data = &e750_tc6393xb_info,
  619. },
  620. .num_resources = 2,
  621. .resource = eseries_tmio_resources,
  622. };
  623. static struct gpiod_lookup_table e750_audio_gpio_table = {
  624. .dev_id = "e750-audio",
  625. .table = {
  626. GPIO_LOOKUP("gpio-pxa", GPIO_E750_HP_AMP_OFF, "Output amp", GPIO_ACTIVE_LOW),
  627. GPIO_LOOKUP("gpio-pxa", GPIO_E750_SPK_AMP_OFF, "Mic amp", GPIO_ACTIVE_LOW),
  628. { },
  629. },
  630. };
  631. static struct platform_device e750_audio_device = {
  632. .name = "e750-audio",
  633. .id = -1,
  634. };
  635. /* ------------------------------------------------------------- */
  636. static struct platform_device *e750_devices[] __initdata = {
  637. &e750_fb_device,
  638. &e750_tc6393xb_device,
  639. &e7xx_gpio_vbus,
  640. &e750_audio_device,
  641. };
  642. static void __init e750_init(void)
  643. {
  644. pxa2xx_mfp_config(ARRAY_AND_SIZE(e750_pin_config));
  645. pxa_set_ffuart_info(NULL);
  646. pxa_set_btuart_info(NULL);
  647. pxa_set_stuart_info(NULL);
  648. clk_add_alias("CLK_CK3P6MI", e750_tc6393xb_device.name,
  649. "GPIO11_CLK", NULL),
  650. eseries_get_tmio_gpios();
  651. gpiod_add_lookup_table(&e7xx_gpio_vbus_gpiod_table);
  652. gpiod_add_lookup_table(&e750_audio_gpio_table);
  653. platform_add_devices(ARRAY_AND_SIZE(e750_devices));
  654. pxa_set_ac97_info(NULL);
  655. pxa_set_ficp_info(&e7xx_ficp_platform_data);
  656. }
  657. MACHINE_START(E750, "Toshiba e750")
  658. /* Maintainer: Ian Molton ([email protected]) */
  659. .atag_offset = 0x100,
  660. .map_io = pxa25x_map_io,
  661. .nr_irqs = ESERIES_NR_IRQS,
  662. .init_irq = pxa25x_init_irq,
  663. .handle_irq = pxa25x_handle_irq,
  664. .fixup = eseries_fixup,
  665. .init_machine = e750_init,
  666. .init_time = pxa_timer_init,
  667. .restart = pxa_restart,
  668. MACHINE_END
  669. #endif
  670. #ifdef CONFIG_MACH_E800
  671. /* ------------------------ e800 LCD definitions ------------------------- */
  672. static unsigned long e800_pin_config[] __initdata = {
  673. /* AC97 */
  674. GPIO28_AC97_BITCLK,
  675. GPIO29_AC97_SDATA_IN_0,
  676. GPIO30_AC97_SDATA_OUT,
  677. GPIO31_AC97_SYNC,
  678. /* tc6393xb */
  679. GPIO11_3_6MHz,
  680. };
  681. static struct w100_gen_regs e800_lcd_regs = {
  682. .lcd_format = 0x00008003,
  683. .lcdd_cntl1 = 0x02a00000,
  684. .lcdd_cntl2 = 0x0003ffff,
  685. .genlcd_cntl1 = 0x000ff2a3,
  686. .genlcd_cntl2 = 0x000002a3,
  687. .genlcd_cntl3 = 0x000102aa,
  688. };
  689. static struct w100_mode e800_lcd_mode[2] = {
  690. [0] = {
  691. .xres = 480,
  692. .yres = 640,
  693. .left_margin = 52,
  694. .right_margin = 148,
  695. .upper_margin = 2,
  696. .lower_margin = 6,
  697. .crtc_ss = 0x80350034,
  698. .crtc_ls = 0x802b0026,
  699. .crtc_gs = 0x80160016,
  700. .crtc_vpos_gs = 0x00020003,
  701. .crtc_rev = 0x0040001d,
  702. .crtc_dclk = 0xe0000000,
  703. .crtc_gclk = 0x82a50049,
  704. .crtc_goe = 0x80ee001c,
  705. .crtc_ps1_active = 0x00000000,
  706. .pll_freq = 128,
  707. .pixclk_divider = 4,
  708. .pixclk_divider_rotated = 6,
  709. .pixclk_src = CLK_SRC_PLL,
  710. .sysclk_divider = 0,
  711. .sysclk_src = CLK_SRC_PLL,
  712. },
  713. [1] = {
  714. .xres = 240,
  715. .yres = 320,
  716. .left_margin = 15,
  717. .right_margin = 88,
  718. .upper_margin = 0,
  719. .lower_margin = 7,
  720. .crtc_ss = 0xd010000f,
  721. .crtc_ls = 0x80070003,
  722. .crtc_gs = 0x80000000,
  723. .crtc_vpos_gs = 0x01460147,
  724. .crtc_rev = 0x00400003,
  725. .crtc_dclk = 0xa1700030,
  726. .crtc_gclk = 0x814b0008,
  727. .crtc_goe = 0x80cc0015,
  728. .crtc_ps1_active = 0x00000000,
  729. .pll_freq = 100,
  730. .pixclk_divider = 6, /* Wince uses 14 which gives a */
  731. .pixclk_divider_rotated = 6, /* 7MHz Pclk. We use a 14MHz one */
  732. .pixclk_src = CLK_SRC_PLL,
  733. .sysclk_divider = 0,
  734. .sysclk_src = CLK_SRC_PLL,
  735. }
  736. };
  737. static struct w100_gpio_regs e800_w100_gpio_info = {
  738. .init_data1 = 0xc13fc019,
  739. .gpio_dir1 = 0x3e40df7f,
  740. .gpio_oe1 = 0x003c3000,
  741. .init_data2 = 0x00000000,
  742. .gpio_dir2 = 0x00000000,
  743. .gpio_oe2 = 0x00000000,
  744. };
  745. static struct w100_mem_info e800_w100_mem_info = {
  746. .ext_cntl = 0x09640011,
  747. .sdram_mode_reg = 0x00600021,
  748. .ext_timing_cntl = 0x10001545,
  749. .io_cntl = 0x7ddd7333,
  750. .size = 0x1fffff,
  751. };
  752. static void e800_tg_change(struct w100fb_par *par)
  753. {
  754. unsigned long tmp;
  755. tmp = w100fb_gpio_read(W100_GPIO_PORT_A);
  756. if (par->mode->xres == 480)
  757. tmp |= 0x100;
  758. else
  759. tmp &= ~0x100;
  760. w100fb_gpio_write(W100_GPIO_PORT_A, tmp);
  761. }
  762. static struct w100_tg_info e800_tg_info = {
  763. .change = e800_tg_change,
  764. };
  765. static struct w100fb_mach_info e800_fb_info = {
  766. .modelist = e800_lcd_mode,
  767. .num_modes = 2,
  768. .regs = &e800_lcd_regs,
  769. .gpio = &e800_w100_gpio_info,
  770. .mem = &e800_w100_mem_info,
  771. .tg = &e800_tg_info,
  772. .xtal_freq = 16000000,
  773. };
  774. static struct resource e800_fb_resources[] = {
  775. [0] = {
  776. .start = 0x0c000000,
  777. .end = 0x0cffffff,
  778. .flags = IORESOURCE_MEM,
  779. },
  780. };
  781. static struct platform_device e800_fb_device = {
  782. .name = "w100fb",
  783. .id = -1,
  784. .dev = {
  785. .platform_data = &e800_fb_info,
  786. },
  787. .num_resources = ARRAY_SIZE(e800_fb_resources),
  788. .resource = e800_fb_resources,
  789. };
  790. /* --------------------------- UDC definitions --------------------------- */
  791. static struct gpiod_lookup_table e800_gpio_vbus_gpiod_table = {
  792. .dev_id = "gpio-vbus",
  793. .table = {
  794. GPIO_LOOKUP("gpio-pxa", GPIO_E800_USB_DISC,
  795. "vbus", GPIO_ACTIVE_HIGH),
  796. GPIO_LOOKUP("gpio-pxa", GPIO_E800_USB_PULLUP,
  797. "pullup", GPIO_ACTIVE_LOW),
  798. { },
  799. },
  800. };
  801. static struct platform_device e800_gpio_vbus = {
  802. .name = "gpio-vbus",
  803. .id = -1,
  804. };
  805. /* ----------------- e800 tc6393xb parameters ------------------ */
  806. static struct tc6393xb_platform_data e800_tc6393xb_info = {
  807. .irq_base = IRQ_BOARD_START,
  808. .scr_pll2cr = 0x0cc1,
  809. .scr_gper = 0,
  810. .suspend = &eseries_tmio_suspend,
  811. .resume = &eseries_tmio_resume,
  812. .enable = &eseries_tmio_enable,
  813. .disable = &eseries_tmio_disable,
  814. };
  815. static struct platform_device e800_tc6393xb_device = {
  816. .name = "tc6393xb",
  817. .id = -1,
  818. .dev = {
  819. .platform_data = &e800_tc6393xb_info,
  820. },
  821. .num_resources = 2,
  822. .resource = eseries_tmio_resources,
  823. };
  824. static struct gpiod_lookup_table e800_audio_gpio_table = {
  825. .dev_id = "e800-audio",
  826. .table = {
  827. GPIO_LOOKUP("gpio-pxa", GPIO_E800_HP_AMP_OFF, "Output amp", GPIO_ACTIVE_LOW),
  828. GPIO_LOOKUP("gpio-pxa", GPIO_E800_SPK_AMP_ON, "Mic amp", GPIO_ACTIVE_HIGH),
  829. { },
  830. },
  831. };
  832. static struct platform_device e800_audio_device = {
  833. .name = "e800-audio",
  834. .id = -1,
  835. };
  836. /* ----------------------------------------------------------------------- */
  837. static struct platform_device *e800_devices[] __initdata = {
  838. &e800_fb_device,
  839. &e800_tc6393xb_device,
  840. &e800_gpio_vbus,
  841. &e800_audio_device,
  842. };
  843. static void __init e800_init(void)
  844. {
  845. pxa2xx_mfp_config(ARRAY_AND_SIZE(e800_pin_config));
  846. pxa_set_ffuart_info(NULL);
  847. pxa_set_btuart_info(NULL);
  848. pxa_set_stuart_info(NULL);
  849. clk_add_alias("CLK_CK3P6MI", e800_tc6393xb_device.name,
  850. "GPIO11_CLK", NULL),
  851. eseries_get_tmio_gpios();
  852. gpiod_add_lookup_table(&e800_gpio_vbus_gpiod_table);
  853. gpiod_add_lookup_table(&e800_audio_gpio_table);
  854. platform_add_devices(ARRAY_AND_SIZE(e800_devices));
  855. pxa_set_ac97_info(NULL);
  856. }
  857. MACHINE_START(E800, "Toshiba e800")
  858. /* Maintainer: Ian Molton ([email protected]) */
  859. .atag_offset = 0x100,
  860. .map_io = pxa25x_map_io,
  861. .nr_irqs = ESERIES_NR_IRQS,
  862. .init_irq = pxa25x_init_irq,
  863. .handle_irq = pxa25x_handle_irq,
  864. .fixup = eseries_fixup,
  865. .init_machine = e800_init,
  866. .init_time = pxa_timer_init,
  867. .restart = pxa_restart,
  868. MACHINE_END
  869. #endif