pcm027.c 5.1 KB

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