Saeed Bishara | 651c74c | 2008-06-22 22:45:06 +0200 | [diff] [blame] | 1 | /* |
| 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 Bishara | 651c74c | 2008-06-22 22:45:06 +0200 | [diff] [blame] | 14 | #include <linux/irq.h> |
Nicolas Pitre | 249cbfa | 2009-02-26 21:35:59 -0500 | [diff] [blame] | 15 | #include <linux/mtd/partitions.h> |
Saeed Bishara | 651c74c | 2008-06-22 22:45:06 +0200 | [diff] [blame] | 16 | #include <linux/ata_platform.h> |
| 17 | #include <linux/mv643xx_eth.h> |
Lennert Buytenhek | 81600eea9 | 2008-07-14 14:29:40 +0200 | [diff] [blame] | 18 | #include <linux/ethtool.h> |
Lennert Buytenhek | dcf1cec | 2008-09-25 16:23:48 +0200 | [diff] [blame] | 19 | #include <net/dsa.h> |
Saeed Bishara | 651c74c | 2008-06-22 22:45:06 +0200 | [diff] [blame] | 20 | #include <asm/mach-types.h> |
| 21 | #include <asm/mach/arch.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 22 | #include <mach/kirkwood.h> |
Nicolas Pitre | 8235ee0 | 2009-02-14 03:15:55 -0500 | [diff] [blame] | 23 | #include <plat/mvsdio.h> |
Saeed Bishara | 651c74c | 2008-06-22 22:45:06 +0200 | [diff] [blame] | 24 | #include "common.h" |
Nicolas Pitre | 8235ee0 | 2009-02-14 03:15:55 -0500 | [diff] [blame] | 25 | #include "mpp.h" |
Saeed Bishara | 651c74c | 2008-06-22 22:45:06 +0200 | [diff] [blame] | 26 | |
| 27 | static 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 Bishara | 651c74c | 2008-06-22 22:45:06 +0200 | [diff] [blame] | 43 | static struct mv643xx_eth_platform_data rd88f6281_ge00_data = { |
Lennert Buytenhek | ac840605 | 2008-08-26 14:06:47 +0200 | [diff] [blame] | 44 | .phy_addr = MV643XX_ETH_PHY_NONE, |
Lennert Buytenhek | 81600eea9 | 2008-07-14 14:29:40 +0200 | [diff] [blame] | 45 | .speed = SPEED_1000, |
| 46 | .duplex = DUPLEX_FULL, |
Saeed Bishara | 651c74c | 2008-06-22 22:45:06 +0200 | [diff] [blame] | 47 | }; |
| 48 | |
Lennert Buytenhek | e84665c | 2009-03-20 09:52:09 +0000 | [diff] [blame] | 49 | static struct dsa_chip_data rd88f6281_switch_chip_data = { |
Lennert Buytenhek | dcf1cec | 2008-09-25 16:23:48 +0200 | [diff] [blame] | 50 | .port_names[0] = "lan1", |
| 51 | .port_names[1] = "lan2", |
| 52 | .port_names[2] = "lan3", |
| 53 | .port_names[3] = "lan4", |
Lennert Buytenhek | dcf1cec | 2008-09-25 16:23:48 +0200 | [diff] [blame] | 54 | .port_names[5] = "cpu", |
| 55 | }; |
| 56 | |
Lennert Buytenhek | e84665c | 2009-03-20 09:52:09 +0000 | [diff] [blame] | 57 | static struct dsa_platform_data rd88f6281_switch_plat_data = { |
| 58 | .nr_chips = 1, |
| 59 | .chip = &rd88f6281_switch_chip_data, |
| 60 | }; |
| 61 | |
Ronen Shitrit | 37787e4 | 2008-10-19 23:19:07 +0200 | [diff] [blame] | 62 | static struct mv643xx_eth_platform_data rd88f6281_ge01_data = { |
| 63 | .phy_addr = MV643XX_ETH_PHY_ADDR(11), |
| 64 | }; |
| 65 | |
Saeed Bishara | 651c74c | 2008-06-22 22:45:06 +0200 | [diff] [blame] | 66 | static struct mv_sata_platform_data rd88f6281_sata_data = { |
| 67 | .n_ports = 2, |
| 68 | }; |
| 69 | |
Nicolas Pitre | 8235ee0 | 2009-02-14 03:15:55 -0500 | [diff] [blame] | 70 | static struct mvsdio_platform_data rd88f6281_mvsdio_data = { |
| 71 | .gpio_card_detect = 28, |
| 72 | }; |
| 73 | |
| 74 | static unsigned int rd88f6281_mpp_config[] __initdata = { |
| 75 | MPP28_GPIO, |
| 76 | 0 |
| 77 | }; |
| 78 | |
Saeed Bishara | 651c74c | 2008-06-22 22:45:06 +0200 | [diff] [blame] | 79 | static void __init rd88f6281_init(void) |
| 80 | { |
Ronen Shitrit | 37787e4 | 2008-10-19 23:19:07 +0200 | [diff] [blame] | 81 | u32 dev, rev; |
| 82 | |
Saeed Bishara | 651c74c | 2008-06-22 22:45:06 +0200 | [diff] [blame] | 83 | /* |
| 84 | * Basic setup. Needs to be called early. |
| 85 | */ |
| 86 | kirkwood_init(); |
Nicolas Pitre | 8235ee0 | 2009-02-14 03:15:55 -0500 | [diff] [blame] | 87 | kirkwood_mpp_conf(rd88f6281_mpp_config); |
Saeed Bishara | 651c74c | 2008-06-22 22:45:06 +0200 | [diff] [blame] | 88 | |
Nicolas Pitre | fb7b2d3 | 2009-06-01 15:36:36 -0400 | [diff] [blame] | 89 | kirkwood_nand_init(ARRAY_AND_SIZE(rd88f6281_nand_parts), 25); |
Saeed Bishara | 651c74c | 2008-06-22 22:45:06 +0200 | [diff] [blame] | 90 | kirkwood_ehci_init(); |
Ronen Shitrit | 37787e4 | 2008-10-19 23:19:07 +0200 | [diff] [blame] | 91 | |
Saeed Bishara | 651c74c | 2008-06-22 22:45:06 +0200 | [diff] [blame] | 92 | kirkwood_ge00_init(&rd88f6281_ge00_data); |
Ronen Shitrit | 37787e4 | 2008-10-19 23:19:07 +0200 | [diff] [blame] | 93 | kirkwood_pcie_id(&dev, &rev); |
| 94 | if (rev == MV88F6281_REV_A0) { |
Lennert Buytenhek | e84665c | 2009-03-20 09:52:09 +0000 | [diff] [blame] | 95 | rd88f6281_switch_chip_data.sw_addr = 10; |
Ronen Shitrit | 37787e4 | 2008-10-19 23:19:07 +0200 | [diff] [blame] | 96 | kirkwood_ge01_init(&rd88f6281_ge01_data); |
| 97 | } else { |
Lennert Buytenhek | e84665c | 2009-03-20 09:52:09 +0000 | [diff] [blame] | 98 | rd88f6281_switch_chip_data.port_names[4] = "wan"; |
Ronen Shitrit | 37787e4 | 2008-10-19 23:19:07 +0200 | [diff] [blame] | 99 | } |
Lennert Buytenhek | e84665c | 2009-03-20 09:52:09 +0000 | [diff] [blame] | 100 | kirkwood_ge00_switch_init(&rd88f6281_switch_plat_data, NO_IRQ); |
Ronen Shitrit | 37787e4 | 2008-10-19 23:19:07 +0200 | [diff] [blame] | 101 | |
Saeed Bishara | 651c74c | 2008-06-22 22:45:06 +0200 | [diff] [blame] | 102 | kirkwood_sata_init(&rd88f6281_sata_data); |
Nicolas Pitre | 8235ee0 | 2009-02-14 03:15:55 -0500 | [diff] [blame] | 103 | kirkwood_sdio_init(&rd88f6281_mvsdio_data); |
Saeed Bishara | 651c74c | 2008-06-22 22:45:06 +0200 | [diff] [blame] | 104 | kirkwood_uart0_init(); |
Saeed Bishara | 651c74c | 2008-06-22 22:45:06 +0200 | [diff] [blame] | 105 | } |
| 106 | |
| 107 | static int __init rd88f6281_pci_init(void) |
| 108 | { |
| 109 | if (machine_is_rd88f6281()) |
Saeed Bishara | ffd58bd | 2010-06-08 14:21:34 +0300 | [diff] [blame] | 110 | kirkwood_pcie_init(KW_PCIE0); |
Saeed Bishara | 651c74c | 2008-06-22 22:45:06 +0200 | [diff] [blame] | 111 | |
| 112 | return 0; |
| 113 | } |
| 114 | subsys_initcall(rd88f6281_pci_init); |
| 115 | |
| 116 | MACHINE_START(RD88F6281, "Marvell RD-88F6281 Reference Board") |
| 117 | /* Maintainer: Saeed Bishara <saeed@marvell.com> */ |
Saeed Bishara | 651c74c | 2008-06-22 22:45:06 +0200 | [diff] [blame] | 118 | .boot_params = 0x00000100, |
| 119 | .init_machine = rd88f6281_init, |
| 120 | .map_io = kirkwood_map_io, |
Lennert Buytenhek | 4ee1f6b | 2010-10-15 16:50:26 +0200 | [diff] [blame] | 121 | .init_early = kirkwood_init_early, |
Saeed Bishara | 651c74c | 2008-06-22 22:45:06 +0200 | [diff] [blame] | 122 | .init_irq = kirkwood_init_irq, |
| 123 | .timer = &kirkwood_timer, |
| 124 | MACHINE_END |