colibri.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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 <asm/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 <asm/arch/pxa-regs.h>
  31. #include <asm/arch/pxa2xx-gpio.h>
  32. #include <asm/arch/colibri.h>
  33. #include "generic.h"
  34. #include "devices.h"
  35. /*
  36. * Flash
  37. */
  38. static struct mtd_partition colibri_partitions[] = {
  39. {
  40. .name = "Bootloader",
  41. .offset = 0x00000000,
  42. .size = 0x00040000,
  43. .mask_flags = MTD_WRITEABLE /* force read-only */
  44. }, {
  45. .name = "Kernel",
  46. .offset = 0x00040000,
  47. .size = 0x00400000,
  48. .mask_flags = 0
  49. }, {
  50. .name = "Rootfs",
  51. .offset = 0x00440000,
  52. .size = MTDPART_SIZ_FULL,
  53. .mask_flags = 0
  54. }
  55. };
  56. static struct physmap_flash_data colibri_flash_data[] = {
  57. {
  58. .width = 4, /* bankwidth in bytes */
  59. .parts = colibri_partitions,
  60. .nr_parts = ARRAY_SIZE(colibri_partitions)
  61. }
  62. };
  63. static struct resource flash_resource = {
  64. .start = PXA_CS0_PHYS,
  65. .end = PXA_CS0_PHYS + SZ_32M - 1,
  66. .flags = IORESOURCE_MEM,
  67. };
  68. static struct platform_device flash_device = {
  69. .name = "physmap-flash",
  70. .id = 0,
  71. .dev = {
  72. .platform_data = colibri_flash_data,
  73. },
  74. .resource = &flash_resource,
  75. .num_resources = 1,
  76. };
  77. /*
  78. * DM9000 Ethernet
  79. */
  80. static struct resource dm9000_resources[] = {
  81. [0] = {
  82. .start = COLIBRI_ETH_PHYS,
  83. .end = COLIBRI_ETH_PHYS + 3,
  84. .flags = IORESOURCE_MEM,
  85. },
  86. [1] = {
  87. .start = COLIBRI_ETH_PHYS + 4,
  88. .end = COLIBRI_ETH_PHYS + 4 + 500,
  89. .flags = IORESOURCE_MEM,
  90. },
  91. [2] = {
  92. .start = COLIBRI_ETH_IRQ,
  93. .end = COLIBRI_ETH_IRQ,
  94. .flags = IORESOURCE_IRQ,
  95. },
  96. };
  97. static struct platform_device dm9000_device = {
  98. .name = "dm9000",
  99. .id = -1,
  100. .num_resources = ARRAY_SIZE(dm9000_resources),
  101. .resource = dm9000_resources,
  102. };
  103. static struct platform_device *colibri_devices[] __initdata = {
  104. &flash_device,
  105. &dm9000_device,
  106. };
  107. static void __init colibri_init(void)
  108. {
  109. /* DM9000 LAN */
  110. pxa_gpio_mode(GPIO78_nCS_2_MD);
  111. pxa_gpio_mode(GPIO_DM9000 | GPIO_IN);
  112. set_irq_type(COLIBRI_ETH_IRQ, IRQT_FALLING);
  113. platform_add_devices(colibri_devices, ARRAY_SIZE(colibri_devices));
  114. }
  115. MACHINE_START(COLIBRI, "Toradex Colibri PXA27x")
  116. .phys_io = 0x40000000,
  117. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  118. .boot_params = COLIBRI_SDRAM_BASE + 0x100,
  119. .init_machine = colibri_init,
  120. .map_io = pxa_map_io,
  121. .init_irq = pxa27x_init_irq,
  122. .timer = &pxa_timer,
  123. MACHINE_END