forked from Minki/linux
1b36810e27
This patch (as1630) cleans up a few minor items resulting from the split-up of the ehci-hcd driver: Remove the product_desc string from the ehci_driver_overrides structure. All drivers will use the generic "EHCI Host Controller" string. (This was requested by Felipe Balbi.) Allow drivers to pass a NULL pointer to ehci_init_driver() if they don't have to override any settings. Remove a #define symbol that is no longer used from the ChipIdea host driver. Rename overrides to pci_overrides in ehci-pci.c, for consistency with ehci-platform.c. Mark the *_overrides structures as __initdata. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Reviewed-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
105 lines
2.3 KiB
C
105 lines
2.3 KiB
C
/*
|
|
* host.c - ChipIdea USB host controller driver
|
|
*
|
|
* Copyright (c) 2012 Intel Corporation
|
|
*
|
|
* Author: Alexander Shishkin
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* 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.
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/io.h>
|
|
#include <linux/usb.h>
|
|
#include <linux/usb/hcd.h>
|
|
#include <linux/usb/chipidea.h>
|
|
|
|
#include "../host/ehci.h"
|
|
|
|
#include "ci.h"
|
|
#include "bits.h"
|
|
#include "host.h"
|
|
|
|
static struct hc_driver __read_mostly ci_ehci_hc_driver;
|
|
|
|
static irqreturn_t host_irq(struct ci13xxx *ci)
|
|
{
|
|
return usb_hcd_irq(ci->irq, ci->hcd);
|
|
}
|
|
|
|
static int host_start(struct ci13xxx *ci)
|
|
{
|
|
struct usb_hcd *hcd;
|
|
struct ehci_hcd *ehci;
|
|
int ret;
|
|
|
|
if (usb_disabled())
|
|
return -ENODEV;
|
|
|
|
hcd = usb_create_hcd(&ci_ehci_hc_driver, ci->dev, dev_name(ci->dev));
|
|
if (!hcd)
|
|
return -ENOMEM;
|
|
|
|
dev_set_drvdata(ci->dev, ci);
|
|
hcd->rsrc_start = ci->hw_bank.phys;
|
|
hcd->rsrc_len = ci->hw_bank.size;
|
|
hcd->regs = ci->hw_bank.abs;
|
|
hcd->has_tt = 1;
|
|
|
|
hcd->power_budget = ci->platdata->power_budget;
|
|
hcd->phy = ci->transceiver;
|
|
|
|
ehci = hcd_to_ehci(hcd);
|
|
ehci->caps = ci->hw_bank.cap;
|
|
ehci->has_hostpc = ci->hw_bank.lpm;
|
|
|
|
ret = usb_add_hcd(hcd, 0, 0);
|
|
if (ret)
|
|
usb_put_hcd(hcd);
|
|
else
|
|
ci->hcd = hcd;
|
|
|
|
return ret;
|
|
}
|
|
|
|
static void host_stop(struct ci13xxx *ci)
|
|
{
|
|
struct usb_hcd *hcd = ci->hcd;
|
|
|
|
usb_remove_hcd(hcd);
|
|
usb_put_hcd(hcd);
|
|
}
|
|
|
|
int ci_hdrc_host_init(struct ci13xxx *ci)
|
|
{
|
|
struct ci_role_driver *rdrv;
|
|
|
|
if (!hw_read(ci, CAP_DCCPARAMS, DCCPARAMS_HC))
|
|
return -ENXIO;
|
|
|
|
rdrv = devm_kzalloc(ci->dev, sizeof(struct ci_role_driver), GFP_KERNEL);
|
|
if (!rdrv)
|
|
return -ENOMEM;
|
|
|
|
rdrv->start = host_start;
|
|
rdrv->stop = host_stop;
|
|
rdrv->irq = host_irq;
|
|
rdrv->name = "host";
|
|
ci->roles[CI_ROLE_HOST] = rdrv;
|
|
|
|
ehci_init_driver(&ci_ehci_hc_driver, NULL);
|
|
|
|
return 0;
|
|
}
|