* [PATCH v3 0/9] Raspberry Pi 4 USB firmware initialization rework
@ 2020-06-12 17:13 Nicolas Saenz Julienne
2020-06-12 17:13 ` [PATCH v3 1/9] dt-bindings: reset: Add a binding for the RPi Firmware reset controller Nicolas Saenz Julienne
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Nicolas Saenz Julienne @ 2020-06-12 17:13 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 depends on another series[1].
The series is based on next-20200611
v2: https://lkml.org/lkml/2020/6/9/875
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 v2:
- Add reset to resume routine in xhci-pci
- Correct of refcount in pci-quirks
- Correct typos
- Use include file to define firmware reset IDs
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 | 14 ++
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 | 122 ++++++++++++++++++
drivers/usb/host/pci-quirks.c | 22 ++--
drivers/usb/host/xhci-pci.c | 10 ++
drivers/usb/host/xhci.h | 2 +
.../reset/raspberrypi,firmware-reset.h | 13 ++
include/soc/bcm2835/raspberrypi-firmware.h | 7 -
13 files changed, 207 insertions(+), 97 deletions(-)
create mode 100644 drivers/reset/reset-raspberrypi.c
create mode 100644 include/dt-bindings/reset/raspberrypi,firmware-reset.h
--
2.26.2
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH v3 1/9] dt-bindings: reset: Add a binding for the RPi Firmware reset controller 2020-06-12 17:13 [PATCH v3 0/9] Raspberry Pi 4 USB firmware initialization rework Nicolas Saenz Julienne @ 2020-06-12 17:13 ` Nicolas Saenz Julienne 2020-06-17 9:55 ` Philipp Zabel 2020-07-13 18:23 ` Rob Herring 2020-06-12 17:13 ` [PATCH v3 3/9] ARM: dts: bcm2711: Add firmware usb reset node Nicolas Saenz Julienne 2020-06-12 17:13 ` [PATCH v3 4/9] ARM: dts: bcm2711: Add reset controller to xHCI node Nicolas Saenz Julienne 2 siblings, 2 replies; 12+ messages in thread From: Nicolas Saenz Julienne @ 2020-06-12 17:13 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> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> --- Changes since v2: - Add include file for reset IDs 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 +++++++++++++++++++ .../reset/raspberrypi,firmware-reset.h | 13 ++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 include/dt-bindings/reset/raspberrypi,firmware-reset.h 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>; + }; }; ... diff --git a/include/dt-bindings/reset/raspberrypi,firmware-reset.h b/include/dt-bindings/reset/raspberrypi,firmware-reset.h new file mode 100644 index 000000000000..1a4f4c792723 --- /dev/null +++ b/include/dt-bindings/reset/raspberrypi,firmware-reset.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2020 Nicolas Saenz Julienne + * Author: Nicolas Saenz Julienne <nsaenzjulienne@suse.com> + */ + +#ifndef _DT_BINDINGS_RASPBERRYPI_FIRMWARE_RESET_H +#define _DT_BINDINGS_RASPBERRYPI_FIRMWARE_RESET_H + +#define RASPBERRYPI_FIRMWARE_RESET_ID_USB 0 +#define RASPBERRYPI_FIRMWARE_RESET_NUM_IDS 1 + +#endif -- 2.26.2 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/9] dt-bindings: reset: Add a binding for the RPi Firmware reset controller 2020-06-12 17:13 ` [PATCH v3 1/9] dt-bindings: reset: Add a binding for the RPi Firmware reset controller Nicolas Saenz Julienne @ 2020-06-17 9:55 ` Philipp Zabel 2020-06-17 10:22 ` Nicolas Saenz Julienne 2020-07-13 18:23 ` Rob Herring 1 sibling, 1 reply; 12+ messages in thread From: Philipp Zabel @ 2020-06-17 9:55 UTC (permalink / raw) To: Nicolas Saenz Julienne, f.fainelli, gregkh, wahrenst, 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 Hi Nicolas, On Fri, 2020-06-12 at 19:13 +0200, 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> > Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> > > --- > Changes since v2: > - Add include file for reset IDs > > 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 +++++++++++++++++++ > .../reset/raspberrypi,firmware-reset.h | 13 ++++++++++++ > 2 files changed, 34 insertions(+) > create mode 100644 include/dt-bindings/reset/raspberrypi,firmware-reset.h > > 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>; > + }; > }; > ... > diff --git a/include/dt-bindings/reset/raspberrypi,firmware-reset.h b/include/dt-bindings/reset/raspberrypi,firmware-reset.h > new file mode 100644 > index 000000000000..1a4f4c792723 > --- /dev/null > +++ b/include/dt-bindings/reset/raspberrypi,firmware-reset.h > @@ -0,0 +1,13 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +/* > + * Copyright (c) 2020 Nicolas Saenz Julienne > + * Author: Nicolas Saenz Julienne <nsaenzjulienne@suse.com> > + */ > + > +#ifndef _DT_BINDINGS_RASPBERRYPI_FIRMWARE_RESET_H > +#define _DT_BINDINGS_RASPBERRYPI_FIRMWARE_RESET_H > + > +#define RASPBERRYPI_FIRMWARE_RESET_ID_USB 0 > +#define RASPBERRYPI_FIRMWARE_RESET_NUM_IDS 1 > + > +#endif Are there going to be any more firmware controlled resets in the future? regards Philipp ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/9] dt-bindings: reset: Add a binding for the RPi Firmware reset controller 2020-06-17 9:55 ` Philipp Zabel @ 2020-06-17 10:22 ` Nicolas Saenz Julienne 0 siblings, 0 replies; 12+ messages in thread From: Nicolas Saenz Julienne @ 2020-06-17 10:22 UTC (permalink / raw) To: Philipp Zabel, f.fainelli, gregkh, wahrenst, 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: 3259 bytes --] Hi, On Wed, 2020-06-17 at 11:55 +0200, Philipp Zabel wrote: > Hi Nicolas, > > On Fri, 2020-06-12 at 19:13 +0200, 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> > > Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> > > > > --- > > Changes since v2: > > - Add include file for reset IDs > > > > 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 +++++++++++++++++++ > > .../reset/raspberrypi,firmware-reset.h | 13 ++++++++++++ > > 2 files changed, 34 insertions(+) > > create mode 100644 include/dt-bindings/reset/raspberrypi,firmware-reset.h > > > > 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>; > > + }; > > }; > > ... > > diff --git a/include/dt-bindings/reset/raspberrypi,firmware-reset.h > > b/include/dt-bindings/reset/raspberrypi,firmware-reset.h > > new file mode 100644 > > index 000000000000..1a4f4c792723 > > --- /dev/null > > +++ b/include/dt-bindings/reset/raspberrypi,firmware-reset.h > > @@ -0,0 +1,13 @@ > > +/* SPDX-License-Identifier: GPL-2.0 */ > > +/* > > + * Copyright (c) 2020 Nicolas Saenz Julienne > > + * Author: Nicolas Saenz Julienne <nsaenzjulienne@suse.com> > > + */ > > + > > +#ifndef _DT_BINDINGS_RASPBERRYPI_FIRMWARE_RESET_H > > +#define _DT_BINDINGS_RASPBERRYPI_FIRMWARE_RESET_H > > + > > +#define RASPBERRYPI_FIRMWARE_RESET_ID_USB 0 > > +#define RASPBERRYPI_FIRMWARE_RESET_NUM_IDS 1 > > + > > +#endif > > Are there going to be any more firmware controlled resets in the future? There are not right now, but it's likely some will show up in the future. I have some contenders in mind, which I'll request once we settle on a design here, but it ultimately depends on what the RPi people decide to implement. Regards, Nicolas [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/9] dt-bindings: reset: Add a binding for the RPi Firmware reset controller 2020-06-12 17:13 ` [PATCH v3 1/9] dt-bindings: reset: Add a binding for the RPi Firmware reset controller Nicolas Saenz Julienne 2020-06-17 9:55 ` Philipp Zabel @ 2020-07-13 18:23 ` Rob Herring 2020-07-14 11:59 ` Nicolas Saenz Julienne 1 sibling, 1 reply; 12+ messages in thread From: Rob Herring @ 2020-07-13 18:23 UTC (permalink / raw) To: Nicolas Saenz Julienne Cc: f.fainelli, gregkh, wahrenst, p.zabel, linux-kernel, Ray Jui, Scott Branden, bcm-kernel-feedback-list, Eric Anholt, linux-usb, linux-rpi-kernel, linux-arm-kernel, tim.gover, linux-pci, helgaas, andy.shevchenko, mathias.nyman, lorenzo.pieralisi, devicetree On Fri, Jun 12, 2020 at 07:13:25PM +0200, 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> > Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> > > --- > Changes since v2: > - Add include file for reset IDs > > 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 +++++++++++++++++++ > .../reset/raspberrypi,firmware-reset.h | 13 ++++++++++++ > 2 files changed, 34 insertions(+) > create mode 100644 include/dt-bindings/reset/raspberrypi,firmware-reset.h > > 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: I'm not really thrilled how this is evolving with a node per provider. There's no reason you can't just add #clock-cells and #reset-cells to the parent firmware node. I probably should have complained with the clocks node, but that's only pending for 5.9. The bigger issue is this stuff is just trickling in one bit at a time which gives no context for review. What's next? Is it really a mystery as to what functions the firmware provides? You don't have to have a driver in place for every function. Rob ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/9] dt-bindings: reset: Add a binding for the RPi Firmware reset controller 2020-07-13 18:23 ` Rob Herring @ 2020-07-14 11:59 ` Nicolas Saenz Julienne 2020-07-14 21:07 ` Rob Herring 0 siblings, 1 reply; 12+ messages in thread From: Nicolas Saenz Julienne @ 2020-07-14 11:59 UTC (permalink / raw) To: Rob Herring Cc: f.fainelli, gregkh, wahrenst, p.zabel, linux-kernel, Ray Jui, Scott Branden, bcm-kernel-feedback-list, Eric Anholt, linux-usb, linux-rpi-kernel, linux-arm-kernel, tim.gover, linux-pci, helgaas, andy.shevchenko, mathias.nyman, lorenzo.pieralisi, devicetree [-- Attachment #1: Type: text/plain, Size: 3035 bytes --] On Mon, 2020-07-13 at 12:23 -0600, Rob Herring wrote: > On Fri, Jun 12, 2020 at 07:13:25PM +0200, 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> > > Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> > > > > --- > > Changes since v2: > > - Add include file for reset IDs > > > > 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 +++++++++++++++++++ > > .../reset/raspberrypi,firmware-reset.h | 13 ++++++++++++ > > 2 files changed, 34 insertions(+) > > create mode 100644 include/dt-bindings/reset/raspberrypi,firmware-reset.h > > > > 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: > > I'm not really thrilled how this is evolving with a node per provider. > There's no reason you can't just add #clock-cells and #reset-cells to > the parent firmware node. What are the downsides? The way I see it there is not much difference. And this way of handling things is feels more intuitive and flexible (overlays can control what to enable easily, we can take advantage of the platform device core). > I probably should have complained with the clocks node, but that's only > pending for 5.9. Note that there are more users for this pattern: "raspberrypi,firmware-ts" and "raspberrypi,firmware-gpio". Actually you were the one to originally propose this it[1]. :P There already is a fair amount of churn in these drivers because of all the DT changes we did in the past, and if we need to change how we integrate these again, I'd really like it to be for good. > The bigger issue is this stuff is just trickling in one bit at a time > which gives no context for review. What's next? Is it really a mystery > as to what functions the firmware provides? We have no control over it, RPi engineers integrate new designs and new firmware interfaces show up. This is a good example of it. I proposed them to use SCMI as it covers most of what they are already providing here. But no luck so far. > You don't have to have a driver in place for every function. I see your point, it could be more monolithic, that said, having a driver is essential. See the reverts I managed to pull off at the end of the series. [1] https://patchwork.kernel.org/patch/10166783/#21421571 [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/9] dt-bindings: reset: Add a binding for the RPi Firmware reset controller 2020-07-14 11:59 ` Nicolas Saenz Julienne @ 2020-07-14 21:07 ` Rob Herring 2020-07-14 21:17 ` Florian Fainelli 0 siblings, 1 reply; 12+ messages in thread From: Rob Herring @ 2020-07-14 21:07 UTC (permalink / raw) To: Nicolas Saenz Julienne Cc: f.fainelli, gregkh, wahrenst, p.zabel, linux-kernel, Ray Jui, Scott Branden, bcm-kernel-feedback-list, Eric Anholt, linux-usb, linux-rpi-kernel, linux-arm-kernel, tim.gover, linux-pci, helgaas, andy.shevchenko, mathias.nyman, lorenzo.pieralisi, devicetree On Tue, Jul 14, 2020 at 01:59:21PM +0200, Nicolas Saenz Julienne wrote: > On Mon, 2020-07-13 at 12:23 -0600, Rob Herring wrote: > > On Fri, Jun 12, 2020 at 07:13:25PM +0200, 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> > > > Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> > > > > > > --- > > > Changes since v2: > > > - Add include file for reset IDs > > > > > > 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 +++++++++++++++++++ > > > .../reset/raspberrypi,firmware-reset.h | 13 ++++++++++++ > > > 2 files changed, 34 insertions(+) > > > create mode 100644 include/dt-bindings/reset/raspberrypi,firmware-reset.h > > > > > > 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: > > > > I'm not really thrilled how this is evolving with a node per provider. > > There's no reason you can't just add #clock-cells and #reset-cells to > > the parent firmware node. > > What are the downsides? The way I see it there is not much difference. And this > way of handling things is feels more intuitive and flexible (overlays can > control what to enable easily, we can take advantage of the platform device > core). What the OS wants can evolve, so designing around the current needs of the OS is not how bindings should be done. Using overlays to add clocks or resets wouldn't really work given they are spread out over the tree. And with clocks in particular, you'd have to replace dummy fixed clocks with actual firmware clocks. Sounds fragile and messy... > > I probably should have complained with the clocks node, but that's only > > pending for 5.9. > > Note that there are more users for this pattern: "raspberrypi,firmware-ts" and > "raspberrypi,firmware-gpio". Actually you were the one to originally propose > this it[1]. :P Sigh, this is why I dislike incomplete examples... Based on that, Acked-by: Rob Herring <robh@kernel.org> And please get gpio and ts converted to schema and referenced here before the next time I look at this. > There already is a fair amount of churn in these drivers because of all the DT > changes we did in the past, and if we need to change how we integrate these > again, I'd really like it to be for good. > > > The bigger issue is this stuff is just trickling in one bit at a time > > which gives no context for review. What's next? Is it really a mystery > > as to what functions the firmware provides? > > We have no control over it, RPi engineers integrate new designs and new > firmware interfaces show up. This is a good example of it. > > I proposed them to use SCMI as it covers most of what they are already > providing here. But no luck so far. Once we get tired of supporting all the different firmware interfaces and the mess they become, we'll just have to start refusing custom ones. Worked for PSCI. > > You don't have to have a driver in place for every function. > > I see your point, it could be more monolithic, that said, having a driver is > essential. See the reverts I managed to pull off at the end of the series. > > [1] https://patchwork.kernel.org/patch/10166783/#21421571 > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/9] dt-bindings: reset: Add a binding for the RPi Firmware reset controller 2020-07-14 21:07 ` Rob Herring @ 2020-07-14 21:17 ` Florian Fainelli 2020-07-14 23:18 ` Rob Herring 0 siblings, 1 reply; 12+ messages in thread From: Florian Fainelli @ 2020-07-14 21:17 UTC (permalink / raw) To: Rob Herring, Nicolas Saenz Julienne Cc: f.fainelli, gregkh, wahrenst, p.zabel, linux-kernel, Ray Jui, Scott Branden, bcm-kernel-feedback-list, Eric Anholt, linux-usb, linux-rpi-kernel, linux-arm-kernel, tim.gover, linux-pci, helgaas, andy.shevchenko, mathias.nyman, lorenzo.pieralisi, devicetree On 7/14/2020 2:07 PM, Rob Herring wrote: > On Tue, Jul 14, 2020 at 01:59:21PM +0200, Nicolas Saenz Julienne wrote: >> On Mon, 2020-07-13 at 12:23 -0600, Rob Herring wrote: >>> On Fri, Jun 12, 2020 at 07:13:25PM +0200, 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> >>>> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> >>>> >>>> --- >>>> Changes since v2: >>>> - Add include file for reset IDs >>>> >>>> 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 +++++++++++++++++++ >>>> .../reset/raspberrypi,firmware-reset.h | 13 ++++++++++++ >>>> 2 files changed, 34 insertions(+) >>>> create mode 100644 include/dt-bindings/reset/raspberrypi,firmware-reset.h >>>> >>>> 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: >>> >>> I'm not really thrilled how this is evolving with a node per provider. >>> There's no reason you can't just add #clock-cells and #reset-cells to >>> the parent firmware node. >> >> What are the downsides? The way I see it there is not much difference. And this >> way of handling things is feels more intuitive and flexible (overlays can >> control what to enable easily, we can take advantage of the platform device >> core). > > What the OS wants can evolve, so designing around the current needs of > the OS is not how bindings should be done. > > Using overlays to add clocks or resets wouldn't really work given they > are spread out over the tree. And with clocks in particular, you'd have > to replace dummy fixed clocks with actual firmware clocks. Sounds > fragile and messy... > >>> I probably should have complained with the clocks node, but that's only >>> pending for 5.9. >> >> Note that there are more users for this pattern: "raspberrypi,firmware-ts" and >> "raspberrypi,firmware-gpio". Actually you were the one to originally propose >> this it[1]. :P > > Sigh, this is why I dislike incomplete examples... > > Based on that, > > Acked-by: Rob Herring <robh@kernel.org> > > And please get gpio and ts converted to schema and referenced here > before the next time I look at this. > >> There already is a fair amount of churn in these drivers because of all the DT >> changes we did in the past, and if we need to change how we integrate these >> again, I'd really like it to be for good. >> >>> The bigger issue is this stuff is just trickling in one bit at a time >>> which gives no context for review. What's next? Is it really a mystery >>> as to what functions the firmware provides? >> >> We have no control over it, RPi engineers integrate new designs and new >> firmware interfaces show up. This is a good example of it. >> >> I proposed them to use SCMI as it covers most of what they are already >> providing here. But no luck so far. > > Once we get tired of supporting all the different firmware interfaces > and the mess they become, we'll just have to start refusing custom ones. > Worked for PSCI. In this particular case, the Raspberry Pi Foundation VPU firmware should just implement SCMI and that would avoid having to write new client drivers for Linux, it is not clear to me why this has not been done yet. -- Florian ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/9] dt-bindings: reset: Add a binding for the RPi Firmware reset controller 2020-07-14 21:17 ` Florian Fainelli @ 2020-07-14 23:18 ` Rob Herring 0 siblings, 0 replies; 12+ messages in thread From: Rob Herring @ 2020-07-14 23:18 UTC (permalink / raw) To: Florian Fainelli Cc: Nicolas Saenz Julienne, Greg Kroah-Hartman, Stefan Wahren, Philipp Zabel, linux-kernel@vger.kernel.org, Ray Jui, Scott Branden, maintainer:BROADCOM BCM7XXX ARM ARCHITECTURE, Eric Anholt, Linux USB List, moderated list:BROADCOM BCM2835 ARM ARCHITECTURE, moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE, tim.gover, PCI, Bjorn Helgaas, Andy Shevchenko, Mathias Nyman, Lorenzo Pieralisi, devicetree On Tue, Jul 14, 2020 at 3:18 PM Florian Fainelli <f.fainelli@gmail.com> wrote: > > > > On 7/14/2020 2:07 PM, Rob Herring wrote: > > On Tue, Jul 14, 2020 at 01:59:21PM +0200, Nicolas Saenz Julienne wrote: > >> On Mon, 2020-07-13 at 12:23 -0600, Rob Herring wrote: > >>> On Fri, Jun 12, 2020 at 07:13:25PM +0200, 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> > >>>> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> > >>>> > >>>> --- > >>>> Changes since v2: > >>>> - Add include file for reset IDs > >>>> > >>>> 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 +++++++++++++++++++ > >>>> .../reset/raspberrypi,firmware-reset.h | 13 ++++++++++++ > >>>> 2 files changed, 34 insertions(+) > >>>> create mode 100644 include/dt-bindings/reset/raspberrypi,firmware-reset.h > >>>> > >>>> 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: > >>> > >>> I'm not really thrilled how this is evolving with a node per provider. > >>> There's no reason you can't just add #clock-cells and #reset-cells to > >>> the parent firmware node. > >> > >> What are the downsides? The way I see it there is not much difference. And this > >> way of handling things is feels more intuitive and flexible (overlays can > >> control what to enable easily, we can take advantage of the platform device > >> core). > > > > What the OS wants can evolve, so designing around the current needs of > > the OS is not how bindings should be done. > > > > Using overlays to add clocks or resets wouldn't really work given they > > are spread out over the tree. And with clocks in particular, you'd have > > to replace dummy fixed clocks with actual firmware clocks. Sounds > > fragile and messy... > > > >>> I probably should have complained with the clocks node, but that's only > >>> pending for 5.9. > >> > >> Note that there are more users for this pattern: "raspberrypi,firmware-ts" and > >> "raspberrypi,firmware-gpio". Actually you were the one to originally propose > >> this it[1]. :P > > > > Sigh, this is why I dislike incomplete examples... > > > > Based on that, > > > > Acked-by: Rob Herring <robh@kernel.org> > > > > And please get gpio and ts converted to schema and referenced here > > before the next time I look at this. > > > >> There already is a fair amount of churn in these drivers because of all the DT > >> changes we did in the past, and if we need to change how we integrate these > >> again, I'd really like it to be for good. > >> > >>> The bigger issue is this stuff is just trickling in one bit at a time > >>> which gives no context for review. What's next? Is it really a mystery > >>> as to what functions the firmware provides? > >> > >> We have no control over it, RPi engineers integrate new designs and new > >> firmware interfaces show up. This is a good example of it. > >> > >> I proposed them to use SCMI as it covers most of what they are already > >> providing here. But no luck so far. > > > > Once we get tired of supporting all the different firmware interfaces > > and the mess they become, we'll just have to start refusing custom ones. > > Worked for PSCI. > > In this particular case, the Raspberry Pi Foundation VPU firmware should > just implement SCMI and that would avoid having to write new client > drivers for Linux, it is not clear to me why this has not been done yet. Writing drivers is fun? Perhaps we should start refusing new firmware interfaces now. Rob ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v3 3/9] ARM: dts: bcm2711: Add firmware usb reset node 2020-06-12 17:13 [PATCH v3 0/9] Raspberry Pi 4 USB firmware initialization rework Nicolas Saenz Julienne 2020-06-12 17:13 ` [PATCH v3 1/9] dt-bindings: reset: Add a binding for the RPi Firmware reset controller Nicolas Saenz Julienne @ 2020-06-12 17:13 ` Nicolas Saenz Julienne 2020-06-12 17:13 ` [PATCH v3 4/9] ARM: dts: bcm2711: Add reset controller to xHCI node Nicolas Saenz Julienne 2 siblings, 0 replies; 12+ messages in thread From: Nicolas Saenz Julienne @ 2020-06-12 17:13 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> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> --- 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] 12+ messages in thread
* [PATCH v3 4/9] ARM: dts: bcm2711: Add reset controller to xHCI node 2020-06-12 17:13 [PATCH v3 0/9] Raspberry Pi 4 USB firmware initialization rework Nicolas Saenz Julienne 2020-06-12 17:13 ` [PATCH v3 1/9] dt-bindings: reset: Add a binding for the RPi Firmware reset controller Nicolas Saenz Julienne 2020-06-12 17:13 ` [PATCH v3 3/9] ARM: dts: bcm2711: Add firmware usb reset node Nicolas Saenz Julienne @ 2020-06-12 17:13 ` Nicolas Saenz Julienne 2020-06-17 19:21 ` Nicolas Saenz Julienne 2 siblings, 1 reply; 12+ messages in thread From: Nicolas Saenz Julienne @ 2020-06-12 17:13 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> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> --- Changes since v2: - Use dt-bindings to access IDs Changes since v1: - Update to match new binding arch/arm/boot/dts/bcm2711-rpi-4-b.dts | 9 +++++++++ 1 file changed, 9 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..e20979013414 100644 --- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts +++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts @@ -4,6 +4,8 @@ #include "bcm2835-rpi.dtsi" #include "bcm283x-rpi-usb-peripheral.dtsi" +#include <dt-bindings/reset/raspberrypi,firmware-reset.h> + / { compatible = "raspberrypi,4-model-b", "brcm,bcm2711"; model = "Raspberry Pi 4 Model B"; @@ -207,6 +209,13 @@ phy1: ethernet-phy@1 { }; }; +&pcie0 { + usb@1,0 { + reg = <0 0 0 0 0>; + resets = <&reset RASPBERRYPI_FIRMWARE_RESET_ID_USB>; + }; +}; + /* uart0 communicates with the BT module */ &uart0 { pinctrl-names = "default"; -- 2.26.2 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v3 4/9] ARM: dts: bcm2711: Add reset controller to xHCI node 2020-06-12 17:13 ` [PATCH v3 4/9] ARM: dts: bcm2711: Add reset controller to xHCI node Nicolas Saenz Julienne @ 2020-06-17 19:21 ` Nicolas Saenz Julienne 0 siblings, 0 replies; 12+ messages in thread From: Nicolas Saenz Julienne @ 2020-06-17 19:21 UTC (permalink / raw) To: f.fainelli, gregkh, linux-kernel, Rob Herring, Bjorn Helgaas Cc: linux-usb, linux-rpi-kernel, linux-arm-kernel, bcm-kernel-feedback-list, tim.gover, linux-pci, andy.shevchenko, mathias.nyman, lorenzo.pieralisi, devicetree, wahrenst, Philipp Zabel [-- Attachment #1: Type: text/plain, Size: 2093 bytes --] Hi All, On Fri, 2020-06-12 at 19:13 +0200, 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> > Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> > > --- > > Changes since v2: > - Use dt-bindings to access IDs > > Changes since v1: > - Update to match new binding > > arch/arm/boot/dts/bcm2711-rpi-4-b.dts | 9 +++++++++ > 1 file changed, 9 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..e20979013414 100644 > --- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts > +++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts > @@ -4,6 +4,8 @@ > #include "bcm2835-rpi.dtsi" > #include "bcm283x-rpi-usb-peripheral.dtsi" > > +#include <dt-bindings/reset/raspberrypi,firmware-reset.h> > + > / { > compatible = "raspberrypi,4-model-b", "brcm,bcm2711"; > model = "Raspberry Pi 4 Model B"; > @@ -207,6 +209,13 @@ phy1: ethernet-phy@1 { > }; > }; > > +&pcie0 { > + usb@1,0 { > + reg = <0 0 0 0 0>; > + resets = <&reset RASPBERRYPI_FIRMWARE_RESET_ID_USB>; > + }; > +}; > + I'm now double-guessing this is correct. With this lspci -tv output: [0000:00]---00.0-[01]----00.0 VIA Technologies, Inc. VL805 USB 3.0 Host Controller The DT patch should be more like this: +&pcie0 { + pci@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>; + }; + }; +}; Small details aside I'm pretty confident this is the way to go, but would appreciate some comments/validation. Regards, Nicolas [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2020-07-14 23:18 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-06-12 17:13 [PATCH v3 0/9] Raspberry Pi 4 USB firmware initialization rework Nicolas Saenz Julienne 2020-06-12 17:13 ` [PATCH v3 1/9] dt-bindings: reset: Add a binding for the RPi Firmware reset controller Nicolas Saenz Julienne 2020-06-17 9:55 ` Philipp Zabel 2020-06-17 10:22 ` Nicolas Saenz Julienne 2020-07-13 18:23 ` Rob Herring 2020-07-14 11:59 ` Nicolas Saenz Julienne 2020-07-14 21:07 ` Rob Herring 2020-07-14 21:17 ` Florian Fainelli 2020-07-14 23:18 ` Rob Herring 2020-06-12 17:13 ` [PATCH v3 3/9] ARM: dts: bcm2711: Add firmware usb reset node Nicolas Saenz Julienne 2020-06-12 17:13 ` [PATCH v3 4/9] ARM: dts: bcm2711: Add reset controller to xHCI node Nicolas Saenz Julienne 2020-06-17 19:21 ` Nicolas Saenz Julienne
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).