blob: a48103649eba97476914bb54a0c700489d9e9186 [file] [log] [blame]
Alexander Clouterb2fdb562010-01-18 23:38:19 +00001/*
2 * arch/arm/mach-kirkwood/openrd-setup.c
3 *
Dmytro Milinevskyy43b56072010-06-10 22:12:55 +03004 * Marvell OpenRD (Base|Client|Ultimate) Board Setup
Alexander Clouterb2fdb562010-01-18 23:38:19 +00005 *
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>
14#include <linux/mtd/nand.h>
15#include <linux/mtd/partitions.h>
16#include <linux/ata_platform.h>
17#include <linux/mv643xx_eth.h>
18#include <asm/mach-types.h>
19#include <asm/mach/arch.h>
20#include <mach/kirkwood.h>
21#include <plat/mvsdio.h>
22#include "common.h"
23#include "mpp.h"
24
25static struct mtd_partition openrd_nand_parts[] = {
26 {
27 .name = "u-boot",
28 .offset = 0,
29 .size = SZ_1M,
30 .mask_flags = MTD_WRITEABLE
31 }, {
32 .name = "uImage",
33 .offset = MTDPART_OFS_NXTBLK,
34 .size = SZ_4M
35 }, {
36 .name = "root",
37 .offset = MTDPART_OFS_NXTBLK,
38 .size = MTDPART_SIZ_FULL
39 },
40};
41
42static struct mv643xx_eth_platform_data openrd_ge00_data = {
43 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
44};
45
46static struct mv643xx_eth_platform_data openrd_ge01_data = {
47 .phy_addr = MV643XX_ETH_PHY_ADDR(24),
48};
49
50static struct mv_sata_platform_data openrd_sata_data = {
51 .n_ports = 2,
52};
53
54static struct mvsdio_platform_data openrd_mvsdio_data = {
55 .gpio_card_detect = 29, /* MPP29 used as SD card detect */
56};
57
58static unsigned int openrd_mpp_config[] __initdata = {
59 MPP29_GPIO,
60 0
61};
62
63static void __init openrd_init(void)
64{
65 /*
66 * Basic setup. Needs to be called early.
67 */
68 kirkwood_init();
69 kirkwood_mpp_conf(openrd_mpp_config);
70
71 kirkwood_uart0_init();
72 kirkwood_nand_init(ARRAY_AND_SIZE(openrd_nand_parts), 25);
73
74 kirkwood_ehci_init();
75
Dmytro Milinevskyy43b56072010-06-10 22:12:55 +030076 if (machine_is_openrd_ultimate()) {
77 openrd_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
78 openrd_ge01_data.phy_addr = MV643XX_ETH_PHY_ADDR(1);
79 }
80
Alexander Clouterb2fdb562010-01-18 23:38:19 +000081 kirkwood_ge00_init(&openrd_ge00_data);
Dmytro Milinevskyy43b56072010-06-10 22:12:55 +030082 if (!machine_is_openrd_base())
Alexander Clouterb2fdb562010-01-18 23:38:19 +000083 kirkwood_ge01_init(&openrd_ge01_data);
Dmytro Milinevskyy43b56072010-06-10 22:12:55 +030084
Alexander Clouterb2fdb562010-01-18 23:38:19 +000085 kirkwood_sata_init(&openrd_sata_data);
86 kirkwood_sdio_init(&openrd_mvsdio_data);
87
88 kirkwood_i2c_init();
89}
90
91static int __init openrd_pci_init(void)
92{
Dmytro Milinevskyy43b56072010-06-10 22:12:55 +030093 if (machine_is_openrd_base() ||
94 machine_is_openrd_client() ||
95 machine_is_openrd_ultimate())
Alexander Clouterb2fdb562010-01-18 23:38:19 +000096 kirkwood_pcie_init();
97
98 return 0;
99}
100subsys_initcall(openrd_pci_init);
101
102#ifdef CONFIG_MACH_OPENRD_BASE
103MACHINE_START(OPENRD_BASE, "Marvell OpenRD Base Board")
104 /* Maintainer: Dhaval Vasa <dhaval.vasa@einfochips.com> */
105 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
106 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
107 .boot_params = 0x00000100,
108 .init_machine = openrd_init,
109 .map_io = kirkwood_map_io,
110 .init_irq = kirkwood_init_irq,
111 .timer = &kirkwood_timer,
112MACHINE_END
113#endif
114
115#ifdef CONFIG_MACH_OPENRD_CLIENT
116MACHINE_START(OPENRD_CLIENT, "Marvell OpenRD Client Board")
117 /* Maintainer: Dhaval Vasa <dhaval.vasa@einfochips.com> */
118 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
119 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
120 .boot_params = 0x00000100,
121 .init_machine = openrd_init,
122 .map_io = kirkwood_map_io,
123 .init_irq = kirkwood_init_irq,
124 .timer = &kirkwood_timer,
125MACHINE_END
126#endif
Dmytro Milinevskyy43b56072010-06-10 22:12:55 +0300127
128#ifdef CONFIG_MACH_OPENRD_ULTIMATE
129MACHINE_START(OPENRD_ULTIMATE, "Marvell OpenRD Ultimate Board")
130 /* Maintainer: Dhaval Vasa <dhaval.vasa@einfochips.com> */
131 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
132 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
133 .boot_params = 0x00000100,
134 .init_machine = openrd_init,
135 .map_io = kirkwood_map_io,
136 .init_irq = kirkwood_init_irq,
137 .timer = &kirkwood_timer,
138MACHINE_END
139#endif