2006-01-21 05:53:38 +08:00
|
|
|
/*
|
2009-12-14 23:41:12 +08:00
|
|
|
* Copyright 2005-2009 MontaVista Software, Inc.
|
|
|
|
* Copyright 2008 Freescale Semiconductor, Inc.
|
2006-01-21 05:53:38 +08: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 23:41:12 +08: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-21 05:53:38 +08:00
|
|
|
*/
|
|
|
|
|
2009-12-14 23:41:12 +08:00
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/delay.h>
|
|
|
|
#include <linux/pm.h>
|
2006-01-21 05:53:38 +08: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 23:41:05 +08:00
|
|
|
static int usb_hcd_fsl_probe(const struct hc_driver *driver,
|
|
|
|
struct platform_device *pdev)
|
2006-01-21 05:53:38 +08:00
|
|
|
{
|
|
|
|
struct fsl_usb2_platform_data *pdata;
|
|
|
|
struct usb_hcd *hcd;
|
|
|
|
struct resource *res;
|
|
|
|
int irq;
|
|
|
|
int retval;
|
|
|
|
unsigned int temp;
|
|
|
|
|
|
|
|
pr_debug("initializing FSL-SOC USB Controller\n");
|
|
|
|
|
|
|
|
/* Need platform data for setup */
|
|
|
|
pdata = (struct fsl_usb2_platform_data *)pdev->dev.platform_data;
|
|
|
|
if (!pdata) {
|
|
|
|
dev_err(&pdev->dev,
|
2008-05-02 12:02:41 +08:00
|
|
|
"No platform data for %s.\n", dev_name(&pdev->dev));
|
2006-01-21 05:53:38 +08: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 17:09:55 +08:00
|
|
|
(pdata->operating_mode == FSL_USB2_MPH_HOST) ||
|
|
|
|
(pdata->operating_mode == FSL_USB2_DR_OTG))) {
|
2006-01-21 05:53:38 +08:00
|
|
|
dev_err(&pdev->dev,
|
|
|
|
"Non Host Mode configured for %s. Wrong driver linked.\n",
|
2008-05-02 12:02:41 +08:00
|
|
|
dev_name(&pdev->dev));
|
2006-01-21 05:53:38 +08: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 12:02:41 +08:00
|
|
|
dev_name(&pdev->dev));
|
2006-01-21 05:53:38 +08:00
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
irq = res->start;
|
|
|
|
|
2008-05-02 12:02:41 +08:00
|
|
|
hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));
|
2006-01-21 05:53:38 +08: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 12:02:41 +08:00
|
|
|
dev_name(&pdev->dev));
|
2006-01-21 05:53:38 +08:00
|
|
|
retval = -ENODEV;
|
|
|
|
goto err2;
|
|
|
|
}
|
|
|
|
hcd->rsrc_start = res->start;
|
|
|
|
hcd->rsrc_len = res->end - res->start + 1;
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Enable USB controller */
|
|
|
|
temp = in_be32(hcd->regs + 0x500);
|
|
|
|
out_be32(hcd->regs + 0x500, temp | 0x4);
|
|
|
|
|
|
|
|
/* Set to Host mode */
|
|
|
|
temp = in_le32(hcd->regs + 0x1a8);
|
|
|
|
out_le32(hcd->regs + 0x1a8, temp | 0x3);
|
|
|
|
|
2007-12-07 03:47:08 +08:00
|
|
|
retval = usb_add_hcd(hcd, irq, IRQF_DISABLED | IRQF_SHARED);
|
2006-01-21 05:53:38 +08:00
|
|
|
if (retval != 0)
|
|
|
|
goto err4;
|
|
|
|
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 12:02:41 +08:00
|
|
|
dev_err(&pdev->dev, "init %s fail, %d\n", dev_name(&pdev->dev), retval);
|
2006-01-21 05:53:38 +08: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 23:41:05 +08:00
|
|
|
static void usb_hcd_fsl_remove(struct usb_hcd *hcd,
|
|
|
|
struct platform_device *pdev)
|
2006-01-21 05:53:38 +08:00
|
|
|
{
|
|
|
|
usb_remove_hcd(hcd);
|
|
|
|
iounmap(hcd->regs);
|
|
|
|
release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
|
|
|
|
usb_put_hcd(hcd);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void mpc83xx_setup_phy(struct ehci_hcd *ehci,
|
|
|
|
enum fsl_usb2_phy_modes phy_mode,
|
|
|
|
unsigned int port_offset)
|
|
|
|
{
|
2006-01-25 00:11:27 +08:00
|
|
|
u32 portsc = 0;
|
2006-01-21 05:53:38 +08:00
|
|
|
switch (phy_mode) {
|
|
|
|
case FSL_USB2_PHY_ULPI:
|
|
|
|
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:
|
|
|
|
portsc |= PORT_PTS_UTMI;
|
|
|
|
break;
|
|
|
|
case FSL_USB2_PHY_NONE:
|
|
|
|
break;
|
|
|
|
}
|
2006-12-15 03:54:08 +08:00
|
|
|
ehci_writel(ehci, portsc, &ehci->regs->port_status[port_offset]);
|
2006-01-21 05:53:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void mpc83xx_usb_setup(struct usb_hcd *hcd)
|
|
|
|
{
|
|
|
|
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
|
|
|
|
struct fsl_usb2_platform_data *pdata;
|
|
|
|
void __iomem *non_ehci = hcd->regs;
|
2007-05-11 17:09:55 +08:00
|
|
|
u32 temp;
|
2006-01-21 05:53:38 +08:00
|
|
|
|
|
|
|
pdata =
|
|
|
|
(struct fsl_usb2_platform_data *)hcd->self.controller->
|
|
|
|
platform_data;
|
|
|
|
/* Enable PHY interface in the control reg. */
|
2007-05-11 17:09:55 +08:00
|
|
|
temp = in_be32(non_ehci + FSL_SOC_USB_CTRL);
|
|
|
|
out_be32(non_ehci + FSL_SOC_USB_CTRL, temp | 0x00000004);
|
2006-01-21 05:53:38 +08:00
|
|
|
out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x0000001b);
|
|
|
|
|
2007-05-24 04:58:17 +08:00
|
|
|
#if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE)
|
|
|
|
/*
|
|
|
|
* Turn on cache snooping hardware, since some PowerPC platforms
|
|
|
|
* wholly rely on hardware to deal with cache coherent
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* 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);
|
|
|
|
#endif
|
|
|
|
|
2007-05-11 17:09:55 +08:00
|
|
|
if ((pdata->operating_mode == FSL_USB2_DR_HOST) ||
|
|
|
|
(pdata->operating_mode == FSL_USB2_DR_OTG))
|
2006-01-21 05:53:38 +08:00
|
|
|
mpc83xx_setup_phy(ehci, pdata->phy_mode, 0);
|
|
|
|
|
|
|
|
if (pdata->operating_mode == FSL_USB2_MPH_HOST) {
|
2006-01-21 05:57:52 +08: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-21 05:53:38 +08:00
|
|
|
if (pdata->port_enables & FSL_USB2_PORT0_ENABLED)
|
|
|
|
mpc83xx_setup_phy(ehci, pdata->phy_mode, 0);
|
|
|
|
if (pdata->port_enables & FSL_USB2_PORT1_ENABLED)
|
|
|
|
mpc83xx_setup_phy(ehci, pdata->phy_mode, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* put controller in host mode. */
|
2006-12-15 03:54:08 +08:00
|
|
|
ehci_writel(ehci, 0x00000003, non_ehci + FSL_SOC_USB_USBMODE);
|
2008-07-02 15:14:33 +08:00
|
|
|
#ifdef CONFIG_PPC_85xx
|
|
|
|
out_be32(non_ehci + FSL_SOC_USB_PRICTRL, 0x00000008);
|
|
|
|
out_be32(non_ehci + FSL_SOC_USB_AGECNTTHRSH, 0x00000080);
|
|
|
|
#else
|
2006-01-21 05:53:38 +08:00
|
|
|
out_be32(non_ehci + FSL_SOC_USB_PRICTRL, 0x0000000c);
|
|
|
|
out_be32(non_ehci + FSL_SOC_USB_AGECNTTHRSH, 0x00000040);
|
2008-07-02 15:14:33 +08:00
|
|
|
#endif
|
2006-01-21 05:53:38 +08:00
|
|
|
out_be32(non_ehci + FSL_SOC_USB_SICTRL, 0x00000001);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* called after powerup, by probe or system-pm "wakeup" */
|
|
|
|
static int ehci_fsl_reinit(struct ehci_hcd *ehci)
|
|
|
|
{
|
|
|
|
mpc83xx_usb_setup(ehci_to_hcd(ehci));
|
|
|
|
ehci_port_power(ehci, 0);
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
/* EHCI registers start at offset 0x100 */
|
|
|
|
ehci->caps = hcd->regs + 0x100;
|
|
|
|
ehci->regs = hcd->regs + 0x100 +
|
2006-12-15 03:54:08 +08:00
|
|
|
HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase));
|
2006-01-21 05:53:38 +08:00
|
|
|
dbg_hcs_params(ehci, "reset");
|
|
|
|
dbg_hcc_params(ehci, "reset");
|
|
|
|
|
|
|
|
/* cache this readonly data; minimize chip reads */
|
2006-12-15 03:54:08 +08:00
|
|
|
ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
|
2006-01-21 05:53:38 +08:00
|
|
|
|
|
|
|
retval = ehci_halt(ehci);
|
|
|
|
if (retval)
|
|
|
|
return retval;
|
|
|
|
|
|
|
|
/* data structure init */
|
|
|
|
retval = ehci_init(hcd);
|
|
|
|
if (retval)
|
|
|
|
return retval;
|
|
|
|
|
2008-05-21 04:58:11 +08:00
|
|
|
hcd->has_tt = 1;
|
2006-01-21 05:53:38 +08:00
|
|
|
|
|
|
|
ehci->sbrn = 0x20;
|
|
|
|
|
|
|
|
ehci_reset(ehci);
|
|
|
|
|
|
|
|
retval = ehci_fsl_reinit(ehci);
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2009-12-14 23:41:12 +08: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
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2010-05-13 06:21:35 +08:00
|
|
|
ehci_prepare_ports_for_controller_suspend(hcd_to_ehci(hcd));
|
2009-12-14 23:41:12 +08: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;
|
|
|
|
|
2010-05-13 06:21:35 +08:00
|
|
|
ehci_prepare_ports_for_controller_resume(ehci);
|
2009-12-14 23:41:12 +08: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 */
|
|
|
|
|
2006-01-21 05:53:38 +08:00
|
|
|
static const struct hc_driver ehci_fsl_hc_driver = {
|
|
|
|
.description = hcd_name,
|
|
|
|
.product_desc = "Freescale On-Chip EHCI Host Controller",
|
2009-12-14 23:41:12 +08:00
|
|
|
.hcd_priv_size = sizeof(struct ehci_fsl),
|
2006-01-21 05:53:38 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* generic hardware linkage
|
|
|
|
*/
|
|
|
|
.irq = ehci_irq,
|
|
|
|
.flags = HCD_USB2,
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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 08:24:08 +08:00
|
|
|
.shutdown = ehci_shutdown,
|
2006-01-21 05:53:38 +08: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-28 06:21:56 +08:00
|
|
|
.endpoint_reset = ehci_endpoint_reset,
|
2006-01-21 05:53:38 +08: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,
|
2007-11-22 04:28:14 +08:00
|
|
|
.relinquish_port = ehci_relinquish_port,
|
2008-05-21 04:58:29 +08:00
|
|
|
.port_handed_over = ehci_port_handed_over,
|
2009-06-29 22:47:30 +08:00
|
|
|
|
|
|
|
.clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
|
2006-01-21 05:53:38 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static int ehci_fsl_drv_probe(struct platform_device *pdev)
|
|
|
|
{
|
|
|
|
if (usb_disabled())
|
|
|
|
return -ENODEV;
|
|
|
|
|
2008-02-12 10:40:46 +08:00
|
|
|
/* FIXME we only want one one probe() not two */
|
2006-01-21 05:53:38 +08: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 10:40:46 +08:00
|
|
|
/* FIXME we only want one one remove() not two */
|
2006-01-21 05:53:38 +08:00
|
|
|
usb_hcd_fsl_remove(hcd, pdev);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-02-12 10:40:46 +08:00
|
|
|
MODULE_ALIAS("platform:fsl-ehci");
|
2006-01-21 05:53:38 +08:00
|
|
|
|
2006-04-11 23:07:16 +08:00
|
|
|
static struct platform_driver ehci_fsl_driver = {
|
2006-01-21 05:53:38 +08: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 08:24:08 +08:00
|
|
|
.shutdown = usb_hcd_platform_shutdown,
|
2006-01-21 05:53:38 +08:00
|
|
|
.driver = {
|
2009-12-14 23:41:12 +08:00
|
|
|
.name = "fsl-ehci",
|
|
|
|
.pm = EHCI_FSL_PM_OPS,
|
2008-02-12 10:40:46 +08:00
|
|
|
},
|
2006-01-21 05:53:38 +08:00
|
|
|
};
|