GNU Linux-libre 5.15.137-gnu
[releases.git] / arch / arm / mach-mv78xx0 / rd78x00-masa-setup.c
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * arch/arm/mach-mv78x00/rd78x00-masa-setup.c
4  *
5  * Marvell RD-78x00-mASA Development Board Setup
6  */
7
8 #include <linux/kernel.h>
9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/ata_platform.h>
12 #include <linux/mv643xx_eth.h>
13 #include <linux/ethtool.h>
14 #include <asm/mach-types.h>
15 #include <asm/mach/arch.h>
16 #include "mv78xx0.h"
17 #include "common.h"
18
19 static struct mv643xx_eth_platform_data rd78x00_masa_ge00_data = {
20         .phy_addr       = MV643XX_ETH_PHY_ADDR(8),
21 };
22
23 static struct mv643xx_eth_platform_data rd78x00_masa_ge01_data = {
24         .phy_addr       = MV643XX_ETH_PHY_ADDR(9),
25 };
26
27 static struct mv643xx_eth_platform_data rd78x00_masa_ge10_data = {
28 };
29
30 static struct mv643xx_eth_platform_data rd78x00_masa_ge11_data = {
31 };
32
33 static struct mv_sata_platform_data rd78x00_masa_sata_data = {
34         .n_ports        = 2,
35 };
36
37 static void __init rd78x00_masa_init(void)
38 {
39         /*
40          * Basic MV78x00 setup. Needs to be called early.
41          */
42         mv78xx0_init();
43
44         /*
45          * Partition on-chip peripherals between the two CPU cores.
46          */
47         if (mv78xx0_core_index() == 0) {
48                 mv78xx0_ehci0_init();
49                 mv78xx0_ehci1_init();
50                 mv78xx0_ge00_init(&rd78x00_masa_ge00_data);
51                 mv78xx0_ge10_init(&rd78x00_masa_ge10_data);
52                 mv78xx0_sata_init(&rd78x00_masa_sata_data);
53                 mv78xx0_uart0_init();
54                 mv78xx0_uart2_init();
55         } else {
56                 mv78xx0_ehci2_init();
57                 mv78xx0_ge01_init(&rd78x00_masa_ge01_data);
58                 mv78xx0_ge11_init(&rd78x00_masa_ge11_data);
59                 mv78xx0_uart1_init();
60                 mv78xx0_uart3_init();
61         }
62 }
63
64 static int __init rd78x00_pci_init(void)
65 {
66         /*
67          * Assign all PCIe devices to CPU core #0.
68          */
69         if (machine_is_rd78x00_masa() && mv78xx0_core_index() == 0)
70                 mv78xx0_pcie_init(1, 1);
71
72         return 0;
73 }
74 subsys_initcall(rd78x00_pci_init);
75
76 MACHINE_START(RD78X00_MASA, "Marvell RD-78x00-MASA Development Board")
77         /* Maintainer: Lennert Buytenhek <buytenh@marvell.com> */
78         .atag_offset    = 0x100,
79         .nr_irqs        = MV78XX0_NR_IRQS,
80         .init_machine   = rd78x00_masa_init,
81         .map_io         = mv78xx0_map_io,
82         .init_early     = mv78xx0_init_early,
83         .init_irq       = mv78xx0_init_irq,
84         .init_time      = mv78xx0_timer_init,
85         .restart        = mv78xx0_restart,
86 MACHINE_END