pleb.c 3.1 KB

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