pleb.c 3.1 KB

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