colibri-pxa270.c 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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 "generic.h"
  35. #include "devices.h"
  36. /******************************************************************************
  37. * Pin configuration
  38. ******************************************************************************/
  39. static mfp_cfg_t colibri_pxa270_pin_config[] __initdata = {
  40. /* Ethernet */
  41. GPIO78_nCS_2, /* Ethernet CS */
  42. GPIO114_GPIO, /* Ethernet IRQ */
  43. };
  44. /******************************************************************************
  45. * NOR Flash
  46. ******************************************************************************/
  47. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  48. static struct mtd_partition colibri_partitions[] = {
  49. {
  50. .name = "Bootloader",
  51. .offset = 0x00000000,
  52. .size = 0x00040000,
  53. .mask_flags = MTD_WRITEABLE /* force read-only */
  54. }, {
  55. .name = "Kernel",
  56. .offset = 0x00040000,
  57. .size = 0x00400000,
  58. .mask_flags = 0
  59. }, {
  60. .name = "Rootfs",
  61. .offset = 0x00440000,
  62. .size = MTDPART_SIZ_FULL,
  63. .mask_flags = 0
  64. }
  65. };
  66. static struct physmap_flash_data colibri_flash_data[] = {
  67. {
  68. .width = 4, /* bankwidth in bytes */
  69. .parts = colibri_partitions,
  70. .nr_parts = ARRAY_SIZE(colibri_partitions)
  71. }
  72. };
  73. static struct resource colibri_pxa270_flash_resource = {
  74. .start = PXA_CS0_PHYS,
  75. .end = PXA_CS0_PHYS + SZ_32M - 1,
  76. .flags = IORESOURCE_MEM,
  77. };
  78. static struct platform_device colibri_pxa270_flash_device = {
  79. .name = "physmap-flash",
  80. .id = 0,
  81. .dev = {
  82. .platform_data = colibri_flash_data,
  83. },
  84. .resource = &colibri_pxa270_flash_resource,
  85. .num_resources = 1,
  86. };
  87. static void __init colibri_pxa270_nor_init(void)
  88. {
  89. platform_device_register(&colibri_pxa270_flash_device);
  90. }
  91. #else
  92. static inline void colibri_pxa270_nor_init(void) {}
  93. #endif
  94. /******************************************************************************
  95. * Ethernet
  96. ******************************************************************************/
  97. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  98. static struct resource colibri_pxa270_dm9000_resources[] = {
  99. [0] = {
  100. .start = PXA_CS2_PHYS,
  101. .end = PXA_CS2_PHYS + 3,
  102. .flags = IORESOURCE_MEM,
  103. },
  104. [1] = {
  105. .start = PXA_CS2_PHYS + 4,
  106. .end = PXA_CS2_PHYS + 4 + 500,
  107. .flags = IORESOURCE_MEM,
  108. },
  109. [2] = {
  110. .start = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ),
  111. .end = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ),
  112. .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
  113. },
  114. };
  115. static struct platform_device colibri_pxa270_dm9000_device = {
  116. .name = "dm9000",
  117. .id = -1,
  118. .num_resources = ARRAY_SIZE(colibri_pxa270_dm9000_resources),
  119. .resource = colibri_pxa270_dm9000_resources,
  120. };
  121. static void __init colibri_pxa270_eth_init(void)
  122. {
  123. platform_device_register(&colibri_pxa270_dm9000_device);
  124. }
  125. #else
  126. static inline void colibri_pxa270_eth_init(void) {}
  127. #endif
  128. static void __init colibri_pxa270_init(void)
  129. {
  130. pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa270_pin_config));
  131. pxa_set_ffuart_info(NULL);
  132. pxa_set_btuart_info(NULL);
  133. pxa_set_stuart_info(NULL);
  134. colibri_pxa270_nor_init();
  135. colibri_pxa270_eth_init();
  136. }
  137. MACHINE_START(COLIBRI, "Toradex Colibri PXA270")
  138. .phys_io = 0x40000000,
  139. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  140. .boot_params = COLIBRI_SDRAM_BASE + 0x100,
  141. .init_machine = colibri_pxa270_init,
  142. .map_io = pxa_map_io,
  143. .init_irq = pxa27x_init_irq,
  144. .timer = &pxa_timer,
  145. MACHINE_END