rd88f6281-setup.c 2.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/*
 * arch/arm/mach-kirkwood/rd88f6281-setup.c
 *
 * Marvell RD-88F6281 Reference Board Setup
 *
 * This file is licensed under the terms of the GNU General Public
 * License version 2.  This program is licensed "as is" without any
 * warranty of any kind, whether express or implied.
 */

#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/irq.h>
15
#include <linux/mtd/partitions.h>
16 17
#include <linux/ata_platform.h>
#include <linux/mv643xx_eth.h>
18
#include <linux/ethtool.h>
19
#include <net/dsa.h>
20 21
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
22
#include <mach/kirkwood.h>
23
#include <linux/platform_data/mmc-mvsdio.h>
24
#include "common.h"
25
#include "mpp.h"
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43

static struct mtd_partition rd88f6281_nand_parts[] = {
	{
		.name = "u-boot",
		.offset = 0,
		.size = SZ_1M
	}, {
		.name = "uImage",
		.offset = MTDPART_OFS_NXTBLK,
		.size = SZ_2M
	}, {
		.name = "root",
		.offset = MTDPART_OFS_NXTBLK,
		.size = MTDPART_SIZ_FULL
	},
};

static struct mv643xx_eth_platform_data rd88f6281_ge00_data = {
44
	.phy_addr	= MV643XX_ETH_PHY_NONE,
45 46
	.speed		= SPEED_1000,
	.duplex		= DUPLEX_FULL,
47 48
};

49
static struct dsa_chip_data rd88f6281_switch_chip_data = {
50 51 52 53 54 55 56
	.port_names[0]	= "lan1",
	.port_names[1]	= "lan2",
	.port_names[2]	= "lan3",
	.port_names[3]	= "lan4",
	.port_names[5]	= "cpu",
};

57 58 59 60 61
static struct dsa_platform_data rd88f6281_switch_plat_data = {
	.nr_chips	= 1,
	.chip		= &rd88f6281_switch_chip_data,
};

62 63 64 65
static struct mv643xx_eth_platform_data rd88f6281_ge01_data = {
	.phy_addr	= MV643XX_ETH_PHY_ADDR(11),
};

66 67 68 69
static struct mv_sata_platform_data rd88f6281_sata_data = {
	.n_ports	= 2,
};

70 71 72 73 74 75 76 77 78
static struct mvsdio_platform_data rd88f6281_mvsdio_data = {
	.gpio_card_detect = 28,
};

static unsigned int rd88f6281_mpp_config[] __initdata = {
	MPP28_GPIO,
	0
};

79 80
static void __init rd88f6281_init(void)
{
81 82
	u32 dev, rev;

83 84 85 86
	/*
	 * Basic setup. Needs to be called early.
	 */
	kirkwood_init();
87
	kirkwood_mpp_conf(rd88f6281_mpp_config);
88

89
	kirkwood_nand_init(ARRAY_AND_SIZE(rd88f6281_nand_parts), 25);
90
	kirkwood_ehci_init();
91

92
	kirkwood_ge00_init(&rd88f6281_ge00_data);
93 94
	kirkwood_pcie_id(&dev, &rev);
	if (rev == MV88F6281_REV_A0) {
95
		rd88f6281_switch_chip_data.sw_addr = 10;
96 97
		kirkwood_ge01_init(&rd88f6281_ge01_data);
	} else {
98
		rd88f6281_switch_chip_data.port_names[4] = "wan";
99
	}
100
	kirkwood_ge00_switch_init(&rd88f6281_switch_plat_data, NO_IRQ);
101

102
	kirkwood_sata_init(&rd88f6281_sata_data);
103
	kirkwood_sdio_init(&rd88f6281_mvsdio_data);
104 105 106 107 108 109
	kirkwood_uart0_init();
}

static int __init rd88f6281_pci_init(void)
{
	if (machine_is_rd88f6281())
110
		kirkwood_pcie_init(KW_PCIE0);
111 112 113 114 115 116 117

	return 0;
}
subsys_initcall(rd88f6281_pci_init);

MACHINE_START(RD88F6281, "Marvell RD-88F6281 Reference Board")
	/* Maintainer: Saeed Bishara <saeed@marvell.com> */
118
	.atag_offset	= 0x100,
119 120
	.init_machine	= rd88f6281_init,
	.map_io		= kirkwood_map_io,
121
	.init_early	= kirkwood_init_early,
122 123
	.init_irq	= kirkwood_init_irq,
	.timer		= &kirkwood_timer,
124
	.restart	= kirkwood_restart,
125
MACHINE_END