pleb.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /*
  2. * linux/arch/arm/mach-sa1100/pleb.c
  3. */
  4. #include <linux/init.h>
  5. #include <linux/kernel.h>
  6. #include <linux/tty.h>
  7. #include <linux/ioport.h>
  8. #include <linux/platform_device.h>
  9. #include <linux/irq.h>
  10. #include <linux/io.h>
  11. #include <linux/mtd/partitions.h>
  12. #include <mach/hardware.h>
  13. #include <asm/setup.h>
  14. #include <asm/mach-types.h>
  15. #include <asm/mach/arch.h>
  16. #include <asm/mach/map.h>
  17. #include <asm/mach/flash.h>
  18. #include <asm/mach/serial_sa1100.h>
  19. #include <mach/irqs.h>
  20. #include "generic.h"
  21. /*
  22. * Ethernet IRQ mappings
  23. */
  24. #define PLEB_ETH0_P (0x20000300) /* Ethernet 0 in PCMCIA0 IO */
  25. #define PLEB_ETH0_V (0xf6000300)
  26. #define GPIO_ETH0_IRQ GPIO_GPIO(21)
  27. #define GPIO_ETH0_EN GPIO_GPIO(26)
  28. #define IRQ_GPIO_ETH0_IRQ IRQ_GPIO21
  29. static struct resource smc91x_resources[] = {
  30. [0] = {
  31. .start = PLEB_ETH0_P,
  32. .end = PLEB_ETH0_P | 0x03ffffff,
  33. .flags = IORESOURCE_MEM,
  34. },
  35. #if 0 /* Autoprobe instead, to get rising/falling edge characteristic right */
  36. [1] = {
  37. .start = IRQ_GPIO_ETH0_IRQ,
  38. .end = IRQ_GPIO_ETH0_IRQ,
  39. .flags = IORESOURCE_IRQ,
  40. },
  41. #endif
  42. };
  43. static struct platform_device smc91x_device = {
  44. .name = "smc91x",
  45. .id = 0,
  46. .num_resources = ARRAY_SIZE(smc91x_resources),
  47. .resource = smc91x_resources,
  48. };
  49. static struct platform_device *devices[] __initdata = {
  50. &smc91x_device,
  51. };
  52. /*
  53. * Pleb's memory map
  54. * has flash memory (typically 4 or 8 meg) selected by
  55. * the two SA1100 lowest chip select outputs.
  56. */
  57. static struct resource pleb_flash_resources[] = {
  58. [0] = {
  59. .start = SA1100_CS0_PHYS,
  60. .end = SA1100_CS0_PHYS + SZ_8M - 1,
  61. .flags = IORESOURCE_MEM,
  62. },
  63. [1] = {
  64. .start = SA1100_CS1_PHYS,
  65. .end = SA1100_CS1_PHYS + SZ_8M - 1,
  66. .flags = IORESOURCE_MEM,
  67. }
  68. };
  69. static struct mtd_partition pleb_partitions[] = {
  70. {
  71. .name = "blob",
  72. .offset = 0,
  73. .size = 0x00020000,
  74. }, {
  75. .name = "kernel",
  76. .offset = MTDPART_OFS_APPEND,
  77. .size = 0x000e0000,
  78. }, {
  79. .name = "rootfs",
  80. .offset = MTDPART_OFS_APPEND,
  81. .size = 0x00300000,
  82. }
  83. };
  84. static struct flash_platform_data pleb_flash_data = {
  85. .map_name = "cfi_probe",
  86. .parts = pleb_partitions,
  87. .nr_parts = ARRAY_SIZE(pleb_partitions),
  88. };
  89. static void __init pleb_init(void)
  90. {
  91. sa11x0_register_mtd(&pleb_flash_data, pleb_flash_resources,
  92. ARRAY_SIZE(pleb_flash_resources));
  93. platform_add_devices(devices, ARRAY_SIZE(devices));
  94. }
  95. static void __init pleb_map_io(void)
  96. {
  97. sa1100_map_io();
  98. sa1100_register_uart(0, 3);
  99. sa1100_register_uart(1, 1);
  100. GAFR |= (GPIO_UART_TXD | GPIO_UART_RXD);
  101. GPDR |= GPIO_UART_TXD;
  102. GPDR &= ~GPIO_UART_RXD;
  103. PPAR |= PPAR_UPR;
  104. /*
  105. * Fix expansion memory timing for network card
  106. */
  107. MECR = ((2<<10) | (2<<5) | (2<<0));
  108. /*
  109. * Enable the SMC ethernet controller
  110. */
  111. GPDR |= GPIO_ETH0_EN; /* set to output */
  112. GPCR = GPIO_ETH0_EN; /* clear MCLK (enable smc) */
  113. GPDR &= ~GPIO_ETH0_IRQ;
  114. irq_set_irq_type(GPIO_ETH0_IRQ, IRQ_TYPE_EDGE_FALLING);
  115. }
  116. MACHINE_START(PLEB, "PLEB")
  117. .map_io = pleb_map_io,
  118. .init_irq = sa1100_init_irq,
  119. .timer = &sa1100_timer,
  120. .init_machine = pleb_init,
  121. MACHINE_END