Skip to content

Instantly share code, notes, and snippets.

@hyphop
Last active August 23, 2019 19:08
Show Gist options
  • Save hyphop/0e06b466b5caa25c5047278bdad93e2b to your computer and use it in GitHub Desktop.
Save hyphop/0e06b466b5caa25c5047278bdad93e2b to your computer and use it in GitHub Desktop.
dwmac_meson8b.experiment.md

sources

load eth

MOD="realtek mdio-mux-meson-g12a dwmac_meson8b"

for i in $MOD; do
    [ -d /sys/module/$i ] || modprobe $i
done

check modules

root@Krescue-init:/# lsmod | egrep mac\|realtek 
dwmac_meson8b          16384  0 
phylink                28672  1 stmmac
realtek                20480  1 
stmmac                135168  2 dwmac_meson8b,stmmac_platform
stmmac_platform        20480  1 dwmac_meson8b

ok its works

dmesg -c

[   13.645057] meson8b-dwmac c9410000.ethernet: PTP uses main clock
[   13.645075] meson8b-dwmac c9410000.ethernet: no reset control found
[   13.646973] meson8b-dwmac c9410000.ethernet: User ID: 0x11, Synopsys ID: 0x37
[   13.646991] meson8b-dwmac c9410000.ethernet:         DWMAC1000
[   13.646997] meson8b-dwmac c9410000.ethernet: DMA HW capability register supported
[   13.647002] meson8b-dwmac c9410000.ethernet: RX Checksum Offload Engine supported
[   13.647006] meson8b-dwmac c9410000.ethernet: COE Type 2
[   13.647010] meson8b-dwmac c9410000.ethernet: TX Checksum insertion supported
[   13.647014] meson8b-dwmac c9410000.ethernet: Wake-Up On Lan supported
[   13.647067] meson8b-dwmac c9410000.ethernet: Normal descriptors
[   13.647072] meson8b-dwmac c9410000.ethernet: Ring mode enabled
[   13.647076] meson8b-dwmac c9410000.ethernet: Enable RX Mitigation via HW Watchdog Timer
[   13.647101] meson8b-dwmac c9410000.ethernet: device MAC address 9a:9c:47:d3:e8:34
[   13.647382] libphy: stmmac: probed
[   13.649210] libphy: mdio_mux: probed
[   13.649457] meson8b-dwmac c9410000.ethernet eth0: no phy at addr -1
[   13.659046] meson8b-dwmac c9410000.ethernet eth0: stmmac_open: Cannot attach to PHY (error: -19)
[   13.676078] libphy: mdio_mux: probed
[   13.677417] meson8b-dwmac c9410000.ethernet eth0: no phy at addr -1
[   13.688248] meson8b-dwmac c9410000.ethernet eth0: stmmac_open: Cannot attach to PHY (error: -19)
[   13.724952] mmc2: new SDIO card at address 0001
[   14.753854] meson8b-dwmac c9410000.ethernet eth0: PHY [0.2009087f:00] driver [RTL8211F Gigabit Ethernet]
[   14.753958] meson8b-dwmac c9410000.ethernet eth0: phy: setting supported 00,00000000,000062ff advertising 00,00000000,000062ff
[   14.776801] meson8b-dwmac c9410000.ethernet eth0: No Safety Features support found
[   14.776812] meson8b-dwmac c9410000.ethernet eth0: PTP not supported by HW
[   14.776821] meson8b-dwmac c9410000.ethernet eth0: configuring for phy/rgmii link mode
[   14.776833] meson8b-dwmac c9410000.ethernet eth0: phylink_mac_config: mode=phy/rgmii/Unknown/Unknown adv=00,00000000,000062ff pause=10 link=0 an=1
[   14.778555] meson8b-dwmac c9410000.ethernet eth0: phy link down rgmii/Unknown/Unknown
[   17.570685] meson8b-dwmac c9410000.ethernet eth0: phy link up rgmii/1Gbps/Full
[   17.570838] meson8b-dwmac c9410000.ethernet eth0: phylink_mac_config: mode=phy/rgmii/1Gbps/Full adv=00,00000000,00000000 pause=0f link=1 an=0
[   17.572588] meson8b-dwmac c9410000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx

unload eth

MOD="dwmac_meson8b stmmac_platform stmmac realtek phylink mdio_mux_meson_g12a"

for i in $MOD; do
    [ -d /sys/module/$i ] && rmmod $i
done

yes its same ok

lsmod | egrep mac\|realtek || echo ALL_IS_UNLOADED_OK
ALL_IS_UNLOADED_OK

dmesg -c

[  125.448398] meson8b-dwmac c9410000.ethernet eth0: stmmac_dvr_remove: removing driver
[  125.448643] meson8b-dwmac c9410000.ethernet eth0: phy link down rgmii/1Gbps/Full

try load modules again !!! modprobe dwmac_meson8b

ooops! we have segfault!

[  158.534101] Mem abort info:
[  158.543562]   ESR = 0x8600000f
[  158.551588]   Exception class = IABT (current EL), IL = 32 bits
[  158.560279]   SET = 0, FnV = 0
[  158.568597]   EA = 0, S1PTW = 0
[  158.576878] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000001c02000
[  158.586561] [ffff0000089ffef0] pgd=00000000b7fff003, pud=00000000b7ffe003, pmd=00000000794d2003, pte=00e000007acb9793
[  158.600662] Internal error: Oops: 8600000f [#1] PREEMPT SMP
[  158.609884] Modules linked in: dwmac_meson8b stmmac_platform stmmac phylink leds_pwm pwm_meson ipv6 nf_defrag_ipv6 meson_gx_mmc cfg80211 g_ncm [last unloaded: mdio_mux_meson_g12a]
[  158.640102] CPU: 2 PID: 729 Comm: netifd Not tainted 5.3.0-rc5+ #3
[  158.650945] Hardware name: Khadas VIM2 (DT)
[  158.661304] pstate: 60000005 (nZCv daif -PAN -UAO)
[  158.671773] pc : dwxgmac210_desc_ops+0x2050/0xffffffffffffc160 [stmmac]
[  158.683421] lr : mdio_mux_read+0x64/0x98
[  158.694107] sp : ffff000012cab8f0
[  158.704715] x29: ffff000012cab8f0 x28: ffff80007ae7de80 
[  158.715408] x27: 0000000000000000 x26: ffff800072d4c8c0 
[  158.726091] x25: ffff8000791f1000 x24: 0000000000000008 
[  158.736349] x23: 0000000000000001 x22: 0000000000000000 
[  158.746105] x21: ffff800079dcfb80 x20: 0000000000000000 
[  158.755802] x19: ffff800079dcf780 x18: 0000000000000000 
[  158.765299] x17: 0000000000000000 x16: 0000000000000000 
[  158.774632] x15: 0000000000000000 x14: ffffffffffffffff 
[  158.783853] x13: 0000000000000000 x12: 0000000000000020 
[  158.792962] x11: 0000000000000030 x10: 0101010101010101 
[  158.801909] x9 : fffffffffffffffc x8 : 7f7f7f7f7f7f7f7f 
[  158.810814] x7 : 5fff646b636d6067 x6 : 0000000000000001 
[  158.819521] x5 : ffff8000791f1b88 x4 : 0000000000000000 
[  158.827860] x3 : ffff0000089ffef0 x2 : 0000000000000001 
[  158.836039] x1 : 0000000000000000 x0 : ffff80007aa4b800 
[  158.844133] Call trace:
[  158.851812]  dwxgmac210_desc_ops+0x2050/0xffffffffffffc160 [stmmac]
[  158.860184]  __mdiobus_read+0x1c/0x38
[  158.867965]  mdiobus_read+0x48/0x70
[  158.875640]  genphy_read_abilities+0x84/0x180
[  158.883315]  phy_probe+0x158/0x1e8
[  158.891003]  phy_attach_direct+0x194/0x2b8
[  158.898575]  of_phy_attach+0x40/0x80
[  158.905786]  phylink_of_phy_connect+0x74/0x140 [phylink]
[  158.912818]  stmmac_open+0x78c/0xa90 [stmmac]
[  158.919492]  __dev_open+0xe4/0x160
[  158.925698]  __dev_change_flags+0x164/0x1c0
[  158.931754]  dev_change_flags+0x20/0x60
[  158.937685]  dev_ifsioc+0x318/0x3b0
[  158.943497]  dev_ioctl+0x128/0x3d0
[  158.949110]  sock_do_ioctl+0xe8/0x200
[  158.954567]  sock_ioctl+0x334/0x4a0
[  158.959988]  do_vfs_ioctl+0xb8/0x8f8
[  158.965425]  ksys_ioctl+0x80/0xb8
[  158.970853]  __arm64_sys_ioctl+0x1c/0x28
[  158.976349]  el0_svc_common.constprop.0+0x64/0x160
[  158.982009]  el0_svc_handler+0x20/0x78
[  158.987651]  el0_svc+0x8/0xc
[  158.993298] Code: 65687420 76656420 0a656369 00000000 (4f525245) 
[  158.999781] ---[ end trace 6fc936bb8ee1e615 ]---

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment