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