pleb.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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_data/sa11x0-serial.h>
  9. #include <linux/platform_device.h>
  10. #include <linux/irq.h>
  11. #include <linux/io.h>
  12. #include <linux/mtd/partitions.h>
  13. #include <linux/smc91x.h>
  14. #include <mach/hardware.h>
  15. #include <asm/setup.h>
  16. #include <asm/mach-types.h>
  17. #include <asm/mach/arch.h>
  18. #include <asm/mach/map.h>
  19. #include <asm/mach/flash.h>
  20. #include <mach/irqs.h>
  21. #include "generic.h"
  22. /*
  23. * Ethernet IRQ mappings
  24. */
  25. #define PLEB_ETH0_P (0x20000300) /* Ethernet 0 in PCMCIA0 IO */
  26. #define PLEB_ETH0_V (0xf6000300)
  27. #define GPIO_ETH0_IRQ GPIO_GPIO(21)
  28. #define GPIO_ETH0_EN GPIO_GPIO(26)
  29. #define IRQ_GPIO_ETH0_IRQ IRQ_GPIO21
  30. static struct resource smc91x_resources[] = {
  31. [0] = DEFINE_RES_MEM(PLEB_ETH0_P, 0x04000000),
  32. #if 0 /* Autoprobe instead, to get rising/falling edge characteristic right */
  33. [1] = DEFINE_RES_IRQ(IRQ_GPIO_ETH0_IRQ),
  34. #endif
  35. };
  36. static struct smc91x_platdata smc91x_platdata = {
  37. .flags = SMC91X_USE_16BIT | SMC91X_USE_8BIT | SMC91X_NOWAIT,
  38. };
  39. static struct platform_device smc91x_device = {
  40. .name = "smc91x",
  41. .id = 0,
  42. .num_resources = ARRAY_SIZE(smc91x_resources),
  43. .resource = smc91x_resources,
  44. .dev = {
  45. .platform_data = &smc91x_platdata,
  46. },
  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] = DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_8M),
  58. [1] = DEFINE_RES_MEM(SA1100_CS1_PHYS, SZ_8M),
  59. };
  60. static struct mtd_partition pleb_partitions[] = {
  61. {
  62. .name = "blob",
  63. .offset = 0,
  64. .size = 0x00020000,
  65. }, {
  66. .name = "kernel",
  67. .offset = MTDPART_OFS_APPEND,
  68. .size = 0x000e0000,
  69. }, {
  70. .name = "rootfs",
  71. .offset = MTDPART_OFS_APPEND,
  72. .size = 0x00300000,
  73. }
  74. };
  75. static struct flash_platform_data pleb_flash_data = {
  76. .map_name = "cfi_probe",
  77. .parts = pleb_partitions,
  78. .nr_parts = ARRAY_SIZE(pleb_partitions),
  79. };
  80. static void __init pleb_init(void)
  81. {
  82. sa11x0_register_mtd(&pleb_flash_data, pleb_flash_resources,
  83. ARRAY_SIZE(pleb_flash_resources));
  84. platform_add_devices(devices, ARRAY_SIZE(devices));
  85. }
  86. static void __init pleb_map_io(void)
  87. {
  88. sa1100_map_io();
  89. sa1100_register_uart(0, 3);
  90. sa1100_register_uart(1, 1);
  91. GAFR |= (GPIO_UART_TXD | GPIO_UART_RXD);
  92. GPDR |= GPIO_UART_TXD;
  93. GPDR &= ~GPIO_UART_RXD;
  94. PPAR |= PPAR_UPR;
  95. /*
  96. * Fix expansion memory timing for network card
  97. */
  98. MECR = ((2<<10) | (2<<5) | (2<<0));
  99. /*
  100. * Enable the SMC ethernet controller
  101. */
  102. GPDR |= GPIO_ETH0_EN; /* set to output */
  103. GPCR = GPIO_ETH0_EN; /* clear MCLK (enable smc) */
  104. GPDR &= ~GPIO_ETH0_IRQ;
  105. irq_set_irq_type(GPIO_ETH0_IRQ, IRQ_TYPE_EDGE_FALLING);
  106. }
  107. MACHINE_START(PLEB, "PLEB")
  108. .map_io = pleb_map_io,
  109. .nr_irqs = SA1100_NR_IRQS,
  110. .init_irq = sa1100_init_irq,
  111. .init_time = sa1100_timer_init,
  112. .init_machine = pleb_init,
  113. .init_late = sa11x0_init_late,
  114. .restart = sa11x0_restart,
  115. MACHINE_END