Jump to content

Nanopi R2S - USB Serial Gadget not working after boot


extjo

Recommended Posts

I have previously successfully been using the USB serial gadget as terminal on the Nanopi R2S.

 

The last working release I have tried was:

Linux 5.4.45-rockchip64 #20.05.3 SMP PREEMPT Wed Jun 10 11:47:27 CEST 2020 aarch64 aarch64 aarch64 GNU/Linux

 

Now I am running the following version (Also tried 20.08.08) and the gadget mode does not work after boot.

Linux 5.8.14-rockchip64 #20.08.10 SMP PREEMPT Tue Oct 13 16:58:01 CEST 2020 aarch64 aarch64 aarch64 GNU/Linux


I have seen no warnings or error messages when running dmesg.

After boot on the failing versions the log contains the following section, which I assume means that the driver loads OK.

[    7.831558] g_serial gadget: Gadget Serial v2.4
[    7.831573] g_serial gadget: g_serial ready
[    7.831594] dwc2 ff580000.usb: bound driver g_serial

 

The device node exists

ls -l /dev/ttyGS0
crw--w---- 1 root tty 241, 0 Oct 16 12:32 /dev/ttyGS0

 

The service seems to be working

 systemctl status serial-getty@ttyGS0.service

● serial-getty@ttyGS0.service - Serial Getty on ttyGS0
     Loaded: loaded (/lib/systemd/system/serial-getty@.service; enabled; vendor preset: enabled)
    Drop-In: /usr/lib/systemd/system/serial-getty@.service.d
             └─10-term.conf
     Active: active (running) since Fri 2020-10-16 12:32:22 CEST; 2min 52s ago
       Docs: man:agetty(8)
             man:systemd-getty-generator(8)
             http://0pointer.de/blog/projects/serial-console.html
   Main PID: 973 (agetty)
      Tasks: 1 (limit: 998)
     Memory: 304.0K
     CGroup: /system.slice/system-serial\x2dgetty.slice/serial-getty@ttyGS0.service
             └─973 /sbin/agetty -o -p -- \u --keep-baud 115200,38400,9600 ttyGS0 linux

 

Only restarting the service has not effect, but by running the following sequence I have been able to restore functionality (until next reboot).

sudo modprobe -r g_serial
sudo modprobe g_serial

sudo systemctl restart serial-getty@ttyGS0.service

 

Any idea on how to fix this permanently?

Link to comment
Share on other sites

The quickest, hackest workaround is adding the modprobe and systemctl restart command to /etc/rc.local, but first let's see the kernel logs

What does dmesg show after removing the g_serial module, and also after re-adding the module? Also be good to see the systemctl status for the working state

Link to comment
Share on other sites

This is dmesg after removing g_serial

[  645.489033] printk: console [ttyGS0] disabled

After re-adding the module

[  729.112172] g_serial gadget: Gadget Serial v2.4
[  729.112181] g_serial gadget: g_serial ready
[  729.112191] dwc2 ff580000.usb: bound driver g_serial
[  729.233924] dwc2 ff580000.usb: new device is high-speed
[  729.269376] dwc2 ff580000.usb: new address 42

The status when working

systemctl status serial-getty@ttyGS0.service
● serial-getty@ttyGS0.service - Serial Getty on ttyGS0
     Loaded: loaded (/lib/systemd/system/serial-getty@.service; enabled; vendor preset: enabled)
    Drop-In: /usr/lib/systemd/system/serial-getty@.service.d
             └─10-term.conf
     Active: active (running) since Tue 2020-10-20 10:11:39 CEST; 9s ago
       Docs: man:agetty(8)
             man:systemd-getty-generator(8)
             http://0pointer.de/blog/projects/serial-console.html
   Main PID: 1898 (agetty)
      Tasks: 1 (limit: 998)
     Memory: 232.0K
     CGroup: /system.slice/system-serial\x2dgetty.slice/serial-getty@ttyGS0.service
             └─1898 /sbin/agetty -o -p -- \u --keep-baud 115200,38400,9600 ttyGS0 linux

 

Link to comment
Share on other sites

That's a big difference for the dwc2 driver messages.  Perhaps gwc2 or g_serial depend on something that's not yet loaded. Comparing lsmod from the working and non-working states might help. It's a bit surprising that ttyGS0 exists when dwc2 didn't log that it found a device. Also that the getty could work with it.  How about posting more dmesg info: dmesg | egrep -i 'serial|tty|dwc|usb|console'

 

Link to comment
Share on other sites

This is the output from dmesg

 

dmesg | egrep -i 'serial|tty|dwc|usb|console'
[    0.000000] Kernel command line: root=UUID=50b7bf20-3a17-4ad2-be5d-1c3b48cc6ab8 rootwait rootfstype=ext4 console=ttyS2,1500000  consoleblank=0 loglevel=1 ubootpart=b554da78-01 usb-storage.quirks=0x2537:0x1066:u,0x2537:0x1068:u   cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory swapaccount=1
[    0.001105] Console: colour dummy device 80x25
[    0.203340] Serial: AMBA PL011 UART driver
[    1.380801] usbcore: registered new interface driver usbfs
[    1.380899] usbcore: registered new interface driver hub
[    1.381042] usbcore: registered new device driver usb
[    3.386585] rockchip-u3phy ff470000.usb3-phy: vbus_drv is not assigned
[    3.389390] rockchip-u3phy ff470000.usb3-phy: Rockchip u3phy initialized successfully
[    3.407732] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[    3.412937] printk: console [ttyS2] disabled
[    3.413080] ff130000.serial: ttyS2 at MMIO 0xff130000 (irq = 12, base_baud = 1500000) is a 16550A
[    3.413235] printk: console [ttyS2] enabled
[    3.414857] Serial: AMBA driver
[    3.455134] phy phy-ff470000.usb3-phy.2: u3phy u2 power on
[    3.455172] phy phy-ff470000.usb3-phy.3: u3phy u3 power on
[    3.458142] dwc2 ff580000.usb: supply vusb_d not found, using dummy regulator
[    3.458343] dwc2 ff580000.usb: supply vusb_a not found, using dummy regulator
[    3.585600] dwc2 ff580000.usb: EPs: 10, dedicated fifos, 972 entries in SPRAM
[    3.586293] dwc2 ff580000.usb: DWC OTG Controller
[    3.586342] dwc2 ff580000.usb: new USB bus registered, assigned bus number 1
[    3.586445] dwc2 ff580000.usb: irq 29, io mem 0xff580000
[    3.586801] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.08
[    3.586813] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    3.586829] usb usb1: Product: DWC OTG Controller
[    3.586839] usb usb1: Manufacturer: Linux 5.8.14-rockchip64 dwc2_hsotg
[    3.586852] usb usb1: SerialNumber: ff580000.usb
[    3.588094] hub 1-0:1.0: USB hub found
[    3.590785] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    3.593610] ehci-platform ff5c0000.usb: EHCI Host Controller
[    3.593657] ehci-platform ff5c0000.usb: new USB bus registered, assigned bus number 2
[    3.593927] ehci-platform ff5c0000.usb: irq 30, io mem 0xff5c0000
[    3.609535] ehci-platform ff5c0000.usb: USB 2.0 started, EHCI 1.00
[    3.609974] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.08
[    3.609987] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    3.610003] usb usb2: Product: EHCI Host Controller
[    3.610013] usb usb2: Manufacturer: Linux 5.8.14-rockchip64 ehci_hcd
[    3.610026] usb usb2: SerialNumber: ff5c0000.usb
[    3.611030] hub 2-0:1.0: USB hub found
[    3.611961] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    3.612827] ohci-platform ff5d0000.usb: Generic Platform OHCI controller
[    3.612867] ohci-platform ff5d0000.usb: new USB bus registered, assigned bus number 3
[    3.613103] ohci-platform ff5d0000.usb: irq 31, io mem 0xff5d0000
[    3.673884] usb usb3: New USB device found, idVendor=1d6b, idProduct=0001, bcdDevice= 5.08
[    3.673897] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    3.673914] usb usb3: Product: Generic Platform OHCI controller
[    3.673924] usb usb3: Manufacturer: Linux 5.8.14-rockchip64 ohci_hcd
[    3.673936] usb usb3: SerialNumber: ff5d0000.usb
[    3.674957] hub 3-0:1.0: USB hub found
[    3.677001] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 4
[    3.678300] usb usb4: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.08
[    3.678314] usb usb4: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    3.678330] usb usb4: Product: xHCI Host Controller
[    3.678340] usb usb4: Manufacturer: Linux 5.8.14-rockchip64 xhci-hcd
[    3.678355] usb usb4: SerialNumber: xhci-hcd.0.auto
[    3.679345] hub 4-0:1.0: USB hub found
[    3.680079] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 5
[    3.680114] xhci-hcd xhci-hcd.0.auto: Host supports USB 3.0 SuperSpeed
[    3.680246] usb usb5: We don't know the algorithms for LPM for this host, disabling LPM.
[    3.680503] usb usb5: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 5.08
[    3.680515] usb usb5: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    3.680532] usb usb5: Product: xHCI Host Controller
[    3.680542] usb usb5: Manufacturer: Linux 5.8.14-rockchip64 xhci-hcd
[    3.680557] usb usb5: SerialNumber: xhci-hcd.0.auto
[    3.681617] hub 5-0:1.0: USB hub found
[    3.682671] usbcore: registered new interface driver usb-storage
[    3.783323] usbcore: registered new interface driver usbhid
[    3.783330] usbhid: USB HID core driver
[    3.948041] friendlyelec-board board: Serial         : bd82a41207725d80
[    3.960286] dw-apb-uart ff130000.serial: forbid DMA for kernel console
[    4.017740] usb 5-1: new SuperSpeed Gen 1 USB device number 2 using xhci-hcd
[    4.038916] usb 5-1: New USB device found, idVendor=0bda, idProduct=8153, bcdDevice=31.00
[    4.038937] usb 5-1: New USB device strings: Mfr=1, Product=2, SerialNumber=6
[    4.038951] usb 5-1: Product: USB 10/100/1000 LAN
[    4.038961] usb 5-1: Manufacturer: Realtek
[    4.038979] usb 5-1: SerialNumber: 000000000000
[    7.441048] systemd[1]: Created slice system-serial\x2dgetty.slice.
[    7.453938] systemd[1]: Condition check resulted in Dispatch Password Requests to Console Directory Watch when bootsplash is active being skipped.
[    7.712709] systemd[1]: Starting Set the console keyboard layout...
[    7.982073] g_serial gadget: Gadget Serial v2.4
[    7.982088] g_serial gadget: g_serial ready
[    7.982108] dwc2 ff580000.usb: bound driver g_serial
[    8.104286] dwc2 ff580000.usb: new device is high-speed
[    8.140862] dwc2 ff580000.usb: new address 40
[    8.424866] systemd[1]: Finished Set the console keyboard layout.
[    8.609200] systemd[1]: Starting Set console font and keymap...
[    8.666789] systemd[1]: Finished Set console font and keymap.
[    8.883878] systemd[1]: Found device /dev/ttyGS0.
[    9.721050] systemd[1]: Found device /dev/ttyS2.
[    9.968289] dwc2 ff580000.usb: new device is high-speed
[   10.004894] dwc2 ff580000.usb: new address 41
[   10.336469] usb 5-1: reset SuperSpeed Gen 1 USB device number 2 using xhci-hcd
[   10.423366] usbcore: registered new interface driver r8152
[  645.489033] printk: console [ttyGS0] disabled
[  729.112172] g_serial gadget: Gadget Serial v2.4
[  729.112181] g_serial gadget: g_serial ready
[  729.112191] dwc2 ff580000.usb: bound driver g_serial
[  729.233924] dwc2 ff580000.usb: new device is high-speed
[  729.269376] dwc2 ff580000.usb: new address 42

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines