pcm027.c 5.1 KB

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