rd88f6183ap-ge-setup.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * arch/arm/mach-orion5x/rd88f6183-ap-ge-setup.c
  4. *
  5. * Marvell Orion-1-90 AP GE Reference Design Setup
  6. */
  7. #include <linux/gpio.h>
  8. #include <linux/kernel.h>
  9. #include <linux/init.h>
  10. #include <linux/platform_device.h>
  11. #include <linux/pci.h>
  12. #include <linux/irq.h>
  13. #include <linux/mtd/physmap.h>
  14. #include <linux/mv643xx_eth.h>
  15. #include <linux/spi/spi.h>
  16. #include <linux/spi/flash.h>
  17. #include <linux/ethtool.h>
  18. #include <linux/platform_data/dsa.h>
  19. #include <asm/mach-types.h>
  20. #include <asm/mach/arch.h>
  21. #include <asm/mach/pci.h>
  22. #include "common.h"
  23. #include "orion5x.h"
  24. static struct mv643xx_eth_platform_data rd88f6183ap_ge_eth_data = {
  25. .phy_addr = -1,
  26. .speed = SPEED_1000,
  27. .duplex = DUPLEX_FULL,
  28. };
  29. static struct dsa_chip_data rd88f6183ap_ge_switch_chip_data = {
  30. .port_names[0] = "lan1",
  31. .port_names[1] = "lan2",
  32. .port_names[2] = "lan3",
  33. .port_names[3] = "lan4",
  34. .port_names[4] = "wan",
  35. .port_names[5] = "cpu",
  36. };
  37. static struct mtd_partition rd88f6183ap_ge_partitions[] = {
  38. {
  39. .name = "kernel",
  40. .offset = 0x00000000,
  41. .size = 0x00200000,
  42. }, {
  43. .name = "rootfs",
  44. .offset = 0x00200000,
  45. .size = 0x00500000,
  46. }, {
  47. .name = "nvram",
  48. .offset = 0x00700000,
  49. .size = 0x00080000,
  50. },
  51. };
  52. static struct flash_platform_data rd88f6183ap_ge_spi_slave_data = {
  53. .type = "m25p64",
  54. .nr_parts = ARRAY_SIZE(rd88f6183ap_ge_partitions),
  55. .parts = rd88f6183ap_ge_partitions,
  56. };
  57. static struct spi_board_info __initdata rd88f6183ap_ge_spi_slave_info[] = {
  58. {
  59. .modalias = "m25p80",
  60. .platform_data = &rd88f6183ap_ge_spi_slave_data,
  61. .max_speed_hz = 20000000,
  62. .bus_num = 0,
  63. .chip_select = 0,
  64. },
  65. };
  66. static void __init rd88f6183ap_ge_init(void)
  67. {
  68. /*
  69. * Setup basic Orion functions. Need to be called early.
  70. */
  71. orion5x_init();
  72. /*
  73. * Configure peripherals.
  74. */
  75. orion5x_ehci0_init();
  76. orion5x_eth_init(&rd88f6183ap_ge_eth_data);
  77. orion5x_eth_switch_init(&rd88f6183ap_ge_switch_chip_data);
  78. spi_register_board_info(rd88f6183ap_ge_spi_slave_info,
  79. ARRAY_SIZE(rd88f6183ap_ge_spi_slave_info));
  80. orion5x_spi_init();
  81. orion5x_uart0_init();
  82. }
  83. static struct hw_pci rd88f6183ap_ge_pci __initdata = {
  84. .nr_controllers = 2,
  85. .setup = orion5x_pci_sys_setup,
  86. .scan = orion5x_pci_sys_scan_bus,
  87. .map_irq = orion5x_pci_map_irq,
  88. };
  89. static int __init rd88f6183ap_ge_pci_init(void)
  90. {
  91. if (machine_is_rd88f6183ap_ge()) {
  92. orion5x_pci_disable();
  93. pci_common_init(&rd88f6183ap_ge_pci);
  94. }
  95. return 0;
  96. }
  97. subsys_initcall(rd88f6183ap_ge_pci_init);
  98. MACHINE_START(RD88F6183AP_GE, "Marvell Orion-1-90 AP GE Reference Design")
  99. /* Maintainer: Lennert Buytenhek <[email protected]> */
  100. .atag_offset = 0x100,
  101. .nr_irqs = ORION5X_NR_IRQS,
  102. .init_machine = rd88f6183ap_ge_init,
  103. .map_io = orion5x_map_io,
  104. .init_early = orion5x_init_early,
  105. .init_irq = orion5x_init_irq,
  106. .init_time = orion5x_timer_init,
  107. .fixup = tag_fixup_mem32,
  108. .restart = orion5x_restart,
  109. MACHINE_END