// SPDX-License-Identifier: GPL-1.0+ /* * OHCI HCD (Host Controller Driver) for USB. * * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at> * (C) Copyright 2000-2005 David Brownell * (C) Copyright 2002 Hewlett-Packard Company * * OMAP Bus Glue * * Modified for OMAP by Tony Lindgren <tony@atomide.com> * Based on the 2.4 OMAP OHCI driver originally done by MontaVista Software Inc. * and on ohci-sa1111.c by Christopher Hoover <ch@hpl.hp.com> * * This file is licenced under the GPL.
*/
/* board-specific power switching and overcurrent support */ if (machine_is_omap_osk()) {
u32 rh = roothub_a (ohci);
/* power switching (ganged by default) */
rh &= ~RH_A_NPS;
/* TPS2045 switch for internal transceiver (port 1) */ if (machine_is_omap_osk()) {
ohci_to_hcd(ohci)->power_budget = 250;
rh &= ~RH_A_NOCP;
/* gpio9 for overcurrent detection */
omap_cfg_reg(W8_1610_GPIO9);
/* for paranoia's sake: disable USB.PUEN */
omap_cfg_reg(W4_USB_HIGHZ);
}
ohci_writel(ohci, rh, &ohci->regs->roothub.a);
ohci->flags &= ~OHCI_QUIRK_HUB_POWER;
} elseif (machine_is_nokia770()) { /* We require a self-powered hub, which should have
* plenty of power. */
ohci_to_hcd(ohci)->power_budget = 0;
}
/* FIXME hub_wq hub requests should manage power switching */ if (config->transceiver_power) return config->transceiver_power(1);
if (priv->power)
gpiod_set_value_cansleep(priv->power, 0);
/* board init will have already handled HMC and mux setup. * any external transceiver should already be initialized * too, so all configured ports use the right signaling now.
*/
/** * ohci_hcd_omap_probe - initialize OMAP-based HCDs * @pdev: USB controller to probe * * Context: task context, might sleep * * Allocates basic resources for this USB host controller, and * then invokes the start() method for the HCD associated with it * through the hotplug entry's driver_data.
*/ staticint ohci_hcd_omap_probe(struct platform_device *pdev)
{ int retval, irq; struct usb_hcd *hcd = 0; struct ohci_omap_priv *priv;
/* Obtain two optional GPIO lines */
priv->power = devm_gpiod_get_optional(&pdev->dev, "power", GPIOD_ASIS); if (IS_ERR(priv->power)) {
retval = PTR_ERR(priv->power); goto err_put_hcd;
} if (priv->power)
gpiod_set_consumer_name(priv->power, "OHCI power");
/* * This "overcurrent" GPIO line isn't really used in the code, * but has a designated hardware function. * TODO: implement proper overcurrent handling.
*/
priv->overcurrent = devm_gpiod_get_optional(&pdev->dev, "overcurrent",
GPIOD_IN); if (IS_ERR(priv->overcurrent)) {
retval = PTR_ERR(priv->overcurrent); goto err_put_hcd;
} if (priv->overcurrent)
gpiod_set_consumer_name(priv->overcurrent, "OHCI overcurrent");
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.