pleb.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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] = DEFINE_RES_MEM(PLEB_ETH0_P, 0x04000000),
  31. #if 0 /* Autoprobe instead, to get rising/falling edge characteristic right */
  32. [1] = DEFINE_RES_IRQ(IRQ_GPIO_ETH0_IRQ),
  33. #endif
  34. };
  35. static struct platform_device smc91x_device = {
  36. .name = "smc91x",
  37. .id = 0,
  38. .num_resources = ARRAY_SIZE(smc91x_resources),
  39. .resource = smc91x_resources,
  40. };
  41. static struct platform_device *devices[] __initdata = {
  42. &smc91x_device,
  43. };
  44. /*
  45. * Pleb's memory map
  46. * has flash memory (typically 4 or 8 meg) selected by
  47. * the two SA1100 lowest chip select outputs.
  48. */
  49. static struct resource pleb_flash_resources[] = {
  50. [0] = DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_8M),
  51. [1] = DEFINE_RES_MEM(SA1100_CS1_PHYS, SZ_8M),
  52. };
  53. static struct mtd_partition pleb_partitions[] = {
  54. {
  55. .name = "blob",
  56. .offset = 0,
  57. .size = 0x00020000,
  58. }, {
  59. .name = "kernel",
  60. .offset = MTDPART_OFS_APPEND,
  61. .size = 0x000e0000,
  62. }, {
  63. .name = "rootfs",
  64. .offset = MTDPART_OFS_APPEND,
  65. .size = 0x00300000,
  66. }
  67. };
  68. static struct flash_platform_data pleb_flash_data = {
  69. .map_name = "cfi_probe",
  70. .parts = pleb_partitions,
  71. .nr_parts = ARRAY_SIZE(pleb_partitions),
  72. };
  73. static void __init pleb_init(void)
  74. {
  75. sa11x0_register_mtd(&pleb_flash_data, pleb_flash_resources,
  76. ARRAY_SIZE(pleb_flash_resources));
  77. platform_add_devices(devices, ARRAY_SIZE(devices));
  78. }
  79. static void __init pleb_map_io(void)
  80. {
  81. sa1100_map_io();
  82. sa1100_register_uart(0, 3);
  83. sa1100_register_uart(1, 1);
  84. GAFR |= (GPIO_UART_TXD | GPIO_UART_RXD);
  85. GPDR |= GPIO_UART_TXD;
  86. GPDR &= ~GPIO_UART_RXD;
  87. PPAR |= PPAR_UPR;
  88. /*
  89. * Fix expansion memory timing for network card
  90. */
  91. MECR = ((2<<10) | (2<<5) | (2<<0));
  92. /*
  93. * Enable the SMC ethernet controller
  94. */
  95. GPDR |= GPIO_ETH0_EN; /* set to output */
  96. GPCR = GPIO_ETH0_EN; /* clear MCLK (enable smc) */
  97. GPDR &= ~GPIO_ETH0_IRQ;
  98. irq_set_irq_type(GPIO_ETH0_IRQ, IRQ_TYPE_EDGE_FALLING);
  99. }
  100. MACHINE_START(PLEB, "PLEB")
  101. .map_io = pleb_map_io,
  102. .nr_irqs = SA1100_NR_IRQS,
  103. .init_irq = sa1100_init_irq,
  104. .timer = &sa1100_timer,
  105. .init_machine = pleb_init,
  106. .restart = sa11x0_restart,
  107. MACHINE_END