Re: [PATCH 16/17] usb: isp1760: Implement driver shutdown operations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 06, 2014 at 06:55:04PM +0300, Laurent Pinchart wrote:
> Reset the HCD and, if applicable, the UDC when shutting down the
> hardware to avoid spurious interrupts.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>

I'm confused as to why would you get spurious IRQs when shutting down
this controller. Is there a known erratum for that or is this just
masking another driver bug ?

> ---
>  drivers/usb/host/isp1760-core.c |  7 +++++++
>  drivers/usb/host/isp1760-core.h |  1 +
>  drivers/usb/host/isp1760-hcd.c  |  4 ++--
>  drivers/usb/host/isp1760-if.c   | 14 +++++++++++++-
>  4 files changed, 23 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/host/isp1760-core.c b/drivers/usb/host/isp1760-core.c
> index cde66d3..595f234 100644
> --- a/drivers/usb/host/isp1760-core.c
> +++ b/drivers/usb/host/isp1760-core.c
> @@ -158,6 +158,13 @@ void isp1760_unregister(struct device *dev)
>  	kfree(isp);
>  }
>  
> +void isp1760_shutdown(struct device *dev)
> +{
> +	struct isp1760_device *isp = dev_get_drvdata(dev);
> +
> +	isp1760_write32(isp->regs, HC_RESET_REG, SW_RESET_RESET_HC);
> +}
> +
>  MODULE_DESCRIPTION("Driver for the ISP1760 USB-controller from NXP");
>  MODULE_AUTHOR("Sebastian Siewior <bigeasy@xxxxxxxxxxxxxx>");
>  MODULE_LICENSE("GPL v2");
> diff --git a/drivers/usb/host/isp1760-core.h b/drivers/usb/host/isp1760-core.h
> index 862dff4..fea1622 100644
> --- a/drivers/usb/host/isp1760-core.h
> +++ b/drivers/usb/host/isp1760-core.h
> @@ -53,6 +53,7 @@ struct isp1760_device {
>  int isp1760_register(struct resource *mem, int irq, unsigned long irqflags,
>  		     int rst_gpio, struct device *dev, unsigned int devflags);
>  void isp1760_unregister(struct device *dev);
> +void isp1760_shutdown(struct device *dev);
>  
>  static inline u32 isp1760_read32(void __iomem *base, u32 reg)
>  {
> diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c
> index 596a1a9..a6081d5 100644
> --- a/drivers/usb/host/isp1760-hcd.c
> +++ b/drivers/usb/host/isp1760-hcd.c
> @@ -2114,7 +2114,7 @@ static void isp1760_stop(struct usb_hcd *hcd)
>  	reg_write32(hcd->regs, HC_CONFIGFLAG, 0);
>  }
>  
> -static void isp1760_shutdown(struct usb_hcd *hcd)
> +static void isp1760_hc_shutdown(struct usb_hcd *hcd)
>  {
>  	u32 command, temp;
>  
> @@ -2153,7 +2153,7 @@ static const struct hc_driver isp1760_hc_driver = {
>  	.reset			= isp1760_hc_setup,
>  	.start			= isp1760_run,
>  	.stop			= isp1760_stop,
> -	.shutdown		= isp1760_shutdown,
> +	.shutdown		= isp1760_hc_shutdown,
>  	.urb_enqueue		= isp1760_urb_enqueue,
>  	.urb_dequeue		= isp1760_urb_dequeue,
>  	.endpoint_disable	= isp1760_endpoint_disable,
> diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c
> index ee19b02..6f83587 100644
> --- a/drivers/usb/host/isp1760-if.c
> +++ b/drivers/usb/host/isp1760-if.c
> @@ -104,6 +104,11 @@ static int of_isp1760_remove(struct platform_device *dev)
>  	return 0;
>  }
>  
> +static void of_isp1760_shutdown(struct platform_device *dev)
> +{
> +	isp1760_shutdown(&dev->dev);
> +}
> +
>  static const struct of_device_id of_isp1760_match[] = {
>  	{
>  		.compatible = "nxp,usb-isp1760",
> @@ -123,6 +128,7 @@ static struct platform_driver isp1760_of_driver = {
>  	},
>  	.probe          = of_isp1760_probe,
>  	.remove         = of_isp1760_remove,
> +	.shutdown	= of_isp1760_shutdown,
>  };
>  #endif
>  
> @@ -264,7 +270,7 @@ static void isp1761_pci_remove(struct pci_dev *dev)
>  
>  static void isp1761_pci_shutdown(struct pci_dev *dev)
>  {
> -	printk(KERN_ERR "ips1761_pci_shutdown\n");
> +	isp1760_shutdown(&dev->dev);
>  }
>  
>  static const struct pci_device_id isp1760_plx [] = {
> @@ -358,9 +364,15 @@ static int isp1760_plat_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> +static void isp1760_plat_shutdown(struct platform_device *pdev)
> +{
> +	isp1760_shutdown(&pdev->dev);
> +}
> +
>  static struct platform_driver isp1760_plat_driver = {
>  	.probe	= isp1760_plat_probe,
>  	.remove	= isp1760_plat_remove,
> +	.shutdown = isp1760_plat_shutdown,
>  	.driver	= {
>  		.name	= "isp1760",
>  	},
> -- 
> 2.0.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
balbi

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux