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

2018-03-18 Thread Mathias Kresin

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 

---
  .../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/

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

2018-03-10 Thread Andrey Jr. Melnikov
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
^^^ 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



___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


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

2018-03-09 Thread John Crispin



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 


---
  .../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 00..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 
+#include 
+
+/ {
+    compatible = "avm,fritz7412", "lantiq,xway", "lantiq,vr9

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

2018-03-09 Thread 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
- 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 

---
 .../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 00..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 
+#include 
+
+/ {
+   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=0x87e0 vpe1_mem=2M ma