cm-x255.c 5.2 KB

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