csb726.c 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. /*
  2. * Support for Cogent CSB726
  3. *
  4. * Copyright (c) 2008 Dmitry Eremin-Solenikov
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. *
  10. */
  11. #include <linux/kernel.h>
  12. #include <linux/init.h>
  13. #include <linux/io.h>
  14. #include <linux/gpio.h>
  15. #include <linux/platform_device.h>
  16. #include <linux/mtd/physmap.h>
  17. #include <linux/mtd/partitions.h>
  18. #include <linux/sm501.h>
  19. #include <linux/smsc911x.h>
  20. #include <linux/i2c/pxa-i2c.h>
  21. #include <asm/mach-types.h>
  22. #include <asm/mach/arch.h>
  23. #include <mach/csb726.h>
  24. #include <mach/mfp-pxa27x.h>
  25. #include <mach/mmc.h>
  26. #include <mach/ohci.h>
  27. #include <mach/pxa2xx-regs.h>
  28. #include <mach/audio.h>
  29. #include <mach/smemc.h>
  30. #include "generic.h"
  31. #include "devices.h"
  32. /*
  33. * n/a: 2, 5, 6, 7, 8, 23, 24, 25, 26, 27, 87, 88, 89,
  34. * nu: 58 -- 77, 90, 91, 93, 102, 105-108, 114-116,
  35. * XXX: 21,
  36. * XXX: 79 CS_3 for LAN9215 or PSKTSEL on R2, R3
  37. * XXX: 33 CS_5 for LAN9215 on R1
  38. */
  39. static unsigned long csb726_pin_config[] = {
  40. GPIO78_nCS_2, /* EXP_CS */
  41. GPIO79_nCS_3, /* SMSC9215 */
  42. GPIO80_nCS_4, /* SM501 */
  43. GPIO52_GPIO, /* #SMSC9251 int */
  44. GPIO53_GPIO, /* SM501 int */
  45. GPIO1_GPIO, /* GPIO0 */
  46. GPIO11_GPIO, /* GPIO1 */
  47. GPIO9_GPIO, /* GPIO2 */
  48. GPIO10_GPIO, /* GPIO3 */
  49. GPIO16_PWM0_OUT, /* or GPIO4 */
  50. GPIO17_PWM1_OUT, /* or GPIO5 */
  51. GPIO94_GPIO, /* GPIO6 */
  52. GPIO95_GPIO, /* GPIO7 */
  53. GPIO96_GPIO, /* GPIO8 */
  54. GPIO97_GPIO, /* GPIO9 */
  55. GPIO15_GPIO, /* EXP_IRQ */
  56. GPIO18_RDY, /* EXP_WAIT */
  57. GPIO0_GPIO, /* PWR_INT */
  58. GPIO104_GPIO, /* PWR_OFF */
  59. GPIO12_GPIO, /* touch irq */
  60. GPIO13_SSP2_TXD,
  61. GPIO14_SSP2_SFRM,
  62. MFP_CFG_OUT(GPIO19, AF1, DRIVE_LOW),/* SSP2_SYSCLK */
  63. GPIO22_SSP2_SCLK,
  64. GPIO81_SSP3_TXD,
  65. GPIO82_SSP3_RXD,
  66. GPIO83_SSP3_SFRM,
  67. GPIO84_SSP3_SCLK,
  68. GPIO20_GPIO, /* SDIO int */
  69. GPIO32_MMC_CLK,
  70. GPIO92_MMC_DAT_0,
  71. GPIO109_MMC_DAT_1,
  72. GPIO110_MMC_DAT_2,
  73. GPIO111_MMC_DAT_3,
  74. GPIO112_MMC_CMD,
  75. GPIO100_GPIO, /* SD CD */
  76. GPIO101_GPIO, /* SD WP */
  77. GPIO28_AC97_BITCLK,
  78. GPIO29_AC97_SDATA_IN_0,
  79. GPIO30_AC97_SDATA_OUT,
  80. GPIO31_AC97_SYNC,
  81. GPIO113_AC97_nRESET,
  82. GPIO34_FFUART_RXD,
  83. GPIO35_FFUART_CTS,
  84. GPIO36_FFUART_DCD,
  85. GPIO37_FFUART_DSR,
  86. GPIO38_FFUART_RI,
  87. GPIO39_FFUART_TXD,
  88. GPIO40_FFUART_DTR,
  89. GPIO41_FFUART_RTS,
  90. GPIO42_BTUART_RXD,
  91. GPIO43_BTUART_TXD,
  92. GPIO44_BTUART_CTS,
  93. GPIO45_BTUART_RTS,
  94. GPIO46_STUART_RXD,
  95. GPIO47_STUART_TXD,
  96. GPIO48_nPOE,
  97. GPIO49_nPWE,
  98. GPIO50_nPIOR,
  99. GPIO51_nPIOW,
  100. GPIO54_nPCE_2,
  101. GPIO55_nPREG,
  102. GPIO56_nPWAIT,
  103. GPIO57_nIOIS16, /* maybe unused */
  104. GPIO85_nPCE_1,
  105. GPIO98_GPIO, /* CF IRQ */
  106. GPIO99_GPIO, /* CF CD */
  107. GPIO103_GPIO, /* Reset */
  108. GPIO117_I2C_SCL,
  109. GPIO118_I2C_SDA,
  110. };
  111. static struct pxamci_platform_data csb726_mci = {
  112. .detect_delay_ms = 500,
  113. .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
  114. /* FIXME setpower */
  115. .gpio_card_detect = CSB726_GPIO_MMC_DETECT,
  116. .gpio_card_ro = CSB726_GPIO_MMC_RO,
  117. .gpio_power = -1,
  118. };
  119. static struct pxaohci_platform_data csb726_ohci_platform_data = {
  120. .port_mode = PMM_NPS_MODE,
  121. .flags = ENABLE_PORT1 | NO_OC_PROTECTION,
  122. };
  123. static struct mtd_partition csb726_flash_partitions[] = {
  124. {
  125. .name = "Bootloader",
  126. .offset = 0,
  127. .size = CSB726_FLASH_uMON,
  128. .mask_flags = MTD_WRITEABLE /* force read-only */
  129. },
  130. {
  131. .name = "root",
  132. .offset = MTDPART_OFS_APPEND,
  133. .size = MTDPART_SIZ_FULL,
  134. }
  135. };
  136. static struct physmap_flash_data csb726_flash_data = {
  137. .width = 2,
  138. .parts = csb726_flash_partitions,
  139. .nr_parts = ARRAY_SIZE(csb726_flash_partitions),
  140. };
  141. static struct resource csb726_flash_resources[] = {
  142. {
  143. .start = PXA_CS0_PHYS,
  144. .end = PXA_CS0_PHYS + CSB726_FLASH_SIZE - 1 ,
  145. .flags = IORESOURCE_MEM,
  146. }
  147. };
  148. static struct platform_device csb726_flash = {
  149. .name = "physmap-flash",
  150. .dev = {
  151. .platform_data = &csb726_flash_data,
  152. },
  153. .resource = csb726_flash_resources,
  154. .num_resources = ARRAY_SIZE(csb726_flash_resources),
  155. };
  156. static struct resource csb726_sm501_resources[] = {
  157. {
  158. .start = PXA_CS4_PHYS,
  159. .end = PXA_CS4_PHYS + SZ_8M - 1,
  160. .flags = IORESOURCE_MEM,
  161. .name = "sm501-localmem",
  162. },
  163. {
  164. .start = PXA_CS4_PHYS + SZ_64M - SZ_2M,
  165. .end = PXA_CS4_PHYS + SZ_64M - 1,
  166. .flags = IORESOURCE_MEM,
  167. .name = "sm501-regs",
  168. },
  169. {
  170. .start = CSB726_IRQ_SM501,
  171. .end = CSB726_IRQ_SM501,
  172. .flags = IORESOURCE_IRQ,
  173. },
  174. };
  175. static struct sm501_initdata csb726_sm501_initdata = {
  176. /* .devices = SM501_USE_USB_HOST, */
  177. .devices = SM501_USE_USB_HOST | SM501_USE_UART0 | SM501_USE_UART1,
  178. };
  179. static struct sm501_platdata csb726_sm501_platdata = {
  180. .init = &csb726_sm501_initdata,
  181. };
  182. static struct platform_device csb726_sm501 = {
  183. .name = "sm501",
  184. .id = 0,
  185. .num_resources = ARRAY_SIZE(csb726_sm501_resources),
  186. .resource = csb726_sm501_resources,
  187. .dev = {
  188. .platform_data = &csb726_sm501_platdata,
  189. },
  190. };
  191. static struct resource csb726_lan_resources[] = {
  192. {
  193. .start = PXA_CS3_PHYS,
  194. .end = PXA_CS3_PHYS + SZ_64K - 1,
  195. .flags = IORESOURCE_MEM,
  196. },
  197. {
  198. .start = CSB726_IRQ_LAN,
  199. .end = CSB726_IRQ_LAN,
  200. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
  201. },
  202. };
  203. struct smsc911x_platform_config csb726_lan_config = {
  204. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  205. .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
  206. .flags = SMSC911X_USE_32BIT,
  207. .phy_interface = PHY_INTERFACE_MODE_MII,
  208. };
  209. static struct platform_device csb726_lan = {
  210. .name = "smsc911x",
  211. .id = -1,
  212. .num_resources = ARRAY_SIZE(csb726_lan_resources),
  213. .resource = csb726_lan_resources,
  214. .dev = {
  215. .platform_data = &csb726_lan_config,
  216. },
  217. };
  218. static struct platform_device *devices[] __initdata = {
  219. &csb726_flash,
  220. &csb726_sm501,
  221. &csb726_lan,
  222. };
  223. static void __init csb726_init(void)
  224. {
  225. pxa2xx_mfp_config(ARRAY_AND_SIZE(csb726_pin_config));
  226. /* __raw_writel(0x7ffc3ffc, MSC1); *//* LAN9215/EXP_CS */
  227. /* __raw_writel(0x06697ff4, MSC2); *//* none/SM501 */
  228. __raw_writel((__raw_readl(MSC2) & ~0xffff) | 0x7ff4, MSC2); /* SM501 */
  229. pxa_set_ffuart_info(NULL);
  230. pxa_set_btuart_info(NULL);
  231. pxa_set_stuart_info(NULL);
  232. pxa_set_i2c_info(NULL);
  233. pxa27x_set_i2c_power_info(NULL);
  234. pxa_set_mci_info(&csb726_mci);
  235. pxa_set_ohci_info(&csb726_ohci_platform_data);
  236. pxa_set_ac97_info(NULL);
  237. platform_add_devices(devices, ARRAY_SIZE(devices));
  238. }
  239. MACHINE_START(CSB726, "Cogent CSB726")
  240. .boot_params = 0xa0000100,
  241. .map_io = pxa27x_map_io,
  242. .init_irq = pxa27x_init_irq,
  243. .init_machine = csb726_init,
  244. .timer = &pxa_timer,
  245. MACHINE_END