blob: 5f388a1ed1e4c9d30f94fd1659ab0a2fab9e2074 [file] [log] [blame]
Lennert Buytenhek0b0740c2008-08-29 06:59:34 +02001/*
2 * arch/arm/mach-orion5x/rd88f6183-ap-ge-setup.c
3 *
4 * Marvell Orion-1-90 AP GE Reference Design Setup
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
Russell King2f8163b2011-07-26 10:53:52 +010010#include <linux/gpio.h>
Lennert Buytenhek0b0740c2008-08-29 06:59:34 +020011#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/pci.h>
15#include <linux/irq.h>
16#include <linux/mtd/physmap.h>
17#include <linux/mv643xx_eth.h>
18#include <linux/spi/spi.h>
Lennert Buytenhek0b0740c2008-08-29 06:59:34 +020019#include <linux/spi/flash.h>
20#include <linux/ethtool.h>
Florian Fainellie5f02a32019-01-15 15:06:12 -080021#include <linux/platform_data/dsa.h>
Lennert Buytenhek0b0740c2008-08-29 06:59:34 +020022#include <asm/mach-types.h>
Lennert Buytenhek0b0740c2008-08-29 06:59:34 +020023#include <asm/mach/arch.h>
24#include <asm/mach/pci.h>
Lennert Buytenhek0b0740c2008-08-29 06:59:34 +020025#include "common.h"
Arnd Bergmannc22c2c62015-12-02 22:27:08 +010026#include "orion5x.h"
Lennert Buytenhek0b0740c2008-08-29 06:59:34 +020027
28static struct mv643xx_eth_platform_data rd88f6183ap_ge_eth_data = {
29 .phy_addr = -1,
30 .speed = SPEED_1000,
31 .duplex = DUPLEX_FULL,
32};
33
Lennert Buytenheke84665c2009-03-20 09:52:09 +000034static struct dsa_chip_data rd88f6183ap_ge_switch_chip_data = {
Lennert Buytenhekdcf1cec2008-09-25 16:23:48 +020035 .port_names[0] = "lan1",
36 .port_names[1] = "lan2",
37 .port_names[2] = "lan3",
38 .port_names[3] = "lan4",
39 .port_names[4] = "wan",
40 .port_names[5] = "cpu",
41};
42
Lennert Buytenhek0b0740c2008-08-29 06:59:34 +020043static struct mtd_partition rd88f6183ap_ge_partitions[] = {
44 {
45 .name = "kernel",
46 .offset = 0x00000000,
47 .size = 0x00200000,
48 }, {
49 .name = "rootfs",
50 .offset = 0x00200000,
51 .size = 0x00500000,
52 }, {
53 .name = "nvram",
54 .offset = 0x00700000,
55 .size = 0x00080000,
56 },
57};
58
59static struct flash_platform_data rd88f6183ap_ge_spi_slave_data = {
60 .type = "m25p64",
61 .nr_parts = ARRAY_SIZE(rd88f6183ap_ge_partitions),
62 .parts = rd88f6183ap_ge_partitions,
63};
64
65static struct spi_board_info __initdata rd88f6183ap_ge_spi_slave_info[] = {
66 {
67 .modalias = "m25p80",
68 .platform_data = &rd88f6183ap_ge_spi_slave_data,
Lennert Buytenhek0b0740c2008-08-29 06:59:34 +020069 .max_speed_hz = 20000000,
70 .bus_num = 0,
71 .chip_select = 0,
72 },
73};
74
75static void __init rd88f6183ap_ge_init(void)
76{
77 /*
78 * Setup basic Orion functions. Need to be called early.
79 */
80 orion5x_init();
81
82 /*
83 * Configure peripherals.
84 */
85 orion5x_ehci0_init();
86 orion5x_eth_init(&rd88f6183ap_ge_eth_data);
Florian Fainelli575e93f2017-02-04 13:02:45 -080087 orion5x_eth_switch_init(&rd88f6183ap_ge_switch_chip_data);
Lennert Buytenhek0b0740c2008-08-29 06:59:34 +020088 spi_register_board_info(rd88f6183ap_ge_spi_slave_info,
89 ARRAY_SIZE(rd88f6183ap_ge_spi_slave_info));
90 orion5x_spi_init();
91 orion5x_uart0_init();
92}
93
94static struct hw_pci rd88f6183ap_ge_pci __initdata = {
95 .nr_controllers = 2,
Lennert Buytenhek0b0740c2008-08-29 06:59:34 +020096 .setup = orion5x_pci_sys_setup,
97 .scan = orion5x_pci_sys_scan_bus,
98 .map_irq = orion5x_pci_map_irq,
99};
100
101static int __init rd88f6183ap_ge_pci_init(void)
102{
103 if (machine_is_rd88f6183ap_ge()) {
104 orion5x_pci_disable();
105 pci_common_init(&rd88f6183ap_ge_pci);
106 }
107
108 return 0;
109}
110subsys_initcall(rd88f6183ap_ge_pci_init);
111
112MACHINE_START(RD88F6183AP_GE, "Marvell Orion-1-90 AP GE Reference Design")
113 /* Maintainer: Lennert Buytenhek <buytenh@marvell.com> */
Nicolas Pitre65aa1b12011-07-05 22:38:15 -0400114 .atag_offset = 0x100,
Arnd Bergmann5cdbe5d2015-12-02 22:27:05 +0100115 .nr_irqs = ORION5X_NR_IRQS,
Lennert Buytenhek0b0740c2008-08-29 06:59:34 +0200116 .init_machine = rd88f6183ap_ge_init,
117 .map_io = orion5x_map_io,
Lennert Buytenhek4ee1f6b2010-10-15 16:50:26 +0200118 .init_early = orion5x_init_early,
Lennert Buytenhek0b0740c2008-08-29 06:59:34 +0200119 .init_irq = orion5x_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700120 .init_time = orion5x_timer_init,
Lennert Buytenhek0b0740c2008-08-29 06:59:34 +0200121 .fixup = tag_fixup_mem32,
Russell King764cbcc22011-11-05 10:13:41 +0000122 .restart = orion5x_restart,
Lennert Buytenhek0b0740c2008-08-29 06:59:34 +0200123MACHINE_END