Lennert Buytenhek | 91af7bb | 2008-10-19 02:38:25 +0200 | [diff] [blame] | 1 | /* |
| 2 | * arch/arm/mach-kirkwood/mv88f6281gtw_ge-setup.c |
| 3 | * |
| 4 | * Marvell 88F6281 GTW GE 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> |
| 14 | #include <linux/pci.h> |
| 15 | #include <linux/irq.h> |
| 16 | #include <linux/mtd/physmap.h> |
| 17 | #include <linux/timer.h> |
| 18 | #include <linux/mv643xx_eth.h> |
| 19 | #include <linux/ethtool.h> |
Siddarth Gore | 96e7d21 | 2009-05-05 14:52:09 +0530 | [diff] [blame] | 20 | #include <linux/gpio.h> |
| 21 | #include <linux/leds.h> |
| 22 | #include <linux/input.h> |
| 23 | #include <linux/gpio_keys.h> |
Lennert Buytenhek | 91af7bb | 2008-10-19 02:38:25 +0200 | [diff] [blame] | 24 | #include <linux/spi/flash.h> |
| 25 | #include <linux/spi/spi.h> |
Lennert Buytenhek | 91af7bb | 2008-10-19 02:38:25 +0200 | [diff] [blame] | 26 | #include <net/dsa.h> |
| 27 | #include <asm/mach-types.h> |
| 28 | #include <asm/mach/arch.h> |
| 29 | #include <asm/mach/pci.h> |
| 30 | #include <mach/kirkwood.h> |
| 31 | #include "common.h" |
Siddarth Gore | 96e7d21 | 2009-05-05 14:52:09 +0530 | [diff] [blame] | 32 | #include "mpp.h" |
Lennert Buytenhek | 91af7bb | 2008-10-19 02:38:25 +0200 | [diff] [blame] | 33 | |
| 34 | static struct mv643xx_eth_platform_data mv88f6281gtw_ge_ge00_data = { |
| 35 | .phy_addr = MV643XX_ETH_PHY_NONE, |
| 36 | .speed = SPEED_1000, |
| 37 | .duplex = DUPLEX_FULL, |
| 38 | }; |
| 39 | |
| 40 | static struct dsa_chip_data mv88f6281gtw_ge_switch_chip_data = { |
| 41 | .port_names[0] = "lan1", |
| 42 | .port_names[1] = "lan2", |
| 43 | .port_names[2] = "lan3", |
| 44 | .port_names[3] = "lan4", |
| 45 | .port_names[4] = "wan", |
| 46 | .port_names[5] = "cpu", |
| 47 | }; |
| 48 | |
| 49 | static struct dsa_platform_data mv88f6281gtw_ge_switch_plat_data = { |
| 50 | .nr_chips = 1, |
| 51 | .chip = &mv88f6281gtw_ge_switch_chip_data, |
| 52 | }; |
| 53 | |
| 54 | static const struct flash_platform_data mv88f6281gtw_ge_spi_slave_data = { |
| 55 | .type = "mx25l12805d", |
| 56 | }; |
| 57 | |
| 58 | static struct spi_board_info __initdata mv88f6281gtw_ge_spi_slave_info[] = { |
| 59 | { |
| 60 | .modalias = "m25p80", |
| 61 | .platform_data = &mv88f6281gtw_ge_spi_slave_data, |
| 62 | .irq = -1, |
| 63 | .max_speed_hz = 50000000, |
| 64 | .bus_num = 0, |
| 65 | .chip_select = 0, |
| 66 | }, |
| 67 | }; |
| 68 | |
Siddarth Gore | 96e7d21 | 2009-05-05 14:52:09 +0530 | [diff] [blame] | 69 | static struct gpio_keys_button mv88f6281gtw_ge_button_pins[] = { |
| 70 | { |
| 71 | .code = KEY_RESTART, |
| 72 | .gpio = 47, |
| 73 | .desc = "SWR Button", |
| 74 | .active_low = 1, |
| 75 | }, { |
Christian Lamparter | 9705c39 | 2010-03-08 15:25:29 -0800 | [diff] [blame] | 76 | .code = KEY_WPS_BUTTON, |
Siddarth Gore | 96e7d21 | 2009-05-05 14:52:09 +0530 | [diff] [blame] | 77 | .gpio = 46, |
Christian Lamparter | 9705c39 | 2010-03-08 15:25:29 -0800 | [diff] [blame] | 78 | .desc = "WPS Button", |
Siddarth Gore | 96e7d21 | 2009-05-05 14:52:09 +0530 | [diff] [blame] | 79 | .active_low = 1, |
| 80 | }, |
| 81 | }; |
| 82 | |
| 83 | static struct gpio_keys_platform_data mv88f6281gtw_ge_button_data = { |
| 84 | .buttons = mv88f6281gtw_ge_button_pins, |
| 85 | .nbuttons = ARRAY_SIZE(mv88f6281gtw_ge_button_pins), |
| 86 | }; |
| 87 | |
| 88 | static struct platform_device mv88f6281gtw_ge_buttons = { |
| 89 | .name = "gpio-keys", |
| 90 | .id = -1, |
| 91 | .num_resources = 0, |
| 92 | .dev = { |
| 93 | .platform_data = &mv88f6281gtw_ge_button_data, |
| 94 | }, |
| 95 | }; |
| 96 | |
| 97 | static struct gpio_led mv88f6281gtw_ge_led_pins[] = { |
| 98 | { |
| 99 | .name = "gtw:green:Status", |
| 100 | .gpio = 20, |
| 101 | .active_low = 0, |
| 102 | }, { |
| 103 | .name = "gtw:red:Status", |
| 104 | .gpio = 21, |
| 105 | .active_low = 0, |
| 106 | }, { |
| 107 | .name = "gtw:green:USB", |
| 108 | .gpio = 12, |
| 109 | .active_low = 0, |
| 110 | }, |
| 111 | }; |
| 112 | |
| 113 | static struct gpio_led_platform_data mv88f6281gtw_ge_led_data = { |
| 114 | .leds = mv88f6281gtw_ge_led_pins, |
| 115 | .num_leds = ARRAY_SIZE(mv88f6281gtw_ge_led_pins), |
| 116 | }; |
| 117 | |
| 118 | static struct platform_device mv88f6281gtw_ge_leds = { |
| 119 | .name = "leds-gpio", |
| 120 | .id = -1, |
| 121 | .dev = { |
| 122 | .platform_data = &mv88f6281gtw_ge_led_data, |
| 123 | }, |
| 124 | }; |
| 125 | |
| 126 | static unsigned int mv88f6281gtw_ge_mpp_config[] __initdata = { |
| 127 | MPP12_GPO, /* Status#_USB pin */ |
| 128 | MPP20_GPIO, /* Status#_GLED pin */ |
| 129 | MPP21_GPIO, /* Status#_RLED pin */ |
| 130 | MPP46_GPIO, /* WPS_Switch pin */ |
| 131 | MPP47_GPIO, /* SW_Init pin */ |
| 132 | 0 |
| 133 | }; |
| 134 | |
Lennert Buytenhek | 91af7bb | 2008-10-19 02:38:25 +0200 | [diff] [blame] | 135 | static void __init mv88f6281gtw_ge_init(void) |
| 136 | { |
| 137 | /* |
| 138 | * Basic setup. Needs to be called early. |
| 139 | */ |
| 140 | kirkwood_init(); |
Siddarth Gore | 96e7d21 | 2009-05-05 14:52:09 +0530 | [diff] [blame] | 141 | kirkwood_mpp_conf(mv88f6281gtw_ge_mpp_config); |
Lennert Buytenhek | 91af7bb | 2008-10-19 02:38:25 +0200 | [diff] [blame] | 142 | |
| 143 | kirkwood_ehci_init(); |
| 144 | kirkwood_ge00_init(&mv88f6281gtw_ge_ge00_data); |
| 145 | kirkwood_ge00_switch_init(&mv88f6281gtw_ge_switch_plat_data, NO_IRQ); |
| 146 | spi_register_board_info(mv88f6281gtw_ge_spi_slave_info, |
| 147 | ARRAY_SIZE(mv88f6281gtw_ge_spi_slave_info)); |
| 148 | kirkwood_spi_init(); |
| 149 | kirkwood_uart0_init(); |
Siddarth Gore | 96e7d21 | 2009-05-05 14:52:09 +0530 | [diff] [blame] | 150 | platform_device_register(&mv88f6281gtw_ge_leds); |
| 151 | platform_device_register(&mv88f6281gtw_ge_buttons); |
Lennert Buytenhek | 91af7bb | 2008-10-19 02:38:25 +0200 | [diff] [blame] | 152 | } |
| 153 | |
| 154 | static int __init mv88f6281gtw_ge_pci_init(void) |
| 155 | { |
| 156 | if (machine_is_mv88f6281gtw_ge()) |
Saeed Bishara | ffd58bd | 2010-06-08 14:21:34 +0300 | [diff] [blame] | 157 | kirkwood_pcie_init(KW_PCIE0); |
Lennert Buytenhek | 91af7bb | 2008-10-19 02:38:25 +0200 | [diff] [blame] | 158 | |
| 159 | return 0; |
| 160 | } |
| 161 | subsys_initcall(mv88f6281gtw_ge_pci_init); |
| 162 | |
| 163 | MACHINE_START(MV88F6281GTW_GE, "Marvell 88F6281 GTW GE Board") |
| 164 | /* Maintainer: Lennert Buytenhek <buytenh@marvell.com> */ |
Nicolas Pitre | 1b7bd28c | 2011-07-05 22:38:13 -0400 | [diff] [blame] | 165 | .atag_offset = 0x100, |
Lennert Buytenhek | 91af7bb | 2008-10-19 02:38:25 +0200 | [diff] [blame] | 166 | .init_machine = mv88f6281gtw_ge_init, |
| 167 | .map_io = kirkwood_map_io, |
Lennert Buytenhek | 4ee1f6b | 2010-10-15 16:50:26 +0200 | [diff] [blame] | 168 | .init_early = kirkwood_init_early, |
Lennert Buytenhek | 91af7bb | 2008-10-19 02:38:25 +0200 | [diff] [blame] | 169 | .init_irq = kirkwood_init_irq, |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 170 | .init_time = kirkwood_timer_init, |
Russell King | cb15dff | 2011-11-05 10:03:47 +0000 | [diff] [blame] | 171 | .restart = kirkwood_restart, |
Lennert Buytenhek | 91af7bb | 2008-10-19 02:38:25 +0200 | [diff] [blame] | 172 | MACHINE_END |