cm-x255.c 4.8 KB

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