static irqreturn_t ehci_msp_irq(struct usb_hcd *hcd)
{
	u32 int_src;
	struct device *dev = hcd->self.controller;
	struct platform_device *pdev;
	struct mspusb_device *mdev;
	struct ehci_hcd	*ehci = hcd_to_ehci(hcd);
	
	pdev = to_platform_device(dev);
	mdev = to_mspusb_device(pdev);

	
	int_src = ehci_readl(ehci, &mdev->mab_regs->int_stat);
	if (int_src & (1 << pdev->id))
		return ehci_irq(hcd);

	
	return IRQ_NONE;
}
Beispiel #2
0
/*
 * Wrapper around the main ehci_irq.  Since both USB host controllers are
 * sharing the same IRQ, need to first determine whether we're the intended
 * recipient of this interrupt.
 */
static irqreturn_t ehci_msp_irq(struct usb_hcd *hcd)
{
    u32 int_src;
    struct device *dev = hcd->self.controller;
    struct platform_device *pdev;
    struct mspusb_device *mdev;
    struct ehci_hcd	*ehci = hcd_to_ehci(hcd);
    /* need to reverse-map a couple of containers to get our device */
    pdev = to_platform_device(dev);
    mdev = to_mspusb_device(pdev);

    /* Check to see if this interrupt is for this host controller */
    int_src = ehci_readl(ehci, &mdev->mab_regs->int_stat);
    if (int_src & (1 << pdev->id))
        return ehci_irq(hcd);

    /* Not for this device */
    return IRQ_NONE;
}
int usb_hcd_msp_probe(const struct hc_driver *driver,
			  struct platform_device *dev)
{
	int retval;
	struct usb_hcd *hcd;
	struct resource *res;
	struct ehci_hcd		*ehci ;

	hcd = usb_create_hcd(driver, &dev->dev, "pmcmsp");
	if (!hcd)
		return -ENOMEM;

	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
	if (res == NULL) {
		pr_debug("No IOMEM resource info for %s.\n", dev->name);
		retval = -ENOMEM;
		goto err1;
	}
	hcd->rsrc_start = res->start;
	hcd->rsrc_len = resource_size(res);
	if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, dev->name)) {
		retval = -EBUSY;
		goto err1;
	}
	hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len);
	if (!hcd->regs) {
		pr_debug("ioremap failed");
		retval = -ENOMEM;
		goto err2;
	}

	res = platform_get_resource(dev, IORESOURCE_IRQ, 0);
	if (res == NULL) {
		dev_err(&dev->dev, "No IRQ resource info for %s.\n", dev->name);
		retval = -ENOMEM;
		goto err3;
	}

	
	retval = usb_hcd_msp_map_regs(to_mspusb_device(dev));
	if (retval != 0)
		goto err3;

	ehci = hcd_to_ehci(hcd);
	ehci->big_endian_mmio = 1;
	ehci->big_endian_desc = 1;


	retval = usb_add_hcd(hcd, res->start, IRQF_SHARED);
	if (retval == 0)
		return 0;

	usb_remove_hcd(hcd);
err3:
	iounmap(hcd->regs);
err2:
	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
err1:
	usb_put_hcd(hcd);

	return retval;
}