cm-x255.c 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. /*
  2. * linux/arch/arm/mach-pxa/cm-x255.c
  3. *
  4. * Copyright (C) 2007, 2008 CompuLab, Ltd.
  5. * Mike Rapoport <mike@compulab.co.il>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #include <linux/platform_device.h>
  12. #include <linux/irq.h>
  13. #include <linux/gpio.h>
  14. #include <linux/mtd/partitions.h>
  15. #include <linux/mtd/physmap.h>
  16. #include <linux/mtd/nand-gpio.h>
  17. #include <linux/spi/spi.h>
  18. #include <asm/mach/arch.h>
  19. #include <asm/mach-types.h>
  20. #include <asm/mach/map.h>
  21. #include <mach/pxa25x.h>
  22. #include <mach/pxa2xx_spi.h>
  23. #include "generic.h"
  24. #define GPIO_NAND_CS (5)
  25. #define GPIO_NAND_ALE (4)
  26. #define GPIO_NAND_CLE (3)
  27. #define GPIO_NAND_RB (10)
  28. static unsigned long cmx255_pin_config[] = {
  29. /* AC'97 */
  30. GPIO28_AC97_BITCLK,
  31. GPIO29_AC97_SDATA_IN_0,
  32. GPIO30_AC97_SDATA_OUT,
  33. GPIO31_AC97_SYNC,
  34. /* BTUART */
  35. GPIO42_BTUART_RXD,
  36. GPIO43_BTUART_TXD,
  37. GPIO44_BTUART_CTS,
  38. GPIO45_BTUART_RTS,
  39. /* STUART */
  40. GPIO46_STUART_RXD,
  41. GPIO47_STUART_TXD,
  42. /* LCD */
  43. GPIO58_LCD_LDD_0,
  44. GPIO59_LCD_LDD_1,
  45. GPIO60_LCD_LDD_2,
  46. GPIO61_LCD_LDD_3,
  47. GPIO62_LCD_LDD_4,
  48. GPIO63_LCD_LDD_5,
  49. GPIO64_LCD_LDD_6,
  50. GPIO65_LCD_LDD_7,
  51. GPIO66_LCD_LDD_8,
  52. GPIO67_LCD_LDD_9,
  53. GPIO68_LCD_LDD_10,
  54. GPIO69_LCD_LDD_11,
  55. GPIO70_LCD_LDD_12,
  56. GPIO71_LCD_LDD_13,
  57. GPIO72_LCD_LDD_14,
  58. GPIO73_LCD_LDD_15,
  59. GPIO74_LCD_FCLK,
  60. GPIO75_LCD_LCLK,
  61. GPIO76_LCD_PCLK,
  62. GPIO77_LCD_BIAS,
  63. /* SSP1 */
  64. GPIO23_SSP1_SCLK,
  65. GPIO24_SSP1_SFRM,
  66. GPIO25_SSP1_TXD,
  67. GPIO26_SSP1_RXD,
  68. /* SSP2 */
  69. GPIO81_SSP2_CLK_OUT,
  70. GPIO82_SSP2_FRM_OUT,
  71. GPIO83_SSP2_TXD,
  72. GPIO84_SSP2_RXD,
  73. /* PC Card */
  74. GPIO48_nPOE,
  75. GPIO49_nPWE,
  76. GPIO50_nPIOR,
  77. GPIO51_nPIOW,
  78. GPIO52_nPCE_1,
  79. GPIO53_nPCE_2,
  80. GPIO54_nPSKTSEL,
  81. GPIO55_nPREG,
  82. GPIO56_nPWAIT,
  83. GPIO57_nIOIS16,
  84. /* SDRAM and local bus */
  85. GPIO15_nCS_1,
  86. GPIO78_nCS_2,
  87. GPIO79_nCS_3,
  88. GPIO80_nCS_4,
  89. GPIO33_nCS_5,
  90. GPIO18_RDY,
  91. /* GPIO */
  92. GPIO0_GPIO | WAKEUP_ON_EDGE_BOTH,
  93. GPIO9_GPIO, /* PC card reset */
  94. /* NAND controls */
  95. GPIO5_GPIO | MFP_LPM_DRIVE_HIGH, /* NAND CE# */
  96. GPIO4_GPIO | MFP_LPM_DRIVE_LOW, /* NAND ALE */
  97. GPIO3_GPIO | MFP_LPM_DRIVE_LOW, /* NAND CLE */
  98. GPIO10_GPIO, /* NAND Ready/Busy */
  99. /* interrupts */
  100. GPIO22_GPIO, /* DM9000 interrupt */
  101. };
  102. #if defined(CONFIG_SPI_PXA2XX)
  103. static struct pxa2xx_spi_master pxa_ssp_master_info = {
  104. .num_chipselect = 1,
  105. };
  106. static struct spi_board_info spi_board_info[] __initdata = {
  107. [0] = {
  108. .modalias = "rtc-max6902",
  109. .max_speed_hz = 1000000,
  110. .bus_num = 1,
  111. .chip_select = 0,
  112. },
  113. };
  114. static void __init cmx255_init_rtc(void)
  115. {
  116. pxa2xx_set_spi_info(1, &pxa_ssp_master_info);
  117. spi_register_board_info(ARRAY_AND_SIZE(spi_board_info));
  118. }
  119. #else
  120. static inline void cmx255_init_rtc(void) {}
  121. #endif
  122. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  123. static struct mtd_partition cmx255_nor_partitions[] = {
  124. {
  125. .name = "ARMmon",
  126. .size = 0x00030000,
  127. .offset = 0,
  128. .mask_flags = MTD_WRITEABLE /* force read-only */
  129. } , {
  130. .name = "ARMmon setup block",
  131. .size = 0x00010000,
  132. .offset = MTDPART_OFS_APPEND,
  133. .mask_flags = MTD_WRITEABLE /* force read-only */
  134. } , {
  135. .name = "kernel",
  136. .size = 0x00160000,
  137. .offset = MTDPART_OFS_APPEND,
  138. } , {
  139. .name = "ramdisk",
  140. .size = MTDPART_SIZ_FULL,
  141. .offset = MTDPART_OFS_APPEND
  142. }
  143. };
  144. static struct physmap_flash_data cmx255_nor_flash_data[] = {
  145. {
  146. .width = 2, /* bankwidth in bytes */
  147. .parts = cmx255_nor_partitions,
  148. .nr_parts = ARRAY_SIZE(cmx255_nor_partitions)
  149. }
  150. };
  151. static struct resource cmx255_nor_resource = {
  152. .start = PXA_CS0_PHYS,
  153. .end = PXA_CS0_PHYS + SZ_8M - 1,
  154. .flags = IORESOURCE_MEM,
  155. };
  156. static struct platform_device cmx255_nor = {
  157. .name = "physmap-flash",
  158. .id = -1,
  159. .dev = {
  160. .platform_data = cmx255_nor_flash_data,
  161. },
  162. .resource = &cmx255_nor_resource,
  163. .num_resources = 1,
  164. };
  165. static void __init cmx255_init_nor(void)
  166. {
  167. platform_device_register(&cmx255_nor);
  168. }
  169. #else
  170. static inline void cmx255_init_nor(void) {}
  171. #endif
  172. #if defined(CONFIG_MTD_NAND_GPIO) || defined(CONFIG_MTD_NAND_GPIO_MODULE)
  173. static struct resource cmx255_nand_resource[] = {
  174. [0] = {
  175. .start = PXA_CS1_PHYS,
  176. .end = PXA_CS1_PHYS + 11,
  177. .flags = IORESOURCE_MEM,
  178. },
  179. [1] = {
  180. .start = PXA_CS5_PHYS,
  181. .end = PXA_CS5_PHYS + 3,
  182. .flags = IORESOURCE_MEM,
  183. },
  184. };
  185. static struct mtd_partition cmx255_nand_parts[] = {
  186. [0] = {
  187. .name = "cmx255-nand",
  188. .size = MTDPART_SIZ_FULL,
  189. .offset = 0,
  190. },
  191. };
  192. static struct gpio_nand_platdata cmx255_nand_platdata = {
  193. .gpio_nce = GPIO_NAND_CS,
  194. .gpio_cle = GPIO_NAND_CLE,
  195. .gpio_ale = GPIO_NAND_ALE,
  196. .gpio_rdy = GPIO_NAND_RB,
  197. .gpio_nwp = -1,
  198. .parts = cmx255_nand_parts,
  199. .num_parts = ARRAY_SIZE(cmx255_nand_parts),
  200. .chip_delay = 25,
  201. };
  202. static struct platform_device cmx255_nand = {
  203. .name = "gpio-nand",
  204. .num_resources = ARRAY_SIZE(cmx255_nand_resource),
  205. .resource = cmx255_nand_resource,
  206. .id = -1,
  207. .dev = {
  208. .platform_data = &cmx255_nand_platdata,
  209. }
  210. };
  211. static void __init cmx255_init_nand(void)
  212. {
  213. platform_device_register(&cmx255_nand);
  214. }
  215. #else
  216. static inline void cmx255_init_nand(void) {}
  217. #endif
  218. void __init cmx255_init(void)
  219. {
  220. pxa2xx_mfp_config(ARRAY_AND_SIZE(cmx255_pin_config));
  221. cmx255_init_rtc();
  222. cmx255_init_nor();
  223. cmx255_init_nand();
  224. }