pcm027.c 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * linux/arch/arm/mach-pxa/pcm027.c
  4. * Support for the Phytec phyCORE-PXA270 CPU card (aka PCM-027).
  5. *
  6. * Refer
  7. * http://www.phytec.com/products/sbc/ARM-XScale/phyCORE-XScale-PXA270.html
  8. * for additional hardware info
  9. *
  10. * Author: Juergen Kilb
  11. * Created: April 05, 2005
  12. * Copyright: Phytec Messtechnik GmbH
  13. * e-Mail: [email protected]
  14. *
  15. * based on Intel Mainstone Board
  16. *
  17. * Copyright 2007 Juergen Beisert @ Pengutronix ([email protected])
  18. */
  19. #include <linux/irq.h>
  20. #include <linux/platform_device.h>
  21. #include <linux/mtd/physmap.h>
  22. #include <linux/spi/spi.h>
  23. #include <linux/spi/max7301.h>
  24. #include <linux/spi/pxa2xx_spi.h>
  25. #include <linux/leds.h>
  26. #include <asm/mach-types.h>
  27. #include <asm/mach/arch.h>
  28. #include "pxa27x.h"
  29. #include "pcm027.h"
  30. #include "generic.h"
  31. /*
  32. * ABSTRACT:
  33. *
  34. * The PXA270 processor comes with a bunch of hardware on its silicon.
  35. * Not all of this hardware can be used at the same time and not all
  36. * is routed to module's connectors. Also it depends on the baseboard, what
  37. * kind of hardware can be used in which way.
  38. * -> So this file supports the main devices on the CPU card only!
  39. * Refer pcm990-baseboard.c how to extend this features to get a full
  40. * blown system with many common interfaces.
  41. *
  42. * The PCM-027 supports the following interfaces through its connectors and
  43. * will be used in pcm990-baseboard.c:
  44. *
  45. * - LCD support
  46. * - MMC support
  47. * - IDE/CF card
  48. * - FFUART
  49. * - BTUART
  50. * - IRUART
  51. * - AC97
  52. * - SSP
  53. * - SSP3
  54. *
  55. * Claimed GPIOs:
  56. * GPIO0 -> IRQ input from RTC
  57. * GPIO2 -> SYS_ENA*)
  58. * GPIO3 -> PWR_SCL
  59. * GPIO4 -> PWR_SDA
  60. * GPIO5 -> PowerCap0*)
  61. * GPIO6 -> PowerCap1*)
  62. * GPIO7 -> PowerCap2*)
  63. * GPIO8 -> PowerCap3*)
  64. * GPIO15 -> /CS1
  65. * GPIO20 -> /CS2
  66. * GPIO21 -> /CS3
  67. * GPIO33 -> /CS5 network controller select
  68. * GPIO52 -> IRQ from network controller
  69. * GPIO78 -> /CS2
  70. * GPIO80 -> /CS4
  71. * GPIO90 -> LED0
  72. * GPIO91 -> LED1
  73. * GPIO114 -> IRQ from CAN controller
  74. * GPIO117 -> SCL
  75. * GPIO118 -> SDA
  76. *
  77. * *) CPU internal use only
  78. */
  79. static unsigned long pcm027_pin_config[] __initdata = {
  80. /* Chip Selects */
  81. GPIO20_nSDCS_2,
  82. GPIO21_nSDCS_3,
  83. GPIO15_nCS_1,
  84. GPIO78_nCS_2,
  85. GPIO80_nCS_4,
  86. GPIO33_nCS_5, /* Ethernet */
  87. /* I2C */
  88. GPIO117_I2C_SCL,
  89. GPIO118_I2C_SDA,
  90. /* GPIO */
  91. GPIO52_GPIO, /* IRQ from network controller */
  92. #ifdef CONFIG_LEDS_GPIO
  93. GPIO90_GPIO, /* PCM027_LED_CPU */
  94. GPIO91_GPIO, /* PCM027_LED_HEART_BEAT */
  95. #endif
  96. GPIO114_GPIO, /* IRQ from CAN controller */
  97. };
  98. /*
  99. * SMC91x network controller specific stuff
  100. */
  101. static struct resource smc91x_resources[] = {
  102. [0] = {
  103. .start = PCM027_ETH_PHYS + 0x300,
  104. .end = PCM027_ETH_PHYS + PCM027_ETH_SIZE,
  105. .flags = IORESOURCE_MEM,
  106. },
  107. [1] = {
  108. .start = PCM027_ETH_IRQ,
  109. .end = PCM027_ETH_IRQ,
  110. /* note: smc91x's driver doesn't use the trigger bits yet */
  111. .flags = IORESOURCE_IRQ | PCM027_ETH_IRQ_EDGE,
  112. }
  113. };
  114. static struct platform_device smc91x_device = {
  115. .name = "smc91x",
  116. .id = 0,
  117. .num_resources = ARRAY_SIZE(smc91x_resources),
  118. .resource = smc91x_resources,
  119. };
  120. /*
  121. * SPI host and devices
  122. */
  123. static struct pxa2xx_spi_controller pxa_ssp_master_info = {
  124. .num_chipselect = 1,
  125. };
  126. static struct max7301_platform_data max7301_info = {
  127. .base = -1,
  128. };
  129. /* bus_num must match id in pxa2xx_set_spi_info() call */
  130. static struct spi_board_info spi_board_info[] __initdata = {
  131. {
  132. .modalias = "max7301",
  133. .platform_data = &max7301_info,
  134. .max_speed_hz = 13000000,
  135. .bus_num = 1,
  136. .chip_select = 0,
  137. .mode = SPI_MODE_0,
  138. },
  139. };
  140. /*
  141. * NOR flash
  142. */
  143. static struct physmap_flash_data pcm027_flash_data = {
  144. .width = 4,
  145. };
  146. static struct resource pcm027_flash_resource = {
  147. .start = PCM027_FLASH_PHYS,
  148. .end = PCM027_FLASH_PHYS + PCM027_FLASH_SIZE - 1 ,
  149. .flags = IORESOURCE_MEM,
  150. };
  151. static struct platform_device pcm027_flash = {
  152. .name = "physmap-flash",
  153. .id = 0,
  154. .dev = {
  155. .platform_data = &pcm027_flash_data,
  156. },
  157. .resource = &pcm027_flash_resource,
  158. .num_resources = 1,
  159. };
  160. #ifdef CONFIG_LEDS_GPIO
  161. static struct gpio_led pcm027_led[] = {
  162. {
  163. .name = "led0:red", /* FIXME */
  164. .gpio = PCM027_LED_CPU
  165. },
  166. {
  167. .name = "led1:green", /* FIXME */
  168. .gpio = PCM027_LED_HEARD_BEAT
  169. },
  170. };
  171. static struct gpio_led_platform_data pcm027_led_data = {
  172. .num_leds = ARRAY_SIZE(pcm027_led),
  173. .leds = pcm027_led
  174. };
  175. static struct platform_device pcm027_led_dev = {
  176. .name = "leds-gpio",
  177. .id = 0,
  178. .dev = {
  179. .platform_data = &pcm027_led_data,
  180. },
  181. };
  182. #endif /* CONFIG_LEDS_GPIO */
  183. /*
  184. * declare the available device resources on this board
  185. */
  186. static struct platform_device *devices[] __initdata = {
  187. &smc91x_device,
  188. &pcm027_flash,
  189. #ifdef CONFIG_LEDS_GPIO
  190. &pcm027_led_dev
  191. #endif
  192. };
  193. /*
  194. * pcm027_init - breath some life into the board
  195. */
  196. static void __init pcm027_init(void)
  197. {
  198. /* system bus arbiter setting
  199. * - Core_Park
  200. * - LCD_wt:DMA_wt:CORE_Wt = 2:3:4
  201. */
  202. ARB_CNTRL = ARB_CORE_PARK | 0x234;
  203. pxa2xx_mfp_config(pcm027_pin_config, ARRAY_SIZE(pcm027_pin_config));
  204. pxa_set_ffuart_info(NULL);
  205. pxa_set_btuart_info(NULL);
  206. pxa_set_stuart_info(NULL);
  207. platform_add_devices(devices, ARRAY_SIZE(devices));
  208. /* at last call the baseboard to initialize itself */
  209. #ifdef CONFIG_MACH_PCM990_BASEBOARD
  210. pcm990_baseboard_init();
  211. #endif
  212. pxa2xx_set_spi_info(1, &pxa_ssp_master_info);
  213. spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
  214. }
  215. static void __init pcm027_map_io(void)
  216. {
  217. pxa27x_map_io();
  218. /* initialize sleep mode regs (wake-up sources, etc) */
  219. PGSR0 = 0x01308000;
  220. PGSR1 = 0x00CF0002;
  221. PGSR2 = 0x0E294000;
  222. PGSR3 = 0x0000C000;
  223. PWER = 0x40000000 | PWER_GPIO0 | PWER_GPIO1;
  224. PRER = 0x00000000;
  225. PFER = 0x00000003;
  226. }
  227. MACHINE_START(PCM027, "Phytec Messtechnik GmbH phyCORE-PXA270")
  228. /* Maintainer: Pengutronix */
  229. .atag_offset = 0x100,
  230. .map_io = pcm027_map_io,
  231. .nr_irqs = PCM027_NR_IRQS,
  232. .init_irq = pxa27x_init_irq,
  233. .handle_irq = pxa27x_handle_irq,
  234. .init_time = pxa_timer_init,
  235. .init_machine = pcm027_init,
  236. .restart = pxa_restart,
  237. MACHINE_END