DietPi icon indicating copy to clipboard operation
DietPi copied to clipboard

NanoPi NEO3 | Add device tree overlay for USB pins host mode

Open mszyndel opened this issue 1 year ago • 10 comments

Creating a bug report/issue

  • [x] I have searched the existing open and closed issues

Required Information

  • DietPi version | 9.8.0 fresh off the downloads
  • Distro version | bookworm
  • Kernel version | Linux DietPi 6.6.56-current-rockchip64 #1 SMP PREEMPT Thu Oct 10 10:50:06 UTC 2024 aarch64 GNU/Linux
  • SBC model | NanoPi NEO3 (aarch64)
  • Power supply used | 5V 1A RAVpower
  • SD card used | SanDisk 32G

Additional Information (if applicable)

  • Software title | (EG: Nextcloud) N/A
  • Was the software title installed freshly or updated/migrated? N/A
  • Can this issue be replicated on a fresh installation of DietPi? YES
  • Bug report ID | N/A

Steps to reproduce

Boot DietPi on NanoPi NEO3 bundled with 4G module. Usb 4G device is not detected, no eth1.

Expected behaviour

DietPi should detect USB and run it using cdc_ether/rndis_host driver It does work on Debian-based distro provided by the manufacturer, also works on DietPi on another board out of the box (see below).

Doesn't look like manufacturer bundles any special drivers, but I wasn't able to solve this myself. I tried stuff like modprobe ... adding all modules that I see used on NanoPI NEO, but to no avail.

Actual behaviour

USB device/4G modem is not detected at all

Extra details

Photo of the setup

Screenshot 2024-11-22 at 18 19 35

lsusb

Bus 005 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

lsmod

Module                  Size  Used by
snd_soc_pcm5102a       12288  1
snd_soc_simple_card    20480  0
snd_soc_simple_card_utils    24576  1 snd_soc_simple_card
snd_soc_rockchip_spdif    12288  0
snd_soc_rockchip_i2s    24576  2
snd_soc_core          208896  5 snd_soc_pcm5102a,snd_soc_rockchip_spdif,snd_soc_simple_card_utils,snd_soc_rockchip_i2s,snd_soc_simple_card
snd_compress           24576  1 snd_soc_core
snd_pcm_dmaengine      12288  1 snd_soc_core
snd_pcm               106496  4 snd_compress,snd_soc_simple_card_utils,snd_soc_core,snd_pcm_dmaengine
snd_timer              36864  1 snd_pcm
rk_crypto              28672  0
snd                    77824  4 snd_timer,snd_compress,snd_soc_core,snd_pcm
rng_core               16384  1 rk_crypto
soundcore              12288  1 snd
cpufreq_dt             16384  0
dm_mod                126976  0
ip_tables              28672  0
x_tables               36864  1 ip_tables
autofs4                40960  2
realtek                32768  1
dwmac_rk               28672  0
stmmac_platform        20480  1 dwmac_rk
stmmac                233472  3 stmmac_platform,dwmac_rk
pcs_xpcs               20480  1 stmmac
gpio_syscon            16384  0

dmesg

[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[    0.000000] Linux version 6.6.56-current-rockchip64 (build@armbian) (aarch64-linux-gnu-gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #1 SMP PREEMPT Thu Oct 10 10:50:06 UTC 2024
[    0.000000] KASLR disabled due to lack of seed
[    0.000000] Machine model: FriendlyElec NanoPi NEO3
[    0.000000] efi: UEFI not found.
[    0.000000] NUMA: No NUMA configuration found
[    0.000000] NUMA: Faking a node at [mem 0x0000000000200000-0x000000007fffffff]
[    0.000000] NUMA: NODE_DATA [mem 0x7fba8980-0x7fbaafff]
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000000200000-0x000000007fffffff]
[    0.000000]   DMA32    empty
[    0.000000]   Normal   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000200000-0x000000007fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000200000-0x000000007fffffff]
[    0.000000] On node 0, zone DMA: 512 pages in unavailable ranges
[    0.000000] cma: Reserved 128 MiB at 0x0000000073200000 on node -1
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: PSCIv1.0 detected in firmware.
[    0.000000] psci: Using standard PSCI v0.2 function IDs
[    0.000000] psci: MIGRATE_INFO_TYPE not supported.
[    0.000000] psci: SMC Calling Convention v1.0
[    0.000000] percpu: Embedded 31 pages/cpu s88296 r8192 d30488 u126976
[    0.000000] pcpu-alloc: s88296 r8192 d30488 u126976 alloc=31*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3
[    0.000000] Detected VIPT I-cache on CPU0
[    0.000000] CPU features: detected: ARM erratum 845719
[    0.000000] alternatives: applying boot alternatives
[    0.000000] Kernel command line: root=UUID=d35cf75b-1dbb-4513-8d65-1675a7e0bc68 rootfstype=ext4 rootwait console=ttyS2,1500000 consoleblank=0 coherent_pool=2M usb-storage.quirks= net.ifnames=0
[    0.000000] Dentry cache hash table entries: 262144 (order: 9, 2097152 bytes, linear)
[    0.000000] Inode-cache hash table entries: 131072 (order: 8, 1048576 bytes, linear)
[    0.000000] Fallback order for Node 0: 0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 515592
[    0.000000] Policy zone: DMA
[    0.000000] mem auto-init: stack:off, heap alloc:on, heap free:off
[    0.000000] software IO TLB: SWIOTLB bounce buffer size adjusted to 1MB
[    0.000000] software IO TLB: area num 4.
[    0.000000] software IO TLB: mapped [mem 0x000000007f616000-0x000000007f816000] (2MB)
[    0.000000] Memory: 1878396K/2095104K available (16960K kernel code, 2318K rwdata, 5248K rodata, 4736K init, 604K bss, 85636K reserved, 131072K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] trace event string verifier disabled
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000] rcu: 	RCU event tracing is enabled.
[    0.000000] rcu: 	RCU restricting CPUs from NR_CPUS=256 to nr_cpu_ids=4.
[    0.000000] 	Trampoline variant of Tasks RCU enabled.
[    0.000000] 	Tracing variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] Root IRQ handler: gic_handle_irq
[    0.000000] GIC: Using split EOI/Deactivate mode
[    0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention.
[    0.000000] arch_timer: cp15 timer(s) running at 24.00MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns
[    0.000001] sched_clock: 56 bits at 24MHz, resolution 41ns, wraps every 4398046511097ns
[    0.001134] Console: colour dummy device 80x25
[    0.001316] Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=96000)
[    0.001339] pid_max: default: 32768 minimum: 301
[    0.001523] LSM: initializing lsm=capability,yama,apparmor,integrity
[    0.001585] Yama: becoming mindful.
[    0.001772] AppArmor: AppArmor initialized
[    0.001969] Mount-cache hash table entries: 4096 (order: 3, 32768 bytes, linear)
[    0.002004] Mountpoint-cache hash table entries: 4096 (order: 3, 32768 bytes, linear)
[    0.006019] RCU Tasks: Setting shift to 2 and lim to 1 rcu_task_cb_adjust=1.
[    0.006208] RCU Tasks Trace: Setting shift to 2 and lim to 1 rcu_task_cb_adjust=1.
[    0.006667] rcu: Hierarchical SRCU implementation.
[    0.006676] rcu: 	Max phase no-delay instances is 1000.
[    0.010511] EFI services will not be available.
[    0.011349] smp: Bringing up secondary CPUs ...
[    0.012718] Detected VIPT I-cache on CPU1
[    0.012920] CPU1: Booted secondary processor 0x0000000001 [0x410fd034]
[    0.014345] Detected VIPT I-cache on CPU2
[    0.014535] CPU2: Booted secondary processor 0x0000000002 [0x410fd034]
[    0.016033] Detected VIPT I-cache on CPU3
[    0.016225] CPU3: Booted secondary processor 0x0000000003 [0x410fd034]
[    0.016442] smp: Brought up 1 node, 4 CPUs
[    0.016459] SMP: Total of 4 processors activated.
[    0.016468] CPU features: detected: 32-bit EL0 Support
[    0.016474] CPU features: detected: 32-bit EL1 Support
[    0.016488] CPU features: detected: CRC32 instructions
[    0.016647] CPU: All CPU(s) started at EL2
[    0.016707] alternatives: applying system-wide alternatives
[    0.020546] devtmpfs: initialized
[    0.042093] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.042168] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[    0.049651] pinctrl core: initialized pinctrl subsystem
[    0.050618] DMI not present or invalid.
[    0.052119] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.055107] DMA: preallocated 2048 KiB GFP_KERNEL pool for atomic allocations
[    0.056668] DMA: preallocated 2048 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations
[    0.058306] DMA: preallocated 2048 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
[    0.058461] audit: initializing netlink subsys (disabled)
[    0.059005] audit: type=2000 audit(0.056:1): state=initialized audit_enabled=0 res=1
[    0.060616] thermal_sys: Registered thermal governor 'fair_share'
[    0.060631] thermal_sys: Registered thermal governor 'bang_bang'
[    0.060639] thermal_sys: Registered thermal governor 'step_wise'
[    0.060647] thermal_sys: Registered thermal governor 'user_space'
[    0.060784] cpuidle: using governor menu
[    0.061211] hw-breakpoint: found 6 breakpoint and 4 watchpoint registers.
[    0.061443] ASID allocator initialised with 65536 entries
[    0.063745] Serial: AMBA PL011 UART driver
[    0.090605] gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    0.091269] rockchip-gpio ff210000.gpio: probed /pinctrl/gpio@ff210000
[    0.092247] gpio gpiochip1: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    0.092799] rockchip-gpio ff220000.gpio: probed /pinctrl/gpio@ff220000
[    0.093445] gpio gpiochip2: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    0.093980] rockchip-gpio ff230000.gpio: probed /pinctrl/gpio@ff230000
[    0.094587] gpio gpiochip3: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    0.095071] rockchip-gpio ff240000.gpio: probed /pinctrl/gpio@ff240000
[    0.102548] Modules: 25248 pages in range for non-PLT usage
[    0.102571] Modules: 516768 pages in range for PLT usage
[    0.104663] HugeTLB: registered 1.00 GiB page size, pre-allocated 0 pages
[    0.104687] HugeTLB: 0 KiB vmemmap can be freed for a 1.00 GiB page
[    0.104700] HugeTLB: registered 32.0 MiB page size, pre-allocated 0 pages
[    0.104709] HugeTLB: 0 KiB vmemmap can be freed for a 32.0 MiB page
[    0.104721] HugeTLB: registered 2.00 MiB page size, pre-allocated 0 pages
[    0.104730] HugeTLB: 0 KiB vmemmap can be freed for a 2.00 MiB page
[    0.104745] HugeTLB: registered 64.0 KiB page size, pre-allocated 0 pages
[    0.104754] HugeTLB: 0 KiB vmemmap can be freed for a 64.0 KiB page
[    0.106537] cryptd: max_cpu_qlen set to 1000
[    0.176581] raid6: neonx8   gen()  1071 MB/s
[    0.244736] raid6: neonx4   gen()  1098 MB/s
[    0.312890] raid6: neonx2   gen()  1039 MB/s
[    0.381042] raid6: neonx1   gen()   888 MB/s
[    0.449182] raid6: int64x8  gen()   682 MB/s
[    0.517368] raid6: int64x4  gen()   800 MB/s
[    0.585500] raid6: int64x2  gen()   695 MB/s
[    0.653647] raid6: int64x1  gen()   515 MB/s
[    0.653656] raid6: using algorithm neonx4 gen() 1098 MB/s
[    0.721771] raid6: .... xor() 781 MB/s, rmw enabled
[    0.721783] raid6: using neon recovery algorithm
[    0.723237] iommu: Default domain type: Translated
[    0.723263] iommu: DMA domain TLB invalidation policy: strict mode
[    0.724297] SCSI subsystem initialized
[    0.725176] libata version 3.00 loaded.
[    0.725697] usbcore: registered new interface driver usbfs
[    0.725758] usbcore: registered new interface driver hub
[    0.725904] usbcore: registered new device driver usb
[    0.726814] pps_core: LinuxPPS API ver. 1 registered
[    0.726823] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <[email protected]>
[    0.726851] PTP clock support registered
[    0.727225] EDAC MC: Ver: 3.0.0
[    0.728434] scmi_core: SCMI protocol bus registered
[    0.730679] NetLabel: Initializing
[    0.730699] NetLabel:  domain hash size = 128
[    0.730708] NetLabel:  protocols = UNLABELED CIPSOv4 CALIPSO
[    0.730847] NetLabel:  unlabeled traffic allowed by default
[    0.731267] vgaarb: loaded
[    0.732151] clocksource: Switched to clocksource arch_sys_counter
[    0.736735] VFS: Disk quotas dquot_6.6.0
[    0.736831] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    0.737953] AppArmor: AppArmor Filesystem Enabled
[    0.753046] NET: Registered PF_INET protocol family
[    0.753490] IP idents hash table entries: 32768 (order: 6, 262144 bytes, linear)
[    0.757387] tcp_listen_portaddr_hash hash table entries: 1024 (order: 2, 16384 bytes, linear)
[    0.757689] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.757784] TCP established hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.758225] TCP bind hash table entries: 16384 (order: 7, 524288 bytes, linear)
[    0.759039] TCP: Hash tables configured (established 16384 bind 16384)
[    0.759367] UDP hash table entries: 1024 (order: 3, 32768 bytes, linear)
[    0.759487] UDP-Lite hash table entries: 1024 (order: 3, 32768 bytes, linear)
[    0.759975] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.760039] NET: Registered PF_XDP protocol family
[    0.760067] PCI: CLS 0 bytes, default 64
[    0.760594] Trying to unpack rootfs image as initramfs...
[    0.762277] kvm [1]: IPA Size Limit: 40 bits
[    0.765167] kvm [1]: vgic interrupt IRQ9
[    0.765266] kvm [1]: Hyp mode initialized successfully
[    0.769642] Initialise system trusted keyrings
[    0.769807] Key type blacklist registered
[    0.770580] workingset: timestamp_bits=44 max_order=19 bucket_order=0
[    0.770807] zbud: loaded
[    0.772011] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.773310] fuse: init (API version 7.39)
[    0.777118] integrity: Platform Keyring initialized
[    0.842458] xor: measuring software checksum speed
[    0.845168]    8regs           :  1226 MB/sec
[    0.847820]    32regs          :  1261 MB/sec
[    0.850710]    arm64_neon      :  1143 MB/sec
[    0.850731] xor: using function: 32regs (1261 MB/sec)
[    0.850762] Key type asymmetric registered
[    0.850773] Asymmetric key parser 'x509' registered
[    0.851011] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 246)
[    0.851501] io scheduler mq-deadline registered
[    0.851521] io scheduler kyber registered
[    0.851629] io scheduler bfq registered
[    0.872082] dma-pl330 ff1f0000.dma-controller: Loaded driver for PL330 DMAC-241330
[    0.872215] dma-pl330 ff1f0000.dma-controller: 	DBUFF-128x8bytes Num_Chans-8 Num_Peri-20 Num_Events-16
[    0.876022] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[    0.885546] ff120000.serial: ttyS1 at MMIO 0xff120000 (irq = 23, base_baud = 1500000) is a 16550A
[    0.888605] ff130000.serial: ttyS2 at MMIO 0xff130000 (irq = 24, base_baud = 1500000) is a 16550A
[    0.888752] printk: console [ttyS2] enabled
[    0.987455] Serial: AMBA driver
[    0.994773] rockchip-drm display-subsystem: [drm:rockchip_drm_platform_probe] *ERROR* No available vop found for display-subsystem.
[    1.013325] loop: module loaded
[    1.022284] tun: Universal TUN/TAP device driver, 1.6
[    1.024447] thunder_xcv, ver 1.0
[    1.024827] thunder_bgx, ver 1.0
[    1.025169] nicpf, ver 1.0
[    1.026422] e1000e: Intel(R) PRO/1000 Network Driver
[    1.026890] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[    1.027486] igb: Intel(R) Gigabit Ethernet Network Driver
[    1.027974] igb: Copyright (c) 2007-2014 Intel Corporation.
[    1.028578] igbvf: Intel(R) Gigabit Virtual Function Network Driver
[    1.029140] igbvf: Copyright (c) 2009 - 2012 Intel Corporation.
[    1.030227] sky2: driver version 1.30
[    1.034237] dwc2 ff580000.usb: supply vusb_d not found, using dummy regulator
[    1.035146] dwc2 ff580000.usb: supply vusb_a not found, using dummy regulator
[    1.168404] dwc2 ff580000.usb: EPs: 10, dedicated fifos, 972 entries in SPRAM
[    1.169661] dwc2 ff580000.usb: DWC OTG Controller
[    1.170201] dwc2 ff580000.usb: new USB bus registered, assigned bus number 1
[    1.170899] dwc2 ff580000.usb: irq 29, io mem 0xff580000
[    1.171984] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 6.06
[    1.172783] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.173434] usb usb1: Product: DWC OTG Controller
[    1.173864] usb usb1: Manufacturer: Linux 6.6.56-current-rockchip64 dwc2_hsotg
[    1.174512] usb usb1: SerialNumber: ff580000.usb
[    1.176491] hub 1-0:1.0: USB hub found
[    1.177000] hub 1-0:1.0: 1 port detected
[    1.181977] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
[    1.182554] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 2
[    1.183508] xhci-hcd xhci-hcd.0.auto: hcc params 0x0220fe64 hci version 0x110 quirks 0x0000008002000010
[    1.183681] ehci-platform ff5c0000.usb: EHCI Host Controller
[    1.183723] ohci-platform ff5d0000.usb: Generic Platform OHCI controller
[    1.183780] ohci-platform ff5d0000.usb: new USB bus registered, assigned bus number 3
[    1.184020] ohci-platform ff5d0000.usb: irq 31, io mem 0xff5d0000
[    1.184751] xhci-hcd xhci-hcd.0.auto: irq 28, io mem 0xff600000
[    1.184993] ehci-platform ff5c0000.usb: new USB bus registered, assigned bus number 4
[    1.185842] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
[    1.186424] ehci-platform ff5c0000.usb: irq 30, io mem 0xff5c0000
[    1.186753] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 5
[    1.189775] xhci-hcd xhci-hcd.0.auto: Host supports USB 3.0 SuperSpeed
[    1.190963] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 6.06
[    1.191750] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.192451] usb usb2: Product: xHCI Host Controller
[    1.192905] usb usb2: Manufacturer: Linux 6.6.56-current-rockchip64 xhci-hcd
[    1.193533] usb usb2: SerialNumber: xhci-hcd.0.auto
[    1.195256] hub 2-0:1.0: USB hub found
[    1.195743] hub 2-0:1.0: 1 port detected
[    1.197474] usb usb5: We don't know the algorithms for LPM for this host, disabling LPM.
[    1.198551] usb usb5: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 6.06
[    1.199310] usb usb5: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.199954] usb usb5: Product: xHCI Host Controller
[    1.200441] usb usb5: Manufacturer: Linux 6.6.56-current-rockchip64 xhci-hcd
[    1.201078] usb usb5: SerialNumber: xhci-hcd.0.auto
[    1.203079] hub 5-0:1.0: USB hub found
[    1.203552] hub 5-0:1.0: 1 port detected
[    1.204233] ehci-platform ff5c0000.usb: USB 2.0 started, EHCI 1.00
[    1.205406] usbcore: registered new interface driver usb-storage
[    1.205778] usb usb4: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 6.06
[    1.206713] usb usb4: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.207362] usb usb4: Product: EHCI Host Controller
[    1.207805] usb usb4: Manufacturer: Linux 6.6.56-current-rockchip64 ehci_hcd
[    1.208476] usb usb4: SerialNumber: ff5c0000.usb
[    1.208708] mousedev: PS/2 mouse device common for all mice
[    1.210346] hub 4-0:1.0: USB hub found
[    1.210917] hub 4-0:1.0: 1 port detected
[    1.211314] i2c_dev: i2c /dev entries driver
[    1.215636] i2c 1-0018: Fixed dependency cycle(s) with /i2c@ff160000/rk805@18/regulators/DCDC_REG4
[    1.226384] rk808-regulator rk808-regulator.2.auto: there is no dvs0 gpio
[    1.227079] rk808-regulator rk808-regulator.2.auto: there is no dvs1 gpio
[    1.227689] rk808-regulator rk808-regulator.2.auto: max buck steps per change: 8
[    1.244856] usb usb3: New USB device found, idVendor=1d6b, idProduct=0001, bcdDevice= 6.06
[    1.245634] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.246279] usb usb3: Product: Generic Platform OHCI controller
[    1.246809] usb usb3: Manufacturer: Linux 6.6.56-current-rockchip64 ohci_hcd
[    1.247435] usb usb3: SerialNumber: ff5d0000.usb
[    1.249478] hub 3-0:1.0: USB hub found
[    1.250054] hub 3-0:1.0: 1 port detected
[    1.259907] rk808-rtc rk808-rtc.4.auto: registered as rtc0
[    1.262452] rk808-rtc rk808-rtc.4.auto: setting system clock to 2024-11-22T17:21:34 UTC (1732296094)
[    1.266132] input: rk805 pwrkey as /devices/platform/ff160000.i2c/i2c-1/1-0018/rk805-pwrkey.6.auto/input/input0
[    1.271357] rockchip-thermal ff250000.tsadc: Missing tshut mode property, using default (cru)
[    1.272244] rockchip-thermal ff250000.tsadc: Missing tshut-polarity property, using default (low)
[    1.275733] dw_wdt ff1a0000.watchdog: No valid TOPs array specified
[    1.281503] sdhci: Secure Digital Host Controller Interface driver
[    1.282095] sdhci: Copyright(c) Pierre Ossman
[    1.282597] Synopsys Designware Multimedia Card Interface Driver
[    1.284473] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.289358] ledtrig-cpu: registered to indicate activity on CPUs
[    1.291243] hid: raw HID events driver (C) Jiri Kosina
[    1.291939] usbcore: registered new interface driver usbhid
[    1.292528] usbhid: USB HID core driver
[    1.298342] hw perfevents: enabled with armv8_cortex_a53 PMU driver, 7 counters available
[    1.303089] drop_monitor: Initializing network drop monitor service
[    1.304664] NET: Registered PF_INET6 protocol family
[    2.193774] Freeing initrd memory: 12628K
[    2.282111] Segment Routing with IPv6
[    2.282655] In-situ OAM (IOAM) with IPv6
[    2.283220] NET: Registered PF_PACKET protocol family
[    2.284349] 8021q: 802.1Q VLAN Support v1.8
[    2.284891] Key type dns_resolver registered
[    2.304764] registered taskstats version 1
[    2.305468] Loading compiled-in X.509 certificates
[    2.310365] zswap: loaded using pool zstd/zbud
[    2.335273] Key type .fscrypt registered
[    2.335666] Key type fscrypt-provisioning registered
[    2.341411] Btrfs loaded, zoned=yes, fsverity=yes
[    2.342224] Key type encrypted registered
[    2.342606] AppArmor: AppArmor sha1 policy hashing enabled
[    2.378858] rk3328-dmc ff780000.dmc: current ATF version 0x101
[    2.379621] dwmmc_rockchip ff500000.mmc: IDMAC supports 32-bit address mode.
[    2.380356] dwmmc_rockchip ff500000.mmc: Using internal DMA controller.
[    2.380954] dwmmc_rockchip ff500000.mmc: Version ID is 270a
[    2.381535] dwmmc_rockchip ff500000.mmc: DW MMC controller at irq 49,32 bit host data width,256 deep fifo
[    2.400289] mmc_host mmc0: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0)
[    2.412993] WCN: marlin_init entry!
[    2.414890] input: gpio-keys as /devices/platform/gpio-keys/input/input1
[    2.416888] of_cfs_init
[    2.417317] of_cfs_init: OK
[    2.417956] clk: Disabling unused clocks
[    2.420605] dw-apb-uart ff130000.serial: forbid DMA for kernel console
[    2.425015] Freeing unused kernel memory: 4736K
[    2.425709] Run /init as init process
[    2.426048]   with arguments:
[    2.426061]     /init
[    2.426073]   with environment:
[    2.426083]     HOME=/
[    2.426094]     TERM=linux
[    2.510235] mmc_host mmc0: Bus speed (slot 0) = 150000000Hz (slot req 150000000Hz, actual 150000000HZ div = 0)
[    2.934019] dwmmc_rockchip ff500000.mmc: Successfully tuned phase to 190
[    2.934663] mmc0: new ultra high speed SDR104 SDHC card at address aaaa
[    2.936918] mmcblk0: mmc0:aaaa SP32G 29.7 GiB
[    2.943101]  mmcblk0: p1
[    3.187956] gpio-syscon ff100000.syscon:gpio: can't read the data register offset!
[    3.311462] rk_gmac-dwmac ff540000.ethernet: IRQ eth_wake_irq not found
[    3.312081] rk_gmac-dwmac ff540000.ethernet: IRQ eth_lpi not found
[    3.323009] rk_gmac-dwmac ff540000.ethernet: PTP uses main clock
[    3.323931] rk_gmac-dwmac ff540000.ethernet: clock input or output? (input).
[    3.329654] rk_gmac-dwmac ff540000.ethernet: TX delay(0x24).
[    3.330191] rk_gmac-dwmac ff540000.ethernet: RX delay(0x18).
[    3.333362] rk_gmac-dwmac ff540000.ethernet: integrated PHY? (no).
[    3.334008] rk_gmac-dwmac ff540000.ethernet: clock input from PHY
[    3.339587] rk_gmac-dwmac ff540000.ethernet: init for RGMII
[    3.343011] rk_gmac-dwmac ff540000.ethernet: User ID: 0x10, Synopsys ID: 0x35
[    3.343680] rk_gmac-dwmac ff540000.ethernet: 	DWMAC1000
[    3.344200] rk_gmac-dwmac ff540000.ethernet: DMA HW capability register supported
[    3.344877] rk_gmac-dwmac ff540000.ethernet: RX Checksum Offload Engine supported
[    3.345544] rk_gmac-dwmac ff540000.ethernet: COE Type 2
[    3.346018] rk_gmac-dwmac ff540000.ethernet: TX Checksum insertion supported
[    3.346646] rk_gmac-dwmac ff540000.ethernet: Wake-Up On Lan supported
[    3.347389] rk_gmac-dwmac ff540000.ethernet: Normal descriptors
[    3.347937] rk_gmac-dwmac ff540000.ethernet: Ring mode enabled
[    3.348706] rk_gmac-dwmac ff540000.ethernet: Enable RX Mitigation via HW Watchdog Timer
[    3.610550] EXT4-fs (mmcblk0p1): mounted filesystem d35cf75b-1dbb-4513-8d65-1675a7e0bc68 ro with ordered data mode. Quota mode: none.
[    4.192762] systemd[1]: Inserted module 'autofs4'
[    4.258497] systemd[1]: systemd 252.31-1~deb12u1 running in system mode (+PAM +AUDIT +SELINUX +APPARMOR +IMA +SMACK +SECCOMP +GCRYPT -GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 -PWQUALITY +P11KIT +QRENCODE +TPM2 +BZIP2 +LZ4 +XZ +ZLIB +ZSTD -BPF_FRAMEWORK -XKBCOMMON +UTMP +SYSVINIT default-hierarchy=unified)
[    4.261487] systemd[1]: Detected architecture arm64.
[    4.269398] systemd[1]: Hostname set to <DietPi>.
[    5.095044] systemd[1]: Queued start job for default target graphical.target.
[    5.123261] systemd[1]: Created slice system-modprobe.slice - Slice /system/modprobe.
[    5.139138] systemd[1]: Created slice system-serial\x2dgetty.slice - Slice /system/serial-getty.
[    5.153211] systemd[1]: Started systemd-ask-password-console.path - Dispatch Password Requests to Console Directory Watch.
[    5.164952] systemd[1]: Started systemd-ask-password-wall.path - Forward Password Requests to Wall Directory Watch.
[    5.177580] systemd[1]: Set up automount proc-sys-fs-binfmt_misc.automount - Arbitrary Executable File Formats File System Automount Point.
[    5.188532] systemd[1]: Expecting device dev-ttyS2.device - /dev/ttyS2...
[    5.200600] systemd[1]: Reached target cryptsetup.target - Local Encrypted Volumes.
[    5.212633] systemd[1]: Reached target integritysetup.target - Local Integrity Protected Volumes.
[    5.224736] systemd[1]: Reached target paths.target - Path Units.
[    5.236543] systemd[1]: Reached target remote-fs.target - Remote File Systems.
[    5.248573] systemd[1]: Reached target slices.target - Slice Units.
[    5.260627] systemd[1]: Reached target swap.target - Swaps.
[    5.272732] systemd[1]: Reached target veritysetup.target - Local Verity Protected Volumes.
[    5.285446] systemd[1]: Listening on systemd-fsckd.socket - fsck to fsckd communication Socket.
[    5.297107] systemd[1]: Listening on systemd-initctl.socket - initctl Compatibility Named Pipe.
[    5.310441] systemd[1]: Listening on systemd-journald-audit.socket - Journal Audit Socket.
[    5.321548] systemd[1]: Listening on systemd-journald-dev-log.socket - Journal Socket (/dev/log).
[    5.333628] systemd[1]: Listening on systemd-journald.socket - Journal Socket.
[    5.348559] systemd[1]: Listening on systemd-udevd-control.socket - udev Control Socket.
[    5.361408] systemd[1]: Listening on systemd-udevd-kernel.socket - udev Kernel Socket.
[    5.372546] systemd[1]: Reached target sockets.target - Socket Units.
[    5.416716] systemd[1]: Mounting dev-hugepages.mount - Huge Pages File System...
[    5.435856] systemd[1]: Mounting dev-mqueue.mount - POSIX Message Queue File System...
[    5.459350] systemd[1]: Mounting sys-kernel-debug.mount - Kernel Debug File System...
[    5.479539] systemd[1]: Mounting sys-kernel-tracing.mount - Kernel Trace File System...
[    5.506580] systemd[1]: Starting fake-hwclock.service - Restore / save the current clock...
[    5.535735] systemd[1]: Starting keyboard-setup.service - Set the console keyboard layout...
[    5.557793] systemd[1]: Starting kmod-static-nodes.service - Create List of Static Device Nodes...
[    5.577187] systemd[1]: Starting [email protected] - Load Kernel Module configfs...
[    5.596984] systemd[1]: Starting modprobe@dm_mod.service - Load Kernel Module dm_mod...
[    5.616869] systemd[1]: Starting modprobe@efi_pstore.service - Load Kernel Module efi_pstore...
[    5.636855] systemd[1]: Starting [email protected] - Load Kernel Module fuse...
[    5.641899] device-mapper: uevent: version 1.0.3
[    5.643173] device-mapper: ioctl: 4.48.0-ioctl (2023-03-01) initialised: [email protected]
[    5.649533] systemd[1]: Starting [email protected] - Load Kernel Module loop...
[    5.664801] systemd[1]: systemd-fsck-root.service - File System Check on Root Device was skipped because of an unmet condition check (ConditionPathExists=!/run/initramfs/fsck-root).
[    5.678673] systemd[1]: Starting systemd-journald.service - Journal Service...
[    5.692653] systemd[1]: Starting systemd-modules-load.service - Load Kernel Modules...
[    5.714590] systemd[1]: Starting systemd-remount-fs.service - Remount Root and Kernel File Systems...
[    5.728987] systemd[1]: Starting systemd-udev-trigger.service - Coldplug All udev Devices...
[    5.760594] systemd[1]: Mounted dev-hugepages.mount - Huge Pages File System.
[    5.766310] systemd[1]: Mounted dev-mqueue.mount - POSIX Message Queue File System.
[    5.773342] systemd[1]: Mounted sys-kernel-debug.mount - Kernel Debug File System.
[    5.785579] systemd[1]: Mounted sys-kernel-tracing.mount - Kernel Trace File System.
[    5.796389] systemd[1]: Finished fake-hwclock.service - Restore / save the current clock.
[    5.811251] systemd[1]: Finished kmod-static-nodes.service - Create List of Static Device Nodes.
[    5.826883] systemd[1]: [email protected]: Deactivated successfully.
[    5.830417] systemd[1]: Finished [email protected] - Load Kernel Module configfs.
[    5.836312] EXT4-fs (mmcblk0p1): re-mounted d35cf75b-1dbb-4513-8d65-1675a7e0bc68 r/w. Quota mode: none.
[    5.838339] systemd[1]: modprobe@dm_mod.service: Deactivated successfully.
[    5.840564] systemd[1]: Finished modprobe@dm_mod.service - Load Kernel Module dm_mod.
[    5.859861] systemd[1]: modprobe@efi_pstore.service: Deactivated successfully.
[    5.862746] systemd[1]: Finished modprobe@efi_pstore.service - Load Kernel Module efi_pstore.
[    5.883320] systemd[1]: [email protected]: Deactivated successfully.
[    5.885541] systemd[1]: Finished [email protected] - Load Kernel Module fuse.
[    5.898986] systemd[1]: [email protected]: Deactivated successfully.
[    5.908379] systemd[1]: Finished [email protected] - Load Kernel Module loop.
[    5.923010] systemd[1]: Finished systemd-modules-load.service - Load Kernel Modules.
[    5.930792] systemd[1]: Finished systemd-remount-fs.service - Remount Root and Kernel File Systems.
[    5.988847] systemd[1]: Mounting sys-fs-fuse-connections.mount - FUSE Control File System...
[    6.012526] systemd[1]: Mounting sys-kernel-config.mount - Kernel Configuration File System...
[    6.024752] systemd[1]: systemd-firstboot.service - First Boot Wizard was skipped because of an unmet condition check (ConditionFirstBoot=yes).
[    6.026370] systemd[1]: systemd-pstore.service - Platform Persistent Storage Archival was skipped because of an unmet condition check (ConditionDirectoryNotEmpty=/sys/fs/pstore).
[    6.039004] systemd[1]: Starting systemd-random-seed.service - Load/Save Random Seed...
[    6.043850] systemd[1]: systemd-repart.service - Repartition Root Disk was skipped because no trigger condition checks were met.
[    6.059839] systemd[1]: Starting systemd-sysctl.service - Apply Kernel Variables...
[    6.086810] systemd[1]: Starting systemd-sysusers.service - Create System Users...
[    6.117198] systemd[1]: Started systemd-journald.service - Journal Service.
[    6.587596] systemd-journald[207]: Received client request to flush runtime journal.
[    8.060184] rk3288-crypto ff060000.crypto: will run requests pump with realtime priority
[    8.060276] rk3288-crypto ff060000.crypto: Register ecb(aes) as ecb-aes-rk
[    8.060358] rk3288-crypto ff060000.crypto: Register cbc(aes) as cbc-aes-rk
[    8.060379] rk3288-crypto ff060000.crypto: Register ecb(des) as ecb-des-rk
[    8.060399] rk3288-crypto ff060000.crypto: Register cbc(des) as cbc-des-rk
[    8.060418] rk3288-crypto ff060000.crypto: Register ecb(des3_ede) as ecb-des3-ede-rk
[    8.060437] rk3288-crypto ff060000.crypto: Register cbc(des3_ede) as cbc-des3-ede-rk
[    8.060457] rk3288-crypto ff060000.crypto: Register sha1 as rk-sha1
[    8.060477] rk3288-crypto ff060000.crypto: Register sha256 as rk-sha256
[    8.060497] rk3288-crypto ff060000.crypto: Register md5 as rk-md5
[    8.549715] rk_gmac-dwmac ff540000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0
[    8.552734] rk_gmac-dwmac ff540000.ethernet eth0: PHY [stmmac-0:00] driver [RTL8211E Gigabit Ethernet] (irq=POLL)
[    8.560298] rk_gmac-dwmac ff540000.ethernet eth0: No Safety Features support found
[    8.560329] rk_gmac-dwmac ff540000.ethernet eth0: PTP not supported by HW
[    8.560738] rk_gmac-dwmac ff540000.ethernet eth0: configuring for phy/rgmii link mode
[   10.764142] random: crng init done
[   13.665287] rk_gmac-dwmac ff540000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[   18.401641] platform sound-spdif: deferred probe pending

Aliexpress link https://pl.aliexpress.com/item/1005007291382440.html?spm=a2g0o.order_list.order_list_main.110.26291c243HOKnn&gatewayAdapt=glo2pol

Extra extra - It works on NanoPi NEO!

A similar 4G card works out of the box on NanoPi NEO (armv7l). Including some details as they may be handy

lsusb

Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 002: ID 19d1:0001 BYD EigenComm Compo
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

lsmod

Module                  Size  Used by
lima                   49152  0
gpu_sched              28672  1 lima
drm_shmem_helper       12288  1 lima
sun8i_thermal          12288  0
sunxi_cedrus           40960  0
v4l2_mem2mem           16384  1 sunxi_cedrus
videobuf2_dma_contig    16384  1 sunxi_cedrus
videobuf2_memops       16384  1 videobuf2_dma_contig
videobuf2_v4l2         16384  2 sunxi_cedrus,v4l2_mem2mem
cdc_acm                28672  0
videodev              180224  3 sunxi_cedrus,v4l2_mem2mem,videobuf2_v4l2
videobuf2_common       45056  5 sunxi_cedrus,videobuf2_dma_contig,videobuf2_memops,v4l2_mem2mem,videobuf2_v4l2
mc                     36864  5 sunxi_cedrus,videobuf2_common,videodev,v4l2_mem2mem,videobuf2_v4l2
cpufreq_dt             16384  0
evdev                  16384  0
uio_pdrv_genirq        16384  0
uio                    16384  1 uio_pdrv_genirq
dm_mod                 98304  0
ip_tables              20480  0
x_tables               24576  1 ip_tables
autofs4                36864  2
rndis_host             16384  0
cdc_ether              16384  1 rndis_host
usbnet                 32768  2 rndis_host,cdc_ether
sunxi                  12288  0
phy_generic            16384  2 sunxi
gpio_keys              16384  0
ac200_phy              12288  1

dmesg -6 (selected lines)

[    5.214210] usb 1-1: New USB device found, idVendor=19d1, idProduct=0001, bcdDevice= 2.00
[    5.222631] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    5.229878] usb 1-1: Product: EigenComm Compo
[    5.234295] usb 1-1: Manufacturer: EigenComm
[    5.238606] usb 1-1: SerialNumber: 000000000001
[    6.605343] usbcore: registered new interface driver cdc_ether
[    6.666027] rndis_host 1-1:1.0: rndis media connect
[    6.735450] rndis_host 1-1:1.0 eth1: register 'rndis_host' at usb-1c1b000.usb-1, RNDIS device, 20:89:84:6a:96:ab
[    6.746377] usbcore: registered new interface driver rndis_host
[   14.193924] cdc_acm 1-1:1.2: ttyACM0: USB ACM device
[   14.249228] cdc_acm 1-1:1.4: ttyACM1: USB ACM device
[   14.284910] cdc_acm 1-1:1.6: ttyACM2: USB ACM device
[   14.285106] usbcore: registered new interface driver cdc_acm
[   14.285117] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters

mszyndel avatar Nov 22 '24 17:11 mszyndel

On the NEO3, the USB device is not detected at all, hence missing driver is not the issue. I guess the pins need to be configured. Let me check for device tree overlays.

MichaIng avatar Nov 22 '24 18:11 MichaIng

Thanks for blazing fast response! Please let me know if I can provide any more details. Documentation for 4g module is sparse to nonexistent but here’s friendlyelec page for the board https://wiki.friendlyelec.com/wiki/index.php/NanoPi_NEO3

mszyndel avatar Nov 22 '24 18:11 mszyndel

Sadly here is no overlay coming with the kernel, to toggle USB support on GPIO: image

The Allwinner kernel has interfaces for usbhosts, which we enable by default for some SBCs, including the NanoPi NEO. See /boot/dietpiEnv.txt. image

I'll check the source of those overlays, maybe we can try to create similar ones for the RK3328.

MichaIng avatar Nov 22 '24 19:11 MichaIng

Please try this:

apt install device-tree-compiler
mkdir -p /boot/overlay-user
cd /boot/overlay-user
cat << '_EOF_' > usbhost.dts
/dts-v1/;
/plugin/;
/ {
        compatible = "rockchip,rk3328";
        fragment@0 {
                target = <&usb20_otg>;
                __overlay__ {
                        dr_mode = "host";
                };
        };
};
_EOF_
dtc -I dts -O dtb -o usbhost.dtbo usbhost.dts
G_CONFIG_INJECT 'user_overlays=' 'user_overlays=usbhost' /boot/dietpiEnv.txt
reboot
cat /proc/device-tree/usb@ff580000/dr_mode; echo

The last command is to check whether this USB port has been switched to host mode.

It is weird:

  • This node is defined in mainline Linux NanoPi R2S device tree (which is used as basis for the NEO3 device tree), and while it is called usb20_otg, in it is configured to be in host mode, instead of OTG:
    • https://github.com/armbian/build/blob/main/patch/kernel/archive/rockchip64-6.6/dt/rk3328-nanopi-neo3-rev02.dts
    • https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts?h=linux-6.6.y#n385
  • Armbian patches this device tree to not set it to host mode anymore, which results in it being in OTG mode: https://github.com/armbian/build/blob/main/patch/kernel/archive/rockchip64-6.6/board-nanopi-r2s.patch#L706
  • OTG mode should generally be able to automatically act as both, host or device mode. But there are cases/devices where it does not work. So maybe it is the case here, and I hope it is the correct node, as the pins actually serve two USB 2.0 ports, with one of them clearly intended to be in OTG mode by default.

But let's see ...


FriendlyELEC sets it also to host mode in their own device tree: https://github.com/friendlyarm/kernel-rockchip/blob/nanopi-r2-v6.1.y-opp1/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2-rev02.dts

MichaIng avatar Nov 22 '24 23:11 MichaIng

After running the command I can't ssh into it. Either times out or says Host is down . I will try to connect through UART later

mszyndel avatar Nov 23 '24 06:11 mszyndel

Hmm, it worked fine here, and the /proc/device-tree/usb@ff580000/dr_mode output verified the mode switch. Also even if an overlay is broken, and causes an error when being applied, the boost script just reverts to the original device tree 🤔.

... ah, I see there was an exec in my command, which replaces the shell process with the dtc command. Copy&paste from another script 😅. However, it terminates the shell session, but another SSH login did work in my case, to repeat the steps without exec, resp. from the dtc command on.

MichaIng avatar Nov 23 '24 17:11 MichaIng

Sorry, I didn't have time to connect via UART. Your fix works, as in USB device/network card is detected successfully. However, 4G modem is detected before LAN and therefore I couldn't ssh into the box.

Here's some more info

First of all, it works!

cat /proc/device-tree/usb@ff580000/dr_mode; echo
host
# lsusb
Bus 005 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 19d1:0001 BYD EigenComm Compo
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Welcome message shows following

curl: (28) Resolving timed out after 3000 milliseconds
# dmesg | grep eth
[    3.357006] rndis_host 1-1:1.0 eth0: register 'rndis_host' at usb-ff580000.usb-1, RNDIS device, 20:89:84:6a:96:ab
ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host noprefixroute
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
    link/ether 20:89:84:6a:96:ab brd ff:ff:ff:ff:ff:ff
    inet 192.168.10.2/24 brd 192.168.10.255 scope global dynamic eth0
       valid_lft 86125sec preferred_lft 86125sec
    inet6 fe80::2289:84ff:fe6a:96ab/64 scope link
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether d2:8a:a2:8b:b5:86 brd ff:ff:ff:ff:ff:ff

ping works when I specify the interface

root@DietPi:~# ping 8.8.8.8
ping: connect: Network is unreachable
root@DietPi:~# ping -Ieth0 8.8.8.8
PING 8.8.8.8 (8.8.8.8) from 192.168.10.2 eth0: 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=113 time=151 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=113 time=44.8 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=113 time=44.4 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=113 time=51.8 ms

same for curl

root@DietPi:~# curl  https://google.com
curl: (7) Failed to connect to google.com port 443 after 3053 ms: Couldn't connect to server
root@DietPi:~# curl --interface eth0 https://google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="https://www.google.com/">here</A>.
</BODY></HTML>

I'll poke around a little more now that we're safely in userland 😅

mszyndel avatar Nov 24 '24 15:11 mszyndel

Okay, to make it work I did following changes to network interfaces

root@DietPi:~# cat /etc/network/interfaces
# Location: /etc/network/interfaces
# Please modify network settings via: dietpi-config
# Or create your own drop-ins in: /etc/network/interfaces.d/

# Drop-in configs
source interfaces.d/*

auto eth1

# 4G
allow-hotplug eth0
iface eth0 inet dhcp
address 192.168.10.2
netmask 255.255.255.0
gateway 192.168.10.1
# dns-nameservers 9.9.9.9 149.112.112.112

# Ethernet
allow-hotplug eth1
iface eth1 inet dhcp
address 192.168.0.101
netmask 255.255.255.0
gateway 192.168.0.1
dns-nameservers 8.8.8.8 9.9.9.9

mszyndel avatar Nov 25 '24 16:11 mszyndel

Sorry for the late reply. So The 4G module shows up as eth0, that is interesting. That also broke the network connection, I guess, as previously eth0 was the Ethernet adapter.

auto eth1 should not be needed, as allow-hotplug eth1 configures it already, once detected.

Since you have both interfaces configured with DHCP, is an Ethernet cable even connected, and if so, which of the two is then used is default gateway?

ip r l 0/0

So the solution to get the $G module detected as USB device was the overlay, right https://github.com/MichaIng/DietPi/issues/7286#issuecomment-2495112813

MichaIng avatar Dec 12 '24 16:12 MichaIng

So the solution to get the $G module detected as USB device was the overlay, right #7286 (comment)

Yes

mszyndel avatar Dec 12 '24 17:12 mszyndel

@MichaIng, why is this fix postponed? let me know if help is needed with testing

tomaszn avatar Nov 02 '25 12:11 tomaszn

This is not a fix but a feature request. However, I just added it: https://github.com/MichaIng/build/commit/2a923bf Build running: https://github.com/MichaIng/DietPi/actions/runs/19014581411 Once this build is done, the packages can be found here: https://dietpi.com/downloads/binaries/testing/

Install the new kernel to test:

cd /tmp
wget https://dietpi.com/downloads/binaries/testing/linux-{image,dtb}-current-rockchip64.deb
sudo dpkg -i linux-{image,dtb}-current-rockchip64.deb

Add the new overlay (here the one for host mode as example) in a way that depends on whether your /boot/boot.scr supports multiple prefixes already or not:

if grep --text 'for pre in \${overlay_prefix}' /boot/boot.scr
then
G_SUDO G_CONFIG_INJECT 'overlay_prefix=' 'overlay_prefix=rockchip-rk3328 rockchip' /boot/dietpiEnv.txt
G_SUDO G_CONFIG_INJECT 'overlays=' 'overlays=usb-c-host' /boot/dietpiEnv.txt
else
G_SUDO G_CONFIG_INJECT 'overlays=' 'overlays=rk3328-usb-c-host' /boot/dietpiEnv.txt
fi

Reboot and check whether the mode has been applied as intended:

cat /proc/device-tree/usb@ff580000/dr_mode; echo

MichaIng avatar Nov 02 '25 16:11 MichaIng

Sorry for late reply. I reinstalled most recent DietPi from scratch on two boards (I think 1GB and 2GB RAM, although they are visually different as well).

Results are the same as previously.

  1. Upon install eth0 is ethernet and it works.
  2. After applying the overlay from https://github.com/MichaIng/DietPi/issues/7286#issuecomment-2495112813, after reboot ethernet doesn't work
  3. I connect via UART I find ethernet is eth1 and eth0 is now 4G board.
dietpi@DietPi:~$ ip r l 0/0
default via 192.168.10.1 dev eth0
dietpi@DietPi:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host noprefixroute
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
    link/ether 20:89:84:6a:96:ab brd ff:ff:ff:ff:ff:ff
    inet 192.168.10.2/24 brd 192.168.10.255 scope global dynamic eth0
       valid_lft 85829sec preferred_lft 85829sec
    inet6 fe80::2289:84ff:fe6a:96ab/64 scope link proto kernel_ll
       valid_lft forever preferred_lft forever
3: eth1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether d2:8a:a2:8b:b5:86 brd ff:ff:ff:ff:ff:ff

I bring eth1 up

dietpi@DietPi:~$ sudo ip link set eth1 up
dietpi@DietPi:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host noprefixroute
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
    link/ether 20:89:84:6a:96:ab brd ff:ff:ff:ff:ff:ff
    inet 192.168.10.2/24 brd 192.168.10.255 scope global dynamic eth0
       valid_lft 85826sec preferred_lft 85826sec
    inet6 fe80::2289:84ff:fe6a:96ab/64 scope link proto kernel_ll
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether d2:8a:a2:8b:b5:86 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::d08a:a2ff:fe8b:b586/64 scope link tentative proto kernel_ll
       valid_lft forever preferred_lft forever

but default route is still through eth0 (4G modem)

dietpi@DietPi:~$ ip r l 0/0
default via 192.168.10.1 dev eth0

Maybe I was unclear in my previous comment https://github.com/MichaIng/DietPi/issues/7286#issuecomment-2498468385. by default etc/network/interfaces looks like this (missing eth1 entirely)

# Location: /etc/network/interfaces
# Please modify network settings via: dietpi-config
# Or create your own drop-ins in: /etc/network/interfaces.d/

# Drop-in configs
source interfaces.d/*

# Ethernet
allow-hotplug eth0
iface eth0 inet dhcp
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
#dns-nameservers 9.9.9.9 149.112.112.112

# WiFi
#allow-hotplug wlan0
iface wlan0 inet dhcp
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
#dns-nameservers 9.9.9.9 149.112.112.112
wireless-power off
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf`

I admit I'm bit out of my depth here, but please ask if there's any more info I can provide.

mszyndel avatar Nov 02 '25 16:11 mszyndel

Just to be sure, the eth1 interface (and USB adapter in lsusb) is not detected at all before you apply the overlay? So then it works all as expected.

Of course you need to configure this additional network interface to do what it is supposed to do. Note that 2 default routes are usually not working OOTB since the system does not know which route to use, hence it randomly uses both of them, regardless from which interface the (TCP) connection was established.

Two Ethernet adapters using the same network is also not what you want, is it? In case what for? Usually, one is used for Internet access, the other one for connecting to the LAN only, to act as NAT or bridge.

If for whatever reason you really want 2 Ethernet adapters to be connected to the same (sub)network, parts of the implied issues can be addressed with route metrics. We just had the topic when using Ethernet + WiFi in combination (where this is a reasonable use case, so loosing WiFi signal or unplugging Ethernet cable does not break Internet access): https://github.com/MichaIng/DietPi/issues/7712#issuecomment-3474576538 But it still has limitations without further setup, since the system then consequently answers through the interface with the lower metric (=higher priority), even when answering to a request received from the higher metric adapter.

Or you just want to switch to eth1 entirely and disable eth0? If you disable Ethernet, unplug the cable from the onboard adapter, and plug it to the USB one, then enable Ethernet again, it will choose eth1 automatically. If no Ethernet interface is up already, it chooses the first which has a cable connected. Or quick CLI way:

sed --follow-symlinks -i 's/eth0/eth1/' /etc/network/interfaces
poweroff
# switch cable from onboard to USB adapter
# boot up again

MichaIng avatar Nov 02 '25 17:11 MichaIng

Just to be sure, the eth1 interface (and USB adapter in lsusb) is not detected at all before you apply the overlay? So then it works all as expected.

Before the overlay ethernet is detected at eth0 and 4G module is not detected. After the overlay 4G becomes eth0 and ethernet eth1 and it's not configured in /etc/network/interfaces so that's why it's down by default.

mszyndel avatar Nov 02 '25 17:11 mszyndel

I used your build from https://github.com/MichaIng/DietPi/issues/7286#issuecomment-3478069009 and it indeed gets 4G modem working.

root@DietPi:~# cat /proc/device-tree/usb@ff580000/dr_mode; echo
host

mszyndel avatar Nov 02 '25 18:11 mszyndel

Re interfaces, order, etc.

How I would expect it to work, eth0 should be ethernet eth1 the usb device. eth0 should have priority of available and eth1 used when eth0 is not plugged in.

At home I could plug in the device to the ethernet for faster link, on the go use USB modem.

Edit: since I'm a little confused by your comment above about unplugging cable, usb modem is a hat on top of NanoPi and it's impractical to remove it.

Image

mszyndel avatar Nov 02 '25 18:11 mszyndel

Okay, ah right it was a 4G modem. Then the whole setup makes sense, of course. A bit confusing that it is detected as Ethernet adapter (ethN interface name), but probably makes sense as it is no WiFi either. I remember in some cases it was named usb0.

Interesting that it becomes eth0, i.e. is detected/probed faster by the kernel than the onboard Ethernet adapter. But you are probably not gonna attach and detach it often so that the changing Ethernet interface name would become a problem.

These overlays are generic, hence should work for the mini USB port of the NanoPi R2S as well, and AFAIK for one of the USB 2.0 Type A ports of the ROCK64. But I don't know which of its two USB 2.0 ports is wired to the OTG PHY. By default both are running in host mode, so this is probably not something obvious. It is powered with a 3.5mm jack, not mini USB or USB-C.

Regarding your intended use case: So you would indeed need something like ifplugd or a custom daemon which toggles the interfaces based on whether Ethernet (eth1 in your case) is plugged or unplugged, or at least switch the default route. ifplugd has been removed from Debian Trixie, but the package from Bookworm can actually be installed on Trixie, AFAICS. So if you are still on Bookworm:

sudo apt install ifplugd

If you are on Trixie already:

cd /tmp
wget https://deb.debian.org/debian/pool/main/i/ifplugd/ifplugd_0.28-19.5_arm64.deb
sudo dpkg -i ifplugd_0.28-19.5_arm64.deb

If asked, enter eth1 for interfaces and hotplug interfaces, leave the args untouched, and select "none" as suspend action. If not asked, configure it afterwards:

G_SUDO G_CONFIG_INJECT 'INTERFACES=' 'INTERFACES=eth1' /etc/default/ifplugd
G_SUDO G_CONFIG_INJECT 'HOTPLUG_INTERFACES=' 'HOTPLUG_INTERFACES=eth1' /etc/default/ifplugd

THen create an action which disables eth0 (4G modem) and enables eth1 (Ethernet) if cable is detected, and switches back to the 4G modem if the cable is disconnected:

cat '_EOF_' | sudo tee /etc/ifplugd/action.d/toggle-4g-on-eth
#!/bin/dash
set -e
[ "$1" = 'eth1' ] || exit 0
case "$2" in
'up')
	/sbin/ifdown -f eth0
	/sbin/ifup -f "$1"
	;;
'down')
	/sbin/ifdown -f "$1"
	/sbin/ifup -f eth0
	;;
esac
exit 0
_EOF_
sudo chmod +x /etc/ifplugd/action.d/toggle-4g-on-eth
# Disable the conflicting default action
sudo chmod -x /etc/ifplugd/action.d/ifupdown
sudo systemctl restart ifplugd

Let the system (ifupdown) bring up 4G by default. On boot, it should detect the Ethernet cable, if plugged, and switch to Ethernet automatically in that case:

sudo sed --follow-symlinks -i 's/eth1/eth0/' /etc/network/interfaces

And add a config for eth1 (Ethernet) but without letting ifupdown bringing it up on boot, as ifplugd is supposed to do this:

echo 'iface eth1 inet dhcp' | sudo tee /etc/network/interfaces.d/eth1.conf

iflugd does not bring up Ethernet properly on boot, this can be inverted by adding the -l argument to ifplugd. It then triggers a "down" event at boot, if no cable is detected. So you can let ifupdown bring up Ethernet on boot by default, and let ifplugd switch to 4G if it does not detect an Ethernet cable.

MichaIng avatar Nov 02 '25 19:11 MichaIng

To be honest I abandoned NanoPi for my project because it has too high power consumption. I still think it's a great board and would love to help make it works out of the both in this 4G bundle.

I have a few laying around, can use them for testing!

mszyndel avatar Nov 03 '25 17:11 mszyndel

NP, was in this topic anyway in another context, hence good to have written down the steps for ifplugd based adapter switch.

MichaIng avatar Nov 03 '25 23:11 MichaIng

I'll mark the issue as closed, since the device tree overlays have been added. But I bookmarked this for later reference regarding ifplugd. Feel free to test and report back how it goes, so we may fine tine the instructions for later use.

MichaIng avatar Nov 15 '25 23:11 MichaIng