colibri.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /*
  2. * linux/arch/arm/mach-pxa/colibri.c
  3. *
  4. * Support for Toradex PXA27x based Colibri module
  5. * Daniel Mack <daniel@caiaq.de>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #include <linux/init.h>
  12. #include <linux/kernel.h>
  13. #include <linux/platform_device.h>
  14. #include <linux/sysdev.h>
  15. #include <linux/interrupt.h>
  16. #include <linux/bitops.h>
  17. #include <linux/ioport.h>
  18. #include <linux/delay.h>
  19. #include <linux/mtd/mtd.h>
  20. #include <linux/mtd/partitions.h>
  21. #include <linux/mtd/physmap.h>
  22. #include <asm/mach-types.h>
  23. #include <mach/hardware.h>
  24. #include <asm/irq.h>
  25. #include <asm/sizes.h>
  26. #include <asm/mach/arch.h>
  27. #include <asm/mach/map.h>
  28. #include <asm/mach/irq.h>
  29. #include <asm/mach/flash.h>
  30. #include <mach/pxa-regs.h>
  31. #include <mach/mfp-pxa27x.h>
  32. #include <mach/colibri.h>
  33. #include "generic.h"
  34. #include "devices.h"
  35. static unsigned long colibri_pin_config[] __initdata = {
  36. GPIO78_nCS_2, /* Ethernet CS */
  37. GPIO114_GPIO, /* Ethernet IRQ */
  38. };
  39. /*
  40. * Flash
  41. */
  42. static struct mtd_partition colibri_partitions[] = {
  43. {
  44. .name = "Bootloader",
  45. .offset = 0x00000000,
  46. .size = 0x00040000,
  47. .mask_flags = MTD_WRITEABLE /* force read-only */
  48. }, {
  49. .name = "Kernel",
  50. .offset = 0x00040000,
  51. .size = 0x00400000,
  52. .mask_flags = 0
  53. }, {
  54. .name = "Rootfs",
  55. .offset = 0x00440000,
  56. .size = MTDPART_SIZ_FULL,
  57. .mask_flags = 0
  58. }
  59. };
  60. static struct physmap_flash_data colibri_flash_data[] = {
  61. {
  62. .width = 4, /* bankwidth in bytes */
  63. .parts = colibri_partitions,
  64. .nr_parts = ARRAY_SIZE(colibri_partitions)
  65. }
  66. };
  67. static struct resource flash_resource = {
  68. .start = PXA_CS0_PHYS,
  69. .end = PXA_CS0_PHYS + SZ_32M - 1,
  70. .flags = IORESOURCE_MEM,
  71. };
  72. static struct platform_device flash_device = {
  73. .name = "physmap-flash",
  74. .id = 0,
  75. .dev = {
  76. .platform_data = colibri_flash_data,
  77. },
  78. .resource = &flash_resource,
  79. .num_resources = 1,
  80. };
  81. /*
  82. * DM9000 Ethernet
  83. */
  84. static struct resource dm9000_resources[] = {
  85. [0] = {
  86. .start = COLIBRI_ETH_PHYS,
  87. .end = COLIBRI_ETH_PHYS + 3,
  88. .flags = IORESOURCE_MEM,
  89. },
  90. [1] = {
  91. .start = COLIBRI_ETH_PHYS + 4,
  92. .end = COLIBRI_ETH_PHYS + 4 + 500,
  93. .flags = IORESOURCE_MEM,
  94. },
  95. [2] = {
  96. .start = COLIBRI_ETH_IRQ,
  97. .end = COLIBRI_ETH_IRQ,
  98. .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
  99. },
  100. };
  101. static struct platform_device dm9000_device = {
  102. .name = "dm9000",
  103. .id = -1,
  104. .num_resources = ARRAY_SIZE(dm9000_resources),
  105. .resource = dm9000_resources,
  106. };
  107. static struct platform_device *colibri_devices[] __initdata = {
  108. &flash_device,
  109. &dm9000_device,
  110. };
  111. static void __init colibri_init(void)
  112. {
  113. pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_pin_config));
  114. platform_add_devices(colibri_devices, ARRAY_SIZE(colibri_devices));
  115. }
  116. MACHINE_START(COLIBRI, "Toradex Colibri PXA27x")
  117. .phys_io = 0x40000000,
  118. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  119. .boot_params = COLIBRI_SDRAM_BASE + 0x100,
  120. .init_machine = colibri_init,
  121. .map_io = pxa_map_io,
  122. .init_irq = pxa27x_init_irq,
  123. .timer = &pxa_timer,
  124. MACHINE_END