devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/9] Raspberry Pi 4 USB firmware initialization rework
@ 2020-06-09 17:49 Nicolas Saenz Julienne
  2020-06-09 17:49 ` [PATCH v2 1/9] dt-bindings: reset: Add a binding for the RPi Firmware reset controller Nicolas Saenz Julienne
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Nicolas Saenz Julienne @ 2020-06-09 17:49 UTC (permalink / raw)
  To: f.fainelli, gregkh, wahrenst, p.zabel, linux-kernel
  Cc: linux-usb, linux-rpi-kernel, linux-arm-kernel,
	bcm-kernel-feedback-list, tim.gover, linux-pci, helgaas,
	andy.shevchenko, mathias.nyman, lorenzo.pieralisi,
	Nicolas Saenz Julienne, Rob Herring, Eric Anholt, devicetree

On the Raspberry Pi 4, after a PCI reset, VL805's firmware may either be
loaded directly from an EEPROM or, if not present, by the SoC's
co-processor, VideoCore. This series reworks how we handle this.

The previous solution makes use of PCI quirks and exporting platform
specific functions. Albeit functional it feels pretty shoehorned. This
proposes an alternative way of handling the triggering of the xHCI chip
initialization trough means of a reset controller.

The benefits are pretty evident: less platform churn in core xHCI code,
and no explicit device dependency management in pcie-brcmstb.

Note that patch #1 depend on another series[1].

The series is based on next-20200605.

v1: https://lore.kernel.org/linux-usb/20200608192701.18355-1-nsaenzjulienne@suse.de/T/#t

[1] https://lwn.net/ml/linux-kernel/cover.662a8d401787ef33780d91252a352de91dc4be10.1590594293.git-series.maxime@cerno.tech/

---

Changes since v1:
 - Rework reset controller so it's less USB centric.
 - Use correct reset controller API in xhci-pci
 - Correct typos

Nicolas Saenz Julienne (9):
  dt-bindings: reset: Add a binding for the RPi Firmware reset
    controller
  reset: Add Raspberry Pi 4 firmware reset controller
  ARM: dts: bcm2711: Add firmware usb reset node
  ARM: dts: bcm2711: Add reset controller to xHCI node
  usb: xhci-pci: Add support for reset controllers
  Revert "USB: pci-quirks: Add Raspberry Pi 4 quirk"
  usb: host: pci-quirks: Bypass xHCI quirks for Raspberry Pi 4
  Revert "firmware: raspberrypi: Introduce vl805 init routine"
  Revert "PCI: brcmstb: Wait for Raspberry Pi's firmware when present"

 .../arm/bcm/raspberrypi,bcm2835-firmware.yaml |  21 +++
 arch/arm/boot/dts/bcm2711-rpi-4-b.dts         |  12 ++
 drivers/firmware/Kconfig                      |   3 +-
 drivers/firmware/raspberrypi.c                |  61 ---------
 drivers/pci/controller/pcie-brcmstb.c         |  17 ---
 drivers/reset/Kconfig                         |  11 ++
 drivers/reset/Makefile                        |   1 +
 drivers/reset/reset-raspberrypi.c             | 126 ++++++++++++++++++
 drivers/usb/host/pci-quirks.c                 |  22 ++-
 drivers/usb/host/xhci-pci.c                   |   7 +
 include/soc/bcm2835/raspberrypi-firmware.h    |   7 -
 11 files changed, 188 insertions(+), 100 deletions(-)
 create mode 100644 drivers/reset/reset-raspberrypi.c

-- 
2.26.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/9] dt-bindings: reset: Add a binding for the RPi Firmware reset controller
  2020-06-09 17:49 [PATCH v2 0/9] Raspberry Pi 4 USB firmware initialization rework Nicolas Saenz Julienne
@ 2020-06-09 17:49 ` Nicolas Saenz Julienne
  2020-06-09 18:07   ` Florian Fainelli
  2020-06-09 17:49 ` [PATCH v2 3/9] ARM: dts: bcm2711: Add firmware usb reset node Nicolas Saenz Julienne
  2020-06-09 17:49 ` [PATCH v2 4/9] ARM: dts: bcm2711: Add reset controller to xHCI node Nicolas Saenz Julienne
  2 siblings, 1 reply; 8+ messages in thread
From: Nicolas Saenz Julienne @ 2020-06-09 17:49 UTC (permalink / raw)
  To: f.fainelli, gregkh, wahrenst, p.zabel, linux-kernel, Ray Jui,
	Scott Branden, bcm-kernel-feedback-list, Nicolas Saenz Julienne,
	Eric Anholt
  Cc: linux-usb, linux-rpi-kernel, linux-arm-kernel, tim.gover,
	linux-pci, helgaas, andy.shevchenko, mathias.nyman,
	lorenzo.pieralisi, Rob Herring, devicetree

The firmware running on the RPi VideoCore can be used to reset and
initialize HW controlled by the firmware.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

---

Changes since v1:
 - Correct cells binding as per Florian's comment
 - Change compatible string to be more generic

 .../arm/bcm/raspberrypi,bcm2835-firmware.yaml | 21 +++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-firmware.yaml b/Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-firmware.yaml
index b48ed875eb8e..23a885af3a28 100644
--- a/Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-firmware.yaml
+++ b/Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-firmware.yaml
@@ -39,6 +39,22 @@ properties:
       - compatible
       - "#clock-cells"
 
+  reset:
+    type: object
+
+    properties:
+      compatible:
+        const: raspberrypi,firmware-reset
+
+      "#reset-cells":
+        const: 1
+        description: >
+          The argument is the ID of the firmware reset line to affect.
+
+    required:
+      - compatible
+      - "#reset-cells"
+
     additionalProperties: false
 
 required:
@@ -55,5 +71,10 @@ examples:
             compatible = "raspberrypi,firmware-clocks";
             #clock-cells = <1>;
         };
+
+        reset: reset {
+            compatible = "raspberrypi,firmware-reset";
+            #reset-cells = <1>;
+        };
     };
 ...
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 3/9] ARM: dts: bcm2711: Add firmware usb reset node
  2020-06-09 17:49 [PATCH v2 0/9] Raspberry Pi 4 USB firmware initialization rework Nicolas Saenz Julienne
  2020-06-09 17:49 ` [PATCH v2 1/9] dt-bindings: reset: Add a binding for the RPi Firmware reset controller Nicolas Saenz Julienne
@ 2020-06-09 17:49 ` Nicolas Saenz Julienne
  2020-06-09 18:16   ` Florian Fainelli
  2020-06-09 17:49 ` [PATCH v2 4/9] ARM: dts: bcm2711: Add reset controller to xHCI node Nicolas Saenz Julienne
  2 siblings, 1 reply; 8+ messages in thread
From: Nicolas Saenz Julienne @ 2020-06-09 17:49 UTC (permalink / raw)
  To: f.fainelli, gregkh, wahrenst, p.zabel, linux-kernel, Rob Herring,
	Nicolas Saenz Julienne
  Cc: linux-usb, linux-rpi-kernel, linux-arm-kernel,
	bcm-kernel-feedback-list, tim.gover, linux-pci, helgaas,
	andy.shevchenko, mathias.nyman, lorenzo.pieralisi, devicetree

Now that the reset driver exposing Raspberry Pi 4's firmware based USB
reset routine is available, let's add the device tree node exposing it.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

---

Changes since v1:
 - Update cell nr to match new bindings

 arch/arm/boot/dts/bcm2711-rpi-4-b.dts | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
index c7f1d97e69bb..0cef95058fb0 100644
--- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
+++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
@@ -83,6 +83,11 @@ expgpio: gpio {
 				  "";
 		status = "okay";
 	};
+
+	reset: reset {
+		compatible = "raspberrypi,firmware-reset";
+		#reset-cells = <1>;
+	};
 };
 
 &gpio {
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 4/9] ARM: dts: bcm2711: Add reset controller to xHCI node
  2020-06-09 17:49 [PATCH v2 0/9] Raspberry Pi 4 USB firmware initialization rework Nicolas Saenz Julienne
  2020-06-09 17:49 ` [PATCH v2 1/9] dt-bindings: reset: Add a binding for the RPi Firmware reset controller Nicolas Saenz Julienne
  2020-06-09 17:49 ` [PATCH v2 3/9] ARM: dts: bcm2711: Add firmware usb reset node Nicolas Saenz Julienne
@ 2020-06-09 17:49 ` Nicolas Saenz Julienne
  2020-06-09 18:16   ` Florian Fainelli
  2 siblings, 1 reply; 8+ messages in thread
From: Nicolas Saenz Julienne @ 2020-06-09 17:49 UTC (permalink / raw)
  To: f.fainelli, gregkh, wahrenst, p.zabel, linux-kernel, Rob Herring,
	Nicolas Saenz Julienne
  Cc: linux-usb, linux-rpi-kernel, linux-arm-kernel,
	bcm-kernel-feedback-list, tim.gover, linux-pci, helgaas,
	andy.shevchenko, mathias.nyman, lorenzo.pieralisi, devicetree

The chip is hardwired to the board's PCIe bus and needs to be properly
setup trough a firmware routine after a PCI fundamental reset. Pass the
reset controller phandle that takes care of triggering the
initialization to the relevant PCI device.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

---

Changes since v1:
 - Update to match new binding

 arch/arm/boot/dts/bcm2711-rpi-4-b.dts | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
index 0cef95058fb0..e74ca0c86137 100644
--- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
+++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
@@ -207,6 +207,13 @@ phy1: ethernet-phy@1 {
 	};
 };
 
+&pcie0 {
+	usb@1,0 {
+		reg = <0 0 0 0 0>;
+		resets = <&reset 0>;
+	};
+};
+
 /* uart0 communicates with the BT module */
 &uart0 {
 	pinctrl-names = "default";
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 1/9] dt-bindings: reset: Add a binding for the RPi Firmware reset controller
  2020-06-09 17:49 ` [PATCH v2 1/9] dt-bindings: reset: Add a binding for the RPi Firmware reset controller Nicolas Saenz Julienne
@ 2020-06-09 18:07   ` Florian Fainelli
  2020-06-10 15:37     ` Nicolas Saenz Julienne
  0 siblings, 1 reply; 8+ messages in thread
From: Florian Fainelli @ 2020-06-09 18:07 UTC (permalink / raw)
  To: Nicolas Saenz Julienne, gregkh, wahrenst, p.zabel, linux-kernel,
	Ray Jui, Scott Branden, bcm-kernel-feedback-list, Eric Anholt
  Cc: linux-usb, linux-rpi-kernel, linux-arm-kernel, tim.gover,
	linux-pci, helgaas, andy.shevchenko, mathias.nyman,
	lorenzo.pieralisi, Rob Herring, devicetree



On 6/9/2020 10:49 AM, Nicolas Saenz Julienne wrote:
> The firmware running on the RPi VideoCore can be used to reset and
> initialize HW controlled by the firmware.
> 
> Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
> 
> ---
> 
> Changes since v1:
>  - Correct cells binding as per Florian's comment
>  - Change compatible string to be more generic
> 
>  .../arm/bcm/raspberrypi,bcm2835-firmware.yaml | 21 +++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-firmware.yaml b/Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-firmware.yaml
> index b48ed875eb8e..23a885af3a28 100644
> --- a/Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-firmware.yaml
> +++ b/Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-firmware.yaml
> @@ -39,6 +39,22 @@ properties:
>        - compatible
>        - "#clock-cells"
>  
> +  reset:
> +    type: object
> +
> +    properties:
> +      compatible:
> +        const: raspberrypi,firmware-reset
> +
> +      "#reset-cells":
> +        const: 1
> +        description: >

Is this a stray '>' character? If so, with that fixed:

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 4/9] ARM: dts: bcm2711: Add reset controller to xHCI node
  2020-06-09 17:49 ` [PATCH v2 4/9] ARM: dts: bcm2711: Add reset controller to xHCI node Nicolas Saenz Julienne
@ 2020-06-09 18:16   ` Florian Fainelli
  0 siblings, 0 replies; 8+ messages in thread
From: Florian Fainelli @ 2020-06-09 18:16 UTC (permalink / raw)
  To: Nicolas Saenz Julienne, f.fainelli, gregkh, wahrenst, p.zabel,
	linux-kernel, Rob Herring
  Cc: linux-usb, linux-rpi-kernel, linux-arm-kernel,
	bcm-kernel-feedback-list, tim.gover, linux-pci, helgaas,
	andy.shevchenko, mathias.nyman, lorenzo.pieralisi, devicetree



On 6/9/2020 10:49 AM, Nicolas Saenz Julienne wrote:
> The chip is hardwired to the board's PCIe bus and needs to be properly
> setup trough a firmware routine after a PCI fundamental reset. Pass the
> reset controller phandle that takes care of triggering the
> initialization to the relevant PCI device.
> 
> Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

With the comment from patch #2 to move the reset identifiers to a shared
header that can be referenced by this file:

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 3/9] ARM: dts: bcm2711: Add firmware usb reset node
  2020-06-09 17:49 ` [PATCH v2 3/9] ARM: dts: bcm2711: Add firmware usb reset node Nicolas Saenz Julienne
@ 2020-06-09 18:16   ` Florian Fainelli
  0 siblings, 0 replies; 8+ messages in thread
From: Florian Fainelli @ 2020-06-09 18:16 UTC (permalink / raw)
  To: Nicolas Saenz Julienne, f.fainelli, gregkh, wahrenst, p.zabel,
	linux-kernel, Rob Herring
  Cc: linux-usb, linux-rpi-kernel, linux-arm-kernel,
	bcm-kernel-feedback-list, tim.gover, linux-pci, helgaas,
	andy.shevchenko, mathias.nyman, lorenzo.pieralisi, devicetree



On 6/9/2020 10:49 AM, Nicolas Saenz Julienne wrote:
> Now that the reset driver exposing Raspberry Pi 4's firmware based USB
> reset routine is available, let's add the device tree node exposing it.
> 
> Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 1/9] dt-bindings: reset: Add a binding for the RPi Firmware reset controller
  2020-06-09 18:07   ` Florian Fainelli
@ 2020-06-10 15:37     ` Nicolas Saenz Julienne
  0 siblings, 0 replies; 8+ messages in thread
From: Nicolas Saenz Julienne @ 2020-06-10 15:37 UTC (permalink / raw)
  To: Florian Fainelli, gregkh, wahrenst, p.zabel, linux-kernel,
	Ray Jui, Scott Branden, bcm-kernel-feedback-list, Eric Anholt
  Cc: linux-usb, linux-rpi-kernel, linux-arm-kernel, tim.gover,
	linux-pci, helgaas, andy.shevchenko, mathias.nyman,
	lorenzo.pieralisi, Rob Herring, devicetree

[-- Attachment #1: Type: text/plain, Size: 1604 bytes --]

Hi Florian, thanks for the review :)

On Tue, 2020-06-09 at 11:07 -0700, Florian Fainelli wrote:
> 
> On 6/9/2020 10:49 AM, Nicolas Saenz Julienne wrote:
> > The firmware running on the RPi VideoCore can be used to reset and
> > initialize HW controlled by the firmware.
> > 
> > Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
> > 
> > ---
> > 
> > Changes since v1:
> >  - Correct cells binding as per Florian's comment
> >  - Change compatible string to be more generic
> > 
> >  .../arm/bcm/raspberrypi,bcm2835-firmware.yaml | 21 +++++++++++++++++++
> >  1 file changed, 21 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-
> > firmware.yaml
> > b/Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-
> > firmware.yaml
> > index b48ed875eb8e..23a885af3a28 100644
> > --- a/Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-
> > firmware.yaml
> > +++ b/Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-
> > firmware.yaml
> > @@ -39,6 +39,22 @@ properties:
> >        - compatible
> >        - "#clock-cells"
> >  
> > +  reset:
> > +    type: object
> > +
> > +    properties:
> > +      compatible:
> > +        const: raspberrypi,firmware-reset
> > +
> > +      "#reset-cells":
> > +        const: 1
> > +        description: >
> 
> Is this a stray '>' character? If so, with that fixed:

No, it marks the formatting of the text below. | will keep the formatting as
is, > will leave the formatting to whatever is going to use it.

Regards,
Nicolas


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-06-10 15:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-09 17:49 [PATCH v2 0/9] Raspberry Pi 4 USB firmware initialization rework Nicolas Saenz Julienne
2020-06-09 17:49 ` [PATCH v2 1/9] dt-bindings: reset: Add a binding for the RPi Firmware reset controller Nicolas Saenz Julienne
2020-06-09 18:07   ` Florian Fainelli
2020-06-10 15:37     ` Nicolas Saenz Julienne
2020-06-09 17:49 ` [PATCH v2 3/9] ARM: dts: bcm2711: Add firmware usb reset node Nicolas Saenz Julienne
2020-06-09 18:16   ` Florian Fainelli
2020-06-09 17:49 ` [PATCH v2 4/9] ARM: dts: bcm2711: Add reset controller to xHCI node Nicolas Saenz Julienne
2020-06-09 18:16   ` Florian Fainelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).