Message ID | 20200609175003.19793-6-nsaenzjulienne@suse.de (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Raspberry Pi 4 USB firmware initialization rework | expand |
On 6/9/2020 10:49 AM, Nicolas Saenz Julienne wrote: > Some atypical users of xhci-pci might need to manually reset their xHCI > controller before starting the HCD setup. Check if a reset controller > device is available to the PCI bus and trigger a reset. > > Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> > > --- > > Changes since v1: > - Use proper reset API > - Make code simpler > > drivers/usb/host/xhci-pci.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c > index ef513c2fb843..6e96affa4ceb 100644 > --- a/drivers/usb/host/xhci-pci.c > +++ b/drivers/usb/host/xhci-pci.c > @@ -12,6 +12,7 @@ > #include <linux/slab.h> > #include <linux/module.h> > #include <linux/acpi.h> > +#include <linux/reset.h> > > #include "xhci.h" > #include "xhci-trace.h" > @@ -339,6 +340,7 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) > struct xhci_hcd *xhci; > struct usb_hcd *hcd; > struct xhci_driver_data *driver_data; > + struct reset_control *reset; > > driver_data = (struct xhci_driver_data *)id->driver_data; > if (driver_data && driver_data->quirks & XHCI_RENESAS_FW_QUIRK) { > @@ -347,6 +349,11 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) > return retval; > } > > + reset = devm_reset_control_get_optional_exclusive(&dev->bus->dev, NULL); > + if (IS_ERR(reset)) > + return PTR_ERR(reset); > + reset_control_reset(reset); Sorry for not catching this earlier, since this is a generic integration with the reset controller API, should not you also add a reset_control_reset() to hcd_pci_resume() for symmetry? > + > /* Prevent runtime suspending between USB-2 and USB-3 initialization */ > pm_runtime_get_noresume(&dev->dev); > >
Hi Florian, On Tue, 2020-06-09 at 11:13 -0700, Florian Fainelli wrote: > > On 6/9/2020 10:49 AM, Nicolas Saenz Julienne wrote: > > Some atypical users of xhci-pci might need to manually reset their xHCI > > controller before starting the HCD setup. Check if a reset controller > > device is available to the PCI bus and trigger a reset. > > > > Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> > > > > --- > > > > Changes since v1: > > - Use proper reset API > > - Make code simpler > > > > drivers/usb/host/xhci-pci.c | 7 +++++++ > > 1 file changed, 7 insertions(+) > > > > diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c > > index ef513c2fb843..6e96affa4ceb 100644 > > --- a/drivers/usb/host/xhci-pci.c > > +++ b/drivers/usb/host/xhci-pci.c > > @@ -12,6 +12,7 @@ > > #include <linux/slab.h> > > #include <linux/module.h> > > #include <linux/acpi.h> > > +#include <linux/reset.h> > > > > #include "xhci.h" > > #include "xhci-trace.h" > > @@ -339,6 +340,7 @@ static int xhci_pci_probe(struct pci_dev *dev, const > > struct pci_device_id *id) > > struct xhci_hcd *xhci; > > struct usb_hcd *hcd; > > struct xhci_driver_data *driver_data; > > + struct reset_control *reset; > > > > driver_data = (struct xhci_driver_data *)id->driver_data; > > if (driver_data && driver_data->quirks & XHCI_RENESAS_FW_QUIRK) { > > @@ -347,6 +349,11 @@ static int xhci_pci_probe(struct pci_dev *dev, const > > struct pci_device_id *id) > > return retval; > > } > > > > + reset = devm_reset_control_get_optional_exclusive(&dev->bus->dev, NULL); > > + if (IS_ERR(reset)) > > + return PTR_ERR(reset); > > + reset_control_reset(reset); > > Sorry for not catching this earlier, since this is a generic integration > with the reset controller API, should not you also add a > reset_control_reset() to hcd_pci_resume() for symmetry? Agreed, if the RPi4 supported suspend/resume, which AFAIK doesn't, an extra reset would be needed as pcie-brcmstb performs a fundamental reset on resume forcing us to reinitialize vl805. Thanks! Nicolas
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index ef513c2fb843..6e96affa4ceb 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -12,6 +12,7 @@ #include <linux/slab.h> #include <linux/module.h> #include <linux/acpi.h> +#include <linux/reset.h> #include "xhci.h" #include "xhci-trace.h" @@ -339,6 +340,7 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) struct xhci_hcd *xhci; struct usb_hcd *hcd; struct xhci_driver_data *driver_data; + struct reset_control *reset; driver_data = (struct xhci_driver_data *)id->driver_data; if (driver_data && driver_data->quirks & XHCI_RENESAS_FW_QUIRK) { @@ -347,6 +349,11 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) return retval; } + reset = devm_reset_control_get_optional_exclusive(&dev->bus->dev, NULL); + if (IS_ERR(reset)) + return PTR_ERR(reset); + reset_control_reset(reset); + /* Prevent runtime suspending between USB-2 and USB-3 initialization */ pm_runtime_get_noresume(&dev->dev);
Some atypical users of xhci-pci might need to manually reset their xHCI controller before starting the HCD setup. Check if a reset controller device is available to the PCI bus and trigger a reset. Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> --- Changes since v1: - Use proper reset API - Make code simpler drivers/usb/host/xhci-pci.c | 7 +++++++ 1 file changed, 7 insertions(+)