colibri-pxa270.c 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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/kernel.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/sysdev.h>
  16. #include <linux/interrupt.h>
  17. #include <linux/bitops.h>
  18. #include <linux/ioport.h>
  19. #include <linux/delay.h>
  20. #include <linux/mtd/mtd.h>
  21. #include <linux/mtd/partitions.h>
  22. #include <linux/mtd/physmap.h>
  23. #include <linux/gpio.h>
  24. #include <asm/mach-types.h>
  25. #include <mach/hardware.h>
  26. #include <asm/irq.h>
  27. #include <asm/sizes.h>
  28. #include <asm/mach/arch.h>
  29. #include <asm/mach/map.h>
  30. #include <asm/mach/irq.h>
  31. #include <asm/mach/flash.h>
  32. #include <mach/pxa27x.h>
  33. #include <mach/colibri.h>
  34. #include <mach/mmc.h>
  35. #include "generic.h"
  36. #include "devices.h"
  37. /******************************************************************************
  38. * Pin configuration
  39. ******************************************************************************/
  40. static mfp_cfg_t colibri_pxa270_pin_config[] __initdata = {
  41. /* Ethernet */
  42. GPIO78_nCS_2, /* Ethernet CS */
  43. GPIO114_GPIO, /* Ethernet IRQ */
  44. /* MMC */
  45. GPIO32_MMC_CLK,
  46. GPIO92_MMC_DAT_0,
  47. GPIO109_MMC_DAT_1,
  48. GPIO110_MMC_DAT_2,
  49. GPIO111_MMC_DAT_3,
  50. GPIO112_MMC_CMD,
  51. GPIO0_GPIO, /* SD detect */
  52. /* FFUART */
  53. GPIO39_FFUART_TXD,
  54. GPIO34_FFUART_RXD,
  55. };
  56. /******************************************************************************
  57. * NOR Flash
  58. ******************************************************************************/
  59. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  60. static struct mtd_partition colibri_partitions[] = {
  61. {
  62. .name = "Bootloader",
  63. .offset = 0x00000000,
  64. .size = 0x00040000,
  65. .mask_flags = MTD_WRITEABLE /* force read-only */
  66. }, {
  67. .name = "Kernel",
  68. .offset = 0x00040000,
  69. .size = 0x00400000,
  70. .mask_flags = 0
  71. }, {
  72. .name = "Rootfs",
  73. .offset = 0x00440000,
  74. .size = MTDPART_SIZ_FULL,
  75. .mask_flags = 0
  76. }
  77. };
  78. static struct physmap_flash_data colibri_flash_data[] = {
  79. {
  80. .width = 4, /* bankwidth in bytes */
  81. .parts = colibri_partitions,
  82. .nr_parts = ARRAY_SIZE(colibri_partitions)
  83. }
  84. };
  85. static struct resource colibri_pxa270_flash_resource = {
  86. .start = PXA_CS0_PHYS,
  87. .end = PXA_CS0_PHYS + SZ_32M - 1,
  88. .flags = IORESOURCE_MEM,
  89. };
  90. static struct platform_device colibri_pxa270_flash_device = {
  91. .name = "physmap-flash",
  92. .id = 0,
  93. .dev = {
  94. .platform_data = colibri_flash_data,
  95. },
  96. .resource = &colibri_pxa270_flash_resource,
  97. .num_resources = 1,
  98. };
  99. static void __init colibri_pxa270_nor_init(void)
  100. {
  101. platform_device_register(&colibri_pxa270_flash_device);
  102. }
  103. #else
  104. static inline void colibri_pxa270_nor_init(void) {}
  105. #endif
  106. /******************************************************************************
  107. * Ethernet
  108. ******************************************************************************/
  109. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  110. static struct resource colibri_pxa270_dm9000_resources[] = {
  111. [0] = {
  112. .start = PXA_CS2_PHYS,
  113. .end = PXA_CS2_PHYS + 3,
  114. .flags = IORESOURCE_MEM,
  115. },
  116. [1] = {
  117. .start = PXA_CS2_PHYS + 4,
  118. .end = PXA_CS2_PHYS + 4 + 500,
  119. .flags = IORESOURCE_MEM,
  120. },
  121. [2] = {
  122. .start = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ),
  123. .end = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ),
  124. .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
  125. },
  126. };
  127. static struct platform_device colibri_pxa270_dm9000_device = {
  128. .name = "dm9000",
  129. .id = -1,
  130. .num_resources = ARRAY_SIZE(colibri_pxa270_dm9000_resources),
  131. .resource = colibri_pxa270_dm9000_resources,
  132. };
  133. static void __init colibri_pxa270_eth_init(void)
  134. {
  135. platform_device_register(&colibri_pxa270_dm9000_device);
  136. }
  137. #else
  138. static inline void colibri_pxa270_eth_init(void) {}
  139. #endif
  140. /******************************************************************************
  141. * SD/MMC card controller
  142. ******************************************************************************/
  143. #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
  144. static struct pxamci_platform_data colibri_pxa270_mci_platform_data = {
  145. .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
  146. .gpio_power = -1,
  147. .gpio_card_detect = GPIO0_COLIBRI_PXA270_SD_DETECT,
  148. .gpio_card_ro = -1,
  149. .detect_delay_ms = 200,
  150. };
  151. static void __init colibri_pxa270_mmc_init(void)
  152. {
  153. pxa_set_mci_info(&colibri_pxa270_mci_platform_data);
  154. }
  155. #else
  156. static inline void colibri_pxa270_mmc_init(void) {}
  157. #endif
  158. static void __init colibri_pxa270_init(void)
  159. {
  160. pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa270_pin_config));
  161. pxa_set_ffuart_info(NULL);
  162. pxa_set_btuart_info(NULL);
  163. pxa_set_stuart_info(NULL);
  164. colibri_pxa270_nor_init();
  165. colibri_pxa270_eth_init();
  166. colibri_pxa270_mmc_init();
  167. }
  168. MACHINE_START(COLIBRI, "Toradex Colibri PXA270")
  169. .phys_io = 0x40000000,
  170. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  171. .boot_params = COLIBRI_SDRAM_BASE + 0x100,
  172. .init_machine = colibri_pxa270_init,
  173. .map_io = pxa_map_io,
  174. .init_irq = pxa27x_init_irq,
  175. .timer = &pxa_timer,
  176. MACHINE_END