2006-01-20 21:53:38 +00:00
|
|
|
/*
|
2009-12-14 15:41:12 +00:00
|
|
|
* Copyright 2005-2009 MontaVista Software, Inc.
|
2012-03-20 05:05:50 +00:00
|
|
|
* Copyright 2008,2012 Freescale Semiconductor, Inc.
|
2006-01-20 21:53:38 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your
|
|
|
|
* option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*
|
|
|
|
* Ported to 834x by Randy Vinson <rvinson@mvista.com> using code provided
|
|
|
|
* by Hunter Wu.
|
2009-12-14 15:41:12 +00:00
|
|
|
* Power Management support by Dave Liu <daveliu@freescale.com>,
|
|
|
|
* Jerry Huang <Chang-Ming.Huang@freescale.com> and
|
|
|
|
* Anton Vorontsov <avorontsov@ru.mvista.com>.
|
2006-01-20 21:53:38 +00:00
|
|
|
*/
|
|
|
|
|
2009-12-14 15:41:12 +00:00
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/delay.h>
|
|
|
|
#include <linux/pm.h>
|
2012-06-26 12:10:32 +00:00
|
|
|
#include <linux/err.h>
|
2006-01-20 21:53:38 +00:00
|
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <linux/fsl_devices.h>
|
|
|
|
|
|
|
|
#include "ehci-fsl.h"
|
|
|
|
|
|
|
|
/* configure so an HC device and id are always provided */
|
|
|
|
/* always called with process context; sleeping is OK */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* usb_hcd_fsl_probe - initialize FSL-based HCDs
|
|
|
|
* @drvier: Driver to be used for this HCD
|
|
|
|
* @pdev: USB Host Controller being probed
|
|
|
|
* Context: !in_interrupt()
|
|
|
|
*
|
|
|
|
* Allocates basic resources for this USB host controller.
|
|
|
|
*
|
|
|
|
*/
|
2009-12-14 15:41:05 +00:00
|
|
|
static int usb_hcd_fsl_probe(const struct hc_driver *driver,
|
|
|
|
struct platform_device *pdev)
|
2006-01-20 21:53:38 +00:00
|
|
|
{
|
|
|
|
struct fsl_usb2_platform_data *pdata;
|
|
|
|
struct usb_hcd *hcd;
|
|
|
|
struct resource *res;
|
|
|
|
int irq;
|
|
|
|
int retval;
|
|
|
|
|
|
|
|
pr_debug("initializing FSL-SOC USB Controller\n");
|
|
|
|
|
|
|
|
/* Need platform data for setup */
|
2013-07-30 10:59:40 +00:00
|
|
|
pdata = (struct fsl_usb2_platform_data *)dev_get_platdata(&pdev->dev);
|
2006-01-20 21:53:38 +00:00
|
|
|
if (!pdata) {
|
|
|
|
dev_err(&pdev->dev,
|
2008-05-02 04:02:41 +00:00
|
|
|
"No platform data for %s.\n", dev_name(&pdev->dev));
|
2006-01-20 21:53:38 +00:00
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This is a host mode driver, verify that we're supposed to be
|
|
|
|
* in host mode.
|
|
|
|
*/
|
|
|
|
if (!((pdata->operating_mode == FSL_USB2_DR_HOST) ||
|
2007-05-11 09:09:55 +00:00
|
|
|
(pdata->operating_mode == FSL_USB2_MPH_HOST) ||
|
|
|
|
(pdata->operating_mode == FSL_USB2_DR_OTG))) {
|
2006-01-20 21:53:38 +00:00
|
|
|
dev_err(&pdev->dev,
|
|
|
|
"Non Host Mode configured for %s. Wrong driver linked.\n",
|
2008-05-02 04:02:41 +00:00
|
|
|
dev_name(&pdev->dev));
|
2006-01-20 21:53:38 +00:00
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
|
|
|
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
|
|
|
|
if (!res) {
|
|
|
|
dev_err(&pdev->dev,
|
|
|
|
"Found HC with no IRQ. Check %s setup!\n",
|
2008-05-02 04:02:41 +00:00
|
|
|
dev_name(&pdev->dev));
|
2006-01-20 21:53:38 +00:00
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
irq = res->start;
|
|
|
|
|
2008-05-02 04:02:41 +00:00
|
|
|
hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));
|
2006-01-20 21:53:38 +00:00
|
|
|
if (!hcd) {
|
|
|
|
retval = -ENOMEM;
|
|
|
|
goto err1;
|
|
|
|
}
|
|
|
|
|
|
|
|
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
|
|
|
if (!res) {
|
|
|
|
dev_err(&pdev->dev,
|
|
|
|
"Found HC with no register addr. Check %s setup!\n",
|
2008-05-02 04:02:41 +00:00
|
|
|
dev_name(&pdev->dev));
|
2006-01-20 21:53:38 +00:00
|
|
|
retval = -ENODEV;
|
|
|
|
goto err2;
|
|
|
|
}
|
|
|
|
hcd->rsrc_start = res->start;
|
2011-06-09 16:13:32 +00:00
|
|
|
hcd->rsrc_len = resource_size(res);
|
2006-01-20 21:53:38 +00:00
|
|
|
if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len,
|
|
|
|
driver->description)) {
|
|
|
|
dev_dbg(&pdev->dev, "controller already in use\n");
|
|
|
|
retval = -EBUSY;
|
|
|
|
goto err2;
|
|
|
|
}
|
|
|
|
hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
|
|
|
|
|
|
|
|
if (hcd->regs == NULL) {
|
|
|
|
dev_dbg(&pdev->dev, "error mapping memory\n");
|
|
|
|
retval = -EFAULT;
|
|
|
|
goto err3;
|
|
|
|
}
|
|
|
|
|
2010-09-28 18:55:21 +00:00
|
|
|
pdata->regs = hcd->regs;
|
2006-01-20 21:53:38 +00:00
|
|
|
|
2011-04-18 20:02:00 +00:00
|
|
|
if (pdata->power_budget)
|
|
|
|
hcd->power_budget = pdata->power_budget;
|
|
|
|
|
2010-09-28 18:55:21 +00:00
|
|
|
/*
|
|
|
|
* do platform specific init: check the clock, grab/config pins, etc.
|
|
|
|
*/
|
|
|
|
if (pdata->init && pdata->init(pdev)) {
|
|
|
|
retval = -ENODEV;
|
2012-01-12 09:55:13 +00:00
|
|
|
goto err4;
|
2010-09-28 18:55:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Enable USB controller, 83xx or 8536 */
|
|
|
|
if (pdata->have_sysif_regs)
|
|
|
|
setbits32(hcd->regs + FSL_SOC_USB_CTRL, 0x4);
|
|
|
|
|
|
|
|
/* Don't need to set host mode here. It will be done by tdi_reset() */
|
2006-01-20 21:53:38 +00:00
|
|
|
|
2011-09-07 08:10:52 +00:00
|
|
|
retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
|
2006-01-20 21:53:38 +00:00
|
|
|
if (retval != 0)
|
|
|
|
goto err4;
|
2011-04-18 20:02:00 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_USB_OTG
|
|
|
|
if (pdata->operating_mode == FSL_USB2_DR_OTG) {
|
|
|
|
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
|
|
|
|
|
2012-07-05 22:35:41 +00:00
|
|
|
hcd->phy = usb_get_phy(USB_PHY_TYPE_USB2);
|
2012-06-13 12:34:12 +00:00
|
|
|
dev_dbg(&pdev->dev, "hcd=0x%p ehci=0x%p, phy=0x%p\n",
|
|
|
|
hcd, ehci, hcd->phy);
|
2011-04-18 20:02:00 +00:00
|
|
|
|
2012-07-05 22:35:41 +00:00
|
|
|
if (!IS_ERR_OR_NULL(hcd->phy)) {
|
2012-06-13 12:34:12 +00:00
|
|
|
retval = otg_set_host(hcd->phy->otg,
|
2011-04-18 20:02:00 +00:00
|
|
|
&ehci_to_hcd(ehci)->self);
|
|
|
|
if (retval) {
|
2012-07-05 22:35:41 +00:00
|
|
|
usb_put_phy(hcd->phy);
|
2011-04-18 20:02:00 +00:00
|
|
|
goto err4;
|
|
|
|
}
|
|
|
|
} else {
|
2012-06-13 12:34:12 +00:00
|
|
|
dev_err(&pdev->dev, "can't find phy\n");
|
2011-04-18 20:02:00 +00:00
|
|
|
retval = -ENODEV;
|
|
|
|
goto err4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2006-01-20 21:53:38 +00:00
|
|
|
return retval;
|
|
|
|
|
|
|
|
err4:
|
|
|
|
iounmap(hcd->regs);
|
|
|
|
err3:
|
|
|
|
release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
|
|
|
|
err2:
|
|
|
|
usb_put_hcd(hcd);
|
|
|
|
err1:
|
2008-05-02 04:02:41 +00:00
|
|
|
dev_err(&pdev->dev, "init %s fail, %d\n", dev_name(&pdev->dev), retval);
|
2010-09-28 18:55:21 +00:00
|
|
|
if (pdata->exit)
|
|
|
|
pdata->exit(pdev);
|
2006-01-20 21:53:38 +00:00
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* may be called without controller electrically present */
|
|
|
|
/* may be called with controller, bus, and devices active */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* usb_hcd_fsl_remove - shutdown processing for FSL-based HCDs
|
|
|
|
* @dev: USB Host Controller being removed
|
|
|
|
* Context: !in_interrupt()
|
|
|
|
*
|
|
|
|
* Reverses the effect of usb_hcd_fsl_probe().
|
|
|
|
*
|
|
|
|
*/
|
2009-12-14 15:41:05 +00:00
|
|
|
static void usb_hcd_fsl_remove(struct usb_hcd *hcd,
|
|
|
|
struct platform_device *pdev)
|
2006-01-20 21:53:38 +00:00
|
|
|
{
|
2013-07-30 10:59:40 +00:00
|
|
|
struct fsl_usb2_platform_data *pdata = dev_get_platdata(&pdev->dev);
|
2011-04-18 20:02:00 +00:00
|
|
|
|
2012-07-05 22:35:41 +00:00
|
|
|
if (!IS_ERR_OR_NULL(hcd->phy)) {
|
2012-06-13 12:34:12 +00:00
|
|
|
otg_set_host(hcd->phy->otg, NULL);
|
2012-07-05 22:35:41 +00:00
|
|
|
usb_put_phy(hcd->phy);
|
2011-04-18 20:02:00 +00:00
|
|
|
}
|
2010-09-28 18:55:21 +00:00
|
|
|
|
2006-01-20 21:53:38 +00:00
|
|
|
usb_remove_hcd(hcd);
|
2010-09-28 18:55:21 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* do platform specific un-initialization:
|
|
|
|
* release iomux pins, disable clock, etc.
|
|
|
|
*/
|
|
|
|
if (pdata->exit)
|
|
|
|
pdata->exit(pdev);
|
2006-01-20 21:53:38 +00:00
|
|
|
iounmap(hcd->regs);
|
|
|
|
release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
|
|
|
|
usb_put_hcd(hcd);
|
|
|
|
}
|
|
|
|
|
2012-08-22 10:17:00 +00:00
|
|
|
static int ehci_fsl_setup_phy(struct usb_hcd *hcd,
|
2010-09-28 18:55:21 +00:00
|
|
|
enum fsl_usb2_phy_modes phy_mode,
|
|
|
|
unsigned int port_offset)
|
2006-01-20 21:53:38 +00:00
|
|
|
{
|
2012-08-22 10:17:00 +00:00
|
|
|
u32 portsc;
|
2012-03-20 05:05:50 +00:00
|
|
|
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
|
2012-02-16 10:02:20 +00:00
|
|
|
void __iomem *non_ehci = hcd->regs;
|
2012-03-20 05:05:50 +00:00
|
|
|
struct device *dev = hcd->self.controller;
|
2013-07-30 10:59:40 +00:00
|
|
|
struct fsl_usb2_platform_data *pdata = dev_get_platdata(dev);
|
2012-04-10 08:48:11 +00:00
|
|
|
|
2012-03-20 05:05:50 +00:00
|
|
|
if (pdata->controller_ver < 0) {
|
|
|
|
dev_warn(hcd->self.controller, "Could not get controller version\n");
|
2012-10-19 14:24:12 +00:00
|
|
|
return -ENODEV;
|
2012-03-20 05:05:50 +00:00
|
|
|
}
|
2010-09-28 18:55:21 +00:00
|
|
|
|
|
|
|
portsc = ehci_readl(ehci, &ehci->regs->port_status[port_offset]);
|
|
|
|
portsc &= ~(PORT_PTS_MSK | PORT_PTS_PTW);
|
|
|
|
|
2006-01-20 21:53:38 +00:00
|
|
|
switch (phy_mode) {
|
|
|
|
case FSL_USB2_PHY_ULPI:
|
2012-12-04 13:24:30 +00:00
|
|
|
if (pdata->have_sysif_regs && pdata->controller_ver) {
|
2012-03-20 05:05:50 +00:00
|
|
|
/* controller version 1.6 or above */
|
2012-08-22 10:17:00 +00:00
|
|
|
setbits32(non_ehci + FSL_SOC_USB_CTRL,
|
|
|
|
ULPI_PHY_CLK_SEL);
|
|
|
|
/*
|
|
|
|
* Due to controller issue of PHY_CLK_VALID in ULPI
|
|
|
|
* mode, we set USB_CTRL_USB_EN before checking
|
|
|
|
* PHY_CLK_VALID, otherwise PHY_CLK_VALID doesn't work.
|
|
|
|
*/
|
|
|
|
clrsetbits_be32(non_ehci + FSL_SOC_USB_CTRL,
|
|
|
|
UTMI_PHY_EN, USB_CTRL_USB_EN);
|
2012-03-20 05:05:50 +00:00
|
|
|
}
|
2006-01-20 21:53:38 +00:00
|
|
|
portsc |= PORT_PTS_ULPI;
|
|
|
|
break;
|
|
|
|
case FSL_USB2_PHY_SERIAL:
|
|
|
|
portsc |= PORT_PTS_SERIAL;
|
|
|
|
break;
|
|
|
|
case FSL_USB2_PHY_UTMI_WIDE:
|
|
|
|
portsc |= PORT_PTS_PTW;
|
|
|
|
/* fall through */
|
|
|
|
case FSL_USB2_PHY_UTMI:
|
2012-12-04 13:24:30 +00:00
|
|
|
if (pdata->have_sysif_regs && pdata->controller_ver) {
|
2012-03-20 05:05:50 +00:00
|
|
|
/* controller version 1.6 or above */
|
2012-08-22 10:17:00 +00:00
|
|
|
setbits32(non_ehci + FSL_SOC_USB_CTRL, UTMI_PHY_EN);
|
2012-03-20 05:05:50 +00:00
|
|
|
mdelay(FSL_UTMI_PHY_DLY); /* Delay for UTMI PHY CLK to
|
|
|
|
become stable - 10ms*/
|
|
|
|
}
|
2012-02-16 10:02:20 +00:00
|
|
|
/* enable UTMI PHY */
|
2012-04-10 08:48:11 +00:00
|
|
|
if (pdata->have_sysif_regs)
|
|
|
|
setbits32(non_ehci + FSL_SOC_USB_CTRL,
|
|
|
|
CTRL_UTMI_PHY_EN);
|
2006-01-20 21:53:38 +00:00
|
|
|
portsc |= PORT_PTS_UTMI;
|
|
|
|
break;
|
|
|
|
case FSL_USB2_PHY_NONE:
|
|
|
|
break;
|
|
|
|
}
|
2012-08-22 10:17:00 +00:00
|
|
|
|
2012-12-04 13:24:30 +00:00
|
|
|
if (pdata->have_sysif_regs && pdata->controller_ver &&
|
|
|
|
(phy_mode == FSL_USB2_PHY_ULPI)) {
|
2012-08-22 10:17:00 +00:00
|
|
|
/* check PHY_CLK_VALID to get phy clk valid */
|
|
|
|
if (!spin_event_timeout(in_be32(non_ehci + FSL_SOC_USB_CTRL) &
|
|
|
|
PHY_CLK_VALID, FSL_USB_PHY_CLK_TIMEOUT, 0)) {
|
|
|
|
printk(KERN_WARNING "fsl-ehci: USB PHY clock invalid\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-12-14 19:54:08 +00:00
|
|
|
ehci_writel(ehci, portsc, &ehci->regs->port_status[port_offset]);
|
2012-08-22 10:17:00 +00:00
|
|
|
|
2012-12-04 13:24:30 +00:00
|
|
|
if (phy_mode != FSL_USB2_PHY_ULPI && pdata->have_sysif_regs)
|
2012-08-22 10:17:00 +00:00
|
|
|
setbits32(non_ehci + FSL_SOC_USB_CTRL, USB_CTRL_USB_EN);
|
|
|
|
|
|
|
|
return 0;
|
2006-01-20 21:53:38 +00:00
|
|
|
}
|
|
|
|
|
2012-08-22 10:17:00 +00:00
|
|
|
static int ehci_fsl_usb_setup(struct ehci_hcd *ehci)
|
2006-01-20 21:53:38 +00:00
|
|
|
{
|
2010-09-28 18:55:21 +00:00
|
|
|
struct usb_hcd *hcd = ehci_to_hcd(ehci);
|
2006-01-20 21:53:38 +00:00
|
|
|
struct fsl_usb2_platform_data *pdata;
|
|
|
|
void __iomem *non_ehci = hcd->regs;
|
|
|
|
|
2013-07-30 10:59:40 +00:00
|
|
|
pdata = dev_get_platdata(hcd->self.controller);
|
2010-09-28 18:55:21 +00:00
|
|
|
|
|
|
|
if (pdata->have_sysif_regs) {
|
2012-02-17 05:57:16 +00:00
|
|
|
/*
|
|
|
|
* Turn on cache snooping hardware, since some PowerPC platforms
|
|
|
|
* wholly rely on hardware to deal with cache coherent
|
|
|
|
*/
|
2007-05-23 20:58:17 +00:00
|
|
|
|
2012-02-17 05:57:16 +00:00
|
|
|
/* Setup Snooping for all the 4GB space */
|
|
|
|
/* SNOOP1 starts from 0x0, size 2G */
|
|
|
|
out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x0 | SNOOP_SIZE_2GB);
|
|
|
|
/* SNOOP2 starts from 0x80000000, size 2G */
|
|
|
|
out_be32(non_ehci + FSL_SOC_USB_SNOOP2, 0x80000000 | SNOOP_SIZE_2GB);
|
|
|
|
}
|
2007-05-23 20:58:17 +00:00
|
|
|
|
2007-05-11 09:09:55 +00:00
|
|
|
if ((pdata->operating_mode == FSL_USB2_DR_HOST) ||
|
|
|
|
(pdata->operating_mode == FSL_USB2_DR_OTG))
|
2012-08-22 10:17:00 +00:00
|
|
|
if (ehci_fsl_setup_phy(hcd, pdata->phy_mode, 0))
|
|
|
|
return -EINVAL;
|
2006-01-20 21:53:38 +00:00
|
|
|
|
|
|
|
if (pdata->operating_mode == FSL_USB2_MPH_HOST) {
|
2006-01-20 21:57:52 +00:00
|
|
|
unsigned int chip, rev, svr;
|
|
|
|
|
|
|
|
svr = mfspr(SPRN_SVR);
|
|
|
|
chip = svr >> 16;
|
|
|
|
rev = (svr >> 4) & 0xf;
|
|
|
|
|
|
|
|
/* Deal with USB Erratum #14 on MPC834x Rev 1.0 & 1.1 chips */
|
|
|
|
if ((rev == 1) && (chip >= 0x8050) && (chip <= 0x8055))
|
|
|
|
ehci->has_fsl_port_bug = 1;
|
|
|
|
|
2006-01-20 21:53:38 +00:00
|
|
|
if (pdata->port_enables & FSL_USB2_PORT0_ENABLED)
|
2012-08-22 10:17:00 +00:00
|
|
|
if (ehci_fsl_setup_phy(hcd, pdata->phy_mode, 0))
|
|
|
|
return -EINVAL;
|
|
|
|
|
2006-01-20 21:53:38 +00:00
|
|
|
if (pdata->port_enables & FSL_USB2_PORT1_ENABLED)
|
2012-08-22 10:17:00 +00:00
|
|
|
if (ehci_fsl_setup_phy(hcd, pdata->phy_mode, 1))
|
|
|
|
return -EINVAL;
|
2006-01-20 21:53:38 +00:00
|
|
|
}
|
|
|
|
|
2010-09-28 18:55:21 +00:00
|
|
|
if (pdata->have_sysif_regs) {
|
2012-07-10 11:58:48 +00:00
|
|
|
#ifdef CONFIG_FSL_SOC_BOOKE
|
2010-09-28 18:55:21 +00:00
|
|
|
out_be32(non_ehci + FSL_SOC_USB_PRICTRL, 0x00000008);
|
|
|
|
out_be32(non_ehci + FSL_SOC_USB_AGECNTTHRSH, 0x00000080);
|
2008-07-02 07:14:33 +00:00
|
|
|
#else
|
2010-09-28 18:55:21 +00:00
|
|
|
out_be32(non_ehci + FSL_SOC_USB_PRICTRL, 0x0000000c);
|
|
|
|
out_be32(non_ehci + FSL_SOC_USB_AGECNTTHRSH, 0x00000040);
|
2008-07-02 07:14:33 +00:00
|
|
|
#endif
|
2010-09-28 18:55:21 +00:00
|
|
|
out_be32(non_ehci + FSL_SOC_USB_SICTRL, 0x00000001);
|
|
|
|
}
|
2012-08-22 10:17:00 +00:00
|
|
|
|
|
|
|
return 0;
|
2006-01-20 21:53:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* called after powerup, by probe or system-pm "wakeup" */
|
|
|
|
static int ehci_fsl_reinit(struct ehci_hcd *ehci)
|
|
|
|
{
|
2012-08-22 10:17:00 +00:00
|
|
|
if (ehci_fsl_usb_setup(ehci))
|
|
|
|
return -EINVAL;
|
2006-01-20 21:53:38 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* called during probe() after chip reset completes */
|
|
|
|
static int ehci_fsl_setup(struct usb_hcd *hcd)
|
|
|
|
{
|
|
|
|
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
|
|
|
|
int retval;
|
2010-09-28 18:55:21 +00:00
|
|
|
struct fsl_usb2_platform_data *pdata;
|
2012-01-24 21:17:38 +00:00
|
|
|
struct device *dev;
|
2010-09-28 18:55:21 +00:00
|
|
|
|
2012-01-24 21:17:38 +00:00
|
|
|
dev = hcd->self.controller;
|
2013-07-30 10:59:40 +00:00
|
|
|
pdata = dev_get_platdata(hcd->self.controller);
|
2010-09-28 18:55:21 +00:00
|
|
|
ehci->big_endian_desc = pdata->big_endian_desc;
|
|
|
|
ehci->big_endian_mmio = pdata->big_endian_mmio;
|
2006-01-20 21:53:38 +00:00
|
|
|
|
|
|
|
/* EHCI registers start at offset 0x100 */
|
|
|
|
ehci->caps = hcd->regs + 0x100;
|
|
|
|
|
2013-04-03 10:18:51 +00:00
|
|
|
#ifdef CONFIG_PPC_83xx
|
|
|
|
/*
|
|
|
|
* Deal with MPC834X that need port power to be cycled after the power
|
|
|
|
* fault condition is removed. Otherwise the state machine does not
|
|
|
|
* reflect PORTSC[CSC] correctly.
|
|
|
|
*/
|
|
|
|
ehci->need_oc_pp_cycle = 1;
|
|
|
|
#endif
|
|
|
|
|
2010-09-06 16:26:56 +00:00
|
|
|
hcd->has_tt = 1;
|
|
|
|
|
2012-07-09 19:55:14 +00:00
|
|
|
retval = ehci_setup(hcd);
|
2006-01-20 21:53:38 +00:00
|
|
|
if (retval)
|
|
|
|
return retval;
|
|
|
|
|
2012-01-24 21:17:38 +00:00
|
|
|
if (of_device_is_compatible(dev->parent->of_node,
|
|
|
|
"fsl,mpc5121-usb2-dr")) {
|
|
|
|
/*
|
|
|
|
* set SBUSCFG:AHBBRST so that control msgs don't
|
|
|
|
* fail when doing heavy PATA writes.
|
|
|
|
*/
|
|
|
|
ehci_writel(ehci, SBUSCFG_INCR8,
|
|
|
|
hcd->regs + FSL_SOC_USB_SBUSCFG);
|
|
|
|
}
|
|
|
|
|
2006-01-20 21:53:38 +00:00
|
|
|
retval = ehci_fsl_reinit(ehci);
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2009-12-14 15:41:12 +00:00
|
|
|
struct ehci_fsl {
|
|
|
|
struct ehci_hcd ehci;
|
|
|
|
|
|
|
|
#ifdef CONFIG_PM
|
|
|
|
/* Saved USB PHY settings, need to restore after deep sleep. */
|
|
|
|
u32 usb_ctrl;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef CONFIG_PM
|
|
|
|
|
2011-04-18 20:01:55 +00:00
|
|
|
#ifdef CONFIG_PPC_MPC512x
|
|
|
|
static int ehci_fsl_mpc512x_drv_suspend(struct device *dev)
|
|
|
|
{
|
|
|
|
struct usb_hcd *hcd = dev_get_drvdata(dev);
|
|
|
|
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
|
2013-07-30 10:59:40 +00:00
|
|
|
struct fsl_usb2_platform_data *pdata = dev_get_platdata(dev);
|
2011-04-18 20:01:55 +00:00
|
|
|
u32 tmp;
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
u32 mode = ehci_readl(ehci, hcd->regs + FSL_SOC_USB_USBMODE);
|
|
|
|
mode &= USBMODE_CM_MASK;
|
|
|
|
tmp = ehci_readl(ehci, hcd->regs + 0x140); /* usbcmd */
|
|
|
|
|
|
|
|
dev_dbg(dev, "suspend=%d already_suspended=%d "
|
|
|
|
"mode=%d usbcmd %08x\n", pdata->suspended,
|
|
|
|
pdata->already_suspended, mode, tmp);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If the controller is already suspended, then this must be a
|
|
|
|
* PM suspend. Remember this fact, so that we will leave the
|
|
|
|
* controller suspended at PM resume time.
|
|
|
|
*/
|
|
|
|
if (pdata->suspended) {
|
|
|
|
dev_dbg(dev, "already suspended, leaving early\n");
|
|
|
|
pdata->already_suspended = 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
dev_dbg(dev, "suspending...\n");
|
|
|
|
|
2011-08-18 20:31:30 +00:00
|
|
|
ehci->rh_state = EHCI_RH_SUSPENDED;
|
2011-04-18 20:01:55 +00:00
|
|
|
dev->power.power_state = PMSG_SUSPEND;
|
|
|
|
|
|
|
|
/* ignore non-host interrupts */
|
|
|
|
clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
|
|
|
|
|
|
|
|
/* stop the controller */
|
|
|
|
tmp = ehci_readl(ehci, &ehci->regs->command);
|
|
|
|
tmp &= ~CMD_RUN;
|
|
|
|
ehci_writel(ehci, tmp, &ehci->regs->command);
|
|
|
|
|
|
|
|
/* save EHCI registers */
|
|
|
|
pdata->pm_command = ehci_readl(ehci, &ehci->regs->command);
|
|
|
|
pdata->pm_command &= ~CMD_RUN;
|
|
|
|
pdata->pm_status = ehci_readl(ehci, &ehci->regs->status);
|
|
|
|
pdata->pm_intr_enable = ehci_readl(ehci, &ehci->regs->intr_enable);
|
|
|
|
pdata->pm_frame_index = ehci_readl(ehci, &ehci->regs->frame_index);
|
|
|
|
pdata->pm_segment = ehci_readl(ehci, &ehci->regs->segment);
|
|
|
|
pdata->pm_frame_list = ehci_readl(ehci, &ehci->regs->frame_list);
|
|
|
|
pdata->pm_async_next = ehci_readl(ehci, &ehci->regs->async_next);
|
|
|
|
pdata->pm_configured_flag =
|
|
|
|
ehci_readl(ehci, &ehci->regs->configured_flag);
|
|
|
|
pdata->pm_portsc = ehci_readl(ehci, &ehci->regs->port_status[0]);
|
|
|
|
pdata->pm_usbgenctrl = ehci_readl(ehci,
|
|
|
|
hcd->regs + FSL_SOC_USB_USBGENCTRL);
|
|
|
|
|
|
|
|
/* clear the W1C bits */
|
|
|
|
pdata->pm_portsc &= cpu_to_hc32(ehci, ~PORT_RWC_BITS);
|
|
|
|
|
|
|
|
pdata->suspended = 1;
|
|
|
|
|
|
|
|
/* clear PP to cut power to the port */
|
|
|
|
tmp = ehci_readl(ehci, &ehci->regs->port_status[0]);
|
|
|
|
tmp &= ~PORT_POWER;
|
|
|
|
ehci_writel(ehci, tmp, &ehci->regs->port_status[0]);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ehci_fsl_mpc512x_drv_resume(struct device *dev)
|
|
|
|
{
|
|
|
|
struct usb_hcd *hcd = dev_get_drvdata(dev);
|
|
|
|
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
|
2013-07-30 10:59:40 +00:00
|
|
|
struct fsl_usb2_platform_data *pdata = dev_get_platdata(dev);
|
2011-04-18 20:01:55 +00:00
|
|
|
u32 tmp;
|
|
|
|
|
|
|
|
dev_dbg(dev, "suspend=%d already_suspended=%d\n",
|
|
|
|
pdata->suspended, pdata->already_suspended);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If the controller was already suspended at suspend time,
|
|
|
|
* then don't resume it now.
|
|
|
|
*/
|
|
|
|
if (pdata->already_suspended) {
|
|
|
|
dev_dbg(dev, "already suspended, leaving early\n");
|
|
|
|
pdata->already_suspended = 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!pdata->suspended) {
|
|
|
|
dev_dbg(dev, "not suspended, leaving early\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
pdata->suspended = 0;
|
|
|
|
|
|
|
|
dev_dbg(dev, "resuming...\n");
|
|
|
|
|
|
|
|
/* set host mode */
|
|
|
|
tmp = USBMODE_CM_HOST | (pdata->es ? USBMODE_ES : 0);
|
|
|
|
ehci_writel(ehci, tmp, hcd->regs + FSL_SOC_USB_USBMODE);
|
|
|
|
|
|
|
|
ehci_writel(ehci, pdata->pm_usbgenctrl,
|
|
|
|
hcd->regs + FSL_SOC_USB_USBGENCTRL);
|
|
|
|
ehci_writel(ehci, ISIPHYCTRL_PXE | ISIPHYCTRL_PHYE,
|
|
|
|
hcd->regs + FSL_SOC_USB_ISIPHYCTRL);
|
|
|
|
|
2012-01-24 21:17:38 +00:00
|
|
|
ehci_writel(ehci, SBUSCFG_INCR8, hcd->regs + FSL_SOC_USB_SBUSCFG);
|
|
|
|
|
2011-04-18 20:01:55 +00:00
|
|
|
/* restore EHCI registers */
|
|
|
|
ehci_writel(ehci, pdata->pm_command, &ehci->regs->command);
|
|
|
|
ehci_writel(ehci, pdata->pm_intr_enable, &ehci->regs->intr_enable);
|
|
|
|
ehci_writel(ehci, pdata->pm_frame_index, &ehci->regs->frame_index);
|
|
|
|
ehci_writel(ehci, pdata->pm_segment, &ehci->regs->segment);
|
|
|
|
ehci_writel(ehci, pdata->pm_frame_list, &ehci->regs->frame_list);
|
|
|
|
ehci_writel(ehci, pdata->pm_async_next, &ehci->regs->async_next);
|
|
|
|
ehci_writel(ehci, pdata->pm_configured_flag,
|
|
|
|
&ehci->regs->configured_flag);
|
|
|
|
ehci_writel(ehci, pdata->pm_portsc, &ehci->regs->port_status[0]);
|
|
|
|
|
|
|
|
set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
|
2011-08-18 20:31:30 +00:00
|
|
|
ehci->rh_state = EHCI_RH_RUNNING;
|
2011-04-18 20:01:55 +00:00
|
|
|
dev->power.power_state = PMSG_ON;
|
|
|
|
|
|
|
|
tmp = ehci_readl(ehci, &ehci->regs->command);
|
|
|
|
tmp |= CMD_RUN;
|
|
|
|
ehci_writel(ehci, tmp, &ehci->regs->command);
|
|
|
|
|
|
|
|
usb_hcd_resume_root_hub(hcd);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
static inline int ehci_fsl_mpc512x_drv_suspend(struct device *dev)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int ehci_fsl_mpc512x_drv_resume(struct device *dev)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_PPC_MPC512x */
|
|
|
|
|
2009-12-14 15:41:12 +00:00
|
|
|
static struct ehci_fsl *hcd_to_ehci_fsl(struct usb_hcd *hcd)
|
|
|
|
{
|
|
|
|
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
|
|
|
|
|
|
|
|
return container_of(ehci, struct ehci_fsl, ehci);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ehci_fsl_drv_suspend(struct device *dev)
|
|
|
|
{
|
|
|
|
struct usb_hcd *hcd = dev_get_drvdata(dev);
|
|
|
|
struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd);
|
|
|
|
void __iomem *non_ehci = hcd->regs;
|
|
|
|
|
2011-04-18 20:01:55 +00:00
|
|
|
if (of_device_is_compatible(dev->parent->of_node,
|
|
|
|
"fsl,mpc5121-usb2-dr")) {
|
|
|
|
return ehci_fsl_mpc512x_drv_suspend(dev);
|
|
|
|
}
|
|
|
|
|
2010-06-25 18:02:14 +00:00
|
|
|
ehci_prepare_ports_for_controller_suspend(hcd_to_ehci(hcd),
|
|
|
|
device_may_wakeup(dev));
|
2009-12-14 15:41:12 +00:00
|
|
|
if (!fsl_deep_sleep())
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
ehci_fsl->usb_ctrl = in_be32(non_ehci + FSL_SOC_USB_CTRL);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ehci_fsl_drv_resume(struct device *dev)
|
|
|
|
{
|
|
|
|
struct usb_hcd *hcd = dev_get_drvdata(dev);
|
|
|
|
struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd);
|
|
|
|
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
|
|
|
|
void __iomem *non_ehci = hcd->regs;
|
|
|
|
|
2011-04-18 20:01:55 +00:00
|
|
|
if (of_device_is_compatible(dev->parent->of_node,
|
|
|
|
"fsl,mpc5121-usb2-dr")) {
|
|
|
|
return ehci_fsl_mpc512x_drv_resume(dev);
|
|
|
|
}
|
|
|
|
|
2010-05-12 22:21:35 +00:00
|
|
|
ehci_prepare_ports_for_controller_resume(ehci);
|
2009-12-14 15:41:12 +00:00
|
|
|
if (!fsl_deep_sleep())
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
usb_root_hub_lost_power(hcd->self.root_hub);
|
|
|
|
|
|
|
|
/* Restore USB PHY settings and enable the controller. */
|
|
|
|
out_be32(non_ehci + FSL_SOC_USB_CTRL, ehci_fsl->usb_ctrl);
|
|
|
|
|
|
|
|
ehci_reset(ehci);
|
|
|
|
ehci_fsl_reinit(ehci);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ehci_fsl_drv_restore(struct device *dev)
|
|
|
|
{
|
|
|
|
struct usb_hcd *hcd = dev_get_drvdata(dev);
|
|
|
|
|
|
|
|
usb_root_hub_lost_power(hcd->self.root_hub);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct dev_pm_ops ehci_fsl_pm_ops = {
|
|
|
|
.suspend = ehci_fsl_drv_suspend,
|
|
|
|
.resume = ehci_fsl_drv_resume,
|
|
|
|
.restore = ehci_fsl_drv_restore,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define EHCI_FSL_PM_OPS (&ehci_fsl_pm_ops)
|
|
|
|
#else
|
|
|
|
#define EHCI_FSL_PM_OPS NULL
|
|
|
|
#endif /* CONFIG_PM */
|
|
|
|
|
2011-04-18 20:02:00 +00:00
|
|
|
#ifdef CONFIG_USB_OTG
|
|
|
|
static int ehci_start_port_reset(struct usb_hcd *hcd, unsigned port)
|
|
|
|
{
|
|
|
|
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
|
|
|
|
u32 status;
|
|
|
|
|
|
|
|
if (!port)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
port--;
|
|
|
|
|
|
|
|
/* start port reset before HNP protocol time out */
|
|
|
|
status = readl(&ehci->regs->port_status[port]);
|
|
|
|
if (!(status & PORT_CONNECT))
|
|
|
|
return -ENODEV;
|
|
|
|
|
|
|
|
/* khubd will finish the reset later */
|
|
|
|
if (ehci_is_TDI(ehci)) {
|
|
|
|
writel(PORT_RESET |
|
|
|
|
(status & ~(PORT_CSC | PORT_PEC | PORT_OCC)),
|
|
|
|
&ehci->regs->port_status[port]);
|
|
|
|
} else {
|
|
|
|
writel(PORT_RESET, &ehci->regs->port_status[port]);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define ehci_start_port_reset NULL
|
|
|
|
#endif /* CONFIG_USB_OTG */
|
|
|
|
|
|
|
|
|
2006-01-20 21:53:38 +00:00
|
|
|
static const struct hc_driver ehci_fsl_hc_driver = {
|
|
|
|
.description = hcd_name,
|
|
|
|
.product_desc = "Freescale On-Chip EHCI Host Controller",
|
2009-12-14 15:41:12 +00:00
|
|
|
.hcd_priv_size = sizeof(struct ehci_fsl),
|
2006-01-20 21:53:38 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* generic hardware linkage
|
|
|
|
*/
|
|
|
|
.irq = ehci_irq,
|
USB: EHCI: support running URB giveback in tasklet context
All 4 transfer types can work well on EHCI HCD after switching to run
URB giveback in tasklet context, so mark all HCD drivers to support
it.
Also we don't need to release ehci->lock during URB giveback any more.
>From below test results on 3 machines(2 ARM and one x86), time
consumed by EHCI interrupt handler droped much without performance
loss.
1 test description
1.1 mass storage performance test:
- run below command 10 times and compute the average performance
dd if=/dev/sdN iflag=direct of=/dev/null bs=200M count=1
- two usb mass storage device:
A: sandisk extreme USB 3.0 16G(used in test case 1 & case 2)
B: kingston DataTraveler G2 4GB(only used in test case 2)
1.2 uvc function test:
- run one simple capture program in the below link
http://kernel.ubuntu.com/~ming/up/capture.c
- capture format 640*480 and results in High Bandwidth mode on the
uvc device: Z-Star 0x0ac8/0x3450
- on T410(x86) laptop, also use guvcview to watch video capture/playback
1.3 about test2 and test4
- both two devices involved are tested concurrently by above test items
1.4 how to compute irq time(the time consumed by ehci_irq)
- use trace points of irq:irq_handler_entry and irq:irq_handler_exit
1.5 kernel
3.10.0-rc3-next-20130528
1.6 test machines
Pandaboard A1: ARM CortexA9 dural core
Arndale board: ARM CortexA15 dural core
T410: i5 CPU 2.67GHz quad core
2 test result
2.1 test case1: single mass storage device performance test
--------------------------------------------------------------------
upstream | patched
perf(MB/s)+irq time(us) | perf(MB/s)+irq time(us)
--------------------------------------------------------------------
Pandaboard A1: 25.280(avg:145,max:772) | 25.540(avg:14, max:75)
Arndale board: 29.700(avg:33, max:129) | 29.700(avg:10, max:50)
T410: 34.430(avg:17, max:154*)| 34.660(avg:12, max:155)
---------------------------------------------------------------------
2.2 test case2: two mass storage devices' performance test
--------------------------------------------------------------------
upstream | patched
perf(MB/s)+irq time(us) | perf(MB/s)+irq time(us)
--------------------------------------------------------------------
Pandaboard A1: 15.840/15.580(avg:158,max:1216) | 16.500/16.160(avg:15,max:139)
Arndale board: 17.370/16.220(avg:33 max:234) | 17.480/16.200(avg:11, max:91)
T410: 21.180/19.820(avg:18 max:160) | 21.220/19.880(avg:11, max:149)
---------------------------------------------------------------------
2.3 test case3: one uvc streaming test
- uvc device works well(on x86, luvcview can be used too and has
same result with uvc capture)
--------------------------------------------------------------------
upstream | patched
irq time(us) | irq time(us)
--------------------------------------------------------------------
Pandaboard A1: (avg:445, max:873) | (avg:33, max:44)
Arndale board: (avg:316, max:630) | (avg:20, max:27)
T410: (avg:39, max:107) | (avg:10, max:65)
---------------------------------------------------------------------
2.4 test case4: one uvc streaming plus one mass storage device test
--------------------------------------------------------------------
upstream | patched
perf(MB/s)+irq time(us) | perf(MB/s)+irq time(us)
--------------------------------------------------------------------
Pandaboard A1: 20.340(avg:259,max:1704)| 20.390(avg:24, max:101)
Arndale board: 23.460(avg:124,max:726) | 23.370(avg:15, max:52)
T410: 28.520(avg:27, max:169) | 28.630(avg:13, max:160)
---------------------------------------------------------------------
2.5 test case5: read single mass storage device with small transfer
- run below command 10 times and compute the average speed
dd if=/dev/sdN iflag=direct of=/dev/null bs=4K count=4000
1), test device A:
--------------------------------------------------------------------
upstream | patched
perf(MB/s)+irq time(us) | perf(MB/s)+irq time(us)
--------------------------------------------------------------------
Pandaboard A1: 6.5(avg:21, max:64) | 6.5(avg:10, max:24)
Arndale board: 8.13(avg:12, max:23) | 8.06(avg:7, max:17)
T410: 6.66(avg:13, max:131) | 6.84(avg:11, max:149)
---------------------------------------------------------------------
2), test device B:
--------------------------------------------------------------------
upstream | patched
perf(MB/s)+irq time(us) | perf(MB/s)+irq time(us)
--------------------------------------------------------------------
Pandaboard A1: 5.5(avg:21,max:43) | 5.49(avg:10, max:24)
Arndale board: 5.9(avg:12, max:22) | 5.9(avg:7, max:17)
T410: 5.48(avg:13, max:155) | 5.48(avg:7, max:140)
---------------------------------------------------------------------
* On T410, sometimes read ehci status register in ehci_irq takes more
than 100us, and the problem has been reported on the link:
http://marc.info/?t=137065867300001&r=1&w=2
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-03 14:53:11 +00:00
|
|
|
.flags = HCD_USB2 | HCD_MEMORY | HCD_BH,
|
2006-01-20 21:53:38 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* basic lifecycle operations
|
|
|
|
*/
|
|
|
|
.reset = ehci_fsl_setup,
|
|
|
|
.start = ehci_run,
|
|
|
|
.stop = ehci_stop,
|
USB: Properly unregister reboot notifier in case of failure in ehci hcd
If some problem occurs during ehci startup, for instance, request_irq fails,
echi hcd driver tries it best to cleanup, but fails to unregister reboot
notifier, which in turn leads to crash on reboot/poweroff.
The following patch resolves this problem by not using reboot notifiers
anymore, but instead making ehci/ohci driver get its own shutdown method. For
PCI, it is done through pci glue, for everything else through platform driver
glue.
One downside: sa1111 does not use platform driver stuff, and does not have its
own shutdown hook, so no 'shutdown' is called for it now. I'm not sure if it
is really necessary on that platform, though.
Signed-off-by: Aleks Gorelov <dared1st@yahoo.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-08-09 00:24:08 +00:00
|
|
|
.shutdown = ehci_shutdown,
|
2006-01-20 21:53:38 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* managing i/o requests and associated device resources
|
|
|
|
*/
|
|
|
|
.urb_enqueue = ehci_urb_enqueue,
|
|
|
|
.urb_dequeue = ehci_urb_dequeue,
|
|
|
|
.endpoint_disable = ehci_endpoint_disable,
|
2009-05-27 22:21:56 +00:00
|
|
|
.endpoint_reset = ehci_endpoint_reset,
|
2006-01-20 21:53:38 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* scheduling support
|
|
|
|
*/
|
|
|
|
.get_frame_number = ehci_get_frame,
|
|
|
|
|
|
|
|
/*
|
|
|
|
* root hub support
|
|
|
|
*/
|
|
|
|
.hub_status_data = ehci_hub_status_data,
|
|
|
|
.hub_control = ehci_hub_control,
|
|
|
|
.bus_suspend = ehci_bus_suspend,
|
|
|
|
.bus_resume = ehci_bus_resume,
|
2011-04-18 20:02:00 +00:00
|
|
|
.start_port_reset = ehci_start_port_reset,
|
2007-11-21 20:28:14 +00:00
|
|
|
.relinquish_port = ehci_relinquish_port,
|
2008-05-20 20:58:29 +00:00
|
|
|
.port_handed_over = ehci_port_handed_over,
|
2009-06-29 14:47:30 +00:00
|
|
|
|
|
|
|
.clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
|
2006-01-20 21:53:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static int ehci_fsl_drv_probe(struct platform_device *pdev)
|
|
|
|
{
|
|
|
|
if (usb_disabled())
|
|
|
|
return -ENODEV;
|
|
|
|
|
2008-02-12 02:40:46 +00:00
|
|
|
/* FIXME we only want one one probe() not two */
|
2006-01-20 21:53:38 +00:00
|
|
|
return usb_hcd_fsl_probe(&ehci_fsl_hc_driver, pdev);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ehci_fsl_drv_remove(struct platform_device *pdev)
|
|
|
|
{
|
|
|
|
struct usb_hcd *hcd = platform_get_drvdata(pdev);
|
|
|
|
|
2008-02-12 02:40:46 +00:00
|
|
|
/* FIXME we only want one one remove() not two */
|
2006-01-20 21:53:38 +00:00
|
|
|
usb_hcd_fsl_remove(hcd, pdev);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-02-12 02:40:46 +00:00
|
|
|
MODULE_ALIAS("platform:fsl-ehci");
|
2006-01-20 21:53:38 +00:00
|
|
|
|
2006-04-11 15:07:16 +00:00
|
|
|
static struct platform_driver ehci_fsl_driver = {
|
2006-01-20 21:53:38 +00:00
|
|
|
.probe = ehci_fsl_drv_probe,
|
|
|
|
.remove = ehci_fsl_drv_remove,
|
USB: Properly unregister reboot notifier in case of failure in ehci hcd
If some problem occurs during ehci startup, for instance, request_irq fails,
echi hcd driver tries it best to cleanup, but fails to unregister reboot
notifier, which in turn leads to crash on reboot/poweroff.
The following patch resolves this problem by not using reboot notifiers
anymore, but instead making ehci/ohci driver get its own shutdown method. For
PCI, it is done through pci glue, for everything else through platform driver
glue.
One downside: sa1111 does not use platform driver stuff, and does not have its
own shutdown hook, so no 'shutdown' is called for it now. I'm not sure if it
is really necessary on that platform, though.
Signed-off-by: Aleks Gorelov <dared1st@yahoo.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-08-09 00:24:08 +00:00
|
|
|
.shutdown = usb_hcd_platform_shutdown,
|
2006-01-20 21:53:38 +00:00
|
|
|
.driver = {
|
2009-12-14 15:41:12 +00:00
|
|
|
.name = "fsl-ehci",
|
2013-05-10 16:48:23 +00:00
|
|
|
.owner = THIS_MODULE,
|
2009-12-14 15:41:12 +00:00
|
|
|
.pm = EHCI_FSL_PM_OPS,
|
2008-02-12 02:40:46 +00:00
|
|
|
},
|
2006-01-20 21:53:38 +00:00
|
|
|
};
|