mv $@.new $@
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
# rootfs integrity check
define Build/append-uImage-fakeroot-hdr
f9k1115v2)
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)
ucidef_set_led_default "act" "act" "rb750:green:act" "1"
ucidef_set_led_netdev "port1" "port1" "rb750:green:port1" "eth1"
eap300v2|\
eap7660d|\
el-mini|\
+ fritz300e|\
hiveap-121|\
loco-m-xw|\
mr12|\
lan_mac=$(mtd_get_mac_binary caldata 0)
wan_mac=$(mtd_get_mac_binary caldata 6)
;;
+ fritz300e)
+ lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)"))
+ ;;
tl-wr1043nd-v4)
wan_mac=$(mtd_get_mac_binary config 0x1017c)
;;
archer-c25-v1|\
archer-c59-v1|\
archer-c60-v1|\
+ fritz300e|\
mr12|\
mr16|\
nbg6616|\
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() {
local mac=$1
ath9k_eeprom_extract "art" 20480 2048
ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary art 0) +2)
;;
+ fritz300e)
+ ath9k_eeprom_extract_reverse "urloader" 5441 1088
+ ;;
mr18)
. /lib/upgrade/nand.sh
*"ESR900")
name="esr900"
;;
+ *"FRITZ!WLAN Repeater 300E")
+ name="fritz300e"
+ ;;
*"GL AR150")
name="gl-ar150"
;;
return 0;
;;
# these boards use metadata images
+ fritz300e|\
rb-750-r2|\
rb-750up-r2|\
rb-941-2nd|\
CONFIG_ATH79_MACH_ESR900=y
CONFIG_ATH79_MACH_EW_DORIN=y
CONFIG_ATH79_MACH_F9K1115V2=y
+CONFIG_ATH79_MACH_FRITZ300E=y
CONFIG_ATH79_MACH_GL_AR150=y
CONFIG_ATH79_MACH_GL_AR300=y
CONFIG_ATH79_MACH_GL_AR300M=y
CONFIG_IRQ_FORCED_THREADING=y
CONFIG_IRQ_MIPS_CPU=y
CONFIG_IRQ_WORK=y
+CONFIG_LANTIQ_PHY=y
CONFIG_LEDS_GPIO=y
CONFIG_LEDS_NU801=y
# CONFIG_LEDS_WNDR3700_USB is not set
CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-2
CONFIG_MTD_REDBOOT_PARTS=y
CONFIG_MTD_SPI_NOR=y
+CONFIG_MTD_SPLIT_EVA_FW=y
CONFIG_MTD_SPLIT_FIRMWARE=y
CONFIG_MTD_SPLIT_LZMA_FW=y
CONFIG_MTD_SPLIT_SEAMA_FW=y
select ATH79_DEV_LEDS_GPIO
select ATH79_DEV_M25P80
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
obj-$(CONFIG_ATH79_MACH_ESR900) += mach-esr900.o
obj-$(CONFIG_ATH79_MACH_EW_DORIN) += mach-ew-dorin.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_AR300) += mach-gl-ar300.o
obj-$(CONFIG_ATH79_MACH_GL_AR300M) += mach-gl-ar300m.o
--- /dev/null
+/*
+ * 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);
ATH79_MACH_EW_DORIN, /* embedded wireless Dorin Platform */
ATH79_MACH_EW_DORIN_ROUTER, /* embedded wireless Dorin Router Platform */
ATH79_MACH_F9K1115V2, /* Belkin AC1750DB */
+ ATH79_MACH_FRITZ300E, /* AVM FRITZ!WLAN Repeater 300E */
ATH79_MACH_GL_AR150, /* GL-AR150 support */
ATH79_MACH_GL_AR300, /* GL-AR300 */
ATH79_MACH_GL_AR300M, /* GL-AR300M */
IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | pad-to $$$$(ROOTFS_SIZE) | append-kernel | check-size $$$$(IMAGE_SIZE)
endef
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
# CONFIG_ATH79_MACH_GL_AR300 is not set
# CONFIG_ATH79_MACH_GL_AR300M 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_MIFI is not set
# CONFIG_ATH79_MACH_GS_MINIBOX_V1 is not set
CONFIG_CRYPTO_DEFLATE=y
CONFIG_GPIO_74X164=y
CONFIG_GPIO_LATCH=y
+# CONFIG_LANTIQ_PHY is not set
CONFIG_LEDS_RB750=y
CONFIG_LZO_DECOMPRESS=y
# CONFIG_MTD_CFI is not set
CONFIG_MTD_NAND_RB750=y
CONFIG_MTD_NAND_RB91X=y
# CONFIG_MTD_REDBOOT_PARTS is not set
+# CONFIG_MTD_SPLIT_EVA_FW is not set
# CONFIG_MTD_TPLINK_PARTS is not set
CONFIG_MTD_UBI=y
CONFIG_MTD_UBI_BEB_LIMIT=20
# CONFIG_ATH79_MACH_ESR900 is not set
# CONFIG_ATH79_MACH_EW_DORIN 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_AR300 is not set
# CONFIG_ATH79_MACH_GL_AR300M is not set
# CONFIG_ATH79_NVRAM is not set
CONFIG_CMDLINE="rootfstype=squashfs noinitrd"
# CONFIG_IP17XX_PHY is not set
+# CONFIG_LANTIQ_PHY is not set
# CONFIG_MARVELL_PHY is not set
# CONFIG_MICREL_PHY is not set
# CONFIG_MTD_CFI is not set
CONFIG_MTD_NAND_ECC_BCH=y
# CONFIG_MTD_REDBOOT_PARTS 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_TPLINK_PARTS is not set
CONFIG_MTD_UBI=y