Lennert Buytenhek | 0b0740c | 2008-08-29 06:59:34 +0200 | [diff] [blame] | 1 | /* |
| 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 King | 2f8163b | 2011-07-26 10:53:52 +0100 | [diff] [blame] | 10 | #include <linux/gpio.h> |
Lennert Buytenhek | 0b0740c | 2008-08-29 06:59:34 +0200 | [diff] [blame] | 11 | #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 Buytenhek | 0b0740c | 2008-08-29 06:59:34 +0200 | [diff] [blame] | 19 | #include <linux/spi/flash.h> |
| 20 | #include <linux/ethtool.h> |
Lennert Buytenhek | dcf1cec | 2008-09-25 16:23:48 +0200 | [diff] [blame] | 21 | #include <net/dsa.h> |
Lennert Buytenhek | 0b0740c | 2008-08-29 06:59:34 +0200 | [diff] [blame] | 22 | #include <asm/mach-types.h> |
Lennert Buytenhek | 0b0740c | 2008-08-29 06:59:34 +0200 | [diff] [blame] | 23 | #include <asm/mach/arch.h> |
| 24 | #include <asm/mach/pci.h> |
Lennert Buytenhek | 0b0740c | 2008-08-29 06:59:34 +0200 | [diff] [blame] | 25 | #include "common.h" |
Arnd Bergmann | c22c2c6 | 2015-12-02 22:27:08 +0100 | [diff] [blame] | 26 | #include "orion5x.h" |
Lennert Buytenhek | 0b0740c | 2008-08-29 06:59:34 +0200 | [diff] [blame] | 27 | |
| 28 | static struct mv643xx_eth_platform_data rd88f6183ap_ge_eth_data = { |
| 29 | .phy_addr = -1, |
| 30 | .speed = SPEED_1000, |
| 31 | .duplex = DUPLEX_FULL, |
| 32 | }; |
| 33 | |
Lennert Buytenhek | e84665c | 2009-03-20 09:52:09 +0000 | [diff] [blame] | 34 | static struct dsa_chip_data rd88f6183ap_ge_switch_chip_data = { |
Lennert Buytenhek | dcf1cec | 2008-09-25 16:23:48 +0200 | [diff] [blame] | 35 | .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 | |
Arnd Bergmann | fe158a1 | 2016-09-05 16:18:45 +0200 | [diff] [blame] | 43 | static struct dsa_platform_data __initdata rd88f6183ap_ge_switch_plat_data = { |
Lennert Buytenhek | e84665c | 2009-03-20 09:52:09 +0000 | [diff] [blame] | 44 | .nr_chips = 1, |
| 45 | .chip = &rd88f6183ap_ge_switch_chip_data, |
| 46 | }; |
| 47 | |
Lennert Buytenhek | 0b0740c | 2008-08-29 06:59:34 +0200 | [diff] [blame] | 48 | static struct mtd_partition rd88f6183ap_ge_partitions[] = { |
| 49 | { |
| 50 | .name = "kernel", |
| 51 | .offset = 0x00000000, |
| 52 | .size = 0x00200000, |
| 53 | }, { |
| 54 | .name = "rootfs", |
| 55 | .offset = 0x00200000, |
| 56 | .size = 0x00500000, |
| 57 | }, { |
| 58 | .name = "nvram", |
| 59 | .offset = 0x00700000, |
| 60 | .size = 0x00080000, |
| 61 | }, |
| 62 | }; |
| 63 | |
| 64 | static struct flash_platform_data rd88f6183ap_ge_spi_slave_data = { |
| 65 | .type = "m25p64", |
| 66 | .nr_parts = ARRAY_SIZE(rd88f6183ap_ge_partitions), |
| 67 | .parts = rd88f6183ap_ge_partitions, |
| 68 | }; |
| 69 | |
| 70 | static struct spi_board_info __initdata rd88f6183ap_ge_spi_slave_info[] = { |
| 71 | { |
| 72 | .modalias = "m25p80", |
| 73 | .platform_data = &rd88f6183ap_ge_spi_slave_data, |
Lennert Buytenhek | 0b0740c | 2008-08-29 06:59:34 +0200 | [diff] [blame] | 74 | .max_speed_hz = 20000000, |
| 75 | .bus_num = 0, |
| 76 | .chip_select = 0, |
| 77 | }, |
| 78 | }; |
| 79 | |
| 80 | static void __init rd88f6183ap_ge_init(void) |
| 81 | { |
| 82 | /* |
| 83 | * Setup basic Orion functions. Need to be called early. |
| 84 | */ |
| 85 | orion5x_init(); |
| 86 | |
| 87 | /* |
| 88 | * Configure peripherals. |
| 89 | */ |
| 90 | orion5x_ehci0_init(); |
| 91 | orion5x_eth_init(&rd88f6183ap_ge_eth_data); |
Arnd Bergmann | fe158a1 | 2016-09-05 16:18:45 +0200 | [diff] [blame] | 92 | orion5x_eth_switch_init(&rd88f6183ap_ge_switch_plat_data); |
Lennert Buytenhek | 0b0740c | 2008-08-29 06:59:34 +0200 | [diff] [blame] | 93 | spi_register_board_info(rd88f6183ap_ge_spi_slave_info, |
| 94 | ARRAY_SIZE(rd88f6183ap_ge_spi_slave_info)); |
| 95 | orion5x_spi_init(); |
| 96 | orion5x_uart0_init(); |
| 97 | } |
| 98 | |
| 99 | static struct hw_pci rd88f6183ap_ge_pci __initdata = { |
| 100 | .nr_controllers = 2, |
Lennert Buytenhek | 0b0740c | 2008-08-29 06:59:34 +0200 | [diff] [blame] | 101 | .setup = orion5x_pci_sys_setup, |
| 102 | .scan = orion5x_pci_sys_scan_bus, |
| 103 | .map_irq = orion5x_pci_map_irq, |
| 104 | }; |
| 105 | |
| 106 | static int __init rd88f6183ap_ge_pci_init(void) |
| 107 | { |
| 108 | if (machine_is_rd88f6183ap_ge()) { |
| 109 | orion5x_pci_disable(); |
| 110 | pci_common_init(&rd88f6183ap_ge_pci); |
| 111 | } |
| 112 | |
| 113 | return 0; |
| 114 | } |
| 115 | subsys_initcall(rd88f6183ap_ge_pci_init); |
| 116 | |
| 117 | MACHINE_START(RD88F6183AP_GE, "Marvell Orion-1-90 AP GE Reference Design") |
| 118 | /* Maintainer: Lennert Buytenhek <buytenh@marvell.com> */ |
Nicolas Pitre | 65aa1b1 | 2011-07-05 22:38:15 -0400 | [diff] [blame] | 119 | .atag_offset = 0x100, |
Arnd Bergmann | 5cdbe5d | 2015-12-02 22:27:05 +0100 | [diff] [blame] | 120 | .nr_irqs = ORION5X_NR_IRQS, |
Lennert Buytenhek | 0b0740c | 2008-08-29 06:59:34 +0200 | [diff] [blame] | 121 | .init_machine = rd88f6183ap_ge_init, |
| 122 | .map_io = orion5x_map_io, |
Lennert Buytenhek | 4ee1f6b | 2010-10-15 16:50:26 +0200 | [diff] [blame] | 123 | .init_early = orion5x_init_early, |
Lennert Buytenhek | 0b0740c | 2008-08-29 06:59:34 +0200 | [diff] [blame] | 124 | .init_irq = orion5x_init_irq, |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 125 | .init_time = orion5x_timer_init, |
Lennert Buytenhek | 0b0740c | 2008-08-29 06:59:34 +0200 | [diff] [blame] | 126 | .fixup = tag_fixup_mem32, |
Russell King | 764cbcc2 | 2011-11-05 10:13:41 +0000 | [diff] [blame] | 127 | .restart = orion5x_restart, |
Lennert Buytenhek | 0b0740c | 2008-08-29 06:59:34 +0200 | [diff] [blame] | 128 | MACHINE_END |