NanoPi R1S USB not working

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

NanoPi R1S USB not working

Nicholas Helke
Hi,

I managed to get OpenBSD to boot on a NanoPi R1S by following Frederic
Cambus' post[1]. I can't however seem to get USB to work even though I
was expecting it to work using ehci(4). This rather defeats the utility
of the R1S, as the second ethernet port is on the USB bus.

One message seen during boot (cf. appendix) which I suspect is relevant
is:

> EHCI failed to shut down host controller.

I tracked this message down to U-Boot [3]. I do not however know what it
means or why this would prevent OpenBSD from initialising the USBI don't
see anything in dmesg(8) (cf. appendix) that implies that the ehci(4)
driver hasn't successfully loaded. However the umass(4) device I have
plugged in doesn't power up and does not show in usbdevs(8):

Controller /dev/usb0:
addr 01: 0000:0000 Generic, EHCI root hub
Controller /dev/usb1:
addr 01: 0000:0000 Generic, EHCI root hub
Controller /dev/usb2:
addr 01: 0000:0000 Generic, OHCI root hub
Controller /dev/usb3:
addr 01: 0000:0000 Generic, OHCI root hub

Can anyone suggest something for me to try next? I don't mind patching
my kernel to help figure this out, but I'm afraid I don't know what to
look at next without guidance.

-- Nicholas

Appendix -- Boot messages through end of dmesg:

U-Boot SPL 2019.10 (Oct 11 2019 - 15:49:48 -0600)
DRAM: 512 MiB
Trying to boot from MMC1
NOTICE:  BL31: v2.1(debug):2.1
NOTICE:  BL31: Built : 15:24:56, Oct 11 2019
NOTICE:  BL31: Detected Allwinner H5 SoC (1718)
NOTICE:  BL31: Found U-Boot DTB at 0x408b7b0, model: FriendlyARM NanoPi NEO 2
INFO:    ARM GICv2 driver initialized
INFO:    Configuring SPC Controller
NOTICE:  BL31: PMIC: Defaulting to PortL GPIO according to H5 reference design.
INFO:    BL31: Platform setup done
INFO:    BL31: Initializing runtime services
WARNING: BL31: cortex_a53: CPU workaround for 819472 was missing!
WARNING: BL31: cortex_a53: CPU workaround for 824069 was missing!
WARNING: BL31: cortex_a53: CPU workaround for 827319 was missing!
INFO:    BL31: cortex_a53: CPU workaund for 855873 was applied
INFO:    BL31: Preparing for EL3 exit to normal world
INFO:    Entry point address = x4a000000
INFO:    SPSR = 0x3c9


U-Boot 2019.10 (Oct 11 2019 - 15:49:48 -0600) Allwinner Technology

CPU:   Allwinner H5 (SUN50I)
Model: FriendlyARM NanoPi NEO 2
DRAM:  512 MiB
MMC:   mmc@1c0f000: 0
Loading Environment from FAT... *** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   phy interface7
Could not get PHY for ethernet@1c30000: addr 7
eth-1: ethernet@1c30000
starting USB...
Bus usb@1c1a000: USB EHCI 1.00
Bus usb@1c1a400: USB OHCI 1.0
Bus usb@1c1d000: USB EHCI 1.00
Bus usb@1c1d400: USB OHCI 1.0
scanning bus usb@1c1a000 for devices... 1 USB Device(s) found
scanning bus usb@1c1a400 for devices... 1 USB Device(s) found
scanning bus usb@1c1d000 for devices... 1 USB Device(s) found
scanning bus usb@1c1d400 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
17280 bytes read in 4 ms (4.1 MiB/s)
Found EFI removable media binary efi/boot/bootaa64.efi
Scanning disk [hidden email]...
Found 3 disks
phy interface7
mdio_register: non unique device name 'ethernet@1c30000'
Found 3 disks
phy interface7
mdio_register: non unique device name 'ethernet@1c30000'
Could not get PHY for ethernet@1c30000: addr 7
BootOrder not defined
EFI boot manager: Cannot load any image
161090 bytes read in 12 ms (12.8 MiB/s)
disks: sd0*
>> OpenBSD/arm64 BOOTAA64 0.19
boot>
booting sd0a:/bsd: 7473584+1601952+537168+849040 [621352+109+867816+526421]=0xd3ec78
EHCI failed to shut down host controller.
type 0x2 pa 0x40000000 va 0x40000000 pages 0x4000 attr 0x8
type 0x7 pa 0x44000000 va 0x44000000 pages 0x3ef8 attr 0x8
type 0x4 pa 0x47ef8000 va 0x47ef8000 pages 0x10 attr 0x8
type 0x7 pa 0x47f08000 va 0x47f08000 pages 0x103c0 attr 0x8
type 0x2 pa 0x582c8000 va 0x582c8000 pages 0xb32 attr 0x8
type 0x7 pa 0x58dfa000 va 0x58dfa000 pages 0x1 attr 0x8
type 0x2 pa 0x58dfb000 va 0x58dfb000 pages 0x100 attr 0x8
type 0x1 pa 0x58efb000 va 0x58efb000 pages 0x28 attr 0x8
type 0x0 pa 0x58f23000 va 0x58f23000 pages 0x5 attr 0x8
type 0x4 pa 0x58f28000 va 0x58f28000 pages 0x1 attr 0x8
type 0x0 pa 0x58f29000 va 0x58f29000 pages 0x2 attr 0x8
type 0x6 pa 0x58f2b000 va 0x325caa2000 pages 0x1 attr 0x8000000000000008
type 0x0 pa 0x58f2c000 va 0x58f2c000 pages 0x1 attr 0x8
type 0x4 pa 0x58f2d000 va 0x58f2d000 pages 0x2 attr 0x8
type 0x0 pa 0x58f2f000 va 0x58f2f000 pages 0x2 attr 0x8
type 0x6 pa 0x58f31000 va 0x325caa8000 pages 0x1 attr 0x8000000000000008
type 0x0 pa 0x58f32000 va 0x58f32000 pages 0x1 attr 0x8
type 0x2 pa 0x58f33000 va 0x58f33000 pages 0x501d attr 0x8
type 0x5 pa 0x5df50000 va 0x3261ac7000 pages 0x10 attr 0x8000000000000008
type 0x2 pa 0x5df60000 va 0x5df60000 pages 0x20a0 attr 0x8
[ using 2016664 bytes of bsd ELF symbol table ]
Copyright (c) 1982, 1986, 1989, 1991, 1993
        The Regents of the University of California.  All rights reserved.
Copyright (c) 1995-2019 OpenBSD. All rights reserved.  https://www.OpenBSD.org

OpenBSD 6.6 (GENERIC.MP) #4: Tue Dec 17 14:55:16 MST 2019
    [hidden email]:/usr/src/sys/arch/arm64/compile/GENERIC.MP
real mem  = 405504000 (386MB)
avail mem = 362999808 (346MB)
mainbus0 at root: FriendlyARM NanoPi NEO 2
cpu0 at mainbus0 mpidr 0: ARM Cortex-A53 r0p4
cpu0: 32KB 64b/line 2-way L1 VIPT I-cache, 32KB 64b/line 4-way L1 D-cache
cpu0: 512KB 64b/line 16-way L2 cache
efi0 at mainbus0: UEFI 2.8
efi0: Das U-Boot rev 0x20191000
apm0 at mainbus0
sxiccmu0 at mainbus0
psci0 at mainbus0: PSCI 1.1, SMCCC 1.1
simplebus0 at mainbus0: "soc"
syscon0 at simplebus0: "syscon"
sxiccmu1 at simplebus0
sxipio0 at simplebus0: 94 pins
ampintc0 at simplebus0 nirq 224, ncpu 4 ipi: 0, 1: "interrupt-controller"
sxirtc0 at simplebus0
sxiccmu2 at simplebus0
sxipio1 at simplebus0: 12 pins
"clock" at simplebus0 not configured
"mixer" at simplebus0 not configured
"dma-controller" at simplebus0 not configured
"lcd-controller" at simplebus0 not configured
sximmc0 at simplebus0
sdmmc0 at sximmc0: 4-bit, sd high-speed, mmc high-speed, dma
"usb" at simplebus0 not configured
"phy" at simplebus0 not configured
ehci0 at simplebus0
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 configuration 1 interface 0 "Generic EHCI root hub" rev 2.00/1.00 addr 1
ohci0 at simplebus0: version 1.0
ehci1 at simplebus0
usb1 at ehci1: USB revision 2.0
uhub1 at usb1 configuration 1 interface 0 "Generic EHCI root hub" rev 2.00/1.00 addr 1
ohci1 at simplebus0: version 1.0
"timer" at simplebus0 not configured
dwxe0 at simplebus0: address 22:22:22:22:22:22
rgephy0 at dwxe0 phy 7: RTL8169S/8110S/8211 PHY, rev. 5
"watchdog" at simplebus0 not configured
com0 at simplebus0: ns16550, no working fifo
com0: console
"hdmi-phy" at simplebus0 not configured
"codec-analog" at simplebus0 not configured
"gpu" at simplebus0 not configured
gpio0 at sxipio0: 32 pins
gpio1 at sxipio0: 32 pins
gpio2 at sxipio0: 32 pins
gpio3 at sxipio0: 32 pins
gpio4 at sxipio0: 32 pins
gpio5 at sxipio0: 32 pins
gpio6 at sxipio0: 32 pins
gpio7 at sxipio1: 32 pins
usb2 at ohci0: USB revision 1.0
uhub2 at usb2 configuration 1 interface 0 "Generic OHCI root hub" rev 1.00/1.00 addr 1
usb3 at ohci1: USB revision 1.0
uhub3 at usb3 configuration 1 interface 0 "Generic OHCI root hub" rev 1.00/1.00 addr 1
agtimer0 at mainbus0: tick rate 24000 KHz
"leds" at mainbus0 not configured
"gmac-3v3" at mainbus0 not configured
"vcc3v3" at mainbus0 not configured
"usb0-vbus" at mainbus0 not configuredcpu1 at mainbus0 mpidr 1: ARM Cortex-A53 r0p4
cpu1: 32KB 64b/line 2-way L1 VIPT I-cache, 32KB 64b/line 4-way L1 D-cache
cpu1: 512KB 64b/line 16-way L2 cache
cpu2 at mainbus0 mpidr 2: ARM Cortex-A53 r0p4
cpu2: 32KB 64b/line 2-way L1 VIPT I-cache, 32KB 64b/line 4-way L1 D-cache
cpu2: 512KB 64b/line 16-way L2 cache
cpu3 at mainbus0 mpidr 3: ARM Cortex-A53 r0p4
cpu3: 32KB 64b/line 2-way L1 VIPT I-cache, 32KB 64b/line 4-way L1 D-cache
cpu3: 512KB 64b/line 16-way L2 cache
scsibus0 at sdmmc0: 2 targets, initiator 0
sd0 at scsibus0 targ 1 lun 0: <SD/MMC, SC32G, 0080> removable
sd0: 30436MB, 512 bytes/sector, 62333952 sectors
vscsi0 at root
scsibus1 at vscsi0: 256 targets
softraid0 at root
scsibus2 at softraid0: 256 targets
bootfile: sd0a:/bsd
boot device: sd0
root on sd0a (ffffffffffffffff.a) swap on sd0b dump on sd0b
Automatic boot in progress: starting file system checks.
/dev/sd0a (ffffffffffffffff.a): file system is clean; not checking
/dev/sd0l (ffffffffffffffff.l): file system is clean; not checking
/dev/sd0d (ffffffffffffffff.d): file system is clean; not checking
/dev/sd0f (ffffffffffffffff.f): file system is clean; not checking
/dev/sd0g (ffffffffffffffff.g): file system is clean; not checking
/dev/sd0h (ffffffffffffffff.h): file system is clean; not checking
/dev/sd0k (ffffffffffffffff.k): file system is clean; not checking
/dev/sd0j (ffffffffffffffff.j): file system is clean; not checking
/dev/sd0e (ffffffffffffffff.e): file system is clean; not checking
pf enabled
starting network
dwxe0: no link......
dwxe0: 192.168.0.43 lease accepted from 192.168.0.1 (11:11:11:11:11:11)
reordering libraries: done.
starting early daemons: syslogd pflogd ntpd.
starting RPC daemons:.
savecore: /dev/wd0a: Device not configured
checking quotas: done.
clearing /tmp
kern.securelevel: 0 -> 1
creating runtime link editor directory cache.
preserving editor files.
starting network daemons: sshd smtprebootd sndiod.
starting local daemons: cron.
Sat Mar 28 20:24:54 GMT 2020

References:

[1]: https://cambus.net/openbsd-arm64-on-the-nanopi-neo2/
[2]: https://twitter.com/fcambus/status/1232942978982912000
[3]: https://github.com/u-boot/u-boot/blob/350c44dfb99017e9147ee07d37a40626bde62250/drivers/usb/host/ehci-hcd.c#L208

Reply | Threaded
Open this post in threaded view
|

Re: NanoPi R1S USB not working

Mark Kettenis
> Date: Sat, 28 Mar 2020 23:03:00 +0000
> From: "Nicholas Helke" <[hidden email]>
>
> Hi,
>
> I managed to get OpenBSD to boot on a NanoPi R1S by following Frederic
> Cambus' post[1]. I can't however seem to get USB to work even though I
> was expecting it to work using ehci(4). This rather defeats the utility
> of the R1S, as the second ethernet port is on the USB bus.
>
> One message seen during boot (cf. appendix) which I suspect is relevant
> is:
>
> > EHCI failed to shut down host controller.

That message is annoying but harmless.

> I tracked this message down to U-Boot [3]. I do not however know what it
> means or why this would prevent OpenBSD from initialising the USBI don't
> see anything in dmesg(8) (cf. appendix) that implies that the ehci(4)
> driver hasn't successfully loaded. However the umass(4) device I have
> plugged in doesn't power up and does not show in usbdevs(8):

The fact that a device plugged into the usb ports doesn't power up
suggests that the USB bus isn't powered.  I think I know why...

> Controller /dev/usb0:
> addr 01: 0000:0000 Generic, EHCI root hub
> Controller /dev/usb1:
> addr 01: 0000:0000 Generic, EHCI root hub
> Controller /dev/usb2:
> addr 01: 0000:0000 Generic, OHCI root hub
> Controller /dev/usb3:
> addr 01: 0000:0000 Generic, OHCI root hub
>
> Can anyone suggest something for me to try next? I don't mind patching
> my kernel to help figure this out, but I'm afraid I don't know what to
> look at next without guidance.

Yes, see below...

> Appendix -- Boot messages through end of dmesg:
>
> U-Boot SPL 2019.10 (Oct 11 2019 - 15:49:48 -0600)
> DRAM: 512 MiB
> Trying to boot from MMC1
> NOTICE:  BL31: v2.1(debug):2.1
> NOTICE:  BL31: Built : 15:24:56, Oct 11 2019
> NOTICE:  BL31: Detected Allwinner H5 SoC (1718)
> NOTICE:  BL31: Found U-Boot DTB at 0x408b7b0, model: FriendlyARM NanoPi NEO 2
> INFO:    ARM GICv2 driver initialized
> INFO:    Configuring SPC Controller
> NOTICE:  BL31: PMIC: Defaulting to PortL GPIO according to H5 reference design.
> INFO:    BL31: Platform setup done
> INFO:    BL31: Initializing runtime services
> WARNING: BL31: cortex_a53: CPU workaround for 819472 was missing!
> WARNING: BL31: cortex_a53: CPU workaround for 824069 was missing!
> WARNING: BL31: cortex_a53: CPU workaround for 827319 was missing!
> INFO:    BL31: cortex_a53: CPU workaund for 855873 was applied
> INFO:    BL31: Preparing for EL3 exit to normal world
> INFO:    Entry point address = x4a000000
> INFO:    SPSR = 0x3c9
>
>
> U-Boot 2019.10 (Oct 11 2019 - 15:49:48 -0600) Allwinner Technology
>
> CPU:   Allwinner H5 (SUN50I)
> Model: FriendlyARM NanoPi NEO 2

You're using a U-Boot for a different device than you have...

> DRAM:  512 MiB
> MMC:   mmc@1c0f000: 0
> Loading Environment from FAT... *** Warning - bad CRC, using default environment
>
> In:    serial
> Out:   serial
> Err:   serial
> Net:   phy interface7
> Could not get PHY for ethernet@1c30000: addr 7
> eth-1: ethernet@1c30000
> starting USB...
> Bus usb@1c1a000: USB EHCI 1.00
> Bus usb@1c1a400: USB OHCI 1.0
> Bus usb@1c1d000: USB EHCI 1.00
> Bus usb@1c1d400: USB OHCI 1.0
> scanning bus usb@1c1a000 for devices... 1 USB Device(s) found
> scanning bus usb@1c1a400 for devices... 1 USB Device(s) found
> scanning bus usb@1c1d000 for devices... 1 USB Device(s) found
> scanning bus usb@1c1d400 for devices... 1 USB Device(s) found
>        scanning usb for storage devices... 0 Storage Device(s) found
> Hit any key to stop autoboot:  0
> switch to partitions #0, OK
> mmc0 is current device
> Scanning mmc 0:1...
> 17280 bytes read in 4 ms (4.1 MiB/s)
> Found EFI removable media binary efi/boot/bootaa64.efi
> Scanning disk [hidden email]...
> Found 3 disks
> phy interface7
> mdio_register: non unique device name 'ethernet@1c30000'
> Found 3 disks
> phy interface7
> mdio_register: non unique device name 'ethernet@1c30000'
> Could not get PHY for ethernet@1c30000: addr 7
> BootOrder not defined
> EFI boot manager: Cannot load any image
> 161090 bytes read in 12 ms (12.8 MiB/s)
> disks: sd0*
> >> OpenBSD/arm64 BOOTAA64 0.19
> boot>
> booting sd0a:/bsd: 7473584+1601952+537168+849040 [621352+109+867816+526421]=0xd3ec78
> EHCI failed to shut down host controller.
> type 0x2 pa 0x40000000 va 0x40000000 pages 0x4000 attr 0x8
> type 0x7 pa 0x44000000 va 0x44000000 pages 0x3ef8 attr 0x8
> type 0x4 pa 0x47ef8000 va 0x47ef8000 pages 0x10 attr 0x8
> type 0x7 pa 0x47f08000 va 0x47f08000 pages 0x103c0 attr 0x8
> type 0x2 pa 0x582c8000 va 0x582c8000 pages 0xb32 attr 0x8
> type 0x7 pa 0x58dfa000 va 0x58dfa000 pages 0x1 attr 0x8
> type 0x2 pa 0x58dfb000 va 0x58dfb000 pages 0x100 attr 0x8
> type 0x1 pa 0x58efb000 va 0x58efb000 pages 0x28 attr 0x8
> type 0x0 pa 0x58f23000 va 0x58f23000 pages 0x5 attr 0x8
> type 0x4 pa 0x58f28000 va 0x58f28000 pages 0x1 attr 0x8
> type 0x0 pa 0x58f29000 va 0x58f29000 pages 0x2 attr 0x8
> type 0x6 pa 0x58f2b000 va 0x325caa2000 pages 0x1 attr 0x8000000000000008
> type 0x0 pa 0x58f2c000 va 0x58f2c000 pages 0x1 attr 0x8
> type 0x4 pa 0x58f2d000 va 0x58f2d000 pages 0x2 attr 0x8
> type 0x0 pa 0x58f2f000 va 0x58f2f000 pages 0x2 attr 0x8
> type 0x6 pa 0x58f31000 va 0x325caa8000 pages 0x1 attr 0x8000000000000008
> type 0x0 pa 0x58f32000 va 0x58f32000 pages 0x1 attr 0x8
> type 0x2 pa 0x58f33000 va 0x58f33000 pages 0x501d attr 0x8
> type 0x5 pa 0x5df50000 va 0x3261ac7000 pages 0x10 attr 0x8000000000000008
> type 0x2 pa 0x5df60000 va 0x5df60000 pages 0x20a0 attr 0x8
> [ using 2016664 bytes of bsd ELF symbol table ]
> Copyright (c) 1982, 1986, 1989, 1991, 1993
>         The Regents of the University of California.  All rights reserved.
> Copyright (c) 1995-2019 OpenBSD. All rights reserved.  https://www.OpenBSD.org
>
> OpenBSD 6.6 (GENERIC.MP) #4: Tue Dec 17 14:55:16 MST 2019
>     [hidden email]:/usr/src/sys/arch/arm64/compile/GENERIC.MP
> real mem  = 405504000 (386MB)
> avail mem = 362999808 (346MB)
> mainbus0 at root: FriendlyARM NanoPi NEO 2

And also a device tree (DTB) for the wrong device.  The device tree
has the information on how to power up the USB bus.  You need to get
yourself a device tree for this particular board.  This may be a
starting point:

https://github.com/friendlyarm/linux/blob/sunxi-4.14.y/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-r1s.dts