ar71xx: add AVM FRITZ!WLAN Repeater 300E support

Specifications:
* SoC: AR7242 (Virian 400MHz)
* RAM: 64 MB DDR (W9751G6JB-25)
* Flash: 16MB SPI flash (S25FL129PIF)
* WiFi: AR9382 (2.4/5GHz) + 2x SE2595L
* LAN: 1x1000M (PEF7071V)

To install LEDE via EVA bootloader, a FTP connection need to be
established to 192.168.178.1 within the first seconds after power on:

  ftp> quote USER adam2
  ftp> quote PASS adam2
  ftp> binary
  ftp> debug
  ftp> passive
  ftp> quote MEDIA FLSH
  ftp> put lede-ar71xx-generic-fritz300e-squashfs-sysupgrade.bin mtd1

Signed-off-by: Mathias Kresin <dev@kresin.me>
owl
Mathias Kresin 2016-12-30 11:53:21 +01:00
parent 0605b15be4
commit e7cd6f5d66
15 changed files with 215 additions and 0 deletions

View File

@ -67,6 +67,16 @@ define Build/netgear-dni
mv $@.new $@ mv $@.new $@
endef endef
define Build/append-squashfs-fakeroot-be
rm -rf $@.fakefs $@.fakesquashfs
mkdir $@.fakefs
$(STAGING_DIR_HOST)/bin/mksquashfs-lzma \
$@.fakefs $@.fakesquashfs \
-noappend -root-owned -be -nopad -b 65536 \
$(if $(SOURCE_DATE_EPOCH),-fixed-time $(SOURCE_DATE_EPOCH))
cat $@.fakesquashfs >> $@
endef
# append a fake/empty rootfs uImage header, to fool the bootloaders # append a fake/empty rootfs uImage header, to fool the bootloaders
# rootfs integrity check # rootfs integrity check
define Build/append-uImage-fakeroot-hdr define Build/append-uImage-fakeroot-hdr

View File

@ -242,6 +242,16 @@ ens202ext)
f9k1115v2) f9k1115v2)
ucidef_set_led_usbdev "usb2" "USB2" "belkin:green:usb2" "1-1" ucidef_set_led_usbdev "usb2" "USB2" "belkin:green:usb2" "1-1"
;; ;;
fritz300e)
ucidef_set_led_netdev "lan" "LAN" "$board:green:lan" "eth0"
ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan" "phy0tpt"
ucidef_set_rssimon "wlan0" "200000" "1"
ucidef_set_led_rssi "rssilow" "RSSILOW" "$board:green:rssi0" "wlan0" "1" "100"
ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "$board:green:rssi1" "wlan0" "20" "100"
ucidef_set_led_rssi "rssimedium" "RSSIMEDIUM" "$board:green:rssi2" "wlan0" "40" "100"
ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "$board:green:rssi3" "wlan0" "60" "100"
ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "$board:green:rssi4" "wlan0" "80" "100"
;;
rb-750) rb-750)
ucidef_set_led_default "act" "act" "rb750:green:act" "1" ucidef_set_led_default "act" "act" "rb750:green:act" "1"
ucidef_set_led_netdev "port1" "port1" "rb750:green:port1" "eth1" ucidef_set_led_netdev "port1" "port1" "rb750:green:port1" "eth1"

View File

@ -75,6 +75,7 @@ ar71xx_setup_interfaces()
eap300v2|\ eap300v2|\
eap7660d|\ eap7660d|\
el-mini|\ el-mini|\
fritz300e|\
hiveap-121|\ hiveap-121|\
loco-m-xw|\ loco-m-xw|\
mr12|\ mr12|\
@ -518,6 +519,9 @@ ar71xx_setup_macs()
lan_mac=$(mtd_get_mac_binary caldata 0) lan_mac=$(mtd_get_mac_binary caldata 0)
wan_mac=$(mtd_get_mac_binary caldata 6) wan_mac=$(mtd_get_mac_binary caldata 6)
;; ;;
fritz300e)
lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)"))
;;
tl-wr1043nd-v4) tl-wr1043nd-v4)
wan_mac=$(mtd_get_mac_binary config 0x1017c) wan_mac=$(mtd_get_mac_binary config 0x1017c)
;; ;;

View File

@ -54,6 +54,7 @@ get_status_led() {
archer-c25-v1|\ archer-c25-v1|\
archer-c59-v1|\ archer-c59-v1|\
archer-c60-v1|\ archer-c60-v1|\
fritz300e|\
mr12|\ mr12|\
mr16|\ mr16|\
nbg6616|\ nbg6616|\

View File

@ -40,6 +40,24 @@ ath9k_ubi_eeprom_extract() {
ath9k_eeprom_die "failed to extract from $ubi" ath9k_eeprom_die "failed to extract from $ubi"
} }
ath9k_eeprom_extract_reverse() {
local part=$1
local offset=$2
local count=$3
local mtd
local reversed
local caldata
mtd=$(find_mtd_chardev "$part")
reversed=$(hexdump -v -s $offset -n $count -e '/1 "%02x "' $mtd)
for byte in $reversed; do
caldata="\x${byte}${caldata}"
done
printf "%b" "$caldata" > /lib/firmware/$FIRMWARE
}
ath9k_patch_firmware_mac() { ath9k_patch_firmware_mac() {
local mac=$1 local mac=$1
@ -99,6 +117,9 @@ case "$FIRMWARE" in
ath9k_eeprom_extract "art" 20480 2048 ath9k_eeprom_extract "art" 20480 2048
ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary art 0) +2) ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary art 0) +2)
;; ;;
fritz300e)
ath9k_eeprom_extract_reverse "urloader" 5441 1088
;;
mr18) mr18)
. /lib/upgrade/nand.sh . /lib/upgrade/nand.sh

View File

@ -640,6 +640,9 @@ ar71xx_board_detect() {
*"ESR900") *"ESR900")
name="esr900" name="esr900"
;; ;;
*"FRITZ!WLAN Repeater 300E")
name="fritz300e"
;;
*"GL AR150") *"GL AR150")
name="gl-ar150" name="gl-ar150"
;; ;;

View File

@ -647,6 +647,7 @@ platform_check_image() {
return 0; return 0;
;; ;;
# these boards use metadata images # these boards use metadata images
fritz300e|\
rb-750-r2|\ rb-750-r2|\
rb-750up-r2|\ rb-750up-r2|\
rb-941-2nd|\ rb-941-2nd|\

View File

@ -107,6 +107,7 @@ CONFIG_ATH79_MACH_ESR1750=y
CONFIG_ATH79_MACH_ESR900=y CONFIG_ATH79_MACH_ESR900=y
CONFIG_ATH79_MACH_EW_DORIN=y CONFIG_ATH79_MACH_EW_DORIN=y
CONFIG_ATH79_MACH_F9K1115V2=y CONFIG_ATH79_MACH_F9K1115V2=y
CONFIG_ATH79_MACH_FRITZ300E=y
CONFIG_ATH79_MACH_GL_AR150=y CONFIG_ATH79_MACH_GL_AR150=y
CONFIG_ATH79_MACH_GL_AR300=y CONFIG_ATH79_MACH_GL_AR300=y
CONFIG_ATH79_MACH_GL_AR300M=y CONFIG_ATH79_MACH_GL_AR300M=y
@ -350,6 +351,7 @@ CONFIG_IRQ_DOMAIN=y
CONFIG_IRQ_FORCED_THREADING=y CONFIG_IRQ_FORCED_THREADING=y
CONFIG_IRQ_MIPS_CPU=y CONFIG_IRQ_MIPS_CPU=y
CONFIG_IRQ_WORK=y CONFIG_IRQ_WORK=y
CONFIG_LANTIQ_PHY=y
CONFIG_LEDS_GPIO=y CONFIG_LEDS_GPIO=y
CONFIG_LEDS_NU801=y CONFIG_LEDS_NU801=y
# CONFIG_LEDS_WNDR3700_USB is not set # CONFIG_LEDS_WNDR3700_USB is not set
@ -386,6 +388,7 @@ CONFIG_MTD_PHYSMAP=y
CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-2 CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-2
CONFIG_MTD_REDBOOT_PARTS=y CONFIG_MTD_REDBOOT_PARTS=y
CONFIG_MTD_SPI_NOR=y CONFIG_MTD_SPI_NOR=y
CONFIG_MTD_SPLIT_EVA_FW=y
CONFIG_MTD_SPLIT_FIRMWARE=y CONFIG_MTD_SPLIT_FIRMWARE=y
CONFIG_MTD_SPLIT_LZMA_FW=y CONFIG_MTD_SPLIT_LZMA_FW=y
CONFIG_MTD_SPLIT_SEAMA_FW=y CONFIG_MTD_SPLIT_SEAMA_FW=y

View File

@ -2061,3 +2061,12 @@ config ATH79_MACH_TL_WPA8630
select ATH79_DEV_LEDS_GPIO select ATH79_DEV_LEDS_GPIO
select ATH79_DEV_M25P80 select ATH79_DEV_M25P80
select ATH79_DEV_WMAC select ATH79_DEV_WMAC
config ATH79_MACH_FRITZ300E
bool "AVM FRITZ!WLAN Repeater 300E support"
select SOC_AR724X
select ATH79_DEV_AP9X_PCI if PCI
select ATH79_DEV_ETH
select ATH79_DEV_GPIO_BUTTONS
select ATH79_DEV_LEDS_GPIO
select ATH79_DEV_M25P80

View File

@ -111,6 +111,7 @@ obj-$(CONFIG_ATH79_MACH_ESR1750) += mach-esr1750.o
obj-$(CONFIG_ATH79_MACH_ESR900) += mach-esr900.o obj-$(CONFIG_ATH79_MACH_ESR900) += mach-esr900.o
obj-$(CONFIG_ATH79_MACH_EW_DORIN) += mach-ew-dorin.o obj-$(CONFIG_ATH79_MACH_EW_DORIN) += mach-ew-dorin.o
obj-$(CONFIG_ATH79_MACH_F9K1115V2) += mach-f9k1115v2.o obj-$(CONFIG_ATH79_MACH_F9K1115V2) += mach-f9k1115v2.o
obj-$(CONFIG_ATH79_MACH_FRITZ300E) += mach-fritz300e.o
obj-$(CONFIG_ATH79_MACH_GL_AR150) += mach-gl-ar150.o obj-$(CONFIG_ATH79_MACH_GL_AR150) += mach-gl-ar150.o
obj-$(CONFIG_ATH79_MACH_GL_AR300) += mach-gl-ar300.o obj-$(CONFIG_ATH79_MACH_GL_AR300) += mach-gl-ar300.o
obj-$(CONFIG_ATH79_MACH_GL_AR300M) += mach-gl-ar300m.o obj-$(CONFIG_ATH79_MACH_GL_AR300M) += mach-gl-ar300m.o

View File

@ -0,0 +1,132 @@
/*
* AVM FRITZ!WLAN Repeater 300E board support
*
* Copyright (C) 2017 Mathias Kresin <dev@kresin.me>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation.
*/
#include <linux/gpio.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include "dev-ap9x-pci.h"
#include "dev-eth.h"
#include "dev-gpio-buttons.h"
#include "dev-leds-gpio.h"
#include "dev-m25p80.h"
#include "machtypes.h"
#define FRITZ300E_KEYS_POLL_INTERVAL 20 /* msecs */
#define FRITZ300E_KEYS_DEBOUNCE_INTERVAL (3 * FRITZ300E_KEYS_POLL_INTERVAL)
static struct mtd_partition fritz300e_flash_partitions[] = {
{
.name = "urloader",
.offset = 0,
.size = 0x0020000,
.mask_flags = MTD_WRITEABLE,
}, {
.name = "firmware",
.offset = 0x0020000,
.size = 0x0ee0000,
}, {
.name = "tffs (1)",
.offset = 0x0f00000,
.size = 0x0080000,
.mask_flags = MTD_WRITEABLE,
}, {
.name = "tffs (2)",
.offset = 0x0f80000,
.size = 0x0080000,
.mask_flags = MTD_WRITEABLE,
}
};
static struct flash_platform_data fritz300e_flash_data = {
.parts = fritz300e_flash_partitions,
.nr_parts = ARRAY_SIZE(fritz300e_flash_partitions),
};
static struct gpio_led fritz300e_leds_gpio[] __initdata = {
{
.name = "fritz300e:green:power",
.gpio = 13,
.active_low = 1,
}, {
.name = "fritz300e:green:lan",
.gpio = 15,
.active_low = 1,
}, {
.name = "fritz300e:green:wlan",
.gpio = 16,
.active_low = 1,
}
};
static struct gpio_led fritz300e_wmac_leds_gpio[] = {
{
.name = "fritz300e:green:rssi0",
.gpio = 10,
.active_low = 1,
}, {
.name = "fritz300e:green:rssi1",
.gpio = 4,
.active_low = 1,
}, {
.name = "fritz300e:green:rssi2",
.gpio = 6,
.active_low = 1,
}, {
.name = "fritz300e:green:rssi3",
.gpio = 7,
.active_low = 1,
}, {
.name = "fritz300e:green:rssi4",
.gpio = 5,
.active_low = 1,
}
};
static struct gpio_keys_button fritz300e_gpio_keys[] __initdata = {
{
.desc = "wps",
.type = EV_KEY,
.code = KEY_WPS_BUTTON,
.debounce_interval = FRITZ300E_KEYS_DEBOUNCE_INTERVAL,
.gpio = 12,
.active_low = 1,
},
};
static void __init fritz300e_setup(void)
{
/* get the Lantiq PEF7071V phy out of reset */
gpio_request_one(11, GPIOF_OUT_INIT_HIGH, "phy reset");
ath79_register_m25p80(&fritz300e_flash_data);
ath79_register_mdio(0, ~(BIT(0)));
ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
ath79_eth0_data.speed = SPEED_1000;
ath79_eth0_data.duplex = DUPLEX_FULL;
ath79_eth0_data.phy_mask = BIT(0);
ath79_register_eth(0);
ath79_register_leds_gpio(-1, ARRAY_SIZE(fritz300e_leds_gpio),
fritz300e_leds_gpio);
ath79_register_gpio_keys_polled(-1, FRITZ300E_KEYS_POLL_INTERVAL,
ARRAY_SIZE(fritz300e_gpio_keys),
fritz300e_gpio_keys);
ap9x_pci_setup_wmac_leds(0, fritz300e_wmac_leds_gpio,
ARRAY_SIZE(fritz300e_wmac_leds_gpio));
ap91_pci_init_simple();
}
MIPS_MACHINE(ATH79_MACH_FRITZ300E, "FRITZ300E",
"AVM FRITZ!WLAN Repeater 300E", fritz300e_setup);

View File

@ -103,6 +103,7 @@ enum ath79_mach_type {
ATH79_MACH_EW_DORIN, /* embedded wireless Dorin Platform */ ATH79_MACH_EW_DORIN, /* embedded wireless Dorin Platform */
ATH79_MACH_EW_DORIN_ROUTER, /* embedded wireless Dorin Router Platform */ ATH79_MACH_EW_DORIN_ROUTER, /* embedded wireless Dorin Router Platform */
ATH79_MACH_F9K1115V2, /* Belkin AC1750DB */ ATH79_MACH_F9K1115V2, /* Belkin AC1750DB */
ATH79_MACH_FRITZ300E, /* AVM FRITZ!WLAN Repeater 300E */
ATH79_MACH_GL_AR150, /* GL-AR150 support */ ATH79_MACH_GL_AR150, /* GL-AR150 support */
ATH79_MACH_GL_AR300, /* GL-AR300 */ ATH79_MACH_GL_AR300, /* GL-AR300 */
ATH79_MACH_GL_AR300M, /* GL-AR300M */ ATH79_MACH_GL_AR300M, /* GL-AR300M */

View File

@ -878,3 +878,16 @@ define Device/zbt-we1526
IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | pad-to $$$$(ROOTFS_SIZE) | append-kernel | check-size $$$$(IMAGE_SIZE) IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | pad-to $$$$(ROOTFS_SIZE) | append-kernel | check-size $$$$(IMAGE_SIZE)
endef endef
TARGET_DEVICES += zbt-we1526 TARGET_DEVICES += zbt-we1526
define Device/fritz300e
DEVICE_TITLE := AVM FRITZ!WLAN Repeater 300E
DEVICE_PACKAGES := fritz-tffs rssileds -swconfig -uboot-envtools
BOARDNAME := FRITZ300E
SUPPORTED_DEVICES := fritz300e
IMAGE_SIZE := 15232k
KERNEL := kernel-bin | patch-cmdline | lzma | eva-image
IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | \
append-squashfs-fakeroot-be | pad-to 256 | \
append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
endef
TARGET_DEVICES += fritz300e

View File

@ -76,6 +76,7 @@
# CONFIG_ATH79_MACH_GL_AR300 is not set # CONFIG_ATH79_MACH_GL_AR300 is not set
# CONFIG_ATH79_MACH_GL_AR300M is not set # CONFIG_ATH79_MACH_GL_AR300M is not set
# CONFIG_ATH79_MACH_GL_DOMINO is not set # CONFIG_ATH79_MACH_GL_DOMINO is not set
# CONFIG_ATH79_MACH_FRITZ300E is not set
# CONFIG_ATH79_MACH_GL_INET is not set # CONFIG_ATH79_MACH_GL_INET is not set
# CONFIG_ATH79_MACH_GL_MIFI is not set # CONFIG_ATH79_MACH_GL_MIFI is not set
# CONFIG_ATH79_MACH_GS_MINIBOX_V1 is not set # CONFIG_ATH79_MACH_GS_MINIBOX_V1 is not set
@ -215,6 +216,7 @@ CONFIG_CRC16=y
CONFIG_CRYPTO_DEFLATE=y CONFIG_CRYPTO_DEFLATE=y
CONFIG_GPIO_74X164=y CONFIG_GPIO_74X164=y
CONFIG_GPIO_LATCH=y CONFIG_GPIO_LATCH=y
# CONFIG_LANTIQ_PHY is not set
CONFIG_LEDS_RB750=y CONFIG_LEDS_RB750=y
CONFIG_LZO_DECOMPRESS=y CONFIG_LZO_DECOMPRESS=y
# CONFIG_MTD_CFI is not set # CONFIG_MTD_CFI is not set
@ -230,6 +232,7 @@ CONFIG_MTD_NAND_RB4XX=y
CONFIG_MTD_NAND_RB750=y CONFIG_MTD_NAND_RB750=y
CONFIG_MTD_NAND_RB91X=y CONFIG_MTD_NAND_RB91X=y
# CONFIG_MTD_REDBOOT_PARTS is not set # CONFIG_MTD_REDBOOT_PARTS is not set
# CONFIG_MTD_SPLIT_EVA_FW is not set
# CONFIG_MTD_TPLINK_PARTS is not set # CONFIG_MTD_TPLINK_PARTS is not set
CONFIG_MTD_UBI=y CONFIG_MTD_UBI=y
CONFIG_MTD_UBI_BEB_LIMIT=20 CONFIG_MTD_UBI_BEB_LIMIT=20

View File

@ -70,6 +70,7 @@
# CONFIG_ATH79_MACH_ESR900 is not set # CONFIG_ATH79_MACH_ESR900 is not set
# CONFIG_ATH79_MACH_EW_DORIN is not set # CONFIG_ATH79_MACH_EW_DORIN is not set
# CONFIG_ATH79_MACH_F9K1115V2 is not set # CONFIG_ATH79_MACH_F9K1115V2 is not set
# CONFIG_ATH79_MACH_FRITZ300E is not set
# CONFIG_ATH79_MACH_GL_AR150 is not set # CONFIG_ATH79_MACH_GL_AR150 is not set
# CONFIG_ATH79_MACH_GL_AR300 is not set # CONFIG_ATH79_MACH_GL_AR300 is not set
# CONFIG_ATH79_MACH_GL_AR300M is not set # CONFIG_ATH79_MACH_GL_AR300M is not set
@ -197,6 +198,7 @@ CONFIG_ATH79_MACH_RAMBUTAN=y
# CONFIG_ATH79_NVRAM is not set # CONFIG_ATH79_NVRAM is not set
CONFIG_CMDLINE="rootfstype=squashfs noinitrd" CONFIG_CMDLINE="rootfstype=squashfs noinitrd"
# CONFIG_IP17XX_PHY is not set # CONFIG_IP17XX_PHY is not set
# CONFIG_LANTIQ_PHY is not set
# CONFIG_MARVELL_PHY is not set # CONFIG_MARVELL_PHY is not set
# CONFIG_MICREL_PHY is not set # CONFIG_MICREL_PHY is not set
# CONFIG_MTD_CFI is not set # CONFIG_MTD_CFI is not set
@ -212,6 +214,7 @@ CONFIG_MTD_NAND_ECC=y
CONFIG_MTD_NAND_ECC_BCH=y CONFIG_MTD_NAND_ECC_BCH=y
# CONFIG_MTD_REDBOOT_PARTS is not set # CONFIG_MTD_REDBOOT_PARTS is not set
# CONFIG_MTD_SM_COMMON is not set # CONFIG_MTD_SM_COMMON is not set
# CONFIG_MTD_SPLIT_EVA_FW is not set
# CONFIG_MTD_SPLIT_SEAMA_FW is not set # CONFIG_MTD_SPLIT_SEAMA_FW is not set
# CONFIG_MTD_TPLINK_PARTS is not set # CONFIG_MTD_TPLINK_PARTS is not set
CONFIG_MTD_UBI=y CONFIG_MTD_UBI=y