colibri-pxa270.c 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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. };
  53. /******************************************************************************
  54. * NOR Flash
  55. ******************************************************************************/
  56. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  57. static struct mtd_partition colibri_partitions[] = {
  58. {
  59. .name = "Bootloader",
  60. .offset = 0x00000000,
  61. .size = 0x00040000,
  62. .mask_flags = MTD_WRITEABLE /* force read-only */
  63. }, {
  64. .name = "Kernel",
  65. .offset = 0x00040000,
  66. .size = 0x00400000,
  67. .mask_flags = 0
  68. }, {
  69. .name = "Rootfs",
  70. .offset = 0x00440000,
  71. .size = MTDPART_SIZ_FULL,
  72. .mask_flags = 0
  73. }
  74. };
  75. static struct physmap_flash_data colibri_flash_data[] = {
  76. {
  77. .width = 4, /* bankwidth in bytes */
  78. .parts = colibri_partitions,
  79. .nr_parts = ARRAY_SIZE(colibri_partitions)
  80. }
  81. };
  82. static struct resource colibri_pxa270_flash_resource = {
  83. .start = PXA_CS0_PHYS,
  84. .end = PXA_CS0_PHYS + SZ_32M - 1,
  85. .flags = IORESOURCE_MEM,
  86. };
  87. static struct platform_device colibri_pxa270_flash_device = {
  88. .name = "physmap-flash",
  89. .id = 0,
  90. .dev = {
  91. .platform_data = colibri_flash_data,
  92. },
  93. .resource = &colibri_pxa270_flash_resource,
  94. .num_resources = 1,
  95. };
  96. static void __init colibri_pxa270_nor_init(void)
  97. {
  98. platform_device_register(&colibri_pxa270_flash_device);
  99. }
  100. #else
  101. static inline void colibri_pxa270_nor_init(void) {}
  102. #endif
  103. /******************************************************************************
  104. * Ethernet
  105. ******************************************************************************/
  106. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  107. static struct resource colibri_pxa270_dm9000_resources[] = {
  108. [0] = {
  109. .start = PXA_CS2_PHYS,
  110. .end = PXA_CS2_PHYS + 3,
  111. .flags = IORESOURCE_MEM,
  112. },
  113. [1] = {
  114. .start = PXA_CS2_PHYS + 4,
  115. .end = PXA_CS2_PHYS + 4 + 500,
  116. .flags = IORESOURCE_MEM,
  117. },
  118. [2] = {
  119. .start = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ),
  120. .end = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ),
  121. .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
  122. },
  123. };
  124. static struct platform_device colibri_pxa270_dm9000_device = {
  125. .name = "dm9000",
  126. .id = -1,
  127. .num_resources = ARRAY_SIZE(colibri_pxa270_dm9000_resources),
  128. .resource = colibri_pxa270_dm9000_resources,
  129. };
  130. static void __init colibri_pxa270_eth_init(void)
  131. {
  132. platform_device_register(&colibri_pxa270_dm9000_device);
  133. }
  134. #else
  135. static inline void colibri_pxa270_eth_init(void) {}
  136. #endif
  137. /******************************************************************************
  138. * SD/MMC card controller
  139. ******************************************************************************/
  140. #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
  141. static struct pxamci_platform_data colibri_pxa270_mci_platform_data = {
  142. .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
  143. .gpio_power = -1,
  144. .gpio_card_detect = GPIO0_COLIBRI_PXA270_SD_DETECT,
  145. .gpio_card_ro = -1,
  146. .detect_delay_ms = 200,
  147. };
  148. static void __init colibri_pxa270_mmc_init(void)
  149. {
  150. pxa_set_mci_info(&colibri_pxa270_mci_platform_data);
  151. }
  152. #else
  153. static inline void colibri_pxa270_mmc_init(void) {}
  154. #endif
  155. static void __init colibri_pxa270_init(void)
  156. {
  157. pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa270_pin_config));
  158. pxa_set_ffuart_info(NULL);
  159. pxa_set_btuart_info(NULL);
  160. pxa_set_stuart_info(NULL);
  161. colibri_pxa270_nor_init();
  162. colibri_pxa270_eth_init();
  163. colibri_pxa270_mmc_init();
  164. }
  165. MACHINE_START(COLIBRI, "Toradex Colibri PXA270")
  166. .phys_io = 0x40000000,
  167. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  168. .boot_params = COLIBRI_SDRAM_BASE + 0x100,
  169. .init_machine = colibri_pxa270_init,
  170. .map_io = pxa_map_io,
  171. .init_irq = pxa27x_init_irq,
  172. .timer = &pxa_timer,
  173. MACHINE_END