GNU Linux-libre 6.1.90-gnu
[releases.git] / arch / arm / mach-orion5x / rd88f6183ap-ge-setup.c
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
25 static struct mv643xx_eth_platform_data rd88f6183ap_ge_eth_data = {
26         .phy_addr       = -1,
27         .speed          = SPEED_1000,
28         .duplex         = DUPLEX_FULL,
29 };
30
31 static struct dsa_chip_data rd88f6183ap_ge_switch_chip_data = {
32         .port_names[0]  = "lan1",
33         .port_names[1]  = "lan2",
34         .port_names[2]  = "lan3",
35         .port_names[3]  = "lan4",
36         .port_names[4]  = "wan",
37         .port_names[5]  = "cpu",
38 };
39
40 static struct mtd_partition rd88f6183ap_ge_partitions[] = {
41         {
42                 .name   = "kernel",
43                 .offset = 0x00000000,
44                 .size   = 0x00200000,
45         }, {
46                 .name   = "rootfs",
47                 .offset = 0x00200000,
48                 .size   = 0x00500000,
49         }, {
50                 .name   = "nvram",
51                 .offset = 0x00700000,
52                 .size   = 0x00080000,
53         },
54 };
55
56 static struct flash_platform_data rd88f6183ap_ge_spi_slave_data = {
57         .type           = "m25p64",
58         .nr_parts       = ARRAY_SIZE(rd88f6183ap_ge_partitions),
59         .parts          = rd88f6183ap_ge_partitions,
60 };
61
62 static struct spi_board_info __initdata rd88f6183ap_ge_spi_slave_info[] = {
63         {
64                 .modalias       = "m25p80",
65                 .platform_data  = &rd88f6183ap_ge_spi_slave_data,
66                 .max_speed_hz   = 20000000,
67                 .bus_num        = 0,
68                 .chip_select    = 0,
69         },
70 };
71
72 static void __init rd88f6183ap_ge_init(void)
73 {
74         /*
75          * Setup basic Orion functions. Need to be called early.
76          */
77         orion5x_init();
78
79         /*
80          * Configure peripherals.
81          */
82         orion5x_ehci0_init();
83         orion5x_eth_init(&rd88f6183ap_ge_eth_data);
84         orion5x_eth_switch_init(&rd88f6183ap_ge_switch_chip_data);
85         spi_register_board_info(rd88f6183ap_ge_spi_slave_info,
86                                 ARRAY_SIZE(rd88f6183ap_ge_spi_slave_info));
87         orion5x_spi_init();
88         orion5x_uart0_init();
89 }
90
91 static struct hw_pci rd88f6183ap_ge_pci __initdata = {
92         .nr_controllers = 2,
93         .setup          = orion5x_pci_sys_setup,
94         .scan           = orion5x_pci_sys_scan_bus,
95         .map_irq        = orion5x_pci_map_irq,
96 };
97
98 static int __init rd88f6183ap_ge_pci_init(void)
99 {
100         if (machine_is_rd88f6183ap_ge()) {
101                 orion5x_pci_disable();
102                 pci_common_init(&rd88f6183ap_ge_pci);
103         }
104
105         return 0;
106 }
107 subsys_initcall(rd88f6183ap_ge_pci_init);
108
109 MACHINE_START(RD88F6183AP_GE, "Marvell Orion-1-90 AP GE Reference Design")
110         /* Maintainer: Lennert Buytenhek <buytenh@marvell.com> */
111         .atag_offset    = 0x100,
112         .nr_irqs        = ORION5X_NR_IRQS,
113         .init_machine   = rd88f6183ap_ge_init,
114         .map_io         = orion5x_map_io,
115         .init_early     = orion5x_init_early,
116         .init_irq       = orion5x_init_irq,
117         .init_time      = orion5x_timer_init,
118         .fixup          = tag_fixup_mem32,
119         .restart        = orion5x_restart,
120 MACHINE_END