[LEDE-DEV,3/3] lantiq: add support for AVM FRITZ!Box 7412

Message ID 20180309191717.19545-3-Valentin.Spreckels@Informatik.Uni-Oldenburg.DE
State Changes Requested
Headers show
Series
  • [LEDE-DEV,1/3] fritz-tools: add fritz_tffs_nand_read tool
Related show

Commit Message

Valentin Spreckels March 9, 2018, 7:17 p.m.
Specification:
- SoC: Lantiq VRX 220
- CPU Cores: 2x MIPS 34Kc at 500 MHz
- RAM: 128 MiB 250 MHz
- Storage: 128 MiB NAND flash
- Ethernet: built-in Fast Ethernet switch, only port 2 is used
- Wireless: Atheros AR9287-BL1A b/g/n with 2 pcb antennas
- Modem: built-in A/VDSL2 modem
- DECT: Dialog SC14441
- LEDs: 1 two-color, 4 one-color
- Buttons: 2
- FXS: 1 port via TAE or RJ12 connector

Working:
- ethernet
- wifi
- leds
- buttons
- dsl

Not working:
- Second cpu core
- FXS
- DECT

Installation:

1. Use the eva_ramboot.py script to load an initramfs image on the
device. Run it a few seconds after turning the device on.
$ scripts/flashing eva_ramboot 192.168.178.1 bin/targets/lantiq/xrx200/openwrt-lantiq-xrx200-avm_fritz7412-initramfs-kernel.bin

If it fails to find the device try the ip address 169.254.120.1.
(Firmware updates or the recovery tool apparently change it.)

2. The device will load it in ram and boot it. You can reach it under
the openwrt default ip address 192.168.1.1.

3. Check if the key linux_fs_start is not set to 1 in tffs:
$ fritz_tffs_nand -d /dev/mtd1 -n linux_fs_start
If it is set to 1, the bootloader will select the wrong set of
partitions. Restart the box and install an FritzOS upgrade or do a
recovery. Afterwards start again at step 1.

4. Run sysupgrade to persistently install OpenWRT.

Signed-off-by: Valentin Spreckels <Valentin.Spreckels@Informatik.Uni-Oldenburg.DE>
---
 .../linux/lantiq/base-files/etc/board.d/02_network |   8 +
 .../etc/hotplug.d/firmware/12-ath9k-eeprom         |   3 +
 .../lantiq/base-files/lib/upgrade/platform.sh      |   2 +-
 .../files-4.14/arch/mips/boot/dts/FRITZ7412.dts    | 241 ++++++++++++++++++++
 .../files-4.9/arch/mips/boot/dts/FRITZ7412.dts     | 242 +++++++++++++++++++++
 .../lantiq/files-4.9/arch/mips/boot/dts/vr9.dtsi   |   2 +-
 target/linux/lantiq/image/Makefile                 |  13 ++
 7 files changed, 509 insertions(+), 2 deletions(-)
 create mode 100644 target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7412.dts
 create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ7412.dts

Comments

John Crispin March 9, 2018, 7:56 p.m. | #1
On 09/03/18 20:55, John Crispin wrote:
>
>
> On 09/03/18 20:17, Valentin Spreckels wrote:
>> Specification:
>> - SoC: Lantiq VRX 220
>> - CPU Cores: 2x MIPS 34Kc at 500 MHz
>> - RAM: 128 MiB 250 MHz
>> - Storage: 128 MiB NAND flash
>> - Ethernet: built-in Fast Ethernet switch, only port 2 is used
>> - Wireless: Atheros AR9287-BL1A b/g/n with 2 pcb antennas
>> - Modem: built-in A/VDSL2 modem
>> - DECT: Dialog SC14441
>> - LEDs: 1 two-color, 4 one-color
>> - Buttons: 2
>> - FXS: 1 port via TAE or RJ12 connector
>>
>> Working:
>> - ethernet
>> - wifi
>> - leds
>> - buttons
>> - dsl
>>
>> Not working:
>> - Second cpu core
>> - FXS
>> - DECT
>>
>> Installation:
>>
>> 1. Use the eva_ramboot.py script to load an initramfs image on the
>> device. Run it a few seconds after turning the device on.
>> $ scripts/flashing eva_ramboot 192.168.178.1 
>> bin/targets/lantiq/xrx200/openwrt-lantiq-xrx200-avm_fritz7412-initramfs-kernel.bin
>>
>> If it fails to find the device try the ip address 169.254.120.1.
>> (Firmware updates or the recovery tool apparently change it.)
>>
>> 2. The device will load it in ram and boot it. You can reach it under
>> the openwrt default ip address 192.168.1.1.
>>
>> 3. Check if the key linux_fs_start is not set to 1 in tffs:
>> $ fritz_tffs_nand -d /dev/mtd1 -n linux_fs_start
>> If it is set to 1, the bootloader will select the wrong set of
>> partitions. Restart the box and install an FritzOS upgrade or do a
>> recovery. Afterwards start again at step 1.
>>
>> 4. Run sysupgrade to persistently install OpenWRT.
>>
>> Signed-off-by: Valentin Spreckels 
>> <Valentin.Spreckels@Informatik.Uni-Oldenburg.DE>
>> ---
>>   .../linux/lantiq/base-files/etc/board.d/02_network |   8 +
>>   .../etc/hotplug.d/firmware/12-ath9k-eeprom         |   3 +
>>   .../lantiq/base-files/lib/upgrade/platform.sh      |   2 +-
>>   .../files-4.14/arch/mips/boot/dts/FRITZ7412.dts    | 241 
>> ++++++++++++++++++++
>>   .../files-4.9/arch/mips/boot/dts/FRITZ7412.dts     | 242 
>> +++++++++++++++++++++
>>   .../lantiq/files-4.9/arch/mips/boot/dts/vr9.dtsi   |   2 +-
>>   target/linux/lantiq/image/Makefile                 |  13 ++
>>   7 files changed, 509 insertions(+), 2 deletions(-)
>>   create mode 100644 
>> target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7412.dts
>>   create mode 100644 
>> target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ7412.dts
>>
>> diff --git a/target/linux/lantiq/base-files/etc/board.d/02_network 
>> b/target/linux/lantiq/base-files/etc/board.d/02_network
>> index ca974b071e..defdc1a94d 100755
>> --- a/target/linux/lantiq/base-files/etc/board.d/02_network
>> +++ b/target/linux/lantiq/base-files/etc/board.d/02_network
>> @@ -154,6 +154,14 @@ avm,fritz7360sl)
>>           "0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "6t@eth0"
>>       ;;
>>   +avm,fritz7412)
>> +    tffsdev=$(find_mtd_chardev "nand-tffs")
>> +    annex="b"
>> +    lan_mac=$(/usr/bin/fritz_tffs_nand -d $tffsdev -n maca)
>> +    wan_mac=$(/usr/bin/fritz_tffs_nand -d $tffsdev -n macdsl)
> dont use absolute paths please ...
>> +    ucidef_set_interface_lan 'eth0'
>> +    ;;
>> +
>>   siemens,gigaset-sx76x)
>>       annex="b"
>>       ucidef_add_switch "switch0" \
>> diff --git 
>> a/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom 
>> b/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom
>> index 498a509012..68181c7b87 100644
>> --- 
>> a/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom
>> +++ 
>> b/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom
>> @@ -141,6 +141,9 @@ case "$FIRMWARE" in
>>               avm,fritz3370|avm,fritz7320|avm,fritz7360sl)
>>                   ath9k_eeprom_extract "urlader" 2437 0
>>                   ;;
>> +            avm,fritz7412)
>> +                /usr/bin/fritz_cal_extract -i 1 -s 0x1e000 -e 0x207 
>> -l 4096 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader")
> absolute path ...
>> +                ;;
>>               tplink,tdw8970|tplink,tdw8980)
>>                   ath9k_eeprom_extract "boardconfig" 135168 0
>>                   ;;
>> diff --git a/target/linux/lantiq/base-files/lib/upgrade/platform.sh 
>> b/target/linux/lantiq/base-files/lib/upgrade/platform.sh
>> index 2e58cb799a..7a43e7e12e 100755
>> --- a/target/linux/lantiq/base-files/lib/upgrade/platform.sh
>> +++ b/target/linux/lantiq/base-files/lib/upgrade/platform.sh
>> @@ -9,7 +9,7 @@ platform_do_upgrade() {
>>       local board=$(board_name)
>>         case "$board" in
>> - 
>> bt,homehub-v2b|bt,homehub-v3a|bt,homehub-v5a|zyxel,p-2812hnu-f1|zyxel,p-2812hnu-f3)
>> + 
>> avm,fritz7412|bt,homehub-v2b|bt,homehub-v3a|bt,homehub-v5a|zyxel,p-2812hnu-f1|zyxel,p-2812hnu-f3)
> please turn this into |\
> multi|\
> line)
>
>>           nand_do_upgrade $1
>>           ;;
>>       *)
>> diff --git 
>> a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7412.dts 
>> b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7412.dts
>> new file mode 100644
>> index 0000000000..5bcd140520
>> --- /dev/null
>> +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7412.dts
>
> i'll leave the dts review to mkresin, there is a newline spacing issue 
> for sure. :-)
>
> all in all, thanks, nice patch series
>
>     John
>> @@ -0,0 +1,241 @@
>> +/dts-v1/;
>> +
>> +#include "vr9.dtsi"
>> +
>> +#include <dt-bindings/input/input.h>
>> +#include <dt-bindings/mips/lantiq_rcu_gphy.h>
>> +
>> +/ {
>> +    compatible = "avm,fritz7412", "lantiq,xway", "lantiq,vr9";
>> +    model = "1&1 DSL-Modem / 1&1 WLAN-Router";
>> +
>> +    chosen {
>> +        bootargs = "console=ttyLTQ0,115200 mem=126M 
>> vpe1_load_addr=0x87e00000 vpe1_mem=2M maxvpes=1 maxtcs=1 nosmp";
>> +    };
>> +
>> +    aliases {
>> +        led-boot = &power_green;
>> +        led-failsafe = &power_red;
>> +        led-running = &power_green;
>> +
>> +        led-dsl = &info;
>> +        led-wifi = &wifi;
>> +    };
>> +
>> +    memory@0 {
>> +        reg = <0x0 0x8000000>;
>> +    };
>> +
>> +    gpio-keys-polled {
>> +        compatible = "gpio-keys-polled";
>> +        #address-cells = <1>;
>> +        #size-cells = <0>;
>> +        poll-interval = <100>;
>> +        wps {
>> +            label = "wps";
>> +            gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
>> +            linux,code = <KEY_WPS_BUTTON>;
>> +        };
>> +        dect {
>> +            label = "dect";
>> +            gpios = <&gpio 2 GPIO_ACTIVE_HIGH>;
>> +            linux,code = <KEY_PHONE>;
>> +        };
>> +    };
>> +
>> +    gpio-leds {
>> +        compatible = "gpio-leds";
>> +
>> +        power_green: power_green {
>> +            label = "fritz7412:green:power";
>> +            gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
>> +            default-state = "keep";
>> +        };
>> +        power_red: power_red {
>> +            label = "fritz7412:red:power";
>> +            gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
>> +        };
>> +        fon {
>> +            label = "fritz7412:green:fon";
>> +            gpios = <&gpio 34 GPIO_ACTIVE_LOW>;
>> +        };
>> +        dect {
>> +            label = "fritz7412:green:dect";
>> +            gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
>> +        };
>> +        wifi: wifi {
>> +            label = "fritz7412:green:wifi";
>> +            gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
>> +        };
>> +        info: info {
>> +            label = "fritz7412:green:info";
>> +            gpios = <&gpio 35 GPIO_ACTIVE_LOW>;
>> +        };
>> +    };
>> +};
>> +
>> +&localbus {
>> +    nand-parts@0 {
>> +        compatible = "lantiq,nand-xway";
>> +        bank-width = <2>;
>> +        reg = <1 0x0 0x2000000>;
>> +        #address-cells = <1>;
>> +        #size-cells = <1>;
>> +        lantiq,cs = <1>;
>> +
>> +        partitions {
>> +            compatible = "fixed-partitions";
>> +            #address-cells = <1>;
>> +            #size-cells = <1>;
>> +
>> +            partition@0 {
>> +                label = "urlader";
>> +                reg = <0x0 0x40000>;
>> +                read-only;
>> +            };
>> +
>> +            partition@40000 {
>> +                label = "nand-tffs";
>> +                reg = <0x40000 0x400000>;
>> +                read-only;
>> +            };
>> +
>> +            partition@440000 {
>> +                label = "kernel";
>> +                reg = <0x440000 0x400000>;
>> +            };
>> +
>> +            partition@840000 {
>> +                label = "ubi";
>> +                reg = <0x840000 0x3000000>;
>> +            };
>> +
>> +            partition@3840000 {
>> +                label = "reserved-kernel";
>> +                reg = <0x3840000 0x400000>;
>> +                read-only;
>> +            };
>> +
>> +            partition@3c40000 {
>> +                label = "reserved-filesystem";
>> +                reg = <0x3c40000 0x3000000>;
>> +                read-only;
>> +            };
>> +
>> +            partition@6c40000 {
>> +                label = "config";
>> +                reg = <0x6c40000 0x400000>;
>> +                read-only;
>> +            };
>> +
>> +            partition@6e40000 {
>> +                label = "nand-filesystem";
>> +                reg = <0x6e40000 0x400000>;
>> +                read-only;
>> +            };
>> +        };
>> +    };
>> +};
>> +
>> +&pcie0 {
>> +    status = "okay";
>> +    gpio-reset = <&gpio 11 GPIO_ACTIVE_HIGH>;
>> +
>> +    pcie@0 {
>> +        reg = <0 0 0 0 0>;
>> +        #interrupt-cells = <1>;
>> +        #size-cells = <2>;
>> +        #address-cells = <3>;
>> +        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 */
>> +        };
>> +    };
>> +};
>> +
>> +&gpio {
>> +    pinctrl-names = "default";
>> +    pinctrl-0 = <&state_default>;
>> +
>> +    state_default: pinmux {
>> +        mdio {
>> +            lantiq,groups = "mdio";
>> +            lantiq,function = "mdio";
>> +        };
>> +        pcie-rst {
>> +            lantiq,pins = "io11";
>> +            lantiq,open-drain = <1>;
>> +            lantiq,output = <1>;
>> +        };
>> +        nand-mux {
>> +            lantiq,groups = "nand cle", "nand ale",
>> +            "nand rd", "nand cs1",
>> +            "nand rdy";
>> +            lantiq,function = "ebu";
>> +        };
>> +        nand-pins {
>> +            lantiq,pins = "io13", "io24", "io49";
>> +            lantiq,pull = <1>;
>> +        };
>> +
>> +        /*
>> +        other gpios:
>> +
>> +        dect reset: 33 output open drain
>> +        dect rd: 8 active low push pull
>> +
>> +        tdm fsc: 9 input + pull-up
>> +        tdm/spi do: 16 output
>> +        tdm/spi di: 17 input + pull-up
>> +        tdm dcl/spi clk: 18 output active low
>> +        tdm clk enable: 7 output active high
>> +        tdm/spi cs: 10 output active low/high
>> +        spi wp: 12 output active low
>> +
>> +        boot sel2: 23 active high
>> +        boot sel3: 38 active high
>> +        boot sel4: 49 active high (also nand rd)
>> +        */
>> +    };
>> +};
>> +
>> +&gphy0 {
>> +       lantiq,gphy-mode = <GPHY_MODE_FE>;
>> +};
>> +
>> +&eth0 {
>> +    lantiq,phys = <&gphy0>;
>> +
>> +    interface@0 {
>> +        compatible = "lantiq,xrx200-pdi";
>> +        #address-cells = <1>;
>> +        #size-cells = <0>;
>> +        reg = <0>;
>> +        mac-address = [ 00 11 22 33 44 55 ];
>> +        lantiq,switch;
>> +
>> +        ethernet@2 {
>> +            compatible = "lantiq,xrx200-pdi-port";
>> +            reg = <2>;
>> +            phy-mode = "gmii";
>> +            phy-handle = <&phy11>;
>> +        };
>> +    };
>> +
>> +    mdio@0 {
>> +        #address-cells = <1>;
>> +        #size-cells = <0>;
>> +        compatible = "lantiq,xrx200-mdio";
>> +        phy11: ethernet-phy@11 {
>> +            reg = <0x11>;
>> +            compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22";
>> +        };
>> +    };
>> +};
>> +
>> +&vmmc {
>> +    status = "okay";
>> +};
>> diff --git 
>> a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ7412.dts 
>> b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ7412.dts
>> new file mode 100644
>> index 0000000000..23f80db121
>> --- /dev/null
>> +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ7412.dts
>> @@ -0,0 +1,242 @@
>> +/dts-v1/;
>> +
>> +#include "vr9.dtsi"
>> +
>> +#include <dt-bindings/input/input.h>
>> +
>> +/ {
>> +    compatible = "avm,fritz7412", "lantiq,xway", "lantiq,vr9";
>> +    model = "1&1 DSL-Modem / 1&1 WLAN-Router";
>> +
>> +    chosen {
>> +        bootargs = "console=ttyLTQ0,115200 mem=126M 
>> vpe1_load_addr=0x87e00000 vpe1_mem=2M maxvpes=1 maxtcs=1 nosmp";
>> +    };
>> +
>> +    aliases {
>> +        led-boot = &power_green;
>> +        led-failsafe = &power_red;
>> +        led-running = &power_green;
>> +
>> +        led-dsl = &info;
>> +        led-wifi = &wifi;
>> +    };
>> +
>> +    memory@0 {
>> +        reg = <0x0 0x8000000>;
>> +    };
>> +
>> +    fpi@10000000 {
>> +        localbus@0 {
>> +            nand-parts@0 {
>> +                compatible = "lantiq,nand-xway";
>> +                bank-width = <2>;
>> +                reg = <1 0x0 0x2000000>;
>> +                #address-cells = <1>;
>> +                #size-cells = <1>;
>> +                lantiq,cs = <1>;
>> +
>> +                partitions {
>> +                    compatible = "fixed-partitions";
>> +                    #address-cells = <1>;
>> +                    #size-cells = <1>;
>> +
>> +                    partition@0 {
>> +                        label = "urlader";
>> +                        reg = <0x0 0x40000>;
>> +                        read-only;
>> +                    };
>> +
>> +                    partition@40000 {
>> +                        label = "nand-tffs";
>> +                        reg = <0x40000 0x400000>;
>> +                        read-only;
>> +                    };
>> +
>> +                    partition@440000 {
>> +                        label = "kernel";
>> +                        reg = <0x440000 0x400000>;
>> +                    };
>> +
>> +                    partition@840000 {
>> +                        label = "ubi";
>> +                        reg = <0x840000 0x3000000>;
>> +                    };
>> +
>> +                    partition@3840000 {
>> +                        label = "reserved-kernel";
>> +                        reg = <0x3840000 0x400000>;
>> +                        read-only;
>> +                    };
>> +
>> +                    partition@3c40000 {
>> +                        label = "reserved-filesystem";
>> +                        reg = <0x3c40000 0x3000000>;
>> +                        read-only;
>> +                    };
>> +
>> +                    partition@6c40000 {
>> +                        label = "config";
>> +                        reg = <0x6c40000 0x400000>;
>> +                        read-only;
>> +                    };
>> +
>> +                    partition@6e40000 {
>> +                        label = "nand-filesystem";
>> +                        reg = <0x6e40000 0x400000>;
>> +                        read-only;
>> +                    };
>> +                };
>> +            };
>> +        };
>> +    };
>> +
>> +    gphy-xrx200 {
>> +        compatible = "lantiq,phy-xrx200";
>> +        firmware = "lantiq/xrx200_phy11g_a22.bin";
>> +        phys = [ 00 ];
>> +    };
>> +
>> +    gpio-keys-polled {
>> +        compatible = "gpio-keys-polled";
>> +        #address-cells = <1>;
>> +        #size-cells = <0>;
>> +        poll-interval = <100>;
>> +        wps {
>> +            label = "wps";
>> +            gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
>> +            linux,code = <KEY_WPS_BUTTON>;
>> +        };
>> +        dect {
>> +            label = "dect";
>> +            gpios = <&gpio 2 GPIO_ACTIVE_HIGH>;
>> +            linux,code = <KEY_PHONE>;
>> +        };
>> +    };
>> +
>> +    gpio-leds {
>> +        compatible = "gpio-leds";
>> +
>> +        power_green: power_green {
>> +            label = "fritz7412:green:power";
>> +            gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
>> +            default-state = "keep";
>> +        };
>> +        power_red: power_red {
>> +            label = "fritz7412:red:power";
>> +            gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
>> +        };
>> +        fon {
>> +            label = "fritz7412:green:fon";
>> +            gpios = <&gpio 34 GPIO_ACTIVE_LOW>;
>> +        };
>> +        dect {
>> +            label = "fritz7412:green:dect";
>> +            gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
>> +        };
>> +        wifi: wifi {
>> +            label = "fritz7412:green:wifi";
>> +            gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
>> +        };
>> +        info: info {
>> +            label = "fritz7412:green:info";
>> +            gpios = <&gpio 35 GPIO_ACTIVE_LOW>;
>> +        };
>> +    };
>> +};
>> +
>> +&pcie0 {
>> +    status = "okay";
>> +    gpio-reset = <&gpio 11 GPIO_ACTIVE_HIGH>;
>> +
>> +    pcie@0 {
>> +        reg = <0 0 0 0 0>;
>> +        #interrupt-cells = <1>;
>> +        #size-cells = <2>;
>> +        #address-cells = <3>;
>> +        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 */
>> +        };
>> +    };
>> +};
>> +
>> +&gpio {
>> +    pinctrl-names = "default";
>> +    pinctrl-0 = <&state_default>;
>> +
>> +    state_default: pinmux {
>> +        mdio {
>> +            lantiq,groups = "mdio";
>> +            lantiq,function = "mdio";
>> +        };
>> +        pcie-rst {
>> +            lantiq,pins = "io11";
>> +            lantiq,open-drain = <1>;
>> +            lantiq,output = <1>;
>> +        };
>> +        nand-mux {
>> +            lantiq,groups = "nand cle", "nand ale",
>> +            "nand rd", "nand cs1",
>> +            "nand rdy";
>> +            lantiq,function = "ebu";
>> +        };
>> +        nand-pins {
>> +            lantiq,pins = "io13", "io24", "io49";
>> +            lantiq,pull = <1>;
>> +        };
>> +
>> +        /*
>> +        other gpios:
>> +
>> +        dect reset: 33 output open drain
>> +        dect rd: 8 active low push pull
>> +
>> +        tdm fsc: 9 input + pull-up
>> +        tdm/spi do: 16 output
>> +        tdm/spi di: 17 input + pull-up
>> +        tdm dcl/spi clk: 18 output active low
>> +        tdm clk enable: 7 output active high
>> +        tdm/spi cs: 10 output active low/high
>> +        spi wp: 12 output active low
>> +
>> +        boot sel2: 23 active high
>> +        boot sel3: 38 active high
>> +        boot sel4: 49 active high (also nand rd)
>> +        */
>> +    };
>> +};
>> +
>> +&eth0 {
>> +    interface@0 {
>> +        compatible = "lantiq,xrx200-pdi";
>> +        #address-cells = <1>;
>> +        #size-cells = <0>;
>> +        reg = <0>;
>> +        mac-address = [ 00 11 22 33 44 55 ];
>> +        lantiq,switch;
>> +
>> +        ethernet@2 {
>> +            compatible = "lantiq,xrx200-pdi-port";
>> +            reg = <2>;
>> +            phy-mode = "gmii";
>> +            phy-handle = <&phy11>;
>> +        };
>> +    };
>> +
>> +    mdio@0 {
>> +        #address-cells = <1>;
>> +        #size-cells = <0>;
>> +        compatible = "lantiq,xrx200-mdio";
>> +        phy11: ethernet-phy@11 {
>> +            reg = <0x11>;
>> +            compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22";
>> +        };
>> +    };
>> +};
>> +
>> +&vmmc {
>> +    status = "okay";
>> +};
>> diff --git 
>> a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/vr9.dtsi 
>> b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/vr9.dtsi
>> index dbcbb3dcec..f787ad7e4d 100644
>> --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/vr9.dtsi
>> +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/vr9.dtsi
>> @@ -82,7 +82,7 @@
>>               reg = <0x106a00 0x200>;
>>           };
>>   -        vmmc@107000 {
>> +        vmmc: vmmc@103000 {
>>               status = "disabled";
>>               compatible = "lantiq,vmmc-xway";
>>               reg = <0x103000 0x400>;
>> diff --git a/target/linux/lantiq/image/Makefile 
>> b/target/linux/lantiq/image/Makefile
>> index e52e43c6e5..6a3c8aef0f 100644
>> --- a/target/linux/lantiq/image/Makefile
>> +++ b/target/linux/lantiq/image/Makefile
>> @@ -103,6 +103,7 @@ define Device/AVM
>>     KERNEL := kernel-bin | append-dtb | lzma | eva-image
>>     IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | 
>> append-avm-fakeroot | \
>>       append-rootfs | pad-rootfs | append-metadata | check-size 
>> $$$$(IMAGE_SIZE)
>> +  KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | eva-image
>>   endef
>>     ifeq ($(SUBTARGET),ase)
>> @@ -630,6 +631,18 @@ define Device/avm_fritz7360sl
>>   endef
>>   TARGET_DEVICES += avm_fritz7360sl
>>   +define Device/avm_fritz7412
>> +  $(Device/AVM)
>> +  $(Device/NAND)
>> +  BOARD_NAME := FRITZ7412
>> +  DEVICE_DTS := FRITZ7412
>> +  KERNEL_SIZE := 4096k
>> +  IMAGE_SIZE := 49152k
>> +  DEVICE_TITLE := 1&1 DSL-Modem / WLAN-Router - FRITZ7412
>> +  DEVICE_PACKAGES := kmod-ath9k kmod-owl-loader wpad-mini 
>> kmod-ltq-tapi kmod-ltq-vmmc fritz-tffs-nand fritz-caldata
>> +endef
>> +TARGET_DEVICES += avm_fritz7412
>> +
>>   define Device/arcadyan_vg3503j
>>     IMAGE_SIZE := 8000k
>>     DEVICE_DTS := VG3503J
>
Andrey Jr. Melnikov March 10, 2018, 2:07 p.m. | #2
Valentin Spreckels <Valentin.Spreckels@informatik.uni-oldenburg.de> wrote:
> Specification:
> - SoC: Lantiq VRX 220
> - CPU Cores: 2x MIPS 34Kc at 500 MHz
> - RAM: 128 MiB 250 MHz
> - Storage: 128 MiB NAND flash
> - Ethernet: built-in Fast Ethernet switch, only port 2 is used
> - Wireless: Atheros AR9287-BL1A b/g/n with 2 pcb antennas
> - Modem: built-in A/VDSL2 modem
^^^^^^^^^^^^^^^^^^^^^^^^^^^ Annex B/J ADSL/VDSL2 modem.
> - DECT: Dialog SC14441
> - LEDs: 1 two-color, 4 one-color
> - Buttons: 2
> - FXS: 1 port via TAE or RJ12 connector
Mathias Kresin March 18, 2018, 6:23 p.m. | #3
Hey Valentin,

I spotted only minor stuff. Find my review inline.

I added Stefan Koch, he is way familiar with the telephony stuff and 
might see why it doesn't work for you.

Mathias

09.03.2018 20:17, Valentin Spreckels:
> Specification:
> - SoC: Lantiq VRX 220
> - CPU Cores: 2x MIPS 34Kc at 500 MHz
> - RAM: 128 MiB 250 MHz
> - Storage: 128 MiB NAND flash
> - Ethernet: built-in Fast Ethernet switch, only port 2 is used
> - Wireless: Atheros AR9287-BL1A b/g/n with 2 pcb antennas
> - Modem: built-in A/VDSL2 modem
> - DECT: Dialog SC14441
> - LEDs: 1 two-color, 4 one-color
> - Buttons: 2
> - FXS: 1 port via TAE or RJ12 connector
> 
> Working:
> - ethernet
> - wifi
> - leds
> - buttons
> - dsl
> 
> Not working:
> - Second cpu core

The second core doesn't work due to the nosmp in the bootargs. The 
second core is used for the telephony stuff. It is an XOR, either 
telephony support or second cpu core available for linux.

> - FXS

@Stefan, do you see anything missing to get FXS working with this board?

> - DECT
> 
> Installation:
> 
> 1. Use the eva_ramboot.py script to load an initramfs image on the
> device. Run it a few seconds after turning the device on.
> $ scripts/flashing eva_ramboot 192.168.178.1 bin/targets/lantiq/xrx200/openwrt-lantiq-xrx200-avm_fritz7412-initramfs-kernel.bin
> 
> If it fails to find the device try the ip address 169.254.120.1.
> (Firmware updates or the recovery tool apparently change it.)
> 
> 2. The device will load it in ram and boot it. You can reach it under
> the openwrt default ip address 192.168.1.1.
> 
> 3. Check if the key linux_fs_start is not set to 1 in tffs:
> $ fritz_tffs_nand -d /dev/mtd1 -n linux_fs_start
> If it is set to 1, the bootloader will select the wrong set of
> partitions. Restart the box and install an FritzOS upgrade or do a
> recovery. Afterwards start again at step 1.
> 
> 4. Run sysupgrade to persistently install OpenWRT.
> 
> Signed-off-by: Valentin Spreckels <Valentin.Spreckels@Informatik.Uni-Oldenburg.DE>
> ---
>   .../linux/lantiq/base-files/etc/board.d/02_network |   8 +
>   .../etc/hotplug.d/firmware/12-ath9k-eeprom         |   3 +
>   .../lantiq/base-files/lib/upgrade/platform.sh      |   2 +-
>   .../files-4.14/arch/mips/boot/dts/FRITZ7412.dts    | 241 ++++++++++++++++++++
>   .../files-4.9/arch/mips/boot/dts/FRITZ7412.dts     | 242 +++++++++++++++++++++
>   .../lantiq/files-4.9/arch/mips/boot/dts/vr9.dtsi   |   2 +-
>   target/linux/lantiq/image/Makefile                 |  13 ++
>   7 files changed, 509 insertions(+), 2 deletions(-)
>   create mode 100644 target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7412.dts
>   create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ7412.dts
> 
> diff --git a/target/linux/lantiq/base-files/etc/board.d/02_network b/target/linux/lantiq/base-files/etc/board.d/02_network
> index ca974b071e..defdc1a94d 100755
> --- a/target/linux/lantiq/base-files/etc/board.d/02_network
> +++ b/target/linux/lantiq/base-files/etc/board.d/02_network
> @@ -154,6 +154,14 @@ avm,fritz7360sl)
>   		"0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "6t@eth0"
>   	;;
>   
> +avm,fritz7412)
> +	tffsdev=$(find_mtd_chardev "nand-tffs")
> +	annex="b"
> +	lan_mac=$(/usr/bin/fritz_tffs_nand -d $tffsdev -n maca)
> +	wan_mac=$(/usr/bin/fritz_tffs_nand -d $tffsdev -n macdsl)
> +	ucidef_set_interface_lan 'eth0'
> +	;;
> +
>   siemens,gigaset-sx76x)
>   	annex="b"
>   	ucidef_add_switch "switch0" \
> diff --git a/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom b/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom
> index 498a509012..68181c7b87 100644
> --- a/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom
> +++ b/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom
> @@ -141,6 +141,9 @@ case "$FIRMWARE" in
>   			avm,fritz3370|avm,fritz7320|avm,fritz7360sl)
>   				ath9k_eeprom_extract "urlader" 2437 0
>   				;;
> +			avm,fritz7412)
> +				/usr/bin/fritz_cal_extract -i 1 -s 0x1e000 -e 0x207 -l 4096 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader")
> +				;;
>   			tplink,tdw8970|tplink,tdw8980)
>   				ath9k_eeprom_extract "boardconfig" 135168 0
>   				;;
> diff --git a/target/linux/lantiq/base-files/lib/upgrade/platform.sh b/target/linux/lantiq/base-files/lib/upgrade/platform.sh
> index 2e58cb799a..7a43e7e12e 100755
> --- a/target/linux/lantiq/base-files/lib/upgrade/platform.sh
> +++ b/target/linux/lantiq/base-files/lib/upgrade/platform.sh
> @@ -9,7 +9,7 @@ platform_do_upgrade() {
>   	local board=$(board_name)
>   
>   	case "$board" in
> -	bt,homehub-v2b|bt,homehub-v3a|bt,homehub-v5a|zyxel,p-2812hnu-f1|zyxel,p-2812hnu-f3)
> +	avm,fritz7412|bt,homehub-v2b|bt,homehub-v3a|bt,homehub-v5a|zyxel,p-2812hnu-f1|zyxel,p-2812hnu-f3)
>   		nand_do_upgrade $1
>   		;;
>   	*)
> diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7412.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7412.dts
> new file mode 100644
> index 0000000000..5bcd140520
> --- /dev/null
> +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7412.dts
> @@ -0,0 +1,241 @@
> +/dts-v1/;
> +
> +#include "vr9.dtsi"
> +
> +#include <dt-bindings/input/input.h>
> +#include <dt-bindings/mips/lantiq_rcu_gphy.h>
> +
> +/ {
> +	compatible = "avm,fritz7412", "lantiq,xway", "lantiq,vr9";
> +	model = "1&1 DSL-Modem / 1&1 WLAN-Router";

I guess the fact that it is a FRITZ!Box 7412 should be mentioned in the 
model name. "1&1 DSL-Modem / 1&1 WLAN-Router" could be all or nothing.

> +
> +	chosen {
> +		bootargs = "console=ttyLTQ0,115200 mem=126M vpe1_load_addr=0x87e00000 vpe1_mem=2M maxvpes=1 maxtcs=1 nosmp";
> +	};
> +
> +	aliases {
> +		led-boot = &power_green;
> +		led-failsafe = &power_red;
> +		led-running = &power_green;
> +
> +		led-dsl = &info;
> +		led-wifi = &wifi;
> +	};
> +
> +	memory@0 {
> +		reg = <0x0 0x8000000>;
> +	};
> +
> +	gpio-keys-polled {
> +		compatible = "gpio-keys-polled";
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +		poll-interval = <100>;
> +		wps {
> +			label = "wps";
> +			gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
> +			linux,code = <KEY_WPS_BUTTON>;
> +		};
> +		dect {
> +			label = "dect";
> +			gpios = <&gpio 2 GPIO_ACTIVE_HIGH>;
> +			linux,code = <KEY_PHONE>;
> +		};
> +	};
> +
> +	gpio-leds {
> +		compatible = "gpio-leds";
> +
> +		power_green: power_green {
> +			label = "fritz7412:green:power";
> +			gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
> +			default-state = "keep";
> +		};
> +		power_red: power_red {
> +			label = "fritz7412:red:power";
> +			gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
> +		};
> +		fon {
> +			label = "fritz7412:green:fon";
> +			gpios = <&gpio 34 GPIO_ACTIVE_LOW>;
> +		};
> +		dect {
> +			label = "fritz7412:green:dect";
> +			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
> +		};
> +		wifi: wifi {
> +			label = "fritz7412:green:wifi";
> +			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
> +		};
> +		info: info {
> +			label = "fritz7412:green:info";
> +			gpios = <&gpio 35 GPIO_ACTIVE_LOW>;
> +		};
> +	};
> +};
> +
> +&localbus {
> +	nand-parts@0 {

nand-parts@1 to match the reg property.

How is the bad block management and ECC done on this board? I would be 
surprised if AVM doesn't use any kind of BBT or ECC.

The Homehub 5a for example does everything in software. Where the Fritz 
3370 uses the NAND chip ECC engine. The on-die ECC is only support if 
kernel 4.14 is used and not yet enabled for the 3370 (one of the tasks 
on my list).

> +		compatible = "lantiq,nand-xway";
> +		bank-width = <2>;
> +		reg = <1 0x0 0x2000000>;
> +		#address-cells = <1>;
> +		#size-cells = <1>;
> +		lantiq,cs = <1>;
> +
> +		partitions {
> +			compatible = "fixed-partitions";
> +			#address-cells = <1>;
> +			#size-cells = <1>;
> +
> +			partition@0 {
> +				label = "urlader";
> +				reg = <0x0 0x40000>;
> +				read-only;
> +			};
> +
> +			partition@40000 {
> +				label = "nand-tffs";
> +				reg = <0x40000 0x400000>;
> +				read-only;
> +			};
> +
> +			partition@440000 {
> +				label = "kernel";
> +				reg = <0x440000 0x400000>;
> +			};
> +
> +			partition@840000 {
> +				label = "ubi";
> +				reg = <0x840000 0x3000000>;
> +			};
> +
> +			partition@3840000 {
> +				label = "reserved-kernel";
> +				reg = <0x3840000 0x400000>;
> +				read-only;
> +			};
> +
> +			partition@3c40000 {
> +				label = "reserved-filesystem";
> +				reg = <0x3c40000 0x3000000>;
> +				read-only;
> +			};
> +
> +			partition@6c40000 {
> +				label = "config";
> +				reg = <0x6c40000 0x400000>;
> +				read-only;
> +			};
> +
> +			partition@6e40000 {
> +				label = "nand-filesystem";
> +				reg = <0x6e40000 0x400000>;
> +				read-only;
> +			};
> +		};
> +	};
> +};
> +
> +&pcie0 {
> +	status = "okay";
> +	gpio-reset = <&gpio 11 GPIO_ACTIVE_HIGH>;
> +
> +	pcie@0 {
> +		reg = <0 0 0 0 0>;
> +		#interrupt-cells = <1>;
> +		#size-cells = <2>;
> +		#address-cells = <3>;
> +		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 */
> +		};
> +	};
> +};
> +
> +&gpio {
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&state_default>;
> +
> +	state_default: pinmux {
> +		mdio {
> +			lantiq,groups = "mdio";
> +			lantiq,function = "mdio";
> +		};
> +		pcie-rst {
> +			lantiq,pins = "io11";
> +			lantiq,open-drain = <1>;
> +			lantiq,output = <1>;
> +		};
> +		nand-mux {
> +			lantiq,groups = "nand cle", "nand ale",
> +			"nand rd", "nand cs1",
> +			"nand rdy";
> +			lantiq,function = "ebu";
> +		};
> +		nand-pins {
> +			lantiq,pins = "io13", "io24", "io49";
> +			lantiq,pull = <1>;
> +		};
> +
> +		/*
> +		other gpios:
> +
> +		dect reset: 33 output open drain
> +		dect rd: 8 active low push pull
> +
> +		tdm fsc: 9 input + pull-up
> +		tdm/spi do: 16 output
> +		tdm/spi di: 17 input + pull-up
> +		tdm dcl/spi clk: 18 output active low
> +		tdm clk enable: 7 output active high
> +		tdm/spi cs: 10 output active low/high
> +		spi wp: 12 output active low
> +
> +		boot sel2: 23 active high
> +		boot sel3: 38 active high
> +		boot sel4: 49 active high (also nand rd)
> +		*/
> +	};
> +};
> +
> +&gphy0 {
> +       lantiq,gphy-mode = <GPHY_MODE_FE>;

Here we have one of the whitespace issues John mentioned. Please check 
all your files and ensure that tabs instead of whitespaces are used.

> +};
> +
> +&eth0 {
> +	lantiq,phys = <&gphy0>;
> +
> +	interface@0 {
> +		compatible = "lantiq,xrx200-pdi";
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +		reg = <0>;
> +		mac-address = [ 00 11 22 33 44 55 ];
> +		lantiq,switch;
> +
> +		ethernet@2 {
> +			compatible = "lantiq,xrx200-pdi-port";
> +			reg = <2>;
> +			phy-mode = "gmii";
> +			phy-handle = <&phy11>;
> +		};
> +	};
> +
> +	mdio@0 {
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +		compatible = "lantiq,xrx200-mdio";
> +		phy11: ethernet-phy@11 {
> +			reg = <0x11>;
> +			compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22";
> +		};
> +	};
> +};
> +
> +&vmmc {
> +	status = "okay";
> +};

[...]

> diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/vr9.dtsi b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/vr9.dtsi
> index dbcbb3dcec..f787ad7e4d 100644
> --- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/vr9.dtsi
> +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/vr9.dtsi
> @@ -82,7 +82,7 @@
>   			reg = <0x106a00 0x200>;
>   		};
>   
> -		vmmc@107000 {
> +		vmmc: vmmc@103000 {
>   			status = "disabled";
>   			compatible = "lantiq,vmmc-xway";
>   			reg = <0x103000 0x400>;

Kernel 4.9 is kind of legacy and this change isn't really worth the 
work. It would only makes sense if the 4.9 dts files gets updated as well.

> diff --git a/target/linux/lantiq/image/Makefile b/target/linux/lantiq/image/Makefile
> index e52e43c6e5..6a3c8aef0f 100644
> --- a/target/linux/lantiq/image/Makefile
> +++ b/target/linux/lantiq/image/Makefile
> @@ -103,6 +103,7 @@ define Device/AVM
>     KERNEL := kernel-bin | append-dtb | lzma | eva-image
>     IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | append-avm-fakeroot | \
>   	append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
> +  KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | eva-image
>   endef
>   
>   ifeq ($(SUBTARGET),ase)
> @@ -630,6 +631,18 @@ define Device/avm_fritz7360sl
>   endef
>   TARGET_DEVICES += avm_fritz7360sl
>   
> +define Device/avm_fritz7412
> +  $(Device/AVM)
> +  $(Device/NAND)
> +  BOARD_NAME := FRITZ7412

BOARD_NAME isn't required for new boards. It is only required for boards 
which used a different name back in the time.

> +  DEVICE_DTS := FRITZ7412
> +  KERNEL_SIZE := 4096k
> +  IMAGE_SIZE := 49152k
> +  DEVICE_TITLE := 1&1 DSL-Modem / WLAN-Router - FRITZ7412

I prefer to have FRITZ7412 first. But it's a mater of taste.

> +  DEVICE_PACKAGES := kmod-ath9k kmod-owl-loader wpad-mini kmod-ltq-tapi kmod-ltq-vmmc fritz-tffs-nand fritz-caldata
> +endef
> +TARGET_DEVICES += avm_fritz7412
> +
>   define Device/arcadyan_vg3503j
>     IMAGE_SIZE := 8000k
>     DEVICE_DTS := VG3503J
>

Patch

diff --git a/target/linux/lantiq/base-files/etc/board.d/02_network b/target/linux/lantiq/base-files/etc/board.d/02_network
index ca974b071e..defdc1a94d 100755
--- a/target/linux/lantiq/base-files/etc/board.d/02_network
+++ b/target/linux/lantiq/base-files/etc/board.d/02_network
@@ -154,6 +154,14 @@  avm,fritz7360sl)
 		"0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "6t@eth0"
 	;;
 
+avm,fritz7412)
+	tffsdev=$(find_mtd_chardev "nand-tffs")
+	annex="b"
+	lan_mac=$(/usr/bin/fritz_tffs_nand -d $tffsdev -n maca)
+	wan_mac=$(/usr/bin/fritz_tffs_nand -d $tffsdev -n macdsl)
+	ucidef_set_interface_lan 'eth0'
+	;;
+
 siemens,gigaset-sx76x)
 	annex="b"
 	ucidef_add_switch "switch0" \
diff --git a/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom b/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom
index 498a509012..68181c7b87 100644
--- a/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom
+++ b/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom
@@ -141,6 +141,9 @@  case "$FIRMWARE" in
 			avm,fritz3370|avm,fritz7320|avm,fritz7360sl)
 				ath9k_eeprom_extract "urlader" 2437 0
 				;;
+			avm,fritz7412)
+				/usr/bin/fritz_cal_extract -i 1 -s 0x1e000 -e 0x207 -l 4096 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader")
+				;;
 			tplink,tdw8970|tplink,tdw8980)
 				ath9k_eeprom_extract "boardconfig" 135168 0
 				;;
diff --git a/target/linux/lantiq/base-files/lib/upgrade/platform.sh b/target/linux/lantiq/base-files/lib/upgrade/platform.sh
index 2e58cb799a..7a43e7e12e 100755
--- a/target/linux/lantiq/base-files/lib/upgrade/platform.sh
+++ b/target/linux/lantiq/base-files/lib/upgrade/platform.sh
@@ -9,7 +9,7 @@  platform_do_upgrade() {
 	local board=$(board_name)
 
 	case "$board" in
-	bt,homehub-v2b|bt,homehub-v3a|bt,homehub-v5a|zyxel,p-2812hnu-f1|zyxel,p-2812hnu-f3)
+	avm,fritz7412|bt,homehub-v2b|bt,homehub-v3a|bt,homehub-v5a|zyxel,p-2812hnu-f1|zyxel,p-2812hnu-f3)
 		nand_do_upgrade $1
 		;;
 	*)
diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7412.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7412.dts
new file mode 100644
index 0000000000..5bcd140520
--- /dev/null
+++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7412.dts
@@ -0,0 +1,241 @@ 
+/dts-v1/;
+
+#include "vr9.dtsi"
+
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/mips/lantiq_rcu_gphy.h>
+
+/ {
+	compatible = "avm,fritz7412", "lantiq,xway", "lantiq,vr9";
+	model = "1&1 DSL-Modem / 1&1 WLAN-Router";
+
+	chosen {
+		bootargs = "console=ttyLTQ0,115200 mem=126M vpe1_load_addr=0x87e00000 vpe1_mem=2M maxvpes=1 maxtcs=1 nosmp";
+	};
+
+	aliases {
+		led-boot = &power_green;
+		led-failsafe = &power_red;
+		led-running = &power_green;
+
+		led-dsl = &info;
+		led-wifi = &wifi;
+	};
+
+	memory@0 {
+		reg = <0x0 0x8000000>;
+	};
+
+	gpio-keys-polled {
+		compatible = "gpio-keys-polled";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		poll-interval = <100>;
+		wps {
+			label = "wps";
+			gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
+			linux,code = <KEY_WPS_BUTTON>;
+		};
+		dect {
+			label = "dect";
+			gpios = <&gpio 2 GPIO_ACTIVE_HIGH>;
+			linux,code = <KEY_PHONE>;
+		};
+	};
+
+	gpio-leds {
+		compatible = "gpio-leds";
+
+		power_green: power_green {
+			label = "fritz7412:green:power";
+			gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
+			default-state = "keep";
+		};
+		power_red: power_red {
+			label = "fritz7412:red:power";
+			gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
+		};
+		fon {
+			label = "fritz7412:green:fon";
+			gpios = <&gpio 34 GPIO_ACTIVE_LOW>;
+		};
+		dect {
+			label = "fritz7412:green:dect";
+			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
+		};
+		wifi: wifi {
+			label = "fritz7412:green:wifi";
+			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
+		};
+		info: info {
+			label = "fritz7412:green:info";
+			gpios = <&gpio 35 GPIO_ACTIVE_LOW>;
+		};
+	};
+};
+
+&localbus {
+	nand-parts@0 {
+		compatible = "lantiq,nand-xway";
+		bank-width = <2>;
+		reg = <1 0x0 0x2000000>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+		lantiq,cs = <1>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition@0 {
+				label = "urlader";
+				reg = <0x0 0x40000>;
+				read-only;
+			};
+
+			partition@40000 {
+				label = "nand-tffs";
+				reg = <0x40000 0x400000>;
+				read-only;
+			};
+
+			partition@440000 {
+				label = "kernel";
+				reg = <0x440000 0x400000>;
+			};
+
+			partition@840000 {
+				label = "ubi";
+				reg = <0x840000 0x3000000>;
+			};
+
+			partition@3840000 {
+				label = "reserved-kernel";
+				reg = <0x3840000 0x400000>;
+				read-only;
+			};
+
+			partition@3c40000 {
+				label = "reserved-filesystem";
+				reg = <0x3c40000 0x3000000>;
+				read-only;
+			};
+
+			partition@6c40000 {
+				label = "config";
+				reg = <0x6c40000 0x400000>;
+				read-only;
+			};
+
+			partition@6e40000 {
+				label = "nand-filesystem";
+				reg = <0x6e40000 0x400000>;
+				read-only;
+			};
+		};
+	};
+};
+
+&pcie0 {
+	status = "okay";
+	gpio-reset = <&gpio 11 GPIO_ACTIVE_HIGH>;
+
+	pcie@0 {
+		reg = <0 0 0 0 0>;
+		#interrupt-cells = <1>;
+		#size-cells = <2>;
+		#address-cells = <3>;
+		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 */
+		};
+	};
+};
+
+&gpio {
+	pinctrl-names = "default";
+	pinctrl-0 = <&state_default>;
+
+	state_default: pinmux {
+		mdio {
+			lantiq,groups = "mdio";
+			lantiq,function = "mdio";
+		};
+		pcie-rst {
+			lantiq,pins = "io11";
+			lantiq,open-drain = <1>;
+			lantiq,output = <1>;
+		};
+		nand-mux {
+			lantiq,groups = "nand cle", "nand ale",
+			"nand rd", "nand cs1",
+			"nand rdy";
+			lantiq,function = "ebu";
+		};
+		nand-pins {
+			lantiq,pins = "io13", "io24", "io49";
+			lantiq,pull = <1>;
+		};
+
+		/*
+		other gpios:
+
+		dect reset: 33 output open drain
+		dect rd: 8 active low push pull
+
+		tdm fsc: 9 input + pull-up
+		tdm/spi do: 16 output
+		tdm/spi di: 17 input + pull-up
+		tdm dcl/spi clk: 18 output active low
+		tdm clk enable: 7 output active high
+		tdm/spi cs: 10 output active low/high
+		spi wp: 12 output active low
+
+		boot sel2: 23 active high
+		boot sel3: 38 active high
+		boot sel4: 49 active high (also nand rd)
+		*/
+	};
+};
+
+&gphy0 {
+       lantiq,gphy-mode = <GPHY_MODE_FE>;
+};
+
+&eth0 {
+	lantiq,phys = <&gphy0>;
+
+	interface@0 {
+		compatible = "lantiq,xrx200-pdi";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0>;
+		mac-address = [ 00 11 22 33 44 55 ];
+		lantiq,switch;
+
+		ethernet@2 {
+			compatible = "lantiq,xrx200-pdi-port";
+			reg = <2>;
+			phy-mode = "gmii";
+			phy-handle = <&phy11>;
+		};
+	};
+
+	mdio@0 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "lantiq,xrx200-mdio";
+		phy11: ethernet-phy@11 {
+			reg = <0x11>;
+			compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22";
+		};
+	};
+};
+
+&vmmc {
+	status = "okay";
+};
diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ7412.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ7412.dts
new file mode 100644
index 0000000000..23f80db121
--- /dev/null
+++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ7412.dts
@@ -0,0 +1,242 @@ 
+/dts-v1/;
+
+#include "vr9.dtsi"
+
+#include <dt-bindings/input/input.h>
+
+/ {
+	compatible = "avm,fritz7412", "lantiq,xway", "lantiq,vr9";
+	model = "1&1 DSL-Modem / 1&1 WLAN-Router";
+
+	chosen {
+		bootargs = "console=ttyLTQ0,115200 mem=126M vpe1_load_addr=0x87e00000 vpe1_mem=2M maxvpes=1 maxtcs=1 nosmp";
+	};
+
+	aliases {
+		led-boot = &power_green;
+		led-failsafe = &power_red;
+		led-running = &power_green;
+
+		led-dsl = &info;
+		led-wifi = &wifi;
+	};
+
+	memory@0 {
+		reg = <0x0 0x8000000>;
+	};
+
+	fpi@10000000 {
+		localbus@0 {
+			nand-parts@0 {
+				compatible = "lantiq,nand-xway";
+				bank-width = <2>;
+				reg = <1 0x0 0x2000000>;
+				#address-cells = <1>;
+				#size-cells = <1>;
+				lantiq,cs = <1>;
+
+				partitions {
+					compatible = "fixed-partitions";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					partition@0 {
+						label = "urlader";
+						reg = <0x0 0x40000>;
+						read-only;
+					};
+
+					partition@40000 {
+						label = "nand-tffs";
+						reg = <0x40000 0x400000>;
+						read-only;
+					};
+
+					partition@440000 {
+						label = "kernel";
+						reg = <0x440000 0x400000>;
+					};
+
+					partition@840000 {
+						label = "ubi";
+						reg = <0x840000 0x3000000>;
+					};
+
+					partition@3840000 {
+						label = "reserved-kernel";
+						reg = <0x3840000 0x400000>;
+						read-only;
+					};
+
+					partition@3c40000 {
+						label = "reserved-filesystem";
+						reg = <0x3c40000 0x3000000>;
+						read-only;
+					};
+
+					partition@6c40000 {
+						label = "config";
+						reg = <0x6c40000 0x400000>;
+						read-only;
+					};
+
+					partition@6e40000 {
+						label = "nand-filesystem";
+						reg = <0x6e40000 0x400000>;
+						read-only;
+					};
+				};
+			};
+		};
+	};
+
+	gphy-xrx200 {
+		compatible = "lantiq,phy-xrx200";
+		firmware = "lantiq/xrx200_phy11g_a22.bin";
+		phys = [ 00 ];
+	};
+
+	gpio-keys-polled {
+		compatible = "gpio-keys-polled";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		poll-interval = <100>;
+		wps {
+			label = "wps";
+			gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
+			linux,code = <KEY_WPS_BUTTON>;
+		};
+		dect {
+			label = "dect";
+			gpios = <&gpio 2 GPIO_ACTIVE_HIGH>;
+			linux,code = <KEY_PHONE>;
+		};
+	};
+
+	gpio-leds {
+		compatible = "gpio-leds";
+
+		power_green: power_green {
+			label = "fritz7412:green:power";
+			gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
+			default-state = "keep";
+		};
+		power_red: power_red {
+			label = "fritz7412:red:power";
+			gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
+		};
+		fon {
+			label = "fritz7412:green:fon";
+			gpios = <&gpio 34 GPIO_ACTIVE_LOW>;
+		};
+		dect {
+			label = "fritz7412:green:dect";
+			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
+		};
+		wifi: wifi {
+			label = "fritz7412:green:wifi";
+			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
+		};
+		info: info {
+			label = "fritz7412:green:info";
+			gpios = <&gpio 35 GPIO_ACTIVE_LOW>;
+		};
+	};
+};
+
+&pcie0 {
+	status = "okay";
+	gpio-reset = <&gpio 11 GPIO_ACTIVE_HIGH>;
+
+	pcie@0 {
+		reg = <0 0 0 0 0>;
+		#interrupt-cells = <1>;
+		#size-cells = <2>;
+		#address-cells = <3>;
+		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 */
+		};
+	};
+};
+
+&gpio {
+	pinctrl-names = "default";
+	pinctrl-0 = <&state_default>;
+
+	state_default: pinmux {
+		mdio {
+			lantiq,groups = "mdio";
+			lantiq,function = "mdio";
+		};
+		pcie-rst {
+			lantiq,pins = "io11";
+			lantiq,open-drain = <1>;
+			lantiq,output = <1>;
+		};
+		nand-mux {
+			lantiq,groups = "nand cle", "nand ale",
+			"nand rd", "nand cs1",
+			"nand rdy";
+			lantiq,function = "ebu";
+		};
+		nand-pins {
+			lantiq,pins = "io13", "io24", "io49";
+			lantiq,pull = <1>;
+		};
+
+		/*
+		other gpios:
+
+		dect reset: 33 output open drain
+		dect rd: 8 active low push pull
+
+		tdm fsc: 9 input + pull-up
+		tdm/spi do: 16 output
+		tdm/spi di: 17 input + pull-up
+		tdm dcl/spi clk: 18 output active low
+		tdm clk enable: 7 output active high
+		tdm/spi cs: 10 output active low/high
+		spi wp: 12 output active low
+
+		boot sel2: 23 active high
+		boot sel3: 38 active high
+		boot sel4: 49 active high (also nand rd)
+		*/
+	};
+};
+
+&eth0 {
+	interface@0 {
+		compatible = "lantiq,xrx200-pdi";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0>;
+		mac-address = [ 00 11 22 33 44 55 ];
+		lantiq,switch;
+
+		ethernet@2 {
+			compatible = "lantiq,xrx200-pdi-port";
+			reg = <2>;
+			phy-mode = "gmii";
+			phy-handle = <&phy11>;
+		};
+	};
+
+	mdio@0 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "lantiq,xrx200-mdio";
+		phy11: ethernet-phy@11 {
+			reg = <0x11>;
+			compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22";
+		};
+	};
+};
+
+&vmmc {
+	status = "okay";
+};
diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/vr9.dtsi b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/vr9.dtsi
index dbcbb3dcec..f787ad7e4d 100644
--- a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/vr9.dtsi
+++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/vr9.dtsi
@@ -82,7 +82,7 @@ 
 			reg = <0x106a00 0x200>;
 		};
 
-		vmmc@107000 {
+		vmmc: vmmc@103000 {
 			status = "disabled";
 			compatible = "lantiq,vmmc-xway";
 			reg = <0x103000 0x400>;
diff --git a/target/linux/lantiq/image/Makefile b/target/linux/lantiq/image/Makefile
index e52e43c6e5..6a3c8aef0f 100644
--- a/target/linux/lantiq/image/Makefile
+++ b/target/linux/lantiq/image/Makefile
@@ -103,6 +103,7 @@  define Device/AVM
   KERNEL := kernel-bin | append-dtb | lzma | eva-image
   IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | append-avm-fakeroot | \
 	append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
+  KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | eva-image
 endef
 
 ifeq ($(SUBTARGET),ase)
@@ -630,6 +631,18 @@  define Device/avm_fritz7360sl
 endef
 TARGET_DEVICES += avm_fritz7360sl
 
+define Device/avm_fritz7412
+  $(Device/AVM)
+  $(Device/NAND)
+  BOARD_NAME := FRITZ7412
+  DEVICE_DTS := FRITZ7412
+  KERNEL_SIZE := 4096k
+  IMAGE_SIZE := 49152k
+  DEVICE_TITLE := 1&1 DSL-Modem / WLAN-Router - FRITZ7412
+  DEVICE_PACKAGES := kmod-ath9k kmod-owl-loader wpad-mini kmod-ltq-tapi kmod-ltq-vmmc fritz-tffs-nand fritz-caldata
+endef
+TARGET_DEVICES += avm_fritz7412
+
 define Device/arcadyan_vg3503j
   IMAGE_SIZE := 8000k
   DEVICE_DTS := VG3503J