pcm027.c 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  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 <asm/arch/hardware.h>
  31. #include <asm/arch/pxa-regs.h>
  32. #include <asm/arch/pxa2xx-gpio.h>
  33. #include <asm/arch/pxa2xx-regs.h>
  34. #include <asm/arch/pxa2xx_spi.h>
  35. #include <asm/arch/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. /*
  86. * SMC91x network controller specific stuff
  87. */
  88. static struct resource smc91x_resources[] = {
  89. [0] = {
  90. .start = PCM027_ETH_PHYS + 0x300,
  91. .end = PCM027_ETH_PHYS + PCM027_ETH_SIZE,
  92. .flags = IORESOURCE_MEM,
  93. },
  94. [1] = {
  95. .start = PCM027_ETH_IRQ,
  96. .end = PCM027_ETH_IRQ,
  97. /* note: smc91x's driver doesn't use the trigger bits yet */
  98. .flags = IORESOURCE_IRQ | PCM027_ETH_IRQ_EDGE,
  99. }
  100. };
  101. static struct platform_device smc91x_device = {
  102. .name = "smc91x",
  103. .id = 0,
  104. .num_resources = ARRAY_SIZE(smc91x_resources),
  105. .resource = smc91x_resources,
  106. };
  107. /*
  108. * SPI host and devices
  109. */
  110. static struct pxa2xx_spi_master pxa_ssp_master_info = {
  111. .num_chipselect = 1,
  112. };
  113. static struct max7301_platform_data max7301_info = {
  114. .base = -1,
  115. };
  116. /* bus_num must match id in pxa2xx_set_spi_info() call */
  117. static struct spi_board_info spi_board_info[] __initdata = {
  118. {
  119. .modalias = "max7301",
  120. .platform_data = &max7301_info,
  121. .max_speed_hz = 13000000,
  122. .bus_num = 1,
  123. .chip_select = 0,
  124. .mode = SPI_MODE_0,
  125. },
  126. };
  127. /*
  128. * NOR flash
  129. */
  130. static struct physmap_flash_data pcm027_flash_data = {
  131. .width = 4,
  132. };
  133. static struct resource pcm027_flash_resource = {
  134. .start = PCM027_FLASH_PHYS,
  135. .end = PCM027_FLASH_PHYS + PCM027_FLASH_SIZE - 1 ,
  136. .flags = IORESOURCE_MEM,
  137. };
  138. static struct platform_device pcm027_flash = {
  139. .name = "physmap-flash",
  140. .id = 0,
  141. .dev = {
  142. .platform_data = &pcm027_flash_data,
  143. },
  144. .resource = &pcm027_flash_resource,
  145. .num_resources = 1,
  146. };
  147. #ifdef CONFIG_LEDS_GPIO
  148. static struct gpio_led pcm027_led[] = {
  149. {
  150. .name = "led0:red", /* FIXME */
  151. .gpio = PCM027_LED_CPU
  152. },
  153. {
  154. .name = "led1:green", /* FIXME */
  155. .gpio = PCM027_LED_HEARD_BEAT
  156. },
  157. };
  158. static struct gpio_led_platform_data pcm027_led_data = {
  159. .num_leds = ARRAY_SIZE(pcm027_led),
  160. .leds = pcm027_led
  161. };
  162. static struct platform_device pcm027_led_dev = {
  163. .name = "leds-gpio",
  164. .id = 0,
  165. .dev = {
  166. .platform_data = &pcm027_led_data,
  167. },
  168. };
  169. #endif /* CONFIG_LEDS_GPIO */
  170. /*
  171. * declare the available device resources on this board
  172. */
  173. static struct platform_device *devices[] __initdata = {
  174. &smc91x_device,
  175. &pcm027_flash,
  176. #ifdef CONFIG_LEDS_GPIO
  177. &pcm027_led_dev
  178. #endif
  179. };
  180. /*
  181. * pcm027_init - breath some life into the board
  182. */
  183. static void __init pcm027_init(void)
  184. {
  185. /* system bus arbiter setting
  186. * - Core_Park
  187. * - LCD_wt:DMA_wt:CORE_Wt = 2:3:4
  188. */
  189. ARB_CNTRL = ARB_CORE_PARK | 0x234;
  190. platform_add_devices(devices, ARRAY_SIZE(devices));
  191. /* LEDs (on demand only) */
  192. #ifdef CONFIG_LEDS_GPIO
  193. pxa_gpio_mode(PCM027_LED_CPU | GPIO_OUT);
  194. pxa_gpio_mode(PCM027_LED_HEARD_BEAT | GPIO_OUT);
  195. #endif /* CONFIG_LEDS_GPIO */
  196. /* at last call the baseboard to initialize itself */
  197. #ifdef CONFIG_MACH_PCM990_BASEBOARD
  198. pcm990_baseboard_init();
  199. #endif
  200. pxa2xx_set_spi_info(1, &pxa_ssp_master_info);
  201. spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
  202. }
  203. static void __init pcm027_map_io(void)
  204. {
  205. pxa_map_io();
  206. /* initialize sleep mode regs (wake-up sources, etc) */
  207. PGSR0 = 0x01308000;
  208. PGSR1 = 0x00CF0002;
  209. PGSR2 = 0x0E294000;
  210. PGSR3 = 0x0000C000;
  211. PWER = 0x40000000 | PWER_GPIO0 | PWER_GPIO1;
  212. PRER = 0x00000000;
  213. PFER = 0x00000003;
  214. }
  215. MACHINE_START(PCM027, "Phytec Messtechnik GmbH phyCORE-PXA270")
  216. /* Maintainer: Pengutronix */
  217. .boot_params = 0xa0000100,
  218. .phys_io = 0x40000000,
  219. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  220. .map_io = pcm027_map_io,
  221. .init_irq = pxa27x_init_irq,
  222. .timer = &pxa_timer,
  223. .init_machine = pcm027_init,
  224. MACHINE_END