Message ID | 20200609175003.19793-1-nsaenzjulienne@suse.de (mailing list archive) |
---|---|
Headers | show |
Series | Raspberry Pi 4 USB firmware initialization rework | expand |
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>
On 6/9/2020 10:49 AM, Nicolas Saenz Julienne wrote: > Raspberry Pi 4's co-processor controls some of the board's HW > initialization process, but it's up to Linux to trigger it when > relevant. Introduce a reset controller capable of interfacing with > RPi4's co-processor that models these firmware initialization routines as > reset lines. > > Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> > > --- > > Changes since v1: > - Make the whole driver less USB centric as per Florian's comments > > drivers/reset/Kconfig | 11 +++ > drivers/reset/Makefile | 1 + > drivers/reset/reset-raspberrypi.c | 126 ++++++++++++++++++++++++++++++ > 3 files changed, 138 insertions(+) > create mode 100644 drivers/reset/reset-raspberrypi.c > > diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig > index d9efbfd29646..97e848740e13 100644 > --- a/drivers/reset/Kconfig > +++ b/drivers/reset/Kconfig > @@ -140,6 +140,17 @@ config RESET_QCOM_PDC > to control reset signals provided by PDC for Modem, Compute, > Display, GPU, Debug, AOP, Sensors, Audio, SP and APPS. > > +config RESET_RASPBERRYPI > + tristate "Raspberry Pi 4 Firmware Reset Driver" > + depends on RASPBERRYPI_FIRMWARE || (RASPBERRYPI_FIRMWARE=n && COMPILE_TEST) > + default USB_XHCI_PCI > + help > + Raspberry Pi 4's co-processor controls some of the board's HW > + initialization process, but it's up to Linux to trigger it when > + relevant. This driver provides a reset controller capable of > + interfacing with RPi4's co-processor and model these firmware > + initialization routines as reset lines. > + > config RESET_SCMI > tristate "Reset driver controlled via ARM SCMI interface" > depends on ARM_SCMI_PROTOCOL || COMPILE_TEST > diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile > index 249ed357c997..16947610cc3b 100644 > --- a/drivers/reset/Makefile > +++ b/drivers/reset/Makefile > @@ -21,6 +21,7 @@ obj-$(CONFIG_RESET_OXNAS) += reset-oxnas.o > obj-$(CONFIG_RESET_PISTACHIO) += reset-pistachio.o > obj-$(CONFIG_RESET_QCOM_AOSS) += reset-qcom-aoss.o > obj-$(CONFIG_RESET_QCOM_PDC) += reset-qcom-pdc.o > +obj-$(CONFIG_RESET_RASPBERRYPI) += reset-raspberrypi.o > obj-$(CONFIG_RESET_SCMI) += reset-scmi.o > obj-$(CONFIG_RESET_SIMPLE) += reset-simple.o > obj-$(CONFIG_RESET_STM32MP157) += reset-stm32mp1.o > diff --git a/drivers/reset/reset-raspberrypi.c b/drivers/reset/reset-raspberrypi.c > new file mode 100644 > index 000000000000..5fc8c6319a20 > --- /dev/null > +++ b/drivers/reset/reset-raspberrypi.c > @@ -0,0 +1,126 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Raspberry Pi 4 firmware reset driver > + * > + * Copyright (C) 2020 Nicolas Saenz Julienne <nsaenzjulienne@suse.de> > + */ > +#include <linux/delay.h> > +#include <linux/device.h> > +#include <linux/module.h> > +#include <linux/of.h> > +#include <linux/platform_device.h> > +#include <linux/reset-controller.h> > +#include <soc/bcm2835/raspberrypi-firmware.h> > + > +struct rpi_reset { > + struct reset_controller_dev rcdev; > + struct rpi_firmware *fw; > +}; > + > +enum rpi_reset_ids { > + RASPBERRYPI_FIRMWARE_RESET_ID_USB, You should probably move this to a header file under include/dt-bindings/reset/ in order to ensure that what gets referenced by the DTS is in sync with what the driver knows about. With that: Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
On 6/9/2020 10:49 AM, Nicolas Saenz Julienne wrote: > This reverts commit c65822fef4adc0ba40c37a47337376ce75f7a7bc. > > The initialization of Raspberry Pi 4's USB chip is now handled through a > reset controller. No need to directly call the firmware routine trough a > pci quirk. > > Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
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>
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
On Tue, 2020-06-09 at 11:14 -0700, Florian Fainelli wrote: > > On 6/9/2020 10:49 AM, Nicolas Saenz Julienne wrote: > > Raspberry Pi 4's co-processor controls some of the board's HW > > initialization process, but it's up to Linux to trigger it when > > relevant. Introduce a reset controller capable of interfacing with > > RPi4's co-processor that models these firmware initialization routines as > > reset lines. > > > > Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> > > > > --- > > > > Changes since v1: > > - Make the whole driver less USB centric as per Florian's comments > > > > drivers/reset/Kconfig | 11 +++ > > drivers/reset/Makefile | 1 + > > drivers/reset/reset-raspberrypi.c | 126 ++++++++++++++++++++++++++++++ > > 3 files changed, 138 insertions(+) > > create mode 100644 drivers/reset/reset-raspberrypi.c > > > > diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig > > index d9efbfd29646..97e848740e13 100644 > > --- a/drivers/reset/Kconfig > > +++ b/drivers/reset/Kconfig > > @@ -140,6 +140,17 @@ config RESET_QCOM_PDC > > to control reset signals provided by PDC for Modem, Compute, > > Display, GPU, Debug, AOP, Sensors, Audio, SP and APPS. > > > > +config RESET_RASPBERRYPI > > + tristate "Raspberry Pi 4 Firmware Reset Driver" > > + depends on RASPBERRYPI_FIRMWARE || (RASPBERRYPI_FIRMWARE=n && > > COMPILE_TEST) > > + default USB_XHCI_PCI > > + help > > + Raspberry Pi 4's co-processor controls some of the board's HW > > + initialization process, but it's up to Linux to trigger it when > > + relevant. This driver provides a reset controller capable of > > + interfacing with RPi4's co-processor and model these firmware > > + initialization routines as reset lines. > > + > > config RESET_SCMI > > tristate "Reset driver controlled via ARM SCMI interface" > > depends on ARM_SCMI_PROTOCOL || COMPILE_TEST > > diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile > > index 249ed357c997..16947610cc3b 100644 > > --- a/drivers/reset/Makefile > > +++ b/drivers/reset/Makefile > > @@ -21,6 +21,7 @@ obj-$(CONFIG_RESET_OXNAS) += reset-oxnas.o > > obj-$(CONFIG_RESET_PISTACHIO) += reset-pistachio.o > > obj-$(CONFIG_RESET_QCOM_AOSS) += reset-qcom-aoss.o > > obj-$(CONFIG_RESET_QCOM_PDC) += reset-qcom-pdc.o > > +obj-$(CONFIG_RESET_RASPBERRYPI) += reset-raspberrypi.o > > obj-$(CONFIG_RESET_SCMI) += reset-scmi.o > > obj-$(CONFIG_RESET_SIMPLE) += reset-simple.o > > obj-$(CONFIG_RESET_STM32MP157) += reset-stm32mp1.o > > diff --git a/drivers/reset/reset-raspberrypi.c b/drivers/reset/reset- > > raspberrypi.c > > new file mode 100644 > > index 000000000000..5fc8c6319a20 > > --- /dev/null > > +++ b/drivers/reset/reset-raspberrypi.c > > @@ -0,0 +1,126 @@ > > +// SPDX-License-Identifier: GPL-2.0 > > +/* > > + * Raspberry Pi 4 firmware reset driver > > + * > > + * Copyright (C) 2020 Nicolas Saenz Julienne <nsaenzjulienne@suse.de> > > + */ > > +#include <linux/delay.h> > > +#include <linux/device.h> > > +#include <linux/module.h> > > +#include <linux/of.h> > > +#include <linux/platform_device.h> > > +#include <linux/reset-controller.h> > > +#include <soc/bcm2835/raspberrypi-firmware.h> > > + > > +struct rpi_reset { > > + struct reset_controller_dev rcdev; > > + struct rpi_firmware *fw; > > +}; > > + > > +enum rpi_reset_ids { > > + RASPBERRYPI_FIRMWARE_RESET_ID_USB, > > You should probably move this to a header file under > include/dt-bindings/reset/ in order to ensure that what gets referenced > by the DTS is in sync with what the driver knows about. > > With that: > > Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Thanks! Will fix that on v3. Regards, Nicolas