2 * AVM FRITZ!WLAN Repeater 300E board support
4 * Copyright (C) 2017 Mathias Kresin <dev@kresin.me>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
11 #include <linux/gpio.h>
12 #include <linux/mtd/mtd.h>
13 #include <linux/mtd/partitions.h>
15 #include "dev-ap9x-pci.h"
17 #include "dev-gpio-buttons.h"
18 #include "dev-leds-gpio.h"
19 #include "dev-m25p80.h"
20 #include "machtypes.h"
22 #define FRITZ300E_KEYS_POLL_INTERVAL 20 /* msecs */
23 #define FRITZ300E_KEYS_DEBOUNCE_INTERVAL (3 * FRITZ300E_KEYS_POLL_INTERVAL)
25 static struct mtd_partition fritz300e_flash_partitions
[] = {
30 .mask_flags
= MTD_WRITEABLE
,
39 .mask_flags
= MTD_WRITEABLE
,
44 .mask_flags
= MTD_WRITEABLE
,
48 static struct flash_platform_data fritz300e_flash_data
= {
49 .parts
= fritz300e_flash_partitions
,
50 .nr_parts
= ARRAY_SIZE(fritz300e_flash_partitions
),
53 static struct gpio_led fritz300e_leds_gpio
[] __initdata
= {
55 .name
= "fritz300e:green:power",
59 .name
= "fritz300e:green:lan",
63 .name
= "fritz300e:green:wlan",
69 static struct gpio_led fritz300e_wmac_leds_gpio
[] = {
71 .name
= "fritz300e:green:rssi0",
75 .name
= "fritz300e:green:rssi1",
79 .name
= "fritz300e:green:rssi2",
83 .name
= "fritz300e:green:rssi3",
87 .name
= "fritz300e:green:rssi4",
93 static struct gpio_keys_button fritz300e_gpio_keys
[] __initdata
= {
97 .code
= KEY_WPS_BUTTON
,
98 .debounce_interval
= FRITZ300E_KEYS_DEBOUNCE_INTERVAL
,
104 static void __init
fritz300e_setup(void)
106 /* get the Lantiq PEF7071V phy out of reset */
107 gpio_request_one(11, GPIOF_OUT_INIT_HIGH
, "phy reset");
109 ath79_register_m25p80(&fritz300e_flash_data
);
111 ath79_register_mdio(0, ~(BIT(0)));
113 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_RGMII
;
114 ath79_eth0_data
.speed
= SPEED_1000
;
115 ath79_eth0_data
.duplex
= DUPLEX_FULL
;
116 ath79_eth0_data
.phy_mask
= BIT(0);
118 ath79_register_eth(0);
120 ath79_register_leds_gpio(-1, ARRAY_SIZE(fritz300e_leds_gpio
),
121 fritz300e_leds_gpio
);
122 ath79_register_gpio_keys_polled(-1, FRITZ300E_KEYS_POLL_INTERVAL
,
123 ARRAY_SIZE(fritz300e_gpio_keys
),
124 fritz300e_gpio_keys
);
126 ap9x_pci_setup_wmac_leds(0, fritz300e_wmac_leds_gpio
,
127 ARRAY_SIZE(fritz300e_wmac_leds_gpio
));
128 ap91_pci_init_simple();
131 MIPS_MACHINE(ATH79_MACH_FRITZ300E
, "FRITZ300E",
132 "AVM FRITZ!WLAN Repeater 300E", fritz300e_setup
);