cregit-Linux how code gets into the kernel

Release 4.8 drivers/usb/dwc3/host.c

Directory: drivers/usb/dwc3
/**
 * host.c - DesignWare USB3 DRD Controller Host Glue
 *
 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com
 *
 * Authors: Felipe Balbi <balbi@ti.com>,
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2  of
 * the License 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.
 */

#include <linux/platform_device.h>

#include "core.h"


int dwc3_host_init(struct dwc3 *dwc) { struct property_entry props[2]; struct platform_device *xhci; int ret, irq; struct resource *res; struct platform_device *dwc3_pdev = to_platform_device(dwc->dev); irq = platform_get_irq_byname(dwc3_pdev, "host"); if (irq == -EPROBE_DEFER) return irq; if (irq <= 0) { irq = platform_get_irq_byname(dwc3_pdev, "dwc_usb3"); if (irq == -EPROBE_DEFER) return irq; if (irq <= 0) { irq = platform_get_irq(dwc3_pdev, 0); if (irq <= 0) { if (irq != -EPROBE_DEFER) { dev_err(dwc->dev, "missing host IRQ\n"); } if (!irq) irq = -EINVAL; return irq; } else { res = platform_get_resource(dwc3_pdev, IORESOURCE_IRQ, 0); } } else { res = platform_get_resource_byname(dwc3_pdev, IORESOURCE_IRQ, "dwc_usb3"); } } else { res = platform_get_resource_byname(dwc3_pdev, IORESOURCE_IRQ, "host"); } dwc->xhci_resources[1].start = irq; dwc->xhci_resources[1].end = irq; dwc->xhci_resources[1].flags = res->flags; dwc->xhci_resources[1].name = res->name; xhci = platform_device_alloc("xhci-hcd", PLATFORM_DEVID_AUTO); if (!xhci) { dev_err(dwc->dev, "couldn't allocate xHCI device\n"); return -ENOMEM; } dma_set_coherent_mask(&xhci->dev, dwc->dev->coherent_dma_mask); xhci->dev.parent = dwc->dev; xhci->dev.dma_mask = dwc->dev->dma_mask; xhci->dev.dma_parms = dwc->dev->dma_parms; dwc->xhci = xhci; ret = platform_device_add_resources(xhci, dwc->xhci_resources, DWC3_XHCI_RESOURCES_NUM); if (ret) { dev_err(dwc->dev, "couldn't add resources to xHCI device\n"); goto err1; } memset(props, 0, sizeof(struct property_entry) * ARRAY_SIZE(props)); if (dwc->usb3_lpm_capable) { props[0].name = "usb3-lpm-capable"; ret = platform_device_add_properties(xhci, props); if (ret) { dev_err(dwc->dev, "failed to add properties to xHCI\n"); goto err1; } } phy_create_lookup(dwc->usb2_generic_phy, "usb2-phy", dev_name(&xhci->dev)); phy_create_lookup(dwc->usb3_generic_phy, "usb3-phy", dev_name(&xhci->dev)); ret = platform_device_add(xhci); if (ret) { dev_err(dwc->dev, "failed to register xHCI device\n"); goto err2; } return 0; err2: phy_remove_lookup(dwc->usb2_generic_phy, "usb2-phy", dev_name(&xhci->dev)); phy_remove_lookup(dwc->usb3_generic_phy, "usb3-phy", dev_name(&xhci->dev)); err1: platform_device_put(xhci); return ret; }

Contributors

PersonTokensPropCommitsCommitProp
roger quadrosroger quadros21140.58%111.11%
felipe balbifelipe balbi16231.15%222.22%
heikki krogerusheikki krogerus10420.00%222.22%
pratyush anandpratyush anand356.73%111.11%
ido shayevitzido shayevitz40.77%111.11%
robert baldygarobert baldyga30.58%111.11%
vivek gautamvivek gautam10.19%111.11%
Total520100.00%9100.00%


void dwc3_host_exit(struct dwc3 *dwc) { phy_remove_lookup(dwc->usb2_generic_phy, "usb2-phy", dev_name(&dwc->xhci->dev)); phy_remove_lookup(dwc->usb3_generic_phy, "usb3-phy", dev_name(&dwc->xhci->dev)); platform_device_unregister(dwc->xhci); }

Contributors

PersonTokensPropCommitsCommitProp
heikki krogerusheikki krogerus3869.09%150.00%
felipe balbifelipe balbi1730.91%150.00%
Total55100.00%2100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
roger quadrosroger quadros21136.25%110.00%
felipe balbifelipe balbi18631.96%330.00%
heikki krogerusheikki krogerus14224.40%220.00%
pratyush anandpratyush anand356.01%110.00%
ido shayevitzido shayevitz40.69%110.00%
robert baldygarobert baldyga30.52%110.00%
vivek gautamvivek gautam10.17%110.00%
Total582100.00%10100.00%
Directory: drivers/usb/dwc3
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.