Message ID | 20211228002818.302910-1-linus.walleij@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | ARM: dts: ixp4xx: Fix up the Netgear WG302 device tree | expand |
On Tue, 28 Dec 2021, Linus Walleij wrote: > The version we can support (because of access to the hardware) > is WG302v1, so rename the file and make the following > modifications: > > - We have 32MB memory not 16MB > - The default console speed is 9600 baud so use this > - The device has no ATA disk nor USB so drop the /dev/sda1 > default mount, this needs to mount ramdisk or NFS > - Both serial0 and serial1 cannot be assigned with aliases, > just assign serial0 > - The Flash is just 8MB so augment the size > - The Flash FIS index is at eraseblock 0x3f > - The PHY is at MDIO address 30 > > Tested by bringing the Netgear WG302v1 up to userspace using > initramfs appended to the kernel and downloaded over TFTP, > then ifconfig to bring up eth0 and pinging the host. All > works fine including SSH into the device from the host. > Does anyone still have the configs for that test? Here's what I see when I build and boot ixp4xx_defconfig. RedBoot> load -r -b 0x01600000 zImage Using default protocol (TFTP) Raw file loaded 0x01600000-0x018a4087, assumed entry at 0x01600000 RedBoot> exec 0x01600000 Using base address 0x01600000 and length 0x002a4088 Error: invalid dtb and unrecognized/unsupported machine ID r1=0x000000f5, r2=0x00000000 Available machine support: ID (hex) NAME ffffffff Generic DT based system ffffffff IXP4xx (Device Tree) Please check your kernel config and/or bootloader. It would be great to have a working mainline build because without it this router is just more e-waste. Any help would be appreciated.
On Fri, Jul 8, 2022 at 5:16 AM Finn Thain <fthain@linux-m68k.org> wrote: > Does anyone still have the configs for that test? Here's what I see when I > build and boot ixp4xx_defconfig. > > RedBoot> load -r -b 0x01600000 zImage > Using default protocol (TFTP) > Raw file loaded 0x01600000-0x018a4087, assumed entry at 0x01600000 > RedBoot> exec 0x01600000 > Using base address 0x01600000 and length 0x002a4088 > > Error: invalid dtb and unrecognized/unsupported machine ID > r1=0x000000f5, r2=0x00000000 > Available machine support: > > ID (hex) NAME > ffffffff Generic DT based system > ffffffff IXP4xx (Device Tree) > > Please check your kernel config and/or bootloader. Usually this is because the DTB is corrupt. > It would be great to have a working mainline build because without it this > router is just more e-waste. Any help would be appreciated. I just test-booted it using v5.19-rc5. I can't mount root but otherwise it works. All info here: https://dflund.se/~triad/krad/netgear-wg302/ A typical problem would be that the kernel gets too big because you use something like initramfs. My idea to use this is configure RedBoot to boot the kernel from TFTP or flash then mount root using NFS to avoid using memory for initramfs. Yours, Linus Walleij
On Fri, Jul 8, 2022 at 3:15 PM Linus Walleij <linus.walleij@linaro.org> wrote: > On Fri, Jul 8, 2022 at 5:16 AM Finn Thain <fthain@linux-m68k.org> wrote: > > Does anyone still have the configs for that test? Here's what I see when I > > build and boot ixp4xx_defconfig. > > > > RedBoot> load -r -b 0x01600000 zImage > > Using default protocol (TFTP) > > Raw file loaded 0x01600000-0x018a4087, assumed entry at 0x01600000 > > RedBoot> exec 0x01600000 > > Using base address 0x01600000 and length 0x002a4088 > > > > Error: invalid dtb and unrecognized/unsupported machine ID > > r1=0x000000f5, r2=0x00000000 > > Available machine support: > > > > ID (hex) NAME > > ffffffff Generic DT based system > > ffffffff IXP4xx (Device Tree) > > > > Please check your kernel config and/or bootloader. > > Usually this is because the DTB is corrupt. Usually because it gets overwritten due to a bad combination of load addresses for kernel and DTB, or during copying by the boot loader. However, this is redboot, using a single load command. Finn: Does your zImage have an appended DTB? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
On Fri, 8 Jul 2022, Linus Walleij wrote: > On Fri, Jul 8, 2022 at 5:16 AM Finn Thain <fthain@linux-m68k.org> wrote: > > > Does anyone still have the configs for that test? Here's what I see when I > > build and boot ixp4xx_defconfig. > > > > RedBoot> load -r -b 0x01600000 zImage > > Using default protocol (TFTP) > > Raw file loaded 0x01600000-0x018a4087, assumed entry at 0x01600000 > > RedBoot> exec 0x01600000 > > Using base address 0x01600000 and length 0x002a4088 > > > > Error: invalid dtb and unrecognized/unsupported machine ID > > r1=0x000000f5, r2=0x00000000 > > Available machine support: > > > > ID (hex) NAME > > ffffffff Generic DT based system > > ffffffff IXP4xx (Device Tree) > > > > Please check your kernel config and/or bootloader. > > Usually this is because the DTB is corrupt. > > > It would be great to have a working mainline build because without it this > > router is just more e-waste. Any help would be appreciated. > > I just test-booted it using v5.19-rc5. I can't mount root but > otherwise it works. > All info here: > https://dflund.se/~triad/krad/netgear-wg302/ > That web page was very helpful. Thanks!
On Fri, 8 Jul 2022, Geert Uytterhoeven wrote: > On Fri, Jul 8, 2022 at 3:15 PM Linus Walleij <linus.walleij@linaro.org> wrote: > > On Fri, Jul 8, 2022 at 5:16 AM Finn Thain <fthain@linux-m68k.org> wrote: > > > Does anyone still have the configs for that test? Here's what I see when I > > > build and boot ixp4xx_defconfig. > > > > > > RedBoot> load -r -b 0x01600000 zImage > > > Using default protocol (TFTP) > > > Raw file loaded 0x01600000-0x018a4087, assumed entry at 0x01600000 > > > RedBoot> exec 0x01600000 > > > Using base address 0x01600000 and length 0x002a4088 > > > > > > Error: invalid dtb and unrecognized/unsupported machine ID > > > r1=0x000000f5, r2=0x00000000 > > > Available machine support: > > > > > > ID (hex) NAME > > > ffffffff Generic DT based system > > > ffffffff IXP4xx (Device Tree) > > > > > > Please check your kernel config and/or bootloader. > > > > Usually this is because the DTB is corrupt. > > Usually because it gets overwritten due to a bad combination of load > addresses for kernel and DTB, or during copying by the boot loader. > However, this is redboot, using a single load command. > Load address seems to be okay. Changing 0x01600000 to 0x00080000 has no effect here. I suspect you're right about Redboot preventing such mistakes. > Finn: Does your zImage have an appended DTB? > No, I wasn't aware of that step. Thanks for the tip! Appending the appropriate dtb was sufficient to get the ixp4xx_defconfig build to boot. But a build using a custom .config crashed early: [ 0.000000] Booting Linux on physical CPU 0x0 [ 0.000000] Linux version 5.19.0-rc5-00105-g9f09069cde34 (fthain@nippy) (arm-unknown-linux-gnueabi-gcc (btc) 6.4.0, GNU ld (btc) 2.28) #16 Sat Jul 9 13:46:40 AEST 2022 [ 0.000000] CPU: XScale-IXP42x Family [690541f1] revision 1 (ARMv5TE), cr=000039ff [ 0.000000] CPU: VIVT data cache, VIVT instruction cache [ 0.000000] OF: fdt: Machine model: Netgear WG302 v1 [ 0.000000] printk: debug: ignoring loglevel setting. [ 0.000000] printk: bootconsole [earlycon0] enabled [ 0.000000] Memory policy: Data cache writeback [ 0.000000] Internal error: Oops - BUG: 0 [#1] ARM [ 0.000000] Modules linked in: [ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 5.19.0-rc5-00105-g9f09069cde34 #16 [ 0.000000] Hardware name: IXP4xx (Device Tree) [ 0.000000] PC is at 0x80494a74 [ 0.000000] LR is at 0x00200000 [ 0.000000] pc : [<80494a74>] lr : [<00200000>] psr: 800000d3 [ 0.000000] sp : 804b1ed4 ip : 81ffcfb0 fp : fef00000 [ 0.000000] r10: ffe00000 r9 : 001fffff r8 : 804b760c [ 0.000000] r7 : 804d6218 r6 : 804e8234 r5 : 804b75ec r4 : 81ffcf88 [ 0.000000] r3 : 81ffcfd8 r2 : fef00000 r1 : ff000000 r0 : 81ffcf88 [ 0.000000] Flags: Nzcv IRQs off FIQs off Mode SVC_32 ISA ARM Segment user [ 0.000000] Control: 000039ff Table: 00004000 DAC: 00000055 [ 0.000000] Register r0 information: [ 0.000000] 8<--- cut here --- [ 0.000000] Unable to handle kernel paging request at virtual address 0003ff84 [ 0.000000] [0003ff84] *pgd=00000000 After a lot of messing around, I was finally able to fix my .config by deleting "CONFIG_DEBUG_UART_VIRT=0xfef00003". Then make was able to replace it with "CONFIG_DEBUG_UART_VIRT=0xfec00003" which resolved the crash. (ISTR the original setting came from an old ixp4xx .config from openwrt.org.)
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 7dfda6be2916..4b1f47a60a84 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -268,7 +268,7 @@ dtb-$(CONFIG_ARCH_IXP4XX) += \ intel-ixp42x-dlink-dsm-g600.dtb \ intel-ixp42x-gateworks-gw2348.dtb \ intel-ixp43x-gateworks-gw2358.dtb \ - intel-ixp42x-netgear-wg302v2.dtb \ + intel-ixp42x-netgear-wg302v1.dtb \ intel-ixp42x-arcom-vulcan.dtb \ intel-ixp42x-gateway-7001.dtb dtb-$(CONFIG_ARCH_KEYSTONE) += \ diff --git a/arch/arm/boot/dts/intel-ixp42x-netgear-wg302v2.dts b/arch/arm/boot/dts/intel-ixp42x-netgear-wg302v1.dts similarity index 77% rename from arch/arm/boot/dts/intel-ixp42x-netgear-wg302v2.dts rename to arch/arm/boot/dts/intel-ixp42x-netgear-wg302v1.dts index a57009436ed8..df2ca6d95ee5 100644 --- a/arch/arm/boot/dts/intel-ixp42x-netgear-wg302v2.dts +++ b/arch/arm/boot/dts/intel-ixp42x-netgear-wg302v1.dts @@ -10,26 +10,26 @@ #include <dt-bindings/input/input.h> / { - model = "Netgear WG302 v2"; - compatible = "netgear,wg302v2", "intel,ixp42x"; + model = "Netgear WG302 v1"; + compatible = "netgear,wg302v1", "intel,ixp42x"; #address-cells = <1>; #size-cells = <1>; memory@0 { - /* 16 MB SDRAM according to OpenWrt database */ + /* 32 MB SDRAM according to boot arguments */ device_type = "memory"; - reg = <0x00000000 0x01000000>; + reg = <0x00000000 0x02000000>; }; chosen { - bootargs = "console=ttyS0,115200n8 root=/dev/sda1 rw rootwait"; - stdout-path = "uart1:115200n8"; + /* The RedBoot comes up in 9600 baud so let's keep this */ + bootargs = "console=ttyS0,9600n8"; + stdout-path = "uart1:9600n8"; }; aliases { /* These are switched around */ serial0 = &uart1; - serial1 = &uart0; }; soc { @@ -38,18 +38,17 @@ flash@0,0 { compatible = "intel,ixp4xx-flash", "cfi-flash"; bank-width = <2>; /* - * 32 MB of Flash in 128 0x20000 sized blocks - * mapped in at CS0 and CS1 + * 8 MB of Flash in 64 0x20000 sized blocks + * mapped in at CS0. */ - reg = <0 0x00000000 0x2000000>; + reg = <0 0x00000000 0x800000>; /* Configure expansion bus to allow writes */ intel,ixp4xx-eb-write-enable = <1>; partitions { compatible = "redboot-fis"; - /* CHECKME: guess this is Redboot FIS */ - fis-index-block = <0xff>; + fis-index-block = <0x3f>; }; }; }; @@ -82,14 +81,14 @@ ethernet@c8009000 { queue-rx = <&qmgr 3>; queue-txready = <&qmgr 20>; phy-mode = "rgmii"; - phy-handle = <&phy8>; + phy-handle = <&phy30>; mdio { #address-cells = <1>; #size-cells = <0>; - phy8: ethernet-phy@8 { - reg = <8>; + phy30: ethernet-phy@30 { + reg = <30>; }; }; };
The version we can support (because of access to the hardware) is WG302v1, so rename the file and make the following modifications: - We have 32MB memory not 16MB - The default console speed is 9600 baud so use this - The device has no ATA disk nor USB so drop the /dev/sda1 default mount, this needs to mount ramdisk or NFS - Both serial0 and serial1 cannot be assigned with aliases, just assign serial0 - The Flash is just 8MB so augment the size - The Flash FIS index is at eraseblock 0x3f - The PHY is at MDIO address 30 Tested by bringing the Netgear WG302v1 up to userspace using initramfs appended to the kernel and downloaded over TFTP, then ifconfig to bring up eth0 and pinging the host. All works fine including SSH into the device from the host. Cc: Zoltan HERPAI <wigyori@uid0.hu> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- Zoltan: please check if some of these changes makes GW7001 come up as well. --- arch/arm/boot/dts/Makefile | 2 +- ...2.dts => intel-ixp42x-netgear-wg302v1.dts} | 29 +++++++++---------- 2 files changed, 15 insertions(+), 16 deletions(-) rename arch/arm/boot/dts/{intel-ixp42x-netgear-wg302v2.dts => intel-ixp42x-netgear-wg302v1.dts} (77%)