mbox series

[v6,0/4] usb: xhci: Load Raspberry Pi 4 VL805's firmware

Message ID 20200629163725.13330-1-nsaenzjulienne@suse.de
Headers show
Series usb: xhci: Load Raspberry Pi 4 VL805's firmware | expand

Message

Nicolas Saenz Julienne June 29, 2020, 4:37 p.m. UTC
Newer revisions of the RPi4 need their xHCI chip, VL805, firmware to be
loaded explicitly. Earlier versions didn't need that as they where using
an EEPROM for that purpose. This series takes care of setting up the
relevant infrastructure and run the firmware loading routine at the
right moment.

Note that this builds on top of Sylwester Nawrocki's "USB host support
for Raspberry Pi 4 board" series.

This also depends on a DT/bindings patch available on the linux-mailing lists:
https://www.mail-archive.com/linux-kernel at vger.kernel.org/msg2205783.html

Here is the relevant bit for reference/discussion:

        &pcie0 {
               pci at 1,0 {
                       #address-cells = <3>;
                       #size-cells = <2>;
                       ranges;

                       reg = <0 0 0 0 0>;

                       usb at 1,0 {
                               reg = <0x10000 0 0 0 0>;
                               resets = <&reset RASPBERRYPI_FIRMWARE_RESET_ID_USB>;
                       };
               };
        };

---

Changes since v5:
 - Properly handle !CONFIG_IS_ENABLED(DM_RESET) in xchi code

Changes since v4:
 - Correct DT PCI topology, I separated the root bridge and controller
   DT nodes
 - Get rid of PCI core patch as not needed with correct DT PCI topology
 - Move reset support to xchi core

Changes since v3:
 - Use reset controller

Changes since v2:
 - Correct comment on patch #1
 - Address Matthias' comments

Changes since v1:
 - Rename function
 - Use callback in xhci-pci.c

Nicolas Saenz Julienne (4):
  arm: rpi: Add function to trigger VL805's firmware load
  reset: Add Raspberry Pi 4 firmware reset controller
  configs: Enable support for reset controllers on RPi4
  usb: xhci: Add reset controller support

 arch/arm/mach-bcm283x/include/mach/mbox.h     | 13 ++++
 arch/arm/mach-bcm283x/include/mach/msg.h      |  7 +++
 arch/arm/mach-bcm283x/msg.c                   | 46 ++++++++++++++
 configs/rpi_4_32b_defconfig                   |  1 +
 configs/rpi_4_defconfig                       |  1 +
 configs/rpi_arm64_defconfig                   |  1 +
 drivers/reset/Kconfig                         | 10 ++++
 drivers/reset/Makefile                        |  1 +
 drivers/reset/reset-raspberrypi.c             | 60 +++++++++++++++++++
 drivers/usb/host/xhci-mem.c                   |  2 +
 drivers/usb/host/xhci.c                       | 33 ++++++++++
 .../reset/raspberrypi,firmware-reset.h        | 13 ++++
 include/usb/xhci.h                            |  2 +
 13 files changed, 190 insertions(+)
 create mode 100644 drivers/reset/reset-raspberrypi.c
 create mode 100644 include/dt-bindings/reset/raspberrypi,firmware-reset.h

Comments

Stefan Agner Aug. 1, 2020, 12:25 p.m. UTC | #1
Hi Nicolas,

I do have USB MSD boot working with at least two USB flash drives
successfully.

I now tried using a USB NVMe enclosure (ICY BOX with a JMicron chip in
it). It seems that U-Boot has troubles enumerating the device at first,
but "usb reset" helps:

U-Boo 2020.07 (Jul 25 2020 - 06:55:15 +0000)

DRAM:  1.9 GiB
RPI 4 Model B (0xb03112)
MMC:   mmcnr@7e300000: 1, emmc2@7e340000: 0
In:    serial
Out:   serial
Err:   serial
Net:   eth0: genet@7d580000
PCIe BRCM: link up, 5.0 Gbps x1 (SSC)
startig USB...
Bus xhci_pci: Register 5000420 NbrPorts 5
Starting the controller
USB XHCI 1.00
scanning bus xhci_pci for devces... Device NOT ready
   Request Sense returned 02 04 01
4 USB Device(s) found
       scanning usb for storage devices... 0 Sorage Device(s) found
Card did not respond to voltage select!
Card did not respond to voltage select!

genet@7d580000 Waiting for PHY auto negotiation to complete... done
BOOTP broadcast 1
DHCP client bound to address 192.168.80.226 (3 ms
====> Ctrl+C
HassOS> <INTERRUPT>
HassOS> usb tree
USB device tree:
  1  Hub (5 Gb/s, 0mA)
  |  U-Boot XHCI Host Controller
  |
  +-2  MassStorage (5 Gb/s, 224mA)
  |    JMicron USB 3.1 Storage Device DD56419884B3E
  |
  +-3  Hub (480 Mb/s, 100A)
    |   USB2.0 Hub
    |
    +-4  Human Interface (12 Mb/s, 98mA)
         Logitech USB Receiver

HassOS> ls usb 0:1
HassOS> usb reset
resetting USB...
Bus xhci_pci: Register 5000420 NbrPorts 5
Starting the controller
USB XHCI 1.00
scanning bus xhci_ci for devices... 4 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
HassOS>ls usb 0:1
    41499   bcm2711-rpi-4-b.dtb
     2382   boot.scr
       57   cmdline.txt
     1785   config.txt
           overlays/
   488304   u-boot.bin
  2272992   start4.elf.orig
  2277376   start4.elf
     5405   fixup4.dat.orig
     5407   fiup4.dat

9 file(s), 1 dir(s)

HassOS> usb tree
USB device tree:
  1  Hub (5 Gb/s, 0mA)
  |  U-Boot XHCI Host Controller
  |
  |+-2  Mass Storage (5 Gb/s, 224mA)
  |    JMicron USB 3.1 Storage Device DD56419884B3E
  |
  +-3  Hub (480 b/s, 100mA)
    |   USB2.0 Hub
    |
    +-4  Human Interface (12 Mb/s, 98mA)
         Logitech USB Receier

The device then boots and works fine.


Do you happen to know if there is some tunable in U-Boot which might
help?
https://github.com/home-assistant/operating-system/issues/796

--
Stefan


On 2020-07-19 12:06, Nicolas Saenz Julienne wrote:
> Hi Stefan,

> 

> On Sun, 2020-07-19 at 02:37 +0200, Stefan Agner wrote:

>> Hi Nicolas,

>>

>> On 2020-06-29 18:37, Nicolas Saenz Julienne wrote:

>> > Newer revisions of the RPi4 need their xHCI chip, VL805, firmware to be

>> > loaded explicitly. Earlier versions didn't need that as they where using

>> > an EEPROM for that purpose. This series takes care of setting up the

>> > relevant infrastructure and run the firmware loading routine at the

>> > right moment.

>>

>> I tried using this patchset to boot from a USB mass storage device on

>> RPi 4 with 8GB RAM. I updated the EEPROM firmware as well as deployed

>> the latest GPU firmware (start4.elf/fixup4.dat) from the firmware master

>> branch. I think with that I have new enough/correct versions.

>>

>> The RPi 4 successfully boots U-Boot from a mass storage device. However,

>> U-Boot itself is then not able to access USB. The output always shows

>> -110 (timeout). It seems that the VL805 controller is not detected on

>> the PCIe bus. Do you happen to know what I might be missing?

>>

>> I tried current master (which has your patchset merged) as well as your

>> vl805 branch on Github.

> 

> 

> You're probably missing these two patches on your device-tree, they haven't

> made it upstream yet, but most likely will soon:

> 

> https://patchwork.ozlabs.org/project/linux-pci/patch/20200629161845.6021-4-nsaenzjulienne@suse.de/

> https://patchwork.ozlabs.org/project/linux-pci/patch/20200629161845.6021-5-nsaenzjulienne@suse.de/

> 

> Sorry for the hassle!

> Nicolas

> 

>>

>> U-Boot 2020.07-rc4-00036-gdeb48986ee (Jul 19 2020 - 02:29:44 +0200)

>>

>> DRAM:  7.9 GiB

>> RPI 4 Model B (0xd03114)

>> MMC:   mmcnr@7e300000: 1, emmc2@7e340000: 0

>> Loading Environment from FAT... Card did not respond to voltage select!

>> In:    serial

>> Out:   vidconsole

>> Err:   vidconsole

>> Net:   eth0: genet@7d580000

>> PCIe BRCM: link up, 5.0 Gbps x1 (!SSC)

>> Device 'pci_0:0.0': seq 0 is in use by 'pcie@7d500000'

>> starting USB...

>> Bus xhci_pci: probe failed, error -110

>> No working controllers found

>> Hit any key to stop autoboot:  0

>> U-Boot> pci enum

>> U-Boot> pci

>> Scanning PCI devices on bus 0

>> BusDevFun  VendorId   DeviceId   Device Class       Sub-Class

>> _____________________________________________________________

>> 00.00.00   0x14e4     0x2711     Bridge device           0x04

>>

>>

>> --

>> Stefan

>>

>> > Note that this builds on top of Sylwester Nawrocki's "USB host support

>> > for Raspberry Pi 4 board" series.

>> >

>> > This also depends on a DT/bindings patch available on the linux-mailing

>> > lists:

>> > https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg2205783.html

>> >

>> > Here is the relevant bit for reference/discussion:

>> >

>> >         &pcie0 {

>> >                pci@1,0 {

>> >                        #address-cells = <3>;

>> >                        #size-cells = <2>;

>> >                        ranges;

>> >

>> >                        reg = <0 0 0 0 0>;

>> >

>> >                        usb@1,0 {

>> >                                reg = <0x10000 0 0 0 0>;

>> >                                resets = <&reset

>> > RASPBERRYPI_FIRMWARE_RESET_ID_USB>;

>> >                        };

>> >                };

>> >         };

>> >

>> > ---

>> >

>> > Changes since v5:

>> >  - Properly handle !CONFIG_IS_ENABLED(DM_RESET) in xchi code

>> >

>> > Changes since v4:

>> >  - Correct DT PCI topology, I separated the root bridge and controller

>> >    DT nodes

>> >  - Get rid of PCI core patch as not needed with correct DT PCI topology

>> >  - Move reset support to xchi core

>> >

>> > Changes since v3:

>> >  - Use reset controller

>> >

>> > Changes since v2:

>> >  - Correct comment on patch #1

>> >  - Address Matthias' comments

>> >

>> > Changes since v1:

>> >  - Rename function

>> >  - Use callback in xhci-pci.c

>> >

>> > Nicolas Saenz Julienne (4):

>> >   arm: rpi: Add function to trigger VL805's firmware load

>> >   reset: Add Raspberry Pi 4 firmware reset controller

>> >   configs: Enable support for reset controllers on RPi4

>> >   usb: xhci: Add reset controller support

>> >

>> >  arch/arm/mach-bcm283x/include/mach/mbox.h     | 13 ++++

>> >  arch/arm/mach-bcm283x/include/mach/msg.h      |  7 +++

>> >  arch/arm/mach-bcm283x/msg.c                   | 46 ++++++++++++++

>> >  configs/rpi_4_32b_defconfig                   |  1 +

>> >  configs/rpi_4_defconfig                       |  1 +

>> >  configs/rpi_arm64_defconfig                   |  1 +

>> >  drivers/reset/Kconfig                         | 10 ++++

>> >  drivers/reset/Makefile                        |  1 +

>> >  drivers/reset/reset-raspberrypi.c             | 60 +++++++++++++++++++

>> >  drivers/usb/host/xhci-mem.c                   |  2 +

>> >  drivers/usb/host/xhci.c                       | 33 ++++++++++

>> >  .../reset/raspberrypi,firmware-reset.h        | 13 ++++

>> >  include/usb/xhci.h                            |  2 +

>> >  13 files changed, 190 insertions(+)

>> >  create mode 100644 drivers/reset/reset-raspberrypi.c

>> >  create mode 100644 include/dt-bindings/reset/raspberrypi,firmware-reset.h
Nicolas Saenz Julienne Aug. 1, 2020, 5:53 p.m. UTC | #2
Hi Stefan,

On Sat, 2020-08-01 at 14:25 +0200, Stefan Agner wrote:
> Hi Nicolas,

> 

> I do have USB MSD boot working with at least two USB flash drives

> successfully.

> 

> I now tried using a USB NVMe enclosure (ICY BOX with a JMicron chip in

> it). It seems that U-Boot has troubles enumerating the device at first,

> but "usb reset" helps:

> 

> U-Boo 2020.07 (Jul 25 2020 - 06:55:15 +0000)

> 

> DRAM:  1.9 GiB

> RPI 4 Model B (0xb03112)

> MMC:   mmcnr@7e300000: 1, emmc2@7e340000: 0

> In:    serial

> Out:   serial

> Err:   serial

> Net:   eth0: genet@7d580000

> PCIe BRCM: link up, 5.0 Gbps x1 (SSC)

> startig USB...

> Bus xhci_pci: Register 5000420 NbrPorts 5

> Starting the controller

> USB XHCI 1.00

> scanning bus xhci_pci for devces... Device NOT ready

>    Request Sense returned 02 04 01

> 4 USB Device(s) found

>        scanning usb for storage devices... 0 Sorage Device(s) found

> Card did not respond to voltage select!

> Card did not respond to voltage select!

> 

> genet@7d580000 Waiting for PHY auto negotiation to complete... done

> BOOTP broadcast 1

> DHCP client bound to address 192.168.80.226 (3 ms

> ====> Ctrl+C

> HassOS> <INTERRUPT>

> HassOS> usb tree

> USB device tree:

>   1  Hub (5 Gb/s, 0mA)

>   |  U-Boot XHCI Host Controller

>   |

>   +-2  MassStorage (5 Gb/s, 224mA)

>   |    JMicron USB 3.1 Storage Device DD56419884B3E

>   |

>   +-3  Hub (480 Mb/s, 100A)

>     |   USB2.0 Hub

>     |

>     +-4  Human Interface (12 Mb/s, 98mA)

>          Logitech USB Receiver

> 

> HassOS> ls usb 0:1

> HassOS> usb reset

> resetting USB...

> Bus xhci_pci: Register 5000420 NbrPorts 5

> Starting the controller

> USB XHCI 1.00

> scanning bus xhci_ci for devices... 4 USB Device(s) found

>        scanning usb for storage devices... 1 Storage Device(s) found

> HassOS>ls usb 0:1

>     41499   bcm2711-rpi-4-b.dtb

>      2382   boot.scr

>        57   cmdline.txt

>      1785   config.txt

>            overlays/

>    488304   u-boot.bin

>   2272992   start4.elf.orig

>   2277376   start4.elf

>      5405   fixup4.dat.orig

>      5407   fiup4.dat

> 

> 9 file(s), 1 dir(s)

> 

> HassOS> usb tree

> USB device tree:

>   1  Hub (5 Gb/s, 0mA)

>   |  U-Boot XHCI Host Controller

>   |

>   |+-2  Mass Storage (5 Gb/s, 224mA)

>   |    JMicron USB 3.1 Storage Device DD56419884B3E

>   |

>   +-3  Hub (480 b/s, 100mA)

>     |   USB2.0 Hub

>     |

>     +-4  Human Interface (12 Mb/s, 98mA)

>          Logitech USB Receier

> 

> The device then boots and works fine.

> 

> 

> Do you happen to know if there is some tunable in U-Boot which might

> help?


Sorry but nothing comes to mind. I'm not aware of similar issues.

Regards,
Nicolas