memoryDefinitionWaterSprayFireAssociated.c 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. /*
  2. * linux/arch/arm/mach-pxa/trizeps4.c
  3. *
  4. * Support for the Keith und Koep Trizeps4 Module Platform.
  5. *
  6. * Author: Jürgen Schindele
  7. * Created: 20 02, 2006
  8. * Copyright: Jürgen Schindele
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #include <linux/init.h>
  15. #include <linux/kernel.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/interrupt.h>
  18. #include <linux/export.h>
  19. #include <linux/sched.h>
  20. #include <linux/bitops.h>
  21. #include <linux/fb.h>
  22. #include <linux/ioport.h>
  23. #include <linux/delay.h>
  24. #include <linux/gpio.h>
  25. #include <linux/dm9000.h>
  26. #include <linux/mtd/physmap.h>
  27. #include <linux/mtd/partitions.h>
  28. #include <linux/i2c/pxa-i2c.h>
  29. #include <asm/types.h>
  30. #include <asm/setup.h>
  31. #include <asm/memory.h>
  32. #include <asm/mach-types.h>
  33. #include <asm/irq.h>
  34. #include <asm/sizes.h>
  35. #include <asm/mach/arch.h>
  36. #include <asm/mach/map.h>
  37. #include <asm/mach/irq.h>
  38. #include <asm/mach/flash.h>
  39. #include <mach/pxa27x.h>
  40. #include <mach/trizeps4.h>
  41. #include <mach/audio.h>
  42. #include <linux/platform_data/video-pxafb.h>
  43. #include <linux/platform_data/mmc-pxamci.h>
  44. #include <linux/platform_data/irda-pxaficp.h>
  45. #include <linux/platform_data/usb-ohci-pxa27x.h>
  46. #include <mach/smemc.h>
  47. #include "generic.h"
  48. #include "devices.h"
  49. /* comment out the following line if you want to use the
  50. * Standard UART from PXA for serial / irda transmission
  51. * and acivate it if you have status leds connected */
  52. #define STATUS_LEDS_ON_STUART_PINS 1
  53. /*****************************************************************************
  54. * MultiFunctionPins of CPU
  55. *****************************************************************************/
  56. static unsigned long trizeps4_pin_config[] __initdata = {
  57. /* Chip Selects */
  58. GPIO15_nCS_1, /* DiskOnChip CS */
  59. GPIO93_GPIO, /* TRIZEPS4_DOC_IRQ */
  60. GPIO94_GPIO, /* DOC lock */
  61. GPIO78_nCS_2, /* DM9000 CS */
  62. GPIO101_GPIO, /* TRIZEPS4_ETH_IRQ */
  63. GPIO79_nCS_3, /* Logic CS */
  64. GPIO0_GPIO | WAKEUP_ON_EDGE_RISE, /* Logic irq */
  65. /* AC97 */
  66. GPIO28_AC97_BITCLK,
  67. GPIO29_AC97_SDATA_IN_0,
  68. GPIO30_AC97_SDATA_OUT,
  69. GPIO31_AC97_SYNC,
  70. /* LCD - 16bpp Active TFT */
  71. GPIOxx_LCD_TFT_16BPP,
  72. /* UART */
  73. GPIO9_FFUART_CTS,
  74. GPIO10_FFUART_DCD,
  75. GPIO16_FFUART_TXD,
  76. GPIO33_FFUART_DSR,
  77. GPIO38_FFUART_RI,
  78. GPIO82_FFUART_DTR,
  79. GPIO83_FFUART_RTS,
  80. GPIO96_FFUART_RXD,
  81. GPIO42_BTUART_RXD,
  82. GPIO43_BTUART_TXD,
  83. GPIO44_BTUART_CTS,
  84. GPIO45_BTUART_RTS,
  85. #ifdef STATUS_LEDS_ON_STUART_PINS
  86. GPIO46_GPIO,
  87. GPIO47_GPIO,
  88. #else
  89. GPIO46_STUART_RXD,
  90. GPIO47_STUART_TXD,
  91. #endif
  92. /* PCMCIA */
  93. GPIO11_GPIO, /* TRIZEPS4_CD_IRQ */
  94. GPIO13_GPIO, /* TRIZEPS4_READY_NINT */
  95. GPIO48_nPOE,
  96. GPIO49_nPWE,
  97. GPIO50_nPIOR,
  98. GPIO51_nPIOW,
  99. GPIO54_nPCE_2,
  100. GPIO55_nPREG,
  101. GPIO56_nPWAIT,
  102. GPIO57_nIOIS16,
  103. GPIO102_nPCE_1,
  104. GPIO104_PSKTSEL,
  105. /* MultiMediaCard */
  106. GPIO32_MMC_CLK,
  107. GPIO92_MMC_DAT_0,
  108. GPIO109_MMC_DAT_1,
  109. GPIO110_MMC_DAT_2,
  110. GPIO111_MMC_DAT_3,
  111. GPIO112_MMC_CMD,
  112. GPIO12_GPIO, /* TRIZEPS4_MMC_IRQ */
  113. /* USB OHCI */
  114. GPIO88_USBH1_PWR, /* USBHPWR1 */
  115. GPIO89_USBH1_PEN, /* USBHPEN1 */
  116. /* I2C */
  117. GPIO117_I2C_SCL,
  118. GPIO118_I2C_SDA,
  119. };
  120. static unsigned long trizeps4wl_pin_config[] __initdata = {
  121. /* SSP 2 */
  122. GPIO14_SSP2_SFRM,
  123. GPIO19_SSP2_SCLK,
  124. GPIO53_GPIO, /* TRIZEPS4_SPI_IRQ */
  125. GPIO86_SSP2_RXD,
  126. GPIO87_SSP2_TXD,
  127. };
  128. /****************************************************************************
  129. * ONBOARD FLASH
  130. ****************************************************************************/
  131. static struct mtd_partition trizeps4_partitions[] = {
  132. {
  133. .name = "Bootloader",
  134. .offset = 0x00000000,
  135. .size = 0x00040000,
  136. .mask_flags = MTD_WRITEABLE /* force read-only */
  137. }, {
  138. .name = "Backup",
  139. .offset = 0x00040000,
  140. .size = 0x00040000,
  141. }, {
  142. .name = "Image",
  143. .offset = 0x00080000,
  144. .size = 0x01080000,
  145. }, {
  146. .name = "IPSM",
  147. .offset = 0x01100000,
  148. .size = 0x00e00000,
  149. }, {
  150. .name = "Registry",
  151. .offset = 0x01f00000,
  152. .size = MTDPART_SIZ_FULL,
  153. }
  154. };
  155. static struct physmap_flash_data trizeps4_flash_data[] = {
  156. {
  157. .width = 4, /* bankwidth in bytes */
  158. .parts = trizeps4_partitions,
  159. .nr_parts = ARRAY_SIZE(trizeps4_partitions)
  160. }
  161. };
  162. static struct resource flash_resource = {
  163. .start = PXA_CS0_PHYS,
  164. .end = PXA_CS0_PHYS + SZ_32M - 1,
  165. .flags = IORESOURCE_MEM,
  166. };
  167. static struct platform_device flash_device = {
  168. .name = "physmap-flash",
  169. .id = 0,
  170. .dev = {
  171. .platform_data = trizeps4_flash_data,
  172. },
  173. .resource = &flash_resource,
  174. .num_resources = 1,
  175. };
  176. /****************************************************************************
  177. * DAVICOM DM9000 Ethernet
  178. ****************************************************************************/
  179. static struct resource dm9000_resources[] = {
  180. [0] = {
  181. .start = TRIZEPS4_ETH_PHYS+0x300,
  182. .end = TRIZEPS4_ETH_PHYS+0x400-1,
  183. .flags = IORESOURCE_MEM,
  184. },
  185. [1] = {
  186. .start = TRIZEPS4_ETH_PHYS+0x8300,
  187. .end = TRIZEPS4_ETH_PHYS+0x8400-1,
  188. .flags = IORESOURCE_MEM,
  189. },
  190. [2] = {
  191. .start = TRIZEPS4_ETH_IRQ,
  192. .end = TRIZEPS4_ETH_IRQ,
  193. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
  194. },
  195. };
  196. static struct dm9000_plat_data tri_dm9000_platdata = {
  197. .flags = DM9000_PLATF_32BITONLY,
  198. };
  199. static struct platform_device dm9000_device = {
  200. .name = "dm9000",
  201. .id = -1,
  202. .num_resources = ARRAY_SIZE(dm9000_resources),
  203. .resource = dm9000_resources,
  204. .dev = {
  205. .platform_data = &tri_dm9000_platdata,
  206. }
  207. };
  208. /****************************************************************************
  209. * LED's on GPIO pins of PXA
  210. ****************************************************************************/
  211. static struct gpio_led trizeps4_led[] = {
  212. #ifdef STATUS_LEDS_ON_STUART_PINS
  213. {
  214. .name = "led0:orange:heartbeat", /* */
  215. .default_trigger = "heartbeat",
  216. .gpio = GPIO_HEARTBEAT_LED,
  217. .active_low = 1,
  218. },
  219. {
  220. .name = "led1:yellow:cpubusy", /* */
  221. .default_trigger = "cpu-busy",
  222. .gpio = GPIO_SYS_BUSY_LED,
  223. .active_low = 1,
  224. },
  225. #endif
  226. };
  227. static struct gpio_led_platform_data trizeps4_led_data = {
  228. .leds = trizeps4_led,
  229. .num_leds = ARRAY_SIZE(trizeps4_led),
  230. };
  231. static struct platform_device leds_devices = {
  232. .name = "leds-gpio",
  233. .id = -1,
  234. .dev = {
  235. .platform_data = &trizeps4_led_data,
  236. },
  237. };
  238. static struct platform_device *trizeps4_devices[] __initdata = {
  239. &flash_device,
  240. &dm9000_device,
  241. &leds_devices,
  242. };
  243. static struct platform_device *trizeps4wl_devices[] __initdata = {
  244. &flash_device,
  245. &leds_devices,
  246. };
  247. static short trizeps_conxs_bcr;
  248. /* PCCARD power switching supports only 3,3V */
  249. void board_pcmcia_power(int power)
  250. {
  251. if (power) {
  252. /* switch power on, put in reset and enable buffers */
  253. trizeps_conxs_bcr |= power;
  254. trizeps_conxs_bcr |= ConXS_BCR_CF_RESET;
  255. trizeps_conxs_bcr &= ~ConXS_BCR_CF_BUF_EN;
  256. BCR_writew(trizeps_conxs_bcr);
  257. /* wait a little */
  258. udelay(2000);
  259. /* take reset away */
  260. trizeps_conxs_bcr &= ~ConXS_BCR_CF_RESET;
  261. BCR_writew(trizeps_conxs_bcr);
  262. udelay(2000);
  263. } else {
  264. /* put in reset */
  265. trizeps_conxs_bcr |= ConXS_BCR_CF_RESET;
  266. BCR_writew(trizeps_conxs_bcr);
  267. udelay(1000);
  268. /* switch power off */
  269. trizeps_conxs_bcr &= ~0xf;
  270. BCR_writew(trizeps_conxs_bcr);
  271. }
  272. pr_debug("%s: o%s 0x%x\n", __func__, power ? "n" : "ff",
  273. trizeps_conxs_bcr);
  274. }
  275. EXPORT_SYMBOL(board_pcmcia_power);
  276. /* backlight power switching for LCD panel */
  277. static void board_backlight_power(int on)
  278. {
  279. if (on)
  280. trizeps_conxs_bcr |= ConXS_BCR_L_DISP;
  281. else
  282. trizeps_conxs_bcr &= ~ConXS_BCR_L_DISP;
  283. pr_debug("%s: o%s 0x%x\n", __func__, on ? "n" : "ff",
  284. trizeps_conxs_bcr);
  285. BCR_writew(trizeps_conxs_bcr);
  286. }
  287. /* a I2C based RTC is known on CONXS board */
  288. static struct i2c_board_info trizeps4_i2c_devices[] __initdata = {
  289. { I2C_BOARD_INFO("rtc-pcf8593", 0x51) }
  290. };
  291. /****************************************************************************
  292. * MMC card slot external to module
  293. ****************************************************************************/
  294. static int trizeps4_mci_init(struct device *dev, irq_handler_t mci_detect_int,
  295. void *data)
  296. {
  297. int err;
  298. err = request_irq(TRIZEPS4_MMC_IRQ, mci_detect_int,
  299. IRQF_DISABLED | IRQF_TRIGGER_RISING,
  300. "MMC card detect", data);
  301. if (err) {
  302. printk(KERN_ERR "trizeps4_mci_init: MMC/SD: can't request"
  303. "MMC card detect IRQ\n");
  304. return -1;
  305. }
  306. return 0;
  307. }
  308. static void trizeps4_mci_exit(struct device *dev, void *data)
  309. {
  310. free_irq(TRIZEPS4_MMC_IRQ, data);
  311. }
  312. static struct pxamci_platform_data trizeps4_mci_platform_data = {
  313. .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
  314. .detect_delay_ms= 10,
  315. .init = trizeps4_mci_init,
  316. .exit = trizeps4_mci_exit,
  317. .get_ro = NULL, /* write-protection not supported */
  318. .setpower = NULL, /* power-switching not supported */
  319. .gpio_card_detect = -1,
  320. .gpio_card_ro = -1,
  321. .gpio_power = -1,
  322. };
  323. /****************************************************************************
  324. * IRDA mode switching on stuart
  325. ****************************************************************************/
  326. #ifndef STATUS_LEDS_ON_STUART_PINS
  327. static short trizeps_conxs_ircr;
  328. static int trizeps4_irda_startup(struct device *dev)