Ipq40xx can't register ess-switch

[    0.837297] libphy: ipq40xx_mdio: probed
[    0.845834] ipq40xx-mdio 90000.mdio: ipq40xx-mdio driver was regitstered
[    0.846556] libphy: Fixed MDIO Bus: probed
[    0.853223] Unable to handle kernel NULL pointer dereference at virtual address 000000a4
[    0.856849] pgd = (ptrval)
[    0.865051] [000000a4] *pgd=00000000
[    0.867595] Internal error: Oops: 5 [#1] SMP ARM
[    0.871306] Modules linked in:
[    0.875909] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.19.66 #0
[    0.878773] Hardware name: Generic DT based system
[    0.884943] PC is at ar40xx_probe+0x31c/0x740
[    0.889535] LR is at ar40xx_probe+0x2fc/0x740
[    0.893963] pc : [<c061b3e8>]    lr : [<c061b3c8>]    psr: 00000013
[    0.898306] sp : cf823df8  ip : cfd7a5a4  fp : 00000000
[    0.904380] r10: cf96e000  r9 : c0b205e4  r8 : c0b689f0
[    0.909591] r7 : cf96e010  r6 : cfdb7314  r5 : 00000000  r4 : cf82c040
[    0.914801] r3 : 00000000  r2 : 00200000  r1 : 00000000  r0 : cf82c220
[    0.921398] Flags: nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
[    0.927908] Control: 10c5387d  Table: 8020406a  DAC: 00000051
[    0.935112] Process swapper/0 (pid: 1, stack limit = 0x(ptrval))
[    0.940842] Stack: (0xcf823df8 to 0xcf824000)
[    0.946917] 3de0:                                                       00000000 c06648a4
[    0.951180] 3e00: cfbe8780 00000004 00098000 000987ff cfdb764c 00000200 00000000 00000000
[    0.959341] 3e20: 00000000 00000000 0c000000 0c07ffff cfdb736c 00000200 00000000 00000000
[    0.967499] 3e40: 00000000 00000000 c0b205e4 cf96e010 c0b205e4 c0b67d5c 00000000 c0b2e430
[    0.975659] 3e60: c0b205e4 00000000 00000000 c05b49a4 c0b67d58 cf96e010 c0b67d5c c05b2ea4
[    0.983818] 3e80: cfdb7314 c0b1ce40 00000000 cf96e010 cf96e044 c0b205e4 c0b1ce40 00000000
[    0.991979] 3ea0: 00000063 c0a3701c 00000000 c05b3488 cf96e010 c0b205e4 c05b3380 c05b10a4
[    1.000138] 3ec0: cf807d58 cf95acb4 c0b205e4 cfbcc580 c0b2e358 c05b2250 c08c66cc 00000000
[    1.008298] 3ee0: c0b205e4 c0b04c48 ffffe000 c0a17da0 00000000 c05b3be4 c0b332c0 c0b04c48
[    1.016457] 3f00: ffffe000 c03026c0 00000064 c090e724 cfffcdac c0337200 00000000 cf823f24
[    1.024618] 3f20: cccccccd c090df68 c0b2a398 00000006 00000006 c08ce390 c0885cc8 00000000
[    1.032777] 3f40: c088cd30 c0885d80 cfffcdac cfffcdb7 00000000 d818d08d 00000007 c0b332c0
[    1.040938] 3f60: c0b332c0 c0a2c834 c0a2c83c c0a3701c 00000000 c0a00f08 00000006 00000006
[    1.049095] 3f80: 00000000 c0a005a4 00000000 c07b098c 00000000 00000000 00000000 00000000
[    1.057257] 3fa0: 00000000 c07b0994 00000000 c03010e8 00000000 00000000 00000000 00000000
[    1.065415] 3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    1.073575] 3fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
[    1.081748] [<c061b3e8>] (ar40xx_probe) from [<c05b49a4>] (platform_drv_probe+0x34/0x70)
[    1.089897] [<c05b49a4>] (platform_drv_probe) from [<c05b2ea4>] (really_probe+0x1c4/0x3e4)
[    1.098056] [<c05b2ea4>] (really_probe) from [<c05b3488>] (__driver_attach+0x108/0x140)
[    1.106131] [<c05b3488>] (__driver_attach) from [<c05b10a4>] (bus_for_each_dev+0x48/0x98)
[    1.114029] [<c05b10a4>] (bus_for_each_dev) from [<c05b2250>] (bus_add_driver+0x13c/0x250)
[    1.122360] [<c05b2250>] (bus_add_driver) from [<c05b3be4>] (driver_register+0xbc/0xf8)
[    1.130523] [<c05b3be4>] (driver_register) from [<c03026c0>] (do_one_initcall+0x7c/0x184)
[    1.138425] [<c03026c0>] (do_one_initcall) from [<c0a00f08>] (kernel_init_freeable+0x1c4/0x260)
[    1.146759] [<c0a00f08>] (kernel_init_freeable) from [<c07b0994>] (kernel_init+0x8/0x114)
[    1.155262] [<c07b0994>] (kernel_init) from [<c03010e8>] (ret_from_fork+0x14/0x2c)
[    1.163584] Exception stack(0xcf823fb0 to 0xcf823ff8)
[    1.171051] 3fa0:                                     00000000 00000000 00000000 00000000
[    1.176178] 3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    1.184337] 3fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[    1.192498] Code: e1a00007 e34c108c ebfe4da5 e5943114 (e59320a4)
[    1.198966] ---[ end trace cf796aa8b07038e2 ]---
[    1.205160] Kernel panic - not syncing: Fatal exception
[    1.209860] CPU3: stopping
[    1.214797] CPU: 3 PID: 0 Comm: swapper/3 Tainted: G      D           4.19.66 #0
[    1.217577] Hardware name: Generic DT based system
[    1.225140] [<c030f1f4>] (unwind_backtrace) from [<c030b9ac>] (show_stack+0x10/0x14)
[    1.229742] [<c030b9ac>] (show_stack) from [<c079cc10>] (dump_stack+0x88/0x9c)
[    1.237639] [<c079cc10>] (dump_stack) from [<c030e268>] (handle_IPI+0xf0/0x19c)
[    1.244671] [<c030e268>] (handle_IPI) from [<c0542cc4>] (gic_handle_irq+0x8c/0x90)
[    1.251875] [<c0542cc4>] (gic_handle_irq) from [<c0301a0c>] (__irq_svc+0x6c/0x90)
[    1.259506] Exception stack(0xcf863f68 to 0xcf863fb0)
[    1.267059] 3f60:                   00000000 00000104 cfda22c4 c0314aa0 ffffe000 c0b04c6c
[    1.272100] 3f80: 00000008 c0b04cac c0a3dda8 00000000 00000000 00000000 0f366000 cf863fb8
[    1.280256] 3fa0: c0308f80 c0308f84 60000013 ffffffff
[    1.288418] [<c0301a0c>] (__irq_svc) from [<c0308f84>] (arch_cpu_idle+0x34/0x38)
[    1.293460] [<c0308f84>] (arch_cpu_idle) from [<c0342d3c>] (do_idle+0xf8/0x208)
[    1.300922] [<c0342d3c>] (do_idle) from [<c03430a8>] (cpu_startup_entry+0x18/0x20)
[    1.307951] [<c03430a8>] (cpu_startup_entry) from [<803023ec>] (0x803023ec)
[    1.315585] CPU2: stopping
[    1.322437] CPU: 2 PID: 0 Comm: swapper/2 Tainted: G      D           4.19.66 #0
[    1.325216] Hardware name: Generic DT based system
[    1.332776] [<c030f1f4>] (unwind_backtrace) from [<c030b9ac>] (show_stack+0x10/0x14)
[    1.337378] [<c030b9ac>] (show_stack) from [<c079cc10>] (dump_stack+0x88/0x9c)
[    1.345277] [<c079cc10>] (dump_stack) from [<c030e268>] (handle_IPI+0xf0/0x19c)
[    1.352308] [<c030e268>] (handle_IPI) from [<c0542cc4>] (gic_handle_irq+0x8c/0x90)
[    1.359512] [<c0542cc4>] (gic_handle_irq) from [<c0301a0c>] (__irq_svc+0x6c/0x90)
[    1.367145] Exception stack(0xcf861f68 to 0xcf861fb0)
[    1.374699] 1f60:                   00000000 000003f0 cfd932c4 c0314aa0 ffffe000 c0b04c6c
[    1.379738] 1f80: 00000004 c0b04cac c0a3dda8 00000000 00000000 00000000 0f357000 cf861fb8
[    1.387894] 1fa0: c0308f80 c0308f84 60000013 ffffffff
[    1.396054] [<c0301a0c>] (__irq_svc) from [<c0308f84>] (arch_cpu_idle+0x34/0x38)
[    1.401095] [<c0308f84>] (arch_cpu_idle) from [<c0342d3c>] (do_idle+0xf8/0x208)
[    1.408560] [<c0342d3c>] (do_idle) from [<c03430a8>] (cpu_startup_entry+0x18/0x20)
[    1.415587] [<c03430a8>] (cpu_startup_entry) from [<803023ec>] (0x803023ec)
[    1.423222] CPU1: stopping
[    1.430074] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G      D           4.19.66 #0
[    1.432856] Hardware name: Generic DT based system
[    1.440415] [<c030f1f4>] (unwind_backtrace) from [<c030b9ac>] (show_stack+0x10/0x14)
[    1.445016] [<c030b9ac>] (show_stack) from [<c079cc10>] (dump_stack+0x88/0x9c)
[    1.452915] [<c079cc10>] (dump_stack) from [<c030e268>] (handle_IPI+0xf0/0x19c)
[    1.459946] [<c030e268>] (handle_IPI) from [<c0542cc4>] (gic_handle_irq+0x8c/0x90)
[    1.467150] [<c0542cc4>] (gic_handle_irq) from [<c0301a0c>] (__irq_svc+0x6c/0x90)
[    1.474783] Exception stack(0xcf85ff68 to 0xcf85ffb0)
[    1.482336] ff60:                   00000000 000003a4 cfd842c4 c0314aa0 ffffe000 c0b04c6c
[    1.487379] ff80: 00000002 c0b04cac c0a3dda8 00000000 00000000 00000000 0f348000 cf85ffb8
[    1.495534] ffa0: c0308f80 c0308f84 60000013 ffffffff
[    1.503695] [<c0301a0c>] (__irq_svc) from [<c0308f84>] (arch_cpu_idle+0x34/0x38)
[    1.508733] [<c0308f84>] (arch_cpu_idle) from [<c0342d3c>] (do_idle+0xf8/0x208)
[    1.516198] [<c0342d3c>] (do_idle) from [<c03430a8>] (cpu_startup_entry+0x18/0x20)
[    1.523227] [<c03430a8>] (cpu_startup_entry) from [<803023ec>] (0x803023ec)
[    1.530865] Rebooting in 1 seconds..
[    3.537872] Reboot failed -- System halted

run to here hug
2021     /* register switch */
2022     swdev = &priv->dev;
2023 
2024     swdev->alias = dev_name(&priv->mii_bus->dev);  <---------------------------------------------
2025 
2026     swdev->cpu_port = AR40XX_PORT_CPU;
2027     swdev->name = "QCA AR40xx";
2028     swdev->vlans = AR40XX_MAX_VLANS;
2029     swdev->ports = AR40XX_NUM_PORTS;
2030     swdev->ops = &ar40xx_sw_ops;
2031     ret = register_switch(swdev, NULL);
2032     if (ret)
2033         goto err_unregister_phy;

OpenWrt? QSDK? What device? What is the DTS?

Many OpenWrt devices run ipq40xx SoCs and register the switch reliably.

openwrt master´╝îDK04 C1

in &tlmm node:

	mdio_pins: mdio_pinmux {
		mux_1 {
			pins = "gpio6";
			function = "mdio";
			bias-pull-up;
		};

 		mux_2 {
			pins = "gpio7";
			function = "mdc";
			bias-pull-up;
		};

 		pin_rst {
			pins = "gpio47";
			function = "gpio";
			bias-disable;
			output-high;
		};
	};

in soc node

		mdio@90000 {
			status = "okay";
			pinctrl-0 = <&mdio_pins>;
			pinctrl-names = "default";
		};

not in here.but thanks always