blob: 5154bd2a3ad3d581d727f946f08e83378d7e80a9 [file] [log] [blame]
Saeed Bishara651c74c2008-06-22 22:45:06 +02001/*
2 * arch/arm/mach-kirkwood/rd88f6281-setup.c
3 *
4 * Marvell RD-88F6281 Reference Board 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 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
Saeed Bishara651c74c2008-06-22 22:45:06 +020014#include <linux/irq.h>
Nicolas Pitre249cbfa2009-02-26 21:35:59 -050015#include <linux/mtd/partitions.h>
Saeed Bishara651c74c2008-06-22 22:45:06 +020016#include <linux/ata_platform.h>
17#include <linux/mv643xx_eth.h>
Lennert Buytenhek81600eea92008-07-14 14:29:40 +020018#include <linux/ethtool.h>
Lennert Buytenhekdcf1cec2008-09-25 16:23:48 +020019#include <net/dsa.h>
Saeed Bishara651c74c2008-06-22 22:45:06 +020020#include <asm/mach-types.h>
21#include <asm/mach/arch.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010022#include <mach/kirkwood.h>
Arnd Bergmannc02cecb2012-08-24 15:21:54 +020023#include <linux/platform_data/mmc-mvsdio.h>
Saeed Bishara651c74c2008-06-22 22:45:06 +020024#include "common.h"
Nicolas Pitre8235ee02009-02-14 03:15:55 -050025#include "mpp.h"
Saeed Bishara651c74c2008-06-22 22:45:06 +020026
27static struct mtd_partition rd88f6281_nand_parts[] = {
28 {
29 .name = "u-boot",
30 .offset = 0,
31 .size = SZ_1M
32 }, {
33 .name = "uImage",
34 .offset = MTDPART_OFS_NXTBLK,
35 .size = SZ_2M
36 }, {
37 .name = "root",
38 .offset = MTDPART_OFS_NXTBLK,
39 .size = MTDPART_SIZ_FULL
40 },
41};
42
Saeed Bishara651c74c2008-06-22 22:45:06 +020043static struct mv643xx_eth_platform_data rd88f6281_ge00_data = {
Lennert Buytenhekac8406052008-08-26 14:06:47 +020044 .phy_addr = MV643XX_ETH_PHY_NONE,
Lennert Buytenhek81600eea92008-07-14 14:29:40 +020045 .speed = SPEED_1000,
46 .duplex = DUPLEX_FULL,
Saeed Bishara651c74c2008-06-22 22:45:06 +020047};
48
Lennert Buytenheke84665c2009-03-20 09:52:09 +000049static struct dsa_chip_data rd88f6281_switch_chip_data = {
Lennert Buytenhekdcf1cec2008-09-25 16:23:48 +020050 .port_names[0] = "lan1",
51 .port_names[1] = "lan2",
52 .port_names[2] = "lan3",
53 .port_names[3] = "lan4",
Lennert Buytenhekdcf1cec2008-09-25 16:23:48 +020054 .port_names[5] = "cpu",
55};
56
Lennert Buytenheke84665c2009-03-20 09:52:09 +000057static struct dsa_platform_data rd88f6281_switch_plat_data = {
58 .nr_chips = 1,
59 .chip = &rd88f6281_switch_chip_data,
60};
61
Ronen Shitrit37787e42008-10-19 23:19:07 +020062static struct mv643xx_eth_platform_data rd88f6281_ge01_data = {
63 .phy_addr = MV643XX_ETH_PHY_ADDR(11),
64};
65
Saeed Bishara651c74c2008-06-22 22:45:06 +020066static struct mv_sata_platform_data rd88f6281_sata_data = {
67 .n_ports = 2,
68};
69
Nicolas Pitre8235ee02009-02-14 03:15:55 -050070static struct mvsdio_platform_data rd88f6281_mvsdio_data = {
71 .gpio_card_detect = 28,
Sebastian Hesselbarth0d0644e2013-03-23 13:56:58 +010072 .gpio_write_protect = -1,
Nicolas Pitre8235ee02009-02-14 03:15:55 -050073};
74
75static unsigned int rd88f6281_mpp_config[] __initdata = {
76 MPP28_GPIO,
77 0
78};
79
Saeed Bishara651c74c2008-06-22 22:45:06 +020080static void __init rd88f6281_init(void)
81{
Ronen Shitrit37787e42008-10-19 23:19:07 +020082 u32 dev, rev;
83
Saeed Bishara651c74c2008-06-22 22:45:06 +020084 /*
85 * Basic setup. Needs to be called early.
86 */
87 kirkwood_init();
Nicolas Pitre8235ee02009-02-14 03:15:55 -050088 kirkwood_mpp_conf(rd88f6281_mpp_config);
Saeed Bishara651c74c2008-06-22 22:45:06 +020089
Julia Lawallf4ada242013-08-11 18:51:56 +020090 kirkwood_nand_init(rd88f6281_nand_parts,
91 ARRAY_SIZE(rd88f6281_nand_parts),
92 25);
Saeed Bishara651c74c2008-06-22 22:45:06 +020093 kirkwood_ehci_init();
Ronen Shitrit37787e42008-10-19 23:19:07 +020094
Saeed Bishara651c74c2008-06-22 22:45:06 +020095 kirkwood_ge00_init(&rd88f6281_ge00_data);
Ronen Shitrit37787e42008-10-19 23:19:07 +020096 kirkwood_pcie_id(&dev, &rev);
97 if (rev == MV88F6281_REV_A0) {
Lennert Buytenheke84665c2009-03-20 09:52:09 +000098 rd88f6281_switch_chip_data.sw_addr = 10;
Ronen Shitrit37787e42008-10-19 23:19:07 +020099 kirkwood_ge01_init(&rd88f6281_ge01_data);
100 } else {
Lennert Buytenheke84665c2009-03-20 09:52:09 +0000101 rd88f6281_switch_chip_data.port_names[4] = "wan";
Ronen Shitrit37787e42008-10-19 23:19:07 +0200102 }
Lennert Buytenheke84665c2009-03-20 09:52:09 +0000103 kirkwood_ge00_switch_init(&rd88f6281_switch_plat_data, NO_IRQ);
Ronen Shitrit37787e42008-10-19 23:19:07 +0200104
Saeed Bishara651c74c2008-06-22 22:45:06 +0200105 kirkwood_sata_init(&rd88f6281_sata_data);
Nicolas Pitre8235ee02009-02-14 03:15:55 -0500106 kirkwood_sdio_init(&rd88f6281_mvsdio_data);
Saeed Bishara651c74c2008-06-22 22:45:06 +0200107 kirkwood_uart0_init();
Saeed Bishara651c74c2008-06-22 22:45:06 +0200108}
109
110static int __init rd88f6281_pci_init(void)
111{
112 if (machine_is_rd88f6281())
Saeed Bisharaffd58bd2010-06-08 14:21:34 +0300113 kirkwood_pcie_init(KW_PCIE0);
Saeed Bishara651c74c2008-06-22 22:45:06 +0200114
115 return 0;
116}
117subsys_initcall(rd88f6281_pci_init);
118
119MACHINE_START(RD88F6281, "Marvell RD-88F6281 Reference Board")
120 /* Maintainer: Saeed Bishara <saeed@marvell.com> */
Nicolas Pitre1b7bd282011-07-05 22:38:13 -0400121 .atag_offset = 0x100,
Saeed Bishara651c74c2008-06-22 22:45:06 +0200122 .init_machine = rd88f6281_init,
123 .map_io = kirkwood_map_io,
Lennert Buytenhek4ee1f6b2010-10-15 16:50:26 +0200124 .init_early = kirkwood_init_early,
Saeed Bishara651c74c2008-06-22 22:45:06 +0200125 .init_irq = kirkwood_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700126 .init_time = kirkwood_timer_init,
Russell Kingcb15dff2011-11-05 10:03:47 +0000127 .restart = kirkwood_restart,
Saeed Bishara651c74c2008-06-22 22:45:06 +0200128MACHINE_END