pcm027.c 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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/leds.h>
  27. #include <asm/mach-types.h>
  28. #include <asm/mach/arch.h>
  29. #include <asm/arch/hardware.h>
  30. #include <asm/arch/pxa-regs.h>
  31. #include <asm/arch/pxa2xx-gpio.h>
  32. #include <asm/arch/pxa2xx-regs.h>
  33. #include <asm/arch/pxa2xx_spi.h>
  34. #include <asm/arch/pcm027.h>
  35. #include "generic.h"
  36. /*
  37. * ABSTRACT:
  38. *
  39. * The PXA270 processor comes with a bunch of hardware on its silicon.
  40. * Not all of this hardware can be used at the same time and not all
  41. * is routed to module's connectors. Also it depends on the baseboard, what
  42. * kind of hardware can be used in which way.
  43. * -> So this file supports the main devices on the CPU card only!
  44. * Refer pcm990-baseboard.c how to extend this features to get a full
  45. * blown system with many common interfaces.
  46. *
  47. * The PCM-027 supports the following interfaces through its connectors and
  48. * will be used in pcm990-baseboard.c:
  49. *
  50. * - LCD support
  51. * - MMC support
  52. * - IDE/CF card
  53. * - FFUART
  54. * - BTUART
  55. * - IRUART
  56. * - AC97
  57. * - SSP
  58. * - SSP3
  59. *
  60. * Claimed GPIOs:
  61. * GPIO0 -> IRQ input from RTC
  62. * GPIO2 -> SYS_ENA*)
  63. * GPIO3 -> PWR_SCL
  64. * GPIO4 -> PWR_SDA
  65. * GPIO5 -> PowerCap0*)
  66. * GPIO6 -> PowerCap1*)
  67. * GPIO7 -> PowerCap2*)
  68. * GPIO8 -> PowerCap3*)
  69. * GPIO15 -> /CS1
  70. * GPIO20 -> /CS2
  71. * GPIO21 -> /CS3
  72. * GPIO33 -> /CS5 network controller select
  73. * GPIO52 -> IRQ from network controller
  74. * GPIO78 -> /CS2
  75. * GPIO80 -> /CS4
  76. * GPIO90 -> LED0
  77. * GPIO91 -> LED1
  78. * GPIO114 -> IRQ from CAN controller
  79. * GPIO117 -> SCL
  80. * GPIO118 -> SDA
  81. *
  82. * *) CPU internal use only
  83. */
  84. /*
  85. * SMC91x network controller specific stuff
  86. */
  87. static struct resource smc91x_resources[] = {
  88. [0] = {
  89. .start = PCM027_ETH_PHYS + 0x300,
  90. .end = PCM027_ETH_PHYS + PCM027_ETH_SIZE,
  91. .flags = IORESOURCE_MEM,
  92. },
  93. [1] = {
  94. .start = PCM027_ETH_IRQ,
  95. .end = PCM027_ETH_IRQ,
  96. /* note: smc91x's driver doesn't use the trigger bits yet */
  97. .flags = IORESOURCE_IRQ | PCM027_ETH_IRQ_EDGE,
  98. }
  99. };
  100. static struct platform_device smc91x_device = {
  101. .name = "smc91x",
  102. .id = 0,
  103. .num_resources = ARRAY_SIZE(smc91x_resources),
  104. .resource = smc91x_resources,
  105. };
  106. static struct physmap_flash_data pcm027_flash_data = {
  107. .width = 4,
  108. };
  109. static struct resource pcm027_flash_resource = {
  110. .start = PCM027_FLASH_PHYS,
  111. .end = PCM027_FLASH_PHYS + PCM027_FLASH_SIZE - 1 ,
  112. .flags = IORESOURCE_MEM,
  113. };
  114. static struct platform_device pcm027_flash = {
  115. .name = "physmap-flash",
  116. .id = 0,
  117. .dev = {
  118. .platform_data = &pcm027_flash_data,
  119. },
  120. .resource = &pcm027_flash_resource,
  121. .num_resources = 1,
  122. };
  123. #ifdef CONFIG_LEDS_GPIO
  124. static struct gpio_led pcm027_led[] = {
  125. {
  126. .name = "led0:red", /* FIXME */
  127. .gpio = PCM027_LED_CPU
  128. },
  129. {
  130. .name = "led1:green", /* FIXME */
  131. .gpio = PCM027_LED_HEARD_BEAT
  132. },
  133. };
  134. static struct gpio_led_platform_data pcm027_led_data = {
  135. .num_leds = ARRAY_SIZE(pcm027_led),
  136. .leds = pcm027_led
  137. };
  138. static struct platform_device pcm027_led_dev = {
  139. .name = "leds-gpio",
  140. .id = 0,
  141. .dev = {
  142. .platform_data = &pcm027_led_data,
  143. },
  144. };
  145. #endif /* CONFIG_LEDS_GPIO */
  146. /*
  147. * declare the available device resources on this board
  148. */
  149. static struct platform_device *devices[] __initdata = {
  150. &smc91x_device,
  151. &pcm027_flash,
  152. #ifdef CONFIG_LEDS_GPIO
  153. &pcm027_led_dev
  154. #endif
  155. };
  156. /*
  157. * pcm027_init - breath some life into the board
  158. */
  159. static void __init pcm027_init(void)
  160. {
  161. /* system bus arbiter setting
  162. * - Core_Park
  163. * - LCD_wt:DMA_wt:CORE_Wt = 2:3:4
  164. */
  165. ARB_CNTRL = ARB_CORE_PARK | 0x234;
  166. platform_add_devices(devices, ARRAY_SIZE(devices));
  167. /* LEDs (on demand only) */
  168. #ifdef CONFIG_LEDS_GPIO
  169. pxa_gpio_mode(PCM027_LED_CPU | GPIO_OUT);
  170. pxa_gpio_mode(PCM027_LED_HEARD_BEAT | GPIO_OUT);
  171. #endif /* CONFIG_LEDS_GPIO */
  172. /* at last call the baseboard to initialize itself */
  173. #ifdef CONFIG_MACH_PCM990_BASEBOARD
  174. pcm990_baseboard_init();
  175. #endif
  176. }
  177. static void __init pcm027_map_io(void)
  178. {
  179. pxa_map_io();
  180. /* initialize sleep mode regs (wake-up sources, etc) */
  181. PGSR0 = 0x01308000;
  182. PGSR1 = 0x00CF0002;
  183. PGSR2 = 0x0E294000;
  184. PGSR3 = 0x0000C000;
  185. PWER = 0x40000000 | PWER_GPIO0 | PWER_GPIO1;
  186. PRER = 0x00000000;
  187. PFER = 0x00000003;
  188. }
  189. MACHINE_START(PCM027, "Phytec Messtechnik GmbH phyCORE-PXA270")
  190. /* Maintainer: Pengutronix */
  191. .boot_params = 0xa0000100,
  192. .phys_io = 0x40000000,
  193. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  194. .map_io = pcm027_map_io,
  195. .init_irq = pxa27x_init_irq,
  196. .timer = &pxa_timer,
  197. .init_machine = pcm027_init,
  198. MACHINE_END