pcm027.c 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. /*
  2. * linux/arch/arm/mach-pxa/pcm027.c
  3. * Support for the Phytec phyCORE-PXA270 CPU card (aka PCM-027).
  4. *
  5. * Refer
  6. * http://www.phytec.com/products/sbc/ARM-XScale/phyCORE-XScale-PXA270.html
  7. * for additional hardware info
  8. *
  9. * Author: Juergen Kilb
  10. * Created: April 05, 2005
  11. * Copyright: Phytec Messtechnik GmbH
  12. * e-Mail: armlinux@phytec.de
  13. *
  14. * based on Intel Mainstone Board
  15. *
  16. * Copyright 2007 Juergen Beisert @ Pengutronix (j.beisert@pengutronix.de)
  17. *
  18. * This program is free software; you can redistribute it and/or modify
  19. * it under the terms of the GNU General Public License version 2 as
  20. * published by the Free Software Foundation.
  21. */
  22. #include <linux/irq.h>
  23. #include <linux/platform_device.h>
  24. #include <linux/mtd/physmap.h>
  25. #include <linux/spi/spi.h>
  26. #include <linux/spi/max7301.h>
  27. #include <linux/leds.h>
  28. #include <asm/mach-types.h>
  29. #include <asm/mach/arch.h>
  30. #include <mach/hardware.h>
  31. #include <mach/pxa-regs.h>
  32. #include <mach/mfp-pxa27x.h>
  33. #include <mach/pxa2xx-regs.h>
  34. #include <mach/pxa2xx_spi.h>
  35. #include <mach/pcm027.h>
  36. #include "generic.h"
  37. /*
  38. * ABSTRACT:
  39. *
  40. * The PXA270 processor comes with a bunch of hardware on its silicon.
  41. * Not all of this hardware can be used at the same time and not all
  42. * is routed to module's connectors. Also it depends on the baseboard, what
  43. * kind of hardware can be used in which way.
  44. * -> So this file supports the main devices on the CPU card only!
  45. * Refer pcm990-baseboard.c how to extend this features to get a full
  46. * blown system with many common interfaces.
  47. *
  48. * The PCM-027 supports the following interfaces through its connectors and
  49. * will be used in pcm990-baseboard.c:
  50. *
  51. * - LCD support
  52. * - MMC support
  53. * - IDE/CF card
  54. * - FFUART
  55. * - BTUART
  56. * - IRUART
  57. * - AC97
  58. * - SSP
  59. * - SSP3
  60. *
  61. * Claimed GPIOs:
  62. * GPIO0 -> IRQ input from RTC
  63. * GPIO2 -> SYS_ENA*)
  64. * GPIO3 -> PWR_SCL
  65. * GPIO4 -> PWR_SDA
  66. * GPIO5 -> PowerCap0*)
  67. * GPIO6 -> PowerCap1*)
  68. * GPIO7 -> PowerCap2*)
  69. * GPIO8 -> PowerCap3*)
  70. * GPIO15 -> /CS1
  71. * GPIO20 -> /CS2
  72. * GPIO21 -> /CS3
  73. * GPIO33 -> /CS5 network controller select
  74. * GPIO52 -> IRQ from network controller
  75. * GPIO78 -> /CS2
  76. * GPIO80 -> /CS4
  77. * GPIO90 -> LED0
  78. * GPIO91 -> LED1
  79. * GPIO114 -> IRQ from CAN controller
  80. * GPIO117 -> SCL
  81. * GPIO118 -> SDA
  82. *
  83. * *) CPU internal use only
  84. */
  85. static unsigned long pcm027_pin_config[] __initdata = {
  86. /* Chip Selects */
  87. GPIO20_nSDCS_2,
  88. GPIO21_nSDCS_3,
  89. GPIO15_nCS_1,
  90. GPIO78_nCS_2,
  91. GPIO80_nCS_4,
  92. GPIO33_nCS_5, /* Ethernet */
  93. /* I2C */
  94. GPIO117_I2C_SCL,
  95. GPIO118_I2C_SDA,
  96. /* GPIO */
  97. GPIO52_GPIO, /* IRQ from network controller */
  98. #ifdef CONFIG_LEDS_GPIO
  99. GPIO90_GPIO, /* PCM027_LED_CPU */
  100. GPIO91_GPIO, /* PCM027_LED_HEART_BEAT */
  101. #endif
  102. GPIO114_GPIO, /* IRQ from CAN controller */
  103. };
  104. /*
  105. * SMC91x network controller specific stuff
  106. */
  107. static struct resource smc91x_resources[] = {
  108. [0] = {
  109. .start = PCM027_ETH_PHYS + 0x300,
  110. .end = PCM027_ETH_PHYS + PCM027_ETH_SIZE,
  111. .flags = IORESOURCE_MEM,
  112. },
  113. [1] = {
  114. .start = PCM027_ETH_IRQ,
  115. .end = PCM027_ETH_IRQ,
  116. /* note: smc91x's driver doesn't use the trigger bits yet */
  117. .flags = IORESOURCE_IRQ | PCM027_ETH_IRQ_EDGE,
  118. }
  119. };
  120. static struct platform_device smc91x_device = {
  121. .name = "smc91x",
  122. .id = 0,
  123. .num_resources = ARRAY_SIZE(smc91x_resources),
  124. .resource = smc91x_resources,
  125. };
  126. /*
  127. * SPI host and devices
  128. */
  129. static struct pxa2xx_spi_master pxa_ssp_master_info = {
  130. .num_chipselect = 1,
  131. };
  132. static struct max7301_platform_data max7301_info = {
  133. .base = -1,
  134. };
  135. /* bus_num must match id in pxa2xx_set_spi_info() call */
  136. static struct spi_board_info spi_board_info[] __initdata = {
  137. {
  138. .modalias = "max7301",
  139. .platform_data = &max7301_info,
  140. .max_speed_hz = 13000000,
  141. .bus_num = 1,
  142. .chip_select = 0,
  143. .mode = SPI_MODE_0,
  144. },
  145. };
  146. /*
  147. * NOR flash
  148. */
  149. static struct physmap_flash_data pcm027_flash_data = {
  150. .width = 4,
  151. };
  152. static struct resource pcm027_flash_resource = {
  153. .start = PCM027_FLASH_PHYS,
  154. .end = PCM027_FLASH_PHYS + PCM027_FLASH_SIZE - 1 ,
  155. .flags = IORESOURCE_MEM,
  156. };
  157. static struct platform_device pcm027_flash = {
  158. .name = "physmap-flash",
  159. .id = 0,
  160. .dev = {
  161. .platform_data = &pcm027_flash_data,
  162. },
  163. .resource = &pcm027_flash_resource,
  164. .num_resources = 1,
  165. };
  166. #ifdef CONFIG_LEDS_GPIO
  167. static struct gpio_led pcm027_led[] = {
  168. {
  169. .name = "led0:red", /* FIXME */
  170. .gpio = PCM027_LED_CPU
  171. },
  172. {
  173. .name = "led1:green", /* FIXME */
  174. .gpio = PCM027_LED_HEARD_BEAT
  175. },
  176. };
  177. static struct gpio_led_platform_data pcm027_led_data = {
  178. .num_leds = ARRAY_SIZE(pcm027_led),
  179. .leds = pcm027_led
  180. };
  181. static struct platform_device pcm027_led_dev = {
  182. .name = "leds-gpio",
  183. .id = 0,
  184. .dev = {
  185. .platform_data = &pcm027_led_data,
  186. },
  187. };
  188. #endif /* CONFIG_LEDS_GPIO */
  189. /*
  190. * declare the available device resources on this board
  191. */
  192. static struct platform_device *devices[] __initdata = {
  193. &smc91x_device,
  194. &pcm027_flash,
  195. #ifdef CONFIG_LEDS_GPIO
  196. &pcm027_led_dev
  197. #endif
  198. };
  199. /*
  200. * pcm027_init - breath some life into the board
  201. */
  202. static void __init pcm027_init(void)
  203. {
  204. /* system bus arbiter setting
  205. * - Core_Park
  206. * - LCD_wt:DMA_wt:CORE_Wt = 2:3:4
  207. */
  208. ARB_CNTRL = ARB_CORE_PARK | 0x234;
  209. pxa2xx_mfp_config(pcm027_pin_config, ARRAY_SIZE(pcm027_pin_config));
  210. platform_add_devices(devices, ARRAY_SIZE(devices));
  211. /* at last call the baseboard to initialize itself */
  212. #ifdef CONFIG_MACH_PCM990_BASEBOARD
  213. pcm990_baseboard_init();
  214. #endif
  215. pxa2xx_set_spi_info(1, &pxa_ssp_master_info);
  216. spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
  217. }
  218. static void __init pcm027_map_io(void)
  219. {
  220. pxa_map_io();
  221. /* initialize sleep mode regs (wake-up sources, etc) */
  222. PGSR0 = 0x01308000;
  223. PGSR1 = 0x00CF0002;
  224. PGSR2 = 0x0E294000;
  225. PGSR3 = 0x0000C000;
  226. PWER = 0x40000000 | PWER_GPIO0 | PWER_GPIO1;
  227. PRER = 0x00000000;
  228. PFER = 0x00000003;
  229. }
  230. MACHINE_START(PCM027, "Phytec Messtechnik GmbH phyCORE-PXA270")
  231. /* Maintainer: Pengutronix */
  232. .boot_params = 0xa0000100,
  233. .phys_io = 0x40000000,
  234. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  235. .map_io = pcm027_map_io,
  236. .init_irq = pxa27x_init_irq,
  237. .timer = &pxa_timer,
  238. .init_machine = pcm027_init,
  239. MACHINE_END