colibri-pxa270.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. *
  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 <linux/gpio.h>
  23. #include <asm/mach-types.h>
  24. #include <mach/hardware.h>
  25. #include <asm/irq.h>
  26. #include <asm/sizes.h>
  27. #include <asm/mach/arch.h>
  28. #include <asm/mach/map.h>
  29. #include <asm/mach/irq.h>
  30. #include <asm/mach/flash.h>
  31. #include <mach/pxa27x.h>
  32. #include <mach/colibri.h>
  33. #include "generic.h"
  34. #include "devices.h"
  35. /*
  36. * GPIO configuration
  37. */
  38. static mfp_cfg_t colibri_pxa270_pin_config[] __initdata = {
  39. GPIO78_nCS_2, /* Ethernet CS */
  40. GPIO114_GPIO, /* Ethernet IRQ */
  41. };
  42. /*
  43. * NOR flash
  44. */
  45. static struct mtd_partition colibri_partitions[] = {
  46. {
  47. .name = "Bootloader",
  48. .offset = 0x00000000,
  49. .size = 0x00040000,
  50. .mask_flags = MTD_WRITEABLE /* force read-only */
  51. }, {
  52. .name = "Kernel",
  53. .offset = 0x00040000,
  54. .size = 0x00400000,
  55. .mask_flags = 0
  56. }, {
  57. .name = "Rootfs",
  58. .offset = 0x00440000,
  59. .size = MTDPART_SIZ_FULL,
  60. .mask_flags = 0
  61. }
  62. };
  63. static struct physmap_flash_data colibri_flash_data[] = {
  64. {
  65. .width = 4, /* bankwidth in bytes */
  66. .parts = colibri_partitions,
  67. .nr_parts = ARRAY_SIZE(colibri_partitions)
  68. }
  69. };
  70. static struct resource colibri_pxa270_flash_resource = {
  71. .start = PXA_CS0_PHYS,
  72. .end = PXA_CS0_PHYS + SZ_32M - 1,
  73. .flags = IORESOURCE_MEM,
  74. };
  75. static struct platform_device colibri_pxa270_flash_device = {
  76. .name = "physmap-flash",
  77. .id = 0,
  78. .dev = {
  79. .platform_data = colibri_flash_data,
  80. },
  81. .resource = &colibri_pxa270_flash_resource,
  82. .num_resources = 1,
  83. };
  84. /*
  85. * DM9000 Ethernet
  86. */
  87. #if defined(CONFIG_DM9000)
  88. static struct resource dm9000_resources[] = {
  89. [0] = {
  90. .start = COLIBRI_PXA270_ETH_PHYS,
  91. .end = COLIBRI_PXA270_ETH_PHYS + 3,
  92. .flags = IORESOURCE_MEM,
  93. },
  94. [1] = {
  95. .start = COLIBRI_PXA270_ETH_PHYS + 4,
  96. .end = COLIBRI_PXA270_ETH_PHYS + 4 + 500,
  97. .flags = IORESOURCE_MEM,
  98. },
  99. [2] = {
  100. .start = COLIBRI_PXA270_ETH_IRQ,
  101. .end = COLIBRI_PXA270_ETH_IRQ,
  102. .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
  103. },
  104. };
  105. static struct platform_device dm9000_device = {
  106. .name = "dm9000",
  107. .id = -1,
  108. .num_resources = ARRAY_SIZE(dm9000_resources),
  109. .resource = dm9000_resources,
  110. };
  111. #endif /* CONFIG_DM9000 */
  112. static struct platform_device *colibri_pxa270_devices[] __initdata = {
  113. &colibri_pxa270_flash_device,
  114. #if defined(CONFIG_DM9000)
  115. &dm9000_device,
  116. #endif
  117. };
  118. static void __init colibri_pxa270_init(void)
  119. {
  120. pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa270_pin_config));
  121. platform_add_devices(ARRAY_AND_SIZE(colibri_pxa270_devices));
  122. }
  123. MACHINE_START(COLIBRI, "Toradex Colibri PXA270")
  124. .phys_io = 0x40000000,
  125. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  126. .boot_params = COLIBRI_SDRAM_BASE + 0x100,
  127. .init_machine = colibri_pxa270_init,
  128. .map_io = pxa_map_io,
  129. .init_irq = pxa27x_init_irq,
  130. .timer = &pxa_timer,
  131. MACHINE_END