Support Fritzbox 7490

hey, sure here they are:

target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom


case "FIRMWARE" in 
....
...
...
avm,fritz3370-rev2-hynix|\
                        avm,fritz3370-rev2-micron|\
                        avm,fritz7362sl|\
                        avm,fritz7490)
                                ath9k_eeprom_extract_reverse "urlader" 5441 1088
                                ;;

...
...
esac
target/linux/lantiq/base-files/lib/upgrade/platform.sh

PART_NAME=firmware
REQUIRE_IMAGE_METADATA=1

platform_check_image() {
        return 0
}

platform_do_upgrade() {
        local board=$(board_name)

        case "$board" in
        avm,fritz3370-rev2-hynix|\
        avm,fritz3370-rev2-micron|\
        avm,fritz7362sl|\
        avm,fritz7490|\
        bt,homehub-v2b|\
        bt,homehub-v3a|\
        bt,homehub-v5a|\
        zyxel,p-2812hnu-f1|\
        zyxel,p-2812hnu-f3)
                nand_do_upgrade $1
                ;;
        *)
                default_do_upgrade "$ARGV"
                ;;
        esac
}

target/linux/lantiq/image/Makefile
define Device/avm_fritz7490
  $(Device/AVM)
  $(Device/NAND)
  KERNEL_SIZE := 4096k
  IMAGE_SIZE := 49152k
  DEVICE_DTS := FRITZ7490
  DEVICE_TITLE := AVM FRITZ!Box 7490
  DEVICE_PACKAGES := kmod-ath9k kmod-owl-loader wpad-basic kmod-usb-dwc2 fritz-tffs
endef
TARGET_DEVICES += avm_fritz7490
target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7490.dts
/dts-v1/;

#include "vr9.dtsi"

#include <dt-bindings/input/input.h>
#include <dt-bindings/mips/lantiq_rcu_gphy.h>

/ {
        compatible = "avm,fritz7490", "lantiq,xway", "lantiq,vr9";
        model = "AVM FRITZ!Box 7490";

        chosen {
                bootargs = "console=ttyLTQ0,115200";
        };

        aliases {
                led-boot = &power_green;
                led-failsafe = &info_red;
                led-running = &power_green;
                led-upgrade = &power_green;

                led-dsl = &info_green;
                led-wifi = &wifi;
        };

        memory@0 {
                reg = <0x0 0x20000000>;
        };

        gpio-keys-polled {
                compatible = "gpio-keys-polled";
                #address-cells = <1>;
                #size-cells = <0>;
                poll-interval = <100>;
                dect {
                        label = "dect";
                        gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
                        linux,code = <KEY_PHONE>;
                };
                wifi {
                        label = "wifi";
                        gpios = <&gpio 29 GPIO_ACTIVE_LOW>;
                        linux,code = <KEY_WLAN>;
                };
        };

        gpio-leds {
                compatible = "gpio-leds";

                power_green: power {
                        label = "fritz7490:green:power";
                        gpios = <&gpio 45 GPIO_ACTIVE_LOW>;
                        default-state = "keep";
                };
                info_red: info_red {
                        label = "fritz7490:red:info";
                        gpios = <&gpio 46 GPIO_ACTIVE_LOW>;
                };
                info_green: info_green {
                        label = "fritz7490:green:info";
                        gpios = <&gpio 33 GPIO_ACTIVE_LOW>;
                };
                internet_green {
                        label = "fritz7490:green:internet";
                        gpios = <&gpio 47 GPIO_ACTIVE_LOW>;
                };
                wifi: wifi {
                        label = "fritz7490:green:wlan";
                        gpios = <&gpio 35 GPIO_ACTIVE_LOW>;
                };
                dect {
                        label = "fritz7490:green:dect";
                        gpios = <&gpio 36 GPIO_ACTIVE_LOW>;
                };
        };
};


&eth0 {
        lan: interface@0 {
                compatible = "lantiq,xrx200-pdi";
                #address-cells = <1>;
                #size-cells = <0>;
                reg = <0>;
                mtd-mac-address = <&urlader 0xa91>;
                mtd-mac-address-increment = <(-2)>;
                lantiq,switch;

                ethernet@0 {
                        compatible = "lantiq,xrx200-pdi-port";
                        reg = <0>;
                        phy-mode = "rmii";
                        phy-handle = <&phy0>;
                };
                ethernet@1 {
                        compatible = "lantiq,xrx200-pdi-port";
                        reg = <1>;
                        phy-mode = "rmii";
                        phy-handle = <&phy1>;
                };
                ethernet@2 {
                        compatible = "lantiq,xrx200-pdi-port";
                        reg = <2>;
                        phy-mode = "gmii";
                        phy-handle = <&phy11>;
                };
                ethernet@3 {
                        compatible = "lantiq,xrx200-pdi-port";
                        reg = <4>;
                        phy-mode = "gmii";
                        phy-handle = <&phy13>;
                };
        };

        mdio@0 {
                #address-cells = <1>;
                #size-cells = <0>;
                compatible = "lantiq,xrx200-mdio";
                reg = <0>;

                phy0: ethernet-phy@0 {
                        reg = <0x00>;
                        compatible = "ethernet-phy-ieee802.3-c22";
                        reset-gpios = <&gpio 37 GPIO_ACTIVE_LOW>;
                };
                phy1: ethernet-phy@1 {
                        reg = <0x01>;
                        compatible = "ethernet-phy-ieee802.3-c22";
                        reset-gpios = <&gpio 44 GPIO_ACTIVE_LOW>;
                };
                phy11: ethernet-phy@11 {
                        reg = <0x11>;
                        compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22";
                };
                phy13: ethernet-phy@13 {
                        reg = <0x13>;
                        compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22";
                };
        };
};

&gphy0 {
        lantiq,gphy-mode = <GPHY_MODE_GE>;
};

&gphy1 {
        lantiq,gphy-mode = <GPHY_MODE_GE>;
};


&gpio {
        pinctrl-names = "default";
        pinctrl-0 = <&state_default>;

        state_default: pinmux {
                mdio {
                        lantiq,groups = "mdio";
                        lantiq,function = "mdio";
                };
                nand {
                        lantiq,groups = "nand ale", "nand cle",
                                        "nand cs1", "nand rd", "nand rdy";
                        lantiq,function = "ebu";
                };
                phy-rst {
                        lantiq,pins = "io37", "io44";
                        lantiq,pull = <0>;
                        lantiq,open-drain;
                        lantiq,output = <1>;
                };
                pcie-rst {
                        lantiq,pins = "io21";
                        lantiq,open-drain = <1>;
                        lantiq,output = <1>;
                };
        };

        pins_spi_default: pins_spi_default {
                spi_in {
                        lantiq,groups = "spi_di";
                        lantiq,function = "spi";
                };

                spi_out {
                        lantiq,groups = "spi_do", "spi_clk",
                                "spi_cs4";
                        lantiq,function = "spi";
                        lantiq,output = <1>;
                };
        };

};

&spi {
        status = "okay";

        pinctrl-names = "default";
        pinctrl-0 = <&pins_spi_default>;

        m25l80@4 {
                #address-cells = <1>;
                #size-cells = <1>;
                compatible = "jedec,spi-nor";
                reg = <4 0>;
                spi-max-frequency = <1000000>;

                urlader: partition@0 {
                        reg = <0x0 0x40000>;
                        label = "urlader";
                        read-only;
                };

                partition@40000 {
                        reg = <0x40000 0x60000>;
                        label = "tffs (1)";
                        read-only;
                };

                partition@A0000 {
                        reg = <0xA0000 0x60000>;
                        label = "tffs (2)";
                        read-only;
                };
        };
};

&localbus {
        nand@1 {
                compatible = "lantiq,nand-xway";
                lantiq,cs1 = <1>;
                bank-width = <1>;
                reg = <1 0x0 0x2000000>;
                #address-cells = <1>;
                #size-cells = <1>;

                nand-ecc-mode = "on-die";

                partitions {
                        compatible = "fixed-partitions";
                        #address-cells = <1>;
                        #size-cells = <1>;
                        partition@0 {
                                label = "kernel";
                                reg = <0x0 0x400000>;
                        };
                        partition@400000 {
                                label = "ubi";
                                reg = <0x400000 0x7c00000>;
                        };
                };
        };
};

&pcie0 {
        status = "okay";
        gpio-reset = <&gpio 21 GPIO_ACTIVE_LOW>;

        pcie@0 {
                reg = <0 0 0 0 0>;
                #interrupt-cells = <1>;
                #size-cells = <1>;
                #address-cells = <2>;
                device_type = "pci";

                wifi@168c,002e {
                        compatible = "pci168c,002e";
                        reg = <0 0 0 0 0>;
                        qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:01:00.0.bin */
                };
        };
};

&usb_phy0 {
        status = "okay";
};

&usb_phy1 {
        status = "okay";
};

&usb0 {
        status = "okay";
};

&usb1 {
        status = "okay";
};

  1. Take these with a big grain of salt though. They compiled a bootable ram image for me, but they could be far from optimal (maybe even wrong in places).
  2. use the python script to copy your ram image for testing (scripts/flashing/eva_ramboot.py 192.168.0.3 bin/targets/lantiq/xrx200/openwrt-lantiq-xrx200-avm_fritz7490-initramfs-kernel.bin)
  3. I found I could change the tftp bootloader IP by fiddling with the environment var my_ipaddress - made it simpler for testing for me. Use at your own risk :wink: I made a reference of stuff here: https://openwrt.org/docs/techref/bootloader/eva

The sticking point for me was the Wifi. In the 7490 the Wifi is run on a completely separate CPU chip that includes 2.4Ghz on chip, and then has another chip for 5Ghz. The communications between the Wifi CPU and the main CPU is done by some 'fancy' IPv6 ethernet bridge/vlan thing that was over my level of understanding. I only got as far as waking up the Wifi CPU by doing this:

To wakeup the 2nd Wifi chip, do this:

root@OpenWrt:/# ./gpiocontrol.sh 34 out 0
root@OpenWrt:/# ./gpiocontrol.sh 34 out 1

(script source from here:https://openwrt.org/docs/techref/hardware/port.gpio?s[]=gpio&s[]=control#utilities)

From the 2nd uart console, I could then see this output, but I could never figure what else was needed to get an image delivered to the 2nd CPU for it to boot up.


__________________sri____________________
944x BootROM Ver. (asic) 1.0 [Nov  8 2011 13:42:57]
_________________________________________
find_hif: bootstrap = 0x21e78
GMAC start
ROM>:mdio download ready

I've kept all the logs and analysis I've done - happy to share these if you need. But as for the 7490 its doubtful I'll make much further headway on this on my own. If the 5490 has a dual CPU design as well and you can figure out how to get the wifi CPU to boot please @mention me in a post about it, or reply on this thread with the details :+1:

1 Like