colibri-pxa270.c 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. /*
  2. * linux/arch/arm/mach-pxa/colibri-pxa270.c
  3. *
  4. * Support for Toradex PXA270 based Colibri module
  5. * Daniel Mack <daniel@caiaq.de>
  6. * Marek Vasut <marek.vasut@gmail.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #include <linux/init.h>
  13. #include <linux/interrupt.h>
  14. #include <linux/kernel.h>
  15. #include <linux/mtd/mtd.h>
  16. #include <linux/mtd/partitions.h>
  17. #include <linux/mtd/physmap.h>
  18. #include <linux/platform_device.h>
  19. #include <linux/sysdev.h>
  20. #include <linux/ucb1400.h>
  21. #include <asm/mach/arch.h>
  22. #include <asm/mach/flash.h>
  23. #include <asm/mach-types.h>
  24. #include <asm/sizes.h>
  25. #include <mach/audio.h>
  26. #include <mach/colibri.h>
  27. #include <mach/pxa27x.h>
  28. #include "devices.h"
  29. #include "generic.h"
  30. /******************************************************************************
  31. * Pin configuration
  32. ******************************************************************************/
  33. static mfp_cfg_t colibri_pxa270_pin_config[] __initdata = {
  34. /* Ethernet */
  35. GPIO78_nCS_2, /* Ethernet CS */
  36. GPIO114_GPIO, /* Ethernet IRQ */
  37. /* AC97 */
  38. GPIO28_AC97_BITCLK,
  39. GPIO29_AC97_SDATA_IN_0,
  40. GPIO30_AC97_SDATA_OUT,
  41. GPIO31_AC97_SYNC,
  42. GPIO95_AC97_nRESET,
  43. GPIO98_AC97_SYSCLK,
  44. GPIO113_GPIO, /* Touchscreen IRQ */
  45. };
  46. /******************************************************************************
  47. * NOR Flash
  48. ******************************************************************************/
  49. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  50. static struct mtd_partition colibri_partitions[] = {
  51. {
  52. .name = "Bootloader",
  53. .offset = 0x00000000,
  54. .size = 0x00040000,
  55. .mask_flags = MTD_WRITEABLE /* force read-only */
  56. }, {
  57. .name = "Kernel",
  58. .offset = 0x00040000,
  59. .size = 0x00400000,
  60. .mask_flags = 0
  61. }, {
  62. .name = "Rootfs",
  63. .offset = 0x00440000,
  64. .size = MTDPART_SIZ_FULL,
  65. .mask_flags = 0
  66. }
  67. };
  68. static struct physmap_flash_data colibri_flash_data[] = {
  69. {
  70. .width = 4, /* bankwidth in bytes */
  71. .parts = colibri_partitions,
  72. .nr_parts = ARRAY_SIZE(colibri_partitions)
  73. }
  74. };
  75. static struct resource colibri_pxa270_flash_resource = {
  76. .start = PXA_CS0_PHYS,
  77. .end = PXA_CS0_PHYS + SZ_32M - 1,
  78. .flags = IORESOURCE_MEM,
  79. };
  80. static struct platform_device colibri_pxa270_flash_device = {
  81. .name = "physmap-flash",
  82. .id = 0,
  83. .dev = {
  84. .platform_data = colibri_flash_data,
  85. },
  86. .resource = &colibri_pxa270_flash_resource,
  87. .num_resources = 1,
  88. };
  89. static void __init colibri_pxa270_nor_init(void)
  90. {
  91. platform_device_register(&colibri_pxa270_flash_device);
  92. }
  93. #else
  94. static inline void colibri_pxa270_nor_init(void) {}
  95. #endif
  96. /******************************************************************************
  97. * Ethernet
  98. ******************************************************************************/
  99. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  100. static struct resource colibri_pxa270_dm9000_resources[] = {
  101. {
  102. .start = PXA_CS2_PHYS,
  103. .end = PXA_CS2_PHYS + 3,
  104. .flags = IORESOURCE_MEM,
  105. },
  106. {
  107. .start = PXA_CS2_PHYS + 4,
  108. .end = PXA_CS2_PHYS + 4 + 500,
  109. .flags = IORESOURCE_MEM,
  110. },
  111. {
  112. .start = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ),
  113. .end = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ),
  114. .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
  115. },
  116. };
  117. static struct platform_device colibri_pxa270_dm9000_device = {
  118. .name = "dm9000",
  119. .id = -1,
  120. .num_resources = ARRAY_SIZE(colibri_pxa270_dm9000_resources),
  121. .resource = colibri_pxa270_dm9000_resources,
  122. };
  123. static void __init colibri_pxa270_eth_init(void)
  124. {
  125. platform_device_register(&colibri_pxa270_dm9000_device);
  126. }
  127. #else
  128. static inline void colibri_pxa270_eth_init(void) {}
  129. #endif
  130. /******************************************************************************
  131. * Audio and Touchscreen
  132. ******************************************************************************/
  133. #if defined(CONFIG_TOUCHSCREEN_UCB1400) || \
  134. defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)
  135. static pxa2xx_audio_ops_t colibri_pxa270_ac97_pdata = {
  136. .reset_gpio = 95,
  137. };
  138. static struct ucb1400_pdata colibri_pxa270_ucb1400_pdata = {
  139. .irq = gpio_to_irq(GPIO113_COLIBRI_PXA270_TS_IRQ),
  140. };
  141. static struct platform_device colibri_pxa270_ucb1400_device = {
  142. .name = "ucb1400_core",
  143. .id = -1,
  144. .dev = {
  145. .platform_data = &colibri_pxa270_ucb1400_pdata,
  146. },
  147. };
  148. static void __init colibri_pxa270_tsc_init(void)
  149. {
  150. pxa_set_ac97_info(&colibri_pxa270_ac97_pdata);
  151. platform_device_register(&colibri_pxa270_ucb1400_device);
  152. }
  153. #else
  154. static inline void colibri_pxa270_tsc_init(void) {}
  155. #endif
  156. static int colibri_pxa270_baseboard;
  157. core_param(colibri_pxa270_baseboard, colibri_pxa270_baseboard, int, 0444);
  158. static void __init colibri_pxa270_init(void)
  159. {
  160. pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa270_pin_config));
  161. colibri_pxa270_nor_init();
  162. colibri_pxa270_eth_init();
  163. colibri_pxa270_tsc_init();
  164. switch (colibri_pxa270_baseboard) {
  165. case COLIBRI_PXA270_EVALBOARD:
  166. colibri_pxa270_evalboard_init();
  167. break;
  168. case COLIBRI_PXA270_INCOME:
  169. colibri_pxa270_income_boardinit();
  170. break;
  171. default:
  172. printk(KERN_ERR "Illegal colibri_pxa270_baseboard type %d\n",
  173. colibri_pxa270_baseboard);
  174. }
  175. }
  176. /* The "Income s.r.o. SH-Dmaster PXA270 SBC" board can be booted either
  177. * with the INCOME mach type or with COLIBRI and the kernel parameter
  178. * "colibri_pxa270_baseboard=1"
  179. */
  180. static void __init colibri_pxa270_income_init(void)
  181. {
  182. colibri_pxa270_baseboard = COLIBRI_PXA270_INCOME;
  183. colibri_pxa270_init();
  184. }
  185. MACHINE_START(COLIBRI, "Toradex Colibri PXA270")
  186. .phys_io = 0x40000000,
  187. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  188. .boot_params = COLIBRI_SDRAM_BASE + 0x100,
  189. .init_machine = colibri_pxa270_init,
  190. .map_io = pxa_map_io,
  191. .init_irq = pxa27x_init_irq,
  192. .timer = &pxa_timer,
  193. MACHINE_END
  194. MACHINE_START(INCOME, "Income s.r.o. SH-Dmaster PXA270 SBC")
  195. .phys_io = 0x40000000,
  196. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  197. .boot_params = 0xa0000100,
  198. .init_machine = colibri_pxa270_income_init,
  199. .map_io = pxa_map_io,
  200. .init_irq = pxa27x_init_irq,
  201. .timer = &pxa_timer,
  202. MACHINE_END