pcm027.c 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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/spi/pxa2xx_spi.h>
  28. #include <linux/leds.h>
  29. #include <asm/mach-types.h>
  30. #include <asm/mach/arch.h>
  31. #include "pxa27x.h"
  32. #include "pcm027.h"
  33. #include "generic.h"
  34. /*
  35. * ABSTRACT:
  36. *
  37. * The PXA270 processor comes with a bunch of hardware on its silicon.
  38. * Not all of this hardware can be used at the same time and not all
  39. * is routed to module's connectors. Also it depends on the baseboard, what
  40. * kind of hardware can be used in which way.
  41. * -> So this file supports the main devices on the CPU card only!
  42. * Refer pcm990-baseboard.c how to extend this features to get a full
  43. * blown system with many common interfaces.
  44. *
  45. * The PCM-027 supports the following interfaces through its connectors and
  46. * will be used in pcm990-baseboard.c:
  47. *
  48. * - LCD support
  49. * - MMC support
  50. * - IDE/CF card
  51. * - FFUART
  52. * - BTUART
  53. * - IRUART
  54. * - AC97
  55. * - SSP
  56. * - SSP3
  57. *
  58. * Claimed GPIOs:
  59. * GPIO0 -> IRQ input from RTC
  60. * GPIO2 -> SYS_ENA*)
  61. * GPIO3 -> PWR_SCL
  62. * GPIO4 -> PWR_SDA
  63. * GPIO5 -> PowerCap0*)
  64. * GPIO6 -> PowerCap1*)
  65. * GPIO7 -> PowerCap2*)
  66. * GPIO8 -> PowerCap3*)
  67. * GPIO15 -> /CS1
  68. * GPIO20 -> /CS2
  69. * GPIO21 -> /CS3
  70. * GPIO33 -> /CS5 network controller select
  71. * GPIO52 -> IRQ from network controller
  72. * GPIO78 -> /CS2
  73. * GPIO80 -> /CS4
  74. * GPIO90 -> LED0
  75. * GPIO91 -> LED1
  76. * GPIO114 -> IRQ from CAN controller
  77. * GPIO117 -> SCL
  78. * GPIO118 -> SDA
  79. *
  80. * *) CPU internal use only
  81. */
  82. static unsigned long pcm027_pin_config[] __initdata = {
  83. /* Chip Selects */
  84. GPIO20_nSDCS_2,
  85. GPIO21_nSDCS_3,
  86. GPIO15_nCS_1,
  87. GPIO78_nCS_2,
  88. GPIO80_nCS_4,
  89. GPIO33_nCS_5, /* Ethernet */
  90. /* I2C */
  91. GPIO117_I2C_SCL,
  92. GPIO118_I2C_SDA,
  93. /* GPIO */
  94. GPIO52_GPIO, /* IRQ from network controller */
  95. #ifdef CONFIG_LEDS_GPIO
  96. GPIO90_GPIO, /* PCM027_LED_CPU */
  97. GPIO91_GPIO, /* PCM027_LED_HEART_BEAT */
  98. #endif
  99. GPIO114_GPIO, /* IRQ from CAN controller */
  100. };
  101. /*
  102. * SMC91x network controller specific stuff
  103. */
  104. static struct resource smc91x_resources[] = {
  105. [0] = {
  106. .start = PCM027_ETH_PHYS + 0x300,
  107. .end = PCM027_ETH_PHYS + PCM027_ETH_SIZE,
  108. .flags = IORESOURCE_MEM,
  109. },
  110. [1] = {
  111. .start = PCM027_ETH_IRQ,
  112. .end = PCM027_ETH_IRQ,
  113. /* note: smc91x's driver doesn't use the trigger bits yet */
  114. .flags = IORESOURCE_IRQ | PCM027_ETH_IRQ_EDGE,
  115. }
  116. };
  117. static struct platform_device smc91x_device = {
  118. .name = "smc91x",
  119. .id = 0,
  120. .num_resources = ARRAY_SIZE(smc91x_resources),
  121. .resource = smc91x_resources,
  122. };
  123. /*
  124. * SPI host and devices
  125. */
  126. static struct pxa2xx_spi_master pxa_ssp_master_info = {
  127. .num_chipselect = 1,
  128. };
  129. static struct max7301_platform_data max7301_info = {
  130. .base = -1,
  131. };
  132. /* bus_num must match id in pxa2xx_set_spi_info() call */
  133. static struct spi_board_info spi_board_info[] __initdata = {
  134. {
  135. .modalias = "max7301",
  136. .platform_data = &max7301_info,
  137. .max_speed_hz = 13000000,
  138. .bus_num = 1,
  139. .chip_select = 0,
  140. .mode = SPI_MODE_0,
  141. },
  142. };
  143. /*
  144. * NOR flash
  145. */
  146. static struct physmap_flash_data pcm027_flash_data = {
  147. .width = 4,
  148. };
  149. static struct resource pcm027_flash_resource = {
  150. .start = PCM027_FLASH_PHYS,
  151. .end = PCM027_FLASH_PHYS + PCM027_FLASH_SIZE - 1 ,
  152. .flags = IORESOURCE_MEM,
  153. };
  154. static struct platform_device pcm027_flash = {
  155. .name = "physmap-flash",
  156. .id = 0,
  157. .dev = {
  158. .platform_data = &pcm027_flash_data,
  159. },
  160. .resource = &pcm027_flash_resource,
  161. .num_resources = 1,
  162. };
  163. #ifdef CONFIG_LEDS_GPIO
  164. static struct gpio_led pcm027_led[] = {
  165. {
  166. .name = "led0:red", /* FIXME */
  167. .gpio = PCM027_LED_CPU
  168. },
  169. {
  170. .name = "led1:green", /* FIXME */
  171. .gpio = PCM027_LED_HEARD_BEAT
  172. },
  173. };
  174. static struct gpio_led_platform_data pcm027_led_data = {
  175. .num_leds = ARRAY_SIZE(pcm027_led),
  176. .leds = pcm027_led
  177. };
  178. static struct platform_device pcm027_led_dev = {
  179. .name = "leds-gpio",
  180. .id = 0,
  181. .dev = {
  182. .platform_data = &pcm027_led_data,
  183. },
  184. };
  185. #endif /* CONFIG_LEDS_GPIO */
  186. /*
  187. * declare the available device resources on this board
  188. */
  189. static struct platform_device *devices[] __initdata = {
  190. &smc91x_device,
  191. &pcm027_flash,
  192. #ifdef CONFIG_LEDS_GPIO
  193. &pcm027_led_dev
  194. #endif
  195. };
  196. /*
  197. * pcm027_init - breath some life into the board
  198. */
  199. static void __init pcm027_init(void)
  200. {
  201. /* system bus arbiter setting
  202. * - Core_Park
  203. * - LCD_wt:DMA_wt:CORE_Wt = 2:3:4
  204. */
  205. ARB_CNTRL = ARB_CORE_PARK | 0x234;
  206. pxa2xx_mfp_config(pcm027_pin_config, ARRAY_SIZE(pcm027_pin_config));
  207. pxa_set_ffuart_info(NULL);
  208. pxa_set_btuart_info(NULL);
  209. pxa_set_stuart_info(NULL);
  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. pxa27x_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. .atag_offset = 0x100,
  233. .map_io = pcm027_map_io,
  234. .nr_irqs = PCM027_NR_IRQS,
  235. .init_irq = pxa27x_init_irq,
  236. .handle_irq = pxa27x_handle_irq,
  237. .init_time = pxa_timer_init,
  238. .init_machine = pcm027_init,
  239. .restart = pxa_restart,
  240. MACHINE_END