您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ usb_add_hcd函数代码示例

51自学网 2021-06-03 09:18:43
  C++
这篇教程C++ usb_add_hcd函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中usb_add_hcd函数的典型用法代码示例。如果您正苦于以下问题:C++ usb_add_hcd函数的具体用法?C++ usb_add_hcd怎么用?C++ usb_add_hcd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了usb_add_hcd函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ehci_octeon_drv_probe

static int ehci_octeon_drv_probe(struct platform_device *pdev){	struct usb_hcd *hcd;	struct ehci_hcd *ehci;	struct resource *res_mem;	int irq;	int ret;	if (usb_disabled())		return -ENODEV;	irq = platform_get_irq(pdev, 0);	if (irq < 0) {		dev_err(&pdev->dev, "No irq assigned/n");		return -ENODEV;	}	res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);	if (res_mem == NULL) {		dev_err(&pdev->dev, "No register space assigned/n");		return -ENODEV;	}	/*	 * We can DMA from anywhere. But the descriptors must be in	 * the lower 4GB.	 */	pdev->dev.dma_mask = &ehci_octeon_dma_mask;	ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));	if (ret)		return ret;	hcd = usb_create_hcd(&ehci_octeon_hc_driver, &pdev->dev, "octeon");	if (!hcd)		return -ENOMEM;	hcd->rsrc_start = res_mem->start;	hcd->rsrc_len = resource_size(res_mem);	hcd->regs = devm_ioremap_resource(&pdev->dev, res_mem);	if (IS_ERR(hcd->regs)) {		ret = PTR_ERR(hcd->regs);		goto err1;	}	ehci_octeon_start();	ehci = hcd_to_ehci(hcd);	/* Octeon EHCI matches CPU endianness. */#ifdef __BIG_ENDIAN	ehci->big_endian_mmio = 1;#endif	ehci->caps = hcd->regs;	ret = usb_add_hcd(hcd, irq, IRQF_SHARED);	if (ret) {		dev_dbg(&pdev->dev, "failed to add hcd with err %d/n", ret);		goto err2;	}	device_wakeup_enable(hcd->self.controller);	platform_set_drvdata(pdev, hcd);	return 0;err2:	ehci_octeon_stop();err1:	usb_put_hcd(hcd);	return ret;}
开发者ID:3null,项目名称:linux,代码行数:73,


示例2: usb_hcd_omap_probe

/** * usb_hcd_omap_probe - initialize OMAP-based HCDs * Context: !in_interrupt() * * 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. */static int usb_hcd_omap_probe (const struct hc_driver *driver,			  struct platform_device *pdev){	int retval, irq;	struct usb_hcd *hcd = 0;	struct ohci_hcd *ohci;	if (pdev->num_resources != 2) {		printk(KERN_ERR "hcd probe: invalid num_resources: %i/n",		       pdev->num_resources);		return -ENODEV;	}	if (pdev->resource[0].flags != IORESOURCE_MEM			|| pdev->resource[1].flags != IORESOURCE_IRQ) {		printk(KERN_ERR "hcd probe: invalid resource type/n");		return -ENODEV;	}	usb_host_ck = clk_get(0, "usb_hhc_ck");	if (IS_ERR(usb_host_ck))		return PTR_ERR(usb_host_ck);	if (!cpu_is_omap1510())		usb_dc_ck = clk_get(0, "usb_dc_ck");	else		usb_dc_ck = clk_get(0, "lb_ck");	if (IS_ERR(usb_dc_ck)) {		clk_put(usb_host_ck);		return PTR_ERR(usb_dc_ck);	}	hcd = usb_create_hcd (driver, &pdev->dev, pdev->dev.bus_id);	if (!hcd) {		retval = -ENOMEM;		goto err0;	}	hcd->rsrc_start = pdev->resource[0].start;	hcd->rsrc_len = pdev->resource[0].end - pdev->resource[0].start + 1;	if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {		dev_dbg(&pdev->dev, "request_mem_region failed/n");		retval = -EBUSY;		goto err1;	}	hcd->regs = (void __iomem *) (int) IO_ADDRESS(hcd->rsrc_start);	ohci = hcd_to_ohci(hcd);	ohci_hcd_init(ohci);	host_initialized = 0;	host_enabled = 1;	irq = platform_get_irq(pdev, 0);	if (irq < 0) {		retval = -ENXIO;		goto err2;	}	retval = usb_add_hcd(hcd, irq, IRQF_DISABLED);	if (retval)		goto err2;	host_initialized = 1;	if (!host_enabled)		omap_ohci_clock_power(0);	return 0;err2:	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);err1:	usb_put_hcd(hcd);err0:	clk_put(usb_dc_ck);	clk_put(usb_host_ck);	return retval;}
开发者ID:mikuhatsune001,项目名称:linux-2.6,代码行数:88,


示例3: ehci_xls_probe_internal

int ehci_xls_probe_internal(const struct hc_driver *driver,	struct platform_device *pdev){	struct usb_hcd  *hcd;	struct resource *res;	int retval, irq;		irq = platform_get_irq(pdev, 0);	if (irq < 0) {		dev_err(&pdev->dev, "Found HC with no IRQ. Check %s setup!/n",				dev_name(&pdev->dev));		return -ENODEV;	}		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);	if (!res) {		dev_err(&pdev->dev, "Error: MMIO Handle %s setup!/n",				dev_name(&pdev->dev));		return -ENODEV;	}	hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));	if (!hcd) {		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,				driver->description)) {		dev_dbg(&pdev->dev, "controller already in use/n");		retval = -EBUSY;		goto err2;	}	hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len);	if (hcd->regs == NULL) {		dev_dbg(&pdev->dev, "error mapping memory/n");		retval = -EFAULT;		goto err3;	}	retval = usb_add_hcd(hcd, irq, IRQF_SHARED);	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:	dev_err(&pdev->dev, "init %s fail, %d/n", dev_name(&pdev->dev),			retval);	return retval;}
开发者ID:MiniBlu,项目名称:cm11_kernel_htc_msm8974a3ul,代码行数:61,


示例4: ehci_hcd_xilinx_of_probe

/** * ehci_hcd_xilinx_of_probe - Probe method for the USB host controller * @op:		pointer to the platform_device bound to the host controller * * This function requests resources and sets up appropriate properties for the * host controller. Because the Xilinx USB host controller can be configured * as HS only or HS/FS only, it checks the configuration in the device tree * entry, and sets an appropriate value for hcd->has_tt. */static int __devinit ehci_hcd_xilinx_of_probe(struct platform_device *op){	struct device_node *dn = op->dev.of_node;	struct usb_hcd *hcd;	struct ehci_hcd	*ehci;	struct resource res;	int irq;	int rv;	int *value;	if (usb_disabled())		return -ENODEV;	dev_dbg(&op->dev, "initializing XILINX-OF USB Controller/n");	rv = of_address_to_resource(dn, 0, &res);	if (rv)		return rv;	hcd = usb_create_hcd(&ehci_xilinx_of_hc_driver, &op->dev,				"XILINX-OF USB");	if (!hcd)		return -ENOMEM;	hcd->rsrc_start = res.start;	hcd->rsrc_len = res.end - res.start + 1;	if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {		printk(KERN_ERR "%s: request_mem_region failed/n", __FILE__);		rv = -EBUSY;		goto err_rmr;	}	irq = irq_of_parse_and_map(dn, 0);	if (irq == NO_IRQ) {		printk(KERN_ERR "%s: irq_of_parse_and_map failed/n", __FILE__);		rv = -EBUSY;		goto err_irq;	}	hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);	if (!hcd->regs) {		printk(KERN_ERR "%s: ioremap failed/n", __FILE__);		rv = -ENOMEM;		goto err_ioremap;	}	ehci = hcd_to_ehci(hcd);	/* This core always has big-endian register interface and uses	 * big-endian memory descriptors.	 */	ehci->big_endian_mmio = 1;	ehci->big_endian_desc = 1;	/* Check whether the FS support option is selected in the hardware.	 */	value = (int *)of_get_property(dn, "xlnx,support-usb-fs", NULL);	if (value && (*value == 1)) {		ehci_dbg(ehci, "USB host controller supports FS devices/n");		hcd->has_tt = 1;	} else {		ehci_dbg(ehci,			"USB host controller is HS only/n");		hcd->has_tt = 0;	}	/* Debug registers are at the first 0x100 region	 */	ehci->caps = hcd->regs + 0x100;	ehci->regs = hcd->regs + 0x100 +		HC_LENGTH(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase));	/* cache this readonly data; minimize chip reads */	ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);	rv = usb_add_hcd(hcd, irq, 0);	if (rv == 0)		return 0;	iounmap(hcd->regs);err_ioremap:err_irq:	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);err_rmr:	usb_put_hcd(hcd);	return rv;}
开发者ID:119-org,项目名称:hi3518-osdrv,代码行数:99,


示例5: ehci_octeon_drv_probe

static int ehci_octeon_drv_probe(struct platform_device *pdev){	struct usb_hcd *hcd;	struct ehci_hcd *ehci;	struct resource *res_mem;	int irq;	int ret;	if (usb_disabled())		return -ENODEV;	irq = platform_get_irq(pdev, 0);	if (irq < 0) {		dev_err(&pdev->dev, "No irq assigned/n");		return -ENODEV;	}	res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);	if (res_mem == NULL) {		dev_err(&pdev->dev, "No register space assigned/n");		return -ENODEV;	}	/*	 * We can DMA from anywhere. But the descriptors must be in	 * the lower 4GB.	 */	pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);	pdev->dev.dma_mask = &ehci_octeon_dma_mask;	hcd = usb_create_hcd(&ehci_octeon_hc_driver, &pdev->dev, "octeon");	if (!hcd)		return -ENOMEM;	hcd->rsrc_start = res_mem->start;	hcd->rsrc_len = res_mem->end - res_mem->start + 1;	if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len,				OCTEON_EHCI_HCD_NAME)) {		dev_err(&pdev->dev, "request_mem_region failed/n");		ret = -EBUSY;		goto err1;	}	hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);	if (!hcd->regs) {		dev_err(&pdev->dev, "ioremap failed/n");		ret = -ENOMEM;		goto err2;	}	ehci_octeon_start();	ehci = hcd_to_ehci(hcd);	/* Octeon EHCI matches CPU endianness. */#ifdef __BIG_ENDIAN	ehci->big_endian_mmio = 1;#endif	ehci->caps = hcd->regs;	ehci->regs = hcd->regs +		HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase));	/* cache this readonly data; minimize chip reads */	ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);	ret = usb_add_hcd(hcd, irq, IRQF_DISABLED | IRQF_SHARED);	if (ret) {		dev_dbg(&pdev->dev, "failed to add hcd with err %d/n", ret);		goto err3;	}	platform_set_drvdata(pdev, hcd);	/* root ports should always stay powered */	ehci_port_power(ehci, 1);	return 0;err3:	ehci_octeon_stop();	iounmap(hcd->regs);err2:	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);err1:	usb_put_hcd(hcd);	return ret;}
开发者ID:ANFS,项目名称:ANFS-kernel,代码行数:88,


示例6: xhci_mtk_probe

//.........这里部分代码省略.........		dma_set_mask(dev, DMA_BIT_MASK(32));	hcd = usb_create_hcd(driver, dev, dev_name(dev));	if (!hcd) {		ret = -ENOMEM;		goto disable_clk;	}	/*	 * USB 2.0 roothub is stored in the platform_device.	 * Swap it with mtk HCD.	 */	mtk->hcd = platform_get_drvdata(pdev);	platform_set_drvdata(pdev, mtk);	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);	hcd->regs = devm_ioremap_resource(dev, res);	if (IS_ERR(hcd->regs)) {		ret = PTR_ERR(hcd->regs);		goto put_usb2_hcd;	}	hcd->rsrc_start = res->start;	hcd->rsrc_len = resource_size(res);	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);	mtk->ippc_regs = devm_ioremap_resource(dev, res);	if (IS_ERR(mtk->ippc_regs)) {		ret = PTR_ERR(mtk->ippc_regs);		goto put_usb2_hcd;	}	for (phy_num = 0; phy_num < mtk->num_phys; phy_num++) {		phy = devm_of_phy_get_by_index(dev, node, phy_num);		if (IS_ERR(phy)) {			ret = PTR_ERR(phy);			goto put_usb2_hcd;		}		mtk->phys[phy_num] = phy;	}	ret = xhci_mtk_phy_init(mtk);	if (ret)		goto put_usb2_hcd;	ret = xhci_mtk_phy_power_on(mtk);	if (ret)		goto exit_phys;	device_init_wakeup(dev, true);	xhci = hcd_to_xhci(hcd);	xhci->main_hcd = hcd;	xhci->shared_hcd = usb_create_shared_hcd(driver, dev,			dev_name(dev), hcd);	if (!xhci->shared_hcd) {		ret = -ENOMEM;		goto power_off_phys;	}	if (HCC_MAX_PSA(xhci->hcc_params) >= 4)		xhci->shared_hcd->can_do_streams = 1;	ret = usb_add_hcd(hcd, irq, IRQF_SHARED);	if (ret)		goto put_usb3_hcd;	ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);	if (ret)		goto dealloc_usb2_hcd;	return 0;dealloc_usb2_hcd:	usb_remove_hcd(hcd);put_usb3_hcd:	xhci_mtk_sch_exit(mtk);	usb_put_hcd(xhci->shared_hcd);power_off_phys:	xhci_mtk_phy_power_off(mtk);	device_init_wakeup(dev, false);exit_phys:	xhci_mtk_phy_exit(mtk);put_usb2_hcd:	usb_put_hcd(hcd);disable_clk:	xhci_mtk_clks_disable(mtk);disable_ldos:	xhci_mtk_ldos_disable(mtk);disable_pm:	pm_runtime_put_sync(dev);	pm_runtime_disable(dev);	return ret;}
开发者ID:SkyRzn,项目名称:xhci,代码行数:101,


示例7: spear_ehci_hcd_drv_probe

static int spear_ehci_hcd_drv_probe(struct platform_device *pdev){    struct usb_hcd *hcd ;    struct spear_ehci *ehci;    struct resource *res;    struct clk *usbh_clk;    const struct hc_driver *driver = &ehci_spear_hc_driver;    int *pdata = pdev->dev.platform_data;    int irq, retval;    char clk_name[20] = "usbh_clk";    if (pdata == NULL)        return -EFAULT;    if (usb_disabled())        return -ENODEV;    irq = platform_get_irq(pdev, 0);    if (irq < 0) {        retval = irq;        goto fail_irq_get;    }    if (*pdata >= 0)        sprintf(clk_name, "usbh.%01d_clk", *pdata);    usbh_clk = clk_get(NULL, clk_name);    if (IS_ERR(usbh_clk)) {        dev_err(&pdev->dev, "Error getting interface clock/n");        retval = PTR_ERR(usbh_clk);        goto fail_get_usbh_clk;    }    hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));    if (!hcd) {        retval = -ENOMEM;        goto fail_create_hcd;    }    res = platform_get_resource(pdev, IORESOURCE_MEM, 0);    if (!res) {        retval = -ENODEV;        goto fail_request_resource;    }    hcd->rsrc_start = res->start;    hcd->rsrc_len = resource_size(res);    if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len,                            driver->description)) {        retval = -EBUSY;        goto fail_request_resource;    }    hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);    if (hcd->regs == NULL) {        dev_dbg(&pdev->dev, "error mapping memory/n");        retval = -ENOMEM;        goto fail_ioremap;    }    ehci = (struct spear_ehci *)hcd_to_ehci(hcd);    ehci->clk = usbh_clk;    spear_start_ehci(ehci);    retval = usb_add_hcd(hcd, irq, IRQF_SHARED);    if (retval)        goto fail_add_hcd;    return retval;fail_add_hcd:    spear_stop_ehci(ehci);    iounmap(hcd->regs);fail_ioremap:    release_mem_region(hcd->rsrc_start, hcd->rsrc_len);fail_request_resource:    usb_put_hcd(hcd);fail_create_hcd:    clk_put(usbh_clk);fail_get_usbh_clk:fail_irq_get:    dev_err(&pdev->dev, "init fail, %d/n", retval);    return retval ;}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:85,


示例8: usb_ehci_ar9130_probe

int usb_ehci_ar9130_probe(struct hc_driver *driver,        struct usb_hcd **hcd_out,        struct platform_device *pdev){    struct usb_hcd *hcd;    int ret;    struct ehci_hcd *ehci;    ar9130_debug_dev("No of Resources %d /n",pdev->num_resources);    /* Verify the Host Mode of the Driver */    if (pdev->resource[1].flags != IORESOURCE_IRQ) {        printk ("resource[1] is not IORESOURCE_IRQ");        ret = -ENOMEM;    }    hcd = usb_create_hcd(driver,&pdev->dev,pdev->dev.bus_id);    if(!hcd){        ret = -ENOMEM;        goto err;    }    hcd->rsrc_start = pdev->resource[0].start;    hcd->rsrc_len   = pdev->resource[0].end - pdev->resource[0].start + 1;    if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len,                driver->description)) {        dev_dbg(&pdev->dev, "controller already in use/n");        ret = -EBUSY;        goto err1;    }    hcd->regs = ioremap(hcd->rsrc_start,hcd->rsrc_len);    if(hcd->regs == NULL){        dev_dbg(&pdev->dev,"error mapping memory /n");        ret = -EFAULT;        goto err2;    }    /* EHCI Register offset 0x100 - Info from ChipIdea */    ehci =hcd_to_ehci(hcd);    ehci->caps = hcd->regs + 0x100;     /* Device/Host Capa Reg*/    ehci->regs = hcd->regs + 0x140;     /* Device/Host Oper Reg*/    ar9130_debug_dev("hcd->regs %p /n",hcd->regs);    ar9130_debug_dev("Host Capability Reg %p /n",ehci->caps);    ar9130_debug_dev("Host Operational Reg %p /n",ehci->regs);	/* Added 5_29_07 */	ar9130_reg_rmw_set(AR9130_RESET,AR9130_RESET_USBSUS_OVRIDE);	mdelay(10);		ar9130_reg_wr(AR9130_RESET,((ar9130_reg_rd(AR9130_RESET) & ~(AR9130_RESET_USB_HOST)) |							   AR9130_RESET_USBSUS_OVRIDE));    mdelay(10);	ar9130_reg_wr(AR9130_RESET,((ar9130_reg_rd(AR9130_RESET) & ~(AR9130_RESET_USB_PHY)) |							   AR9130_RESET_USBSUS_OVRIDE));    mdelay(10);    printk("Port Status %x /n",readl(&ehci->regs->port_status[0])); // 26thFeb    ret = usb_add_hcd(hcd,pdev->resource[1].start,SA_INTERRUPT | SA_SHIRQ);	    if(ret != 0){        goto err3;    }    return ret;err3:    iounmap(hcd->regs);err2:    release_mem_region(hcd->rsrc_start,hcd->rsrc_len);err1:    usb_put_hcd(hcd);err:    dev_err(&pdev->dev,"init %s fail, %d /n",pdev->dev.bus_id,ret);    return ret;}
开发者ID:BackupTheBerlios,项目名称:tew632-brp-svn,代码行数:81,


示例9: usb_otg_ar9130_probe

int usb_otg_ar9130_probe(struct hc_driver *driver){    struct ar9130_otg *ar9130_otg;    struct usb_hcd *hcd;    struct ehci_hcd *ehci;    struct device *dev;    int ret;    ar9130_otg = ar9130_get_otg();    if (ar9130_otg == NULL) {        return -EINVAL;    }    dev = ar9130_otg->dev;    hcd = usb_create_hcd(driver, dev, dev->bus_id);    if(!hcd){        ret = -ENOMEM;        goto err;    }    hcd->rsrc_start = 0;    hcd->rsrc_len   = 0;    hcd->regs = ar9130_otg->reg_base;    if(hcd->regs == NULL){        dev_dbg(dev,"error mapping memory /n");        ret = -EFAULT;        goto err1;    }    /* EHCI Register offset 0x100 - Info from ChipIdea */    ehci = hcd_to_ehci(hcd);    ehci->caps = hcd->regs + 0x100;     /* Device/Host Capa Reg*/    ehci->regs = hcd->regs + 0x140;     /* Device/Host Oper Reg*/    ar9130_otg->ehci = ehci; /* Temp To Test HNP */    printk("hcd->regs %p, %p /n", hcd, hcd->regs);    printk("Host Capability Reg %p /n",ehci->caps);    printk("Host Operational Reg %p /n",ehci->regs);    ehci->transceiver = &ar9130_otg->otg;    printk ("usb_add_hcd/n");    ret = usb_add_hcd(hcd, 0, 0);    if(ret != 0){        goto err1;    }    dev_set_drvdata(dev, hcd);    ehci_hc_ar9130_driver.irq = ehci_irq;    ret = ar9130_start_hc(ehci, dev);    if (ret != 0) {        goto err1;    }    return ret;err1:    usb_put_hcd(hcd);err:    dev_err(dev,"init %s fail, %d /n", dev->bus_id, ret);    return ret;}
开发者ID:BackupTheBerlios,项目名称:tew632-brp-svn,代码行数:63,


示例10: uhci_hcd_grlib_probe

static int __devinit uhci_hcd_grlib_probe(struct platform_device *op){	struct device_node *dn = op->dev.of_node;	struct usb_hcd *hcd;	struct uhci_hcd	*uhci = NULL;	struct resource res;	int irq;	int rv;	if (usb_disabled())		return -ENODEV;	dev_dbg(&op->dev, "initializing GRUSBHC UHCI USB Controller/n");	rv = of_address_to_resource(dn, 0, &res);	if (rv)		return rv;	/* usb_create_hcd requires dma_mask != NULL */	op->dev.dma_mask = &op->dev.coherent_dma_mask;	hcd = usb_create_hcd(&uhci_grlib_hc_driver, &op->dev,			"GRUSBHC UHCI USB");	if (!hcd)		return -ENOMEM;	hcd->rsrc_start = res.start;	hcd->rsrc_len = resource_size(&res);	if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {		printk(KERN_ERR "%s: request_mem_region failed/n", __FILE__);		rv = -EBUSY;		goto err_rmr;	}	irq = irq_of_parse_and_map(dn, 0);	if (irq == NO_IRQ) {		printk(KERN_ERR "%s: irq_of_parse_and_map failed/n", __FILE__);		rv = -EBUSY;		goto err_irq;	}	hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);	if (!hcd->regs) {		printk(KERN_ERR "%s: ioremap failed/n", __FILE__);		rv = -ENOMEM;		goto err_ioremap;	}	uhci = hcd_to_uhci(hcd);	uhci->regs = hcd->regs;	rv = usb_add_hcd(hcd, irq, 0);	if (rv)		goto err_uhci;	return 0;err_uhci:	iounmap(hcd->regs);err_ioremap:	irq_dispose_mapping(irq);err_irq:	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);err_rmr:	usb_put_hcd(hcd);	return rv;}
开发者ID:0xroot,项目名称:Blackphone-BP1-Kernel,代码行数:69,


示例11: host_start

static int host_start(struct ci_hdrc *ci){	struct usb_hcd *hcd;	struct ehci_hcd *ehci;	struct ehci_ci_priv *priv;	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->tpl_support = ci->platdata->tpl_support;	if (ci->phy)		hcd->phy = ci->phy;	else		hcd->usb_phy = ci->usb_phy;	ehci = hcd_to_ehci(hcd);	ehci->caps = ci->hw_bank.cap;	ehci->has_hostpc = ci->hw_bank.lpm;	ehci->has_tdi_phy_lpm = ci->hw_bank.lpm;	ehci->imx28_write_fix = ci->imx28_write_fix;	priv = (struct ehci_ci_priv *)ehci->priv;	priv->reg_vbus = NULL;	if (ci->platdata->reg_vbus)		priv->reg_vbus = ci->platdata->reg_vbus;	ret = usb_add_hcd(hcd, 0, 0);	if (ret) {		goto put_hcd;	} else {		struct usb_otg *otg = &ci->otg;		ci->hcd = hcd;		if (ci_otg_is_fsm_mode(ci)) {			otg->host = &hcd->self;			hcd->self.otg_port = 1;		}	}	if (ci->platdata->flags & CI_HDRC_DISABLE_STREAMING)		hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS);	return ret;put_hcd:	usb_put_hcd(hcd);	return ret;}
开发者ID:Sangil-Lee,项目名称:ZynqFPGA,代码行数:63,


示例12: usb_hcd_s3c2410_probe

/** * usb_hcd_s3c2410_probe - initialize S3C2410-based HCDs * Context: !in_interrupt() * * 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. * */static int usb_hcd_s3c2410_probe(const struct hc_driver *driver,				  struct platform_device *dev){	struct usb_hcd *hcd = NULL;	int retval;	s3c2410_usb_set_power(dev->dev.platform_data, 1, 1);	s3c2410_usb_set_power(dev->dev.platform_data, 2, 1);	hcd = usb_create_hcd(driver, &dev->dev, "s3c24xx");	if (hcd == NULL)		return -ENOMEM;	hcd->rsrc_start = dev->resource[0].start;	hcd->rsrc_len	= resource_size(&dev->resource[0]);	printk("gjl usb_hcd_s3c2410_probe here 000!/n");	if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {		dev_err(&dev->dev, "request_mem_region failed/n");		retval = -EBUSY;		goto err_put;	}	printk("gjl usb_hcd_s3c2410_probe here 11111!/n");	clk = clk_get(&dev->dev, "usb-host");	if (IS_ERR(clk)) {		dev_err(&dev->dev, "cannot get usb-host clock/n");		retval = PTR_ERR(clk);		goto err_mem;	}	usb_clk = clk_get(&dev->dev, "usb-bus-host");	if (IS_ERR(usb_clk)) {		dev_err(&dev->dev, "cannot get usb-bus-host clock/n");		retval = PTR_ERR(usb_clk);		goto err_clk;	}// gjl	otg_clk = clk_get(&dev->dev, "otg");	if (IS_ERR(otg_clk)) {		dev_err(&dev->dev, "cannot get otg clock/n");		retval = -ENOENT;		goto err_otg;	}	s3c2410_start_hc(dev, hcd);	hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);	if (!hcd->regs) {		dev_err(&dev->dev, "ioremap failed/n");		retval = -ENOMEM;		goto err_ioremap;	}	ohci_hcd_init(hcd_to_ohci(hcd));	retval = usb_add_hcd(hcd, dev->resource[1].start, IRQF_DISABLED);	if (retval != 0)		goto err_ioremap;	return 0; err_ioremap:	s3c2410_stop_hc(dev);	iounmap(hcd->regs);	clk_put(usb_clk);err_otg:  // gjl 	clk_put(otg_clk); err_clk:	clk_put(clk);err_mem:	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);err_put:	usb_put_hcd(hcd);	return retval;}
开发者ID:jeehong,项目名称:kernel,代码行数:90,


示例13: usb_hcd_pci_probe

/** * usb_hcd_pci_probe - initialize PCI-based HCDs * @dev: USB Host Controller being probed * @id: pci hotplug id connecting controller to HCD framework * Context: !in_interrupt() * * Allocates basic PCI 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. * * Store this function in the HCD's struct pci_driver as probe(). */int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id){	struct hc_driver	*driver;	struct usb_hcd		*hcd;	int			retval;	if (usb_disabled())		return -ENODEV;	if (!id)		return -EINVAL;	driver = (struct hc_driver *)id->driver_data;	if (!driver)		return -EINVAL;	if (pci_enable_device(dev) < 0)		return -ENODEV;	dev->current_state = PCI_D0;	if (!dev->irq) {		dev_err(&dev->dev,			"Found HC with no IRQ.  Check BIOS/PCI %s setup!/n",			pci_name(dev));		retval = -ENODEV;		goto err1;	}	hcd = usb_create_hcd(driver, &dev->dev, pci_name(dev));	if (!hcd) {		retval = -ENOMEM;		goto err1;	}	if (driver->flags & HCD_MEMORY) {		/* EHCI, OHCI */		hcd->rsrc_start = pci_resource_start(dev, 0);		hcd->rsrc_len = pci_resource_len(dev, 0);		if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len,				driver->description)) {			dev_dbg(&dev->dev, "controller already in use/n");			retval = -EBUSY;			goto err2;		}		hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len);		if (hcd->regs == NULL) {			dev_dbg(&dev->dev, "error mapping memory/n");			retval = -EFAULT;			goto err3;		}	} else {		/* UHCI */		int	region;		for (region = 0; region < PCI_ROM_RESOURCE; region++) {			if (!(pci_resource_flags(dev, region) &					IORESOURCE_IO))				continue;			hcd->rsrc_start = pci_resource_start(dev, region);			hcd->rsrc_len = pci_resource_len(dev, region);			if (request_region(hcd->rsrc_start, hcd->rsrc_len,					driver->description))				break;		}		if (region == PCI_ROM_RESOURCE) {			dev_dbg(&dev->dev, "no i/o regions available/n");			retval = -EBUSY;			goto err1;		}	}	pci_set_master(dev);	retval = usb_add_hcd(hcd, dev->irq, IRQF_DISABLED | IRQF_SHARED);	if (retval != 0)		goto err4;	return retval; err4:	if (driver->flags & HCD_MEMORY) {		iounmap(hcd->regs); err3:		release_mem_region(hcd->rsrc_start, hcd->rsrc_len);	} else		release_region(hcd->rsrc_start, hcd->rsrc_len); err2:	usb_put_hcd(hcd);//.........这里部分代码省略.........
开发者ID:AdrianHuang,项目名称:uclinux-robutest,代码行数:101,


示例14: usb_hcd_msp_probe

/** * usb_hcd_msp_probe - initialize PMC MSP-based HCDs * Context: !in_interrupt() * * 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. * */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;	}	/* Map non-EHCI register spaces */	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;}
开发者ID:0xroot,项目名称:Blackphone-BP1-Kernel,代码行数:71,


示例15: ixp4xx_ehci_probe

static int ixp4xx_ehci_probe(struct platform_device *pdev){	struct usb_hcd *hcd;	const struct hc_driver *driver = &ixp4xx_ehci_hc_driver;	struct resource *res;	int irq;	int retval;	if (usb_disabled())		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",			dev_name(&pdev->dev));		return -ENODEV;	}	irq = res->start;	hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));	if (!hcd) {		retval = -ENOMEM;		goto fail_create_hcd;	}	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);	if (!res) {		dev_err(&pdev->dev,			"Found HC with no register addr. Check %s setup!/n",			dev_name(&pdev->dev));		retval = -ENODEV;		goto fail_request_resource;	}	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 fail_request_resource;	}	hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len);	if (hcd->regs == NULL) {		dev_dbg(&pdev->dev, "error mapping memory/n");		retval = -EFAULT;		goto fail_ioremap;	}	retval = usb_add_hcd(hcd, irq, IRQF_SHARED);	if (retval)		goto fail_add_hcd;	return retval;fail_add_hcd:	iounmap(hcd->regs);fail_ioremap:	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);fail_request_resource:	usb_put_hcd(hcd);fail_create_hcd:	dev_err(&pdev->dev, "init %s fail, %d/n", dev_name(&pdev->dev), retval);	return retval;}
开发者ID:119-org,项目名称:hi3518-osdrv,代码行数:67,


示例16: xhci_pci_probe

/* * We need to register our own PCI probe function (instead of the USB core's * function) in order to create a second roothub under xHCI. */static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id){    int retval;    struct xhci_hcd *xhci;    struct hc_driver *driver;    struct usb_hcd *hcd;    driver = (struct hc_driver *)id->driver_data;    /* Prevent runtime suspending between USB-2 and USB-3 initialization */    pm_runtime_get_noresume(&dev->dev);    /* Register the USB 2.0 roothub.     * FIXME: USB core must know to register the USB 2.0 roothub first.     * This is sort of silly, because we could just set the HCD driver flags     * to say USB 2.0, but I'm not sure what the implications would be in     * the other parts of the HCD code.     */    retval = usb_hcd_pci_probe(dev, id);    if (retval)        goto put_runtime_pm;    /* USB 2.0 roothub is stored in the PCI device now. */    hcd = dev_get_drvdata(&dev->dev);    xhci = hcd_to_xhci(hcd);    xhci->shared_hcd = usb_create_shared_hcd(driver, &dev->dev,                       pci_name(dev), hcd);    if (!xhci->shared_hcd) {        retval = -ENOMEM;        goto dealloc_usb2_hcd;    }    /* Set the xHCI pointer before xhci_pci_setup() (aka hcd_driver.reset)     * is called by usb_add_hcd().     */    *((struct xhci_hcd **) xhci->shared_hcd->hcd_priv) = xhci;    retval = usb_add_hcd(xhci->shared_hcd, dev->irq,                         IRQF_SHARED);    if (retval)        goto put_usb3_hcd;    /* Roothub already marked as USB 3.0 speed */    if (!(xhci->quirks & XHCI_BROKEN_STREAMS) &&            HCC_MAX_PSA(xhci->hcc_params) >= 4)        xhci->shared_hcd->can_do_streams = 1;    /* USB-2 and USB-3 roothubs initialized, allow runtime pm suspend */    pm_runtime_put_noidle(&dev->dev);    return 0;put_usb3_hcd:    usb_put_hcd(xhci->shared_hcd);dealloc_usb2_hcd:    usb_hcd_pci_remove(dev);put_runtime_pm:    pm_runtime_put_noidle(&dev->dev);    return retval;}
开发者ID:shucommon,项目名称:linux-stable-rcn-ee,代码行数:65,


示例17: usb_hcd_omap_probe

/** * usb_hcd_omap_probe - initialize OMAP-based HCDs * Context: !in_interrupt() * * 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. */static int usb_hcd_omap_probe (const struct hc_driver *driver,			  struct platform_device *pdev){	int retval, irq;	struct usb_hcd *hcd = 0;	if (pdev->num_resources != 2) {		dev_err(&pdev->dev, "invalid num_resources: %i/n",		       pdev->num_resources);		return -ENODEV;	}	if (pdev->resource[0].flags != IORESOURCE_MEM			|| pdev->resource[1].flags != IORESOURCE_IRQ) {		dev_err(&pdev->dev, "invalid resource type/n");		return -ENODEV;	}	usb_host_ck = clk_get(&pdev->dev, "usb_hhc_ck");	if (IS_ERR(usb_host_ck))		return PTR_ERR(usb_host_ck);	if (!cpu_is_omap15xx())		usb_dc_ck = clk_get(&pdev->dev, "usb_dc_ck");	else		usb_dc_ck = clk_get(&pdev->dev, "lb_ck");	if (IS_ERR(usb_dc_ck)) {		clk_put(usb_host_ck);		return PTR_ERR(usb_dc_ck);	}	hcd = usb_create_hcd (driver, &pdev->dev, dev_name(&pdev->dev));	if (!hcd) {		retval = -ENOMEM;		goto err0;	}	hcd->rsrc_start = pdev->resource[0].start;	hcd->rsrc_len = pdev->resource[0].end - pdev->resource[0].start + 1;	if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {		dev_dbg(&pdev->dev, "request_mem_region failed/n");		retval = -EBUSY;		goto err1;	}	hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);	if (!hcd->regs) {		dev_err(&pdev->dev, "can't ioremap OHCI HCD/n");		retval = -ENOMEM;		goto err2;	}	irq = platform_get_irq(pdev, 0);	if (irq < 0) {		retval = -ENXIO;		goto err3;	}	retval = usb_add_hcd(hcd, irq, 0);	if (retval)		goto err3;	device_wakeup_enable(hcd->self.controller);	return 0;err3:	iounmap(hcd->regs);err2:	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);err1:	usb_put_hcd(hcd);err0:	clk_put(usb_dc_ck);	clk_put(usb_host_ck);	return retval;}
开发者ID:atmark-techno,项目名称:linux-3.14-at,代码行数:84,


示例18: usb_hcd_pnx4008_probe

//.........这里部分代码省略.........	__raw_writel(USB_SLAVE_HCLK_EN | (1 << 19), USB_CTRL);	ret = i2c_add_driver(&isp1301_driver);	if (ret < 0) {		err("failed to add ISP1301 driver");		goto out;	}	i2c_adap = i2c_get_adapter(2);	memset(&i2c_info, 0, sizeof(struct i2c_board_info));	strlcpy(i2c_info.type, "isp1301_pnx", I2C_NAME_SIZE);	isp1301_i2c_client = i2c_new_probed_device(i2c_adap, &i2c_info,						   normal_i2c);	i2c_put_adapter(i2c_adap);	if (!isp1301_i2c_client) {		err("failed to connect I2C to ISP1301 USB Transceiver");		ret = -ENODEV;		goto out_i2c_driver;	}	isp1301_configure();	/* Enable USB PLL */	usb_clk = clk_get(&pdev->dev, "ck_pll5");	if (IS_ERR(usb_clk)) {		err("failed to acquire USB PLL");		ret = PTR_ERR(usb_clk);		goto out1;	}	ret = clk_enable(usb_clk);	if (ret < 0) {		err("failed to start USB PLL");		goto out2;	}	ret = clk_set_rate(usb_clk, 48000);	if (ret < 0) {		err("failed to set USB clock rate");		goto out3;	}	__raw_writel(__raw_readl(USB_CTRL) | USB_HOST_NEED_CLK_EN, USB_CTRL);	/* Set to enable all needed USB clocks */	__raw_writel(USB_CLOCK_MASK, USB_OTG_CLK_CTRL);	while ((__raw_readl(USB_OTG_CLK_STAT) & USB_CLOCK_MASK) !=	       USB_CLOCK_MASK) ;	hcd = usb_create_hcd (driver, &pdev->dev, dev_name(&pdev->dev));	if (!hcd) {		err("Failed to allocate HC buffer");		ret = -ENOMEM;		goto out3;	}	/* Set all USB bits in the Start Enable register */	pnx4008_set_usb_bits();	hcd->rsrc_start = pdev->resource[0].start;	hcd->rsrc_len = pdev->resource[0].end - pdev->resource[0].start + 1;	if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {		dev_dbg(&pdev->dev, "request_mem_region failed/n");		ret =  -ENOMEM;		goto out4;	}	hcd->regs = (void __iomem *)pdev->resource[0].start;	irq = platform_get_irq(pdev, 0);	if (irq < 0) {		ret = -ENXIO;		goto out4;	}	pnx4008_start_hc();	platform_set_drvdata(pdev, hcd);	ohci = hcd_to_ohci(hcd);	ohci_hcd_init(ohci);	dev_info(&pdev->dev, "at 0x%p, irq %d/n", hcd->regs, hcd->irq);	ret = usb_add_hcd(hcd, irq, IRQF_DISABLED);	if (ret == 0)		return ret;	pnx4008_stop_hc();out4:	pnx4008_unset_usb_bits();	usb_put_hcd(hcd);out3:	clk_disable(usb_clk);out2:	clk_put(usb_clk);out1:	i2c_unregister_device(isp1301_i2c_client);	isp1301_i2c_client = NULL;out_i2c_driver:	i2c_del_driver(&isp1301_driver);out:	return ret;}
开发者ID:ArthySundaram,项目名称:firstrepo,代码行数:101,


示例19: ehci_oxnas_drv_probe

static int ehci_oxnas_drv_probe(struct platform_device *ofdev){	struct device_node *np = ofdev->dev.of_node;	struct usb_hcd *hcd;	struct ehci_hcd *ehci;	struct resource res;	struct oxnas_hcd *oxnas;	int irq, err;	struct reset_control *rstc;	if (usb_disabled())		return -ENODEV;	if (!ofdev->dev.dma_mask)		ofdev->dev.dma_mask = &ofdev->dev.coherent_dma_mask;	if (!ofdev->dev.coherent_dma_mask)		ofdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);	hcd = usb_create_hcd(&oxnas_hc_driver,	&ofdev->dev,					dev_name(&ofdev->dev));	if (!hcd)		return -ENOMEM;	err = of_address_to_resource(np, 0, &res);	if (err)		goto err_res;	hcd->rsrc_start = res.start;	hcd->rsrc_len = resource_size(&res);	hcd->regs = devm_ioremap_resource(&ofdev->dev, &res);	if (IS_ERR(hcd->regs)) {		dev_err(&ofdev->dev, "devm_ioremap_resource failed/n");		err = PTR_ERR(hcd->regs);		goto err_ioremap;	}	oxnas = (struct oxnas_hcd *)hcd_to_ehci(hcd)->priv;	oxnas->use_pllb = of_property_read_bool(np, "plxtech,ehci_use_pllb");	oxnas->use_phya = of_property_read_bool(np, "plxtech,ehci_use_phya");	oxnas->clk = of_clk_get_by_name(np, "usb");	if (IS_ERR(oxnas->clk)) {		err = PTR_ERR(oxnas->clk);		goto err_clk;	}	if (oxnas->use_pllb) {		oxnas->refsrc = of_clk_get_by_name(np, "refsrc");		if (IS_ERR(oxnas->refsrc)) {			err = PTR_ERR(oxnas->refsrc);			goto err_refsrc;		}		oxnas->phyref = of_clk_get_by_name(np, "phyref");		if (IS_ERR(oxnas->refsrc)) {			err = PTR_ERR(oxnas->refsrc);			goto err_phyref;		}	} else {		oxnas->refsrc = NULL;		oxnas->phyref = NULL;	}	rstc = devm_reset_control_get(&ofdev->dev, "host");	if (IS_ERR(rstc)) {		err = PTR_ERR(rstc);		goto err_rst;	}	oxnas->rst_host = rstc;	rstc = devm_reset_control_get(&ofdev->dev, "phya");	if (IS_ERR(rstc)) {		err = PTR_ERR(rstc);		goto err_rst;	}	oxnas->rst_phya = rstc;	rstc = devm_reset_control_get(&ofdev->dev, "phyb");	if (IS_ERR(rstc)) {		err = PTR_ERR(rstc);		goto err_rst;	}	oxnas->rst_phyb = rstc;	irq = irq_of_parse_and_map(np, 0);	if (!irq) {		dev_err(&ofdev->dev, "irq_of_parse_and_map failed/n");		err = -EBUSY;		goto err_irq;	}	hcd->has_tt = 1;	ehci = hcd_to_ehci(hcd);	ehci->caps = hcd->regs;	start_oxnas_usb_ehci(oxnas);	err = usb_add_hcd(hcd, irq, IRQF_SHARED | IRQF_DISABLED);//.........这里部分代码省略.........
开发者ID:2812015651,项目名称:openwrt,代码行数:101,


示例20: sw_ohci_hcd_probe

static int sw_ohci_hcd_probe(struct platform_device *pdev){	int ret;	struct usb_hcd *hcd = NULL;	struct sw_hci_hcd *sw_ohci = NULL;	if(pdev == NULL){	    DMSG_PANIC("ERR: Argment is invaild/n");	    return -1;    }    /* if usb is disabled, can not probe */    if (usb_disabled()){        DMSG_PANIC("ERR: usb hcd is disabled/n");        return -ENODEV;    }	sw_ohci = pdev->dev.platform_data;	if(!sw_ohci){		DMSG_PANIC("ERR: sw_ohci is null/n");		ret = -ENOMEM;		goto ERR1;	}	sw_ohci->pdev = pdev;	g_sw_ohci[sw_ohci->usbc_no] = sw_ohci;	DMSG_INFO("[%s%d]: probe, pdev->name: %s, pdev->id: %d, sw_ohci: 0x%p/n",		      ohci_name, sw_ohci->usbc_no, pdev->name, pdev->id, sw_ohci);	/* get io resource */	sw_get_io_resource(pdev, sw_ohci);	sw_ohci->ohci_base 			= sw_ohci->usb_vbase + SW_USB_OHCI_BASE_OFFSET;	sw_ohci->ohci_reg_length 	= SW_USB_OHCI_LEN;    /*creat a usb_hcd for the ohci controller*/	hcd = usb_create_hcd(&sw_ohci_hc_driver, &pdev->dev, ohci_name);	if(!hcd){        DMSG_PANIC("ERR: usb_ohci_create_hcd failed/n");        ret = -ENOMEM;		goto ERR2;	}  	hcd->rsrc_start = (u32)sw_ohci->ohci_base;	hcd->rsrc_len 	= sw_ohci->ohci_reg_length;	hcd->regs 		= sw_ohci->ohci_base;	sw_ohci->hcd    = hcd;	/* ochi start to work */	sw_start_ohc(sw_ohci);    printk("[%s %d]:reg(0xf1c20060) = %x/n", __func__, __LINE__, *(u32 *)0xf1c20060);    ohci_hcd_init(hcd_to_ohci(hcd));    ret = usb_add_hcd(hcd, sw_ohci->irq_no, IRQF_DISABLED | IRQF_SHARED);    if(ret != 0){        DMSG_PANIC("ERR: usb_add_hcd failed/n");        ret = -ENOMEM;        goto ERR3;    }    platform_set_drvdata(pdev, hcd);#ifdef  SW_USB_OHCI_DEBUG    DMSG_INFO("[%s]: probe, clock: 0x60(0x%x), 0xcc(0x%x); usb: 0x800(0x%x), dram:(0x%x, 0x%x)/n",              sw_ohci->hci_name,              (u32)USBC_Readl(sw_ohci->clock_vbase + 0x60),              (u32)USBC_Readl(sw_ohci->clock_vbase + 0xcc),              (u32)USBC_Readl(sw_ohci->usb_vbase + 0x800),              (u32)USBC_Readl(sw_ohci->sdram_vbase + SW_SDRAM_REG_HPCR_USB1),              (u32)USBC_Readl(sw_ohci->sdram_vbase + SW_SDRAM_REG_HPCR_USB2));#endif	device_enable_async_suspend(&pdev->dev);	sw_ohci->probe = 1;    /* Disable ohci, when driver probe */    if(sw_ohci->host_init_state == 0){        if(ohci_first_probe[sw_ohci->usbc_no]){            sw_usb_disable_ohci(sw_ohci->usbc_no);            ohci_first_probe[sw_ohci->usbc_no]--;        }    }    return 0;ERR3:	usb_put_hcd(hcd);ERR2:	sw_ohci->hcd = NULL;	g_sw_ohci[sw_ohci->usbc_no] = NULL;ERR1:    return ret;}
开发者ID:mfkiwl,项目名称:PhoenixA20_linux_sourcecode,代码行数:96,


示例21: ehci_hcd_stm_probe

static int ehci_hcd_stm_probe(struct platform_device *pdev){	int retval = 0;	struct usb_hcd *hcd;        struct ehci_hcd *ehci;	struct device *dev = &pdev->dev;	struct resource *res;	struct platform_device *stm_usb_pdev;	dgb_print("/n");	hcd = usb_create_hcd(&ehci_stm_hc_driver, dev, dev->bus_id);	if (!hcd) {		retval = -ENOMEM;		goto err0;	}	stm_usb_pdev = to_platform_device(pdev->dev.parent);	res = platform_get_resource(stm_usb_pdev, IORESOURCE_MEM, 0);	hcd->rsrc_start = res->start;	hcd->rsrc_len = res->end - res->start;	if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {		pr_debug("request_mem_region failed");		retval = -EBUSY;		goto err1;	}	hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);	if (!hcd->regs) {		pr_debug("ioremap failed");		retval = -ENOMEM;		goto err2;	}	ehci = hcd_to_ehci(hcd);	ehci->caps = hcd->regs;	ehci->regs = hcd->regs + HC_LENGTH(readl(&ehci->caps->hc_capbase));	/* cache this readonly data; minimize device reads */	ehci->hcs_params = readl(&ehci->caps->hcs_params);/* * Fix the reset port issue on a load-unload-load sequence */	ehci->has_reset_port_bug = 1,	res = platform_get_resource(stm_usb_pdev, IORESOURCE_IRQ, 0);	retval = usb_add_hcd(hcd, res->start, 0);	if (retval == 0) {#ifdef CONFIG_PM		hcd->self.root_hub->do_remote_wakeup = 0;		hcd->self.root_hub->persist_enabled = 0;		hcd->self.root_hub->autosuspend_disabled = 1;		hcd->self.root_hub->autoresume_disabled = 1;#endif		return retval;	}	iounmap(hcd->regs);err2:	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);err1:	usb_put_hcd(hcd);err0:	return retval;}
开发者ID:amalrajt,项目名称:linux-sh4-2.6.23.17_stm23_A18B,代码行数:65,


示例22: ehci_hcd_tilegx_drv_probe

static int ehci_hcd_tilegx_drv_probe(struct platform_device *pdev){	struct usb_hcd *hcd;	struct ehci_hcd *ehci;	struct tilegx_usb_platform_data *pdata = pdev->dev.platform_data;	pte_t pte = { 0 };	int my_cpu = smp_processor_id();	int ret;	if (usb_disabled())		return -ENODEV;	/*	 * Try to initialize our GXIO context; if we can't, the device	 * doesn't exist.	 */	if (gxio_usb_host_init(&pdata->usb_ctx, pdata->dev_index, 1) != 0)		return -ENXIO;	hcd = usb_create_hcd(&ehci_tilegx_hc_driver, &pdev->dev,			     dev_name(&pdev->dev));	if (!hcd) {          ret = -ENOMEM;          goto err_hcd;        }	/*	 * We don't use rsrc_start to map in our registers, but seems like	 * we ought to set it to something, so we use the register VA.	 */	hcd->rsrc_start =		(ulong) gxio_usb_host_get_reg_start(&pdata->usb_ctx);	hcd->rsrc_len = gxio_usb_host_get_reg_len(&pdata->usb_ctx);	hcd->regs = gxio_usb_host_get_reg_start(&pdata->usb_ctx);	tilegx_start_ehc();	ehci = hcd_to_ehci(hcd);	ehci->caps = hcd->regs;	ehci->regs =		hcd->regs + HC_LENGTH(ehci, readl(&ehci->caps->hc_capbase));	/* cache this readonly data; minimize chip reads */	ehci->hcs_params = readl(&ehci->caps->hcs_params);	/* Create our IRQs and register them. */	pdata->irq = create_irq();	if (pdata->irq < 0) {		ret = -ENXIO;		goto err_no_irq;	}	tile_irq_activate(pdata->irq, TILE_IRQ_PERCPU);	/* Configure interrupts. */	ret = gxio_usb_host_cfg_interrupt(&pdata->usb_ctx,					  cpu_x(my_cpu), cpu_y(my_cpu),					  KERNEL_PL, pdata->irq);	if (ret) {		ret = -ENXIO;		goto err_have_irq;	}	/* Register all of our memory. */	pte = pte_set_home(pte, PAGE_HOME_HASH);	ret = gxio_usb_host_register_client_memory(&pdata->usb_ctx, pte, 0);	if (ret) {		ret = -ENXIO;		goto err_have_irq;	}	ret = usb_add_hcd(hcd, pdata->irq, IRQF_SHARED);	if (ret == 0) {		platform_set_drvdata(pdev, hcd);		return ret;	}err_have_irq:	destroy_irq(pdata->irq);err_no_irq:	tilegx_stop_ehc();	usb_put_hcd(hcd);err_hcd:	gxio_usb_host_destroy(&pdata->usb_ctx);	return ret;}
开发者ID:AD5GB,项目名称:kernel_n5_3.10-experimental,代码行数:85,


示例23: ohci_hcd_sm501_drv_probe

static int ohci_hcd_sm501_drv_probe(struct platform_device *pdev){	const struct hc_driver *driver = &ohci_sm501_hc_driver;	struct device *dev = &pdev->dev;	struct resource	*res, *mem;	int retval, irq;	struct usb_hcd *hcd = NULL;	irq = retval = platform_get_irq(pdev, 0);	if (retval < 0)		goto err0;	mem = platform_get_resource(pdev, IORESOURCE_MEM, 1);	if (mem == NULL) {		dev_err(dev, "no resource definition for memory/n");		retval = -ENOENT;		goto err0;	}	if (!request_mem_region(mem->start, resource_size(mem), pdev->name)) {		dev_err(dev, "request_mem_region failed/n");		retval = -EBUSY;		goto err0;	}	if (!dma_declare_coherent_memory(dev, mem->start,					 mem->start - mem->parent->start,					 resource_size(mem),					 DMA_MEMORY_MAP |					 DMA_MEMORY_EXCLUSIVE)) {		dev_err(dev, "cannot declare coherent memory/n");		retval = -ENXIO;		goto err1;	}		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);	if (res == NULL) {		dev_err(dev, "no resource definition for registers/n");		retval = -ENOENT;		goto err2;	}	hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));	if (!hcd) {		retval = -ENOMEM;		goto err2;	}	hcd->rsrc_start = res->start;	hcd->rsrc_len = resource_size(res);	if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len,	pdev->name)) {		dev_err(dev, "request_mem_region failed/n");		retval = -EBUSY;		goto err3;	}	hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);	if (hcd->regs == NULL) {		dev_err(dev, "cannot remap registers/n");		retval = -ENXIO;		goto err4;	}	ohci_hcd_init(hcd_to_ohci(hcd));	retval = usb_add_hcd(hcd, irq, IRQF_SHARED);	if (retval)		goto err5;		sm501_unit_power(dev->parent, SM501_GATE_USB_HOST, 1);	sm501_modify_reg(dev->parent, SM501_IRQ_MASK, 1 << 6, 0);	return 0;err5:	iounmap(hcd->regs);err4:	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);err3:	usb_put_hcd(hcd);err2:	dma_release_declared_memory(dev);err1:	release_mem_region(mem->start, resource_size(mem));err0:	return retval;}
开发者ID:MiniBlu,项目名称:cm11_kernel_htc_msm8974a3ul,代码行数:91,


示例24: ohci_hcd_tmio_drv_probe

static int __devinit ohci_hcd_tmio_drv_probe(struct platform_device *dev){	struct mfd_cell *cell = dev->dev.platform_data;	struct resource *regs = platform_get_resource(dev, IORESOURCE_MEM, 0);	struct resource *config = platform_get_resource(dev, IORESOURCE_MEM, 1);	struct resource *sram = platform_get_resource(dev, IORESOURCE_MEM, 2);	int irq = platform_get_irq(dev, 0);	struct tmio_hcd *tmio;	struct ohci_hcd *ohci;	struct usb_hcd *hcd;	int ret;	if (usb_disabled())		return -ENODEV;	if (!cell)		return -EINVAL;	hcd = usb_create_hcd(&ohci_tmio_hc_driver, &dev->dev, dev->dev.bus_id);	if (!hcd) {		ret = -ENOMEM;		goto err_usb_create_hcd;	}	hcd->rsrc_start = regs->start;	hcd->rsrc_len = regs->end - regs->start + 1;	tmio = hcd_to_tmio(hcd);	spin_lock_init(&tmio->lock);	tmio->ccr = ioremap(config->start, config->end - config->start + 1);	if (!tmio->ccr) {		ret = -ENOMEM;		goto err_ioremap_ccr;	}	hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);	if (!hcd->regs) {		ret = -ENOMEM;		goto err_ioremap_regs;	}	if (!dma_declare_coherent_memory(&dev->dev, sram->start,				sram->start,				sram->end - sram->start + 1,				DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE)) {		ret = -EBUSY;		goto err_dma_declare;	}	if (cell->enable) {		ret = cell->enable(dev);		if (ret)			goto err_enable;	}	tmio_start_hc(dev);	ohci = hcd_to_ohci(hcd);	ohci_hcd_init(ohci);	ret = usb_add_hcd(hcd, irq, IRQF_DISABLED);	if (ret)		goto err_add_hcd;	if (ret == 0)		return ret;	usb_remove_hcd(hcd);err_add_hcd:	tmio_stop_hc(dev);	if (cell->disable)		cell->disable(dev);err_enable:	dma_release_declared_memory(&dev->dev);err_dma_declare:	iounmap(hcd->regs);err_ioremap_regs:	iounmap(tmio->ccr);err_ioremap_ccr:	usb_put_hcd(hcd);err_usb_create_hcd:	return ret;}
开发者ID:kizukukoto,项目名称:WDN900_GPL,代码行数:86,


示例25: xhci_plat_probe

static int xhci_plat_probe(struct platform_device *pdev){	const struct hc_driver	*driver;	struct xhci_hcd		*xhci;	struct resource         *res;	struct usb_hcd		*hcd;	int			ret;	int			irq;	if (usb_disabled())		return -ENODEV;	driver = &xhci_plat_xhci_driver;	irq = platform_get_irq(pdev, 0);	if (irq < 0)		return -ENODEV;	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);	if (!res)		return -ENODEV;	hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));	if (!hcd)		return -ENOMEM;	hcd->rsrc_start = res->start;	hcd->rsrc_len = resource_size(res);	if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len,				driver->description)) {		dev_dbg(&pdev->dev, "controller already in use/n");		ret = -EBUSY;		goto put_hcd;	}	hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len);	if (!hcd->regs) {		dev_dbg(&pdev->dev, "error mapping memory/n");		ret = -EFAULT;		goto release_mem_region;	}	ret = usb_add_hcd(hcd, irq, IRQF_SHARED);	if (ret)		goto unmap_registers;	/* USB 2.0 roothub is stored in the platform_device now. */	hcd = dev_get_drvdata(&pdev->dev);	xhci = hcd_to_xhci(hcd);	xhci->shared_hcd = usb_create_shared_hcd(driver, &pdev->dev,			dev_name(&pdev->dev), hcd);	if (!xhci->shared_hcd) {		ret = -ENOMEM;		goto dealloc_usb2_hcd;	}	/*	 * Set the xHCI pointer before xhci_plat_setup() (aka hcd_driver.reset)	 * is called by usb_add_hcd().	 */	*((struct xhci_hcd **) xhci->shared_hcd->hcd_priv) = xhci;	ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);	if (ret)		goto put_usb3_hcd;	phy = usb_get_transceiver();	if (phy && phy->otg) {		dev_dbg(&pdev->dev, "%s otg support available/n", __func__);		hcd->driver->stop(hcd);		ret = otg_set_host(phy->otg, &hcd->self);		if (ret) {			dev_err(&pdev->dev, "%s otg_set_host failed/n",				__func__);			usb_put_transceiver(phy);			goto put_usb3_hcd;		}	}	return 0;put_usb3_hcd:	usb_put_hcd(xhci->shared_hcd);dealloc_usb2_hcd:	usb_remove_hcd(hcd);unmap_registers:	iounmap(hcd->regs);release_mem_region:	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);put_hcd:	usb_put_hcd(hcd);	return ret;}
开发者ID:RolanDroid,项目名称:lge_MonsterKernel-lproj,代码行数:99,


示例26: whc_probe

static int whc_probe(struct umc_dev *umc){	int ret;	struct usb_hcd *usb_hcd;	struct wusbhc *wusbhc;	struct whc *whc;	struct device *dev = &umc->dev;	usb_hcd = usb_create_hcd(&whc_hc_driver, dev, "whci");	if (usb_hcd == NULL) {		dev_err(dev, "unable to create hcd/n");		return -ENOMEM;	}	usb_hcd->wireless = 1;	usb_hcd->self.sg_tablesize = 2048; /* somewhat arbitrary */	wusbhc = usb_hcd_to_wusbhc(usb_hcd);	whc = wusbhc_to_whc(wusbhc);	whc->umc = umc;	ret = whc_init(whc);	if (ret)		goto error;	wusbhc->dev = dev;	wusbhc->uwb_rc = uwb_rc_get_by_grandpa(umc->dev.parent);	if (!wusbhc->uwb_rc) {		ret = -ENODEV;		dev_err(dev, "cannot get radio controller/n");		goto error;	}	if (whc->n_devices > USB_MAXCHILDREN) {		dev_warn(dev, "USB_MAXCHILDREN too low for WUSB adapter (%u ports)/n",			 whc->n_devices);		wusbhc->ports_max = USB_MAXCHILDREN;	} else		wusbhc->ports_max = whc->n_devices;	wusbhc->mmcies_max      = whc->n_mmc_ies;	wusbhc->start           = whc_wusbhc_start;	wusbhc->stop            = whc_wusbhc_stop;	wusbhc->mmcie_add       = whc_mmcie_add;	wusbhc->mmcie_rm        = whc_mmcie_rm;	wusbhc->dev_info_set    = whc_dev_info_set;	wusbhc->bwa_set         = whc_bwa_set;	wusbhc->set_num_dnts    = whc_set_num_dnts;	wusbhc->set_ptk         = whc_set_ptk;	wusbhc->set_gtk         = whc_set_gtk;	ret = wusbhc_create(wusbhc);	if (ret)		goto error_wusbhc_create;	ret = usb_add_hcd(usb_hcd, whc->umc->irq, IRQF_SHARED);	if (ret) {		dev_err(dev, "cannot add HCD: %d/n", ret);		goto error_usb_add_hcd;	}	ret = wusbhc_b_create(wusbhc);	if (ret) {		dev_err(dev, "WUSBHC phase B setup failed: %d/n", ret);		goto error_wusbhc_b_create;	}	whc_dbg_init(whc);	return 0;error_wusbhc_b_create:	usb_remove_hcd(usb_hcd);error_usb_add_hcd:	wusbhc_destroy(wusbhc);error_wusbhc_create:	uwb_rc_put(wusbhc->uwb_rc);error:	whc_clean_up(whc);	if (usb_hcd)		usb_put_hcd(usb_hcd);	return ret;}
开发者ID:AnadoluPanteri,项目名称:kernel-plus-harmattan,代码行数:82,


示例27: ehci_msm2_probe

//.........这里部分代码省略.........		goto deinit_ldo;	}	ret = msm_ehci_init_vbus(mhcd, 1);	if (ret)		goto disable_ldo;	hcd->phy = devm_usb_get_phy_by_phandle(&pdev->dev, "usb-phy", 0);	if (IS_ERR(hcd->phy)) {		if (PTR_ERR(hcd->phy) == -EPROBE_DEFER) {			dev_dbg(&pdev->dev, "usb-phy not probed yet/n");			ret = -EPROBE_DEFER;			goto vbus_deinit;		}		hcd->phy = NULL;	}	if (hcd->phy) {		usb_phy_init(hcd->phy);		/* Set Host mode flag */		hcd->phy->flags |= PHY_HOST_MODE;	} else if (pdata && pdata->use_sec_phy) {		mhcd->usb_phy_ctrl_reg = USB_PHY_CTRL2;	} else {		mhcd->usb_phy_ctrl_reg = USB_PHY_CTRL;	}	ret = msm_hsusb_reset(mhcd);	if (ret) {		dev_err(&pdev->dev, "hsusb PHY initialization failed/n");		goto vbus_deinit;	}	ret = usb_add_hcd(hcd, hcd->irq, IRQF_SHARED);	if (ret) {		dev_err(&pdev->dev, "unable to register HCD/n");		goto vbus_deinit;	}	mhcd->bus_scale_table = msm_bus_cl_get_pdata(pdev);	if (!mhcd->bus_scale_table) {		dev_dbg(&pdev->dev, "bus scaling is disabled/n");	} else {		mhcd->bus_perf_client =			msm_bus_scale_register_client(mhcd->bus_scale_table);		ret = msm_bus_scale_client_update_request(						mhcd->bus_perf_client, 1);		if (ret)			dev_err(&pdev->dev, "Failed to vote for bus scaling/n");	}	pdata = mhcd->dev->platform_data;	if (pdata && (!pdata->dock_connect_irq ||				!irq_read_line(pdata->dock_connect_irq)))		msm_ehci_vbus_power(mhcd, 1);	/* For peripherals directly conneted to downstream port of root hub	 * and require to drive suspend and resume by controller driver instead	 * of root hub.	 */	if (pdata)		mhcd->ehci.no_selective_suspend = pdata->no_selective_suspend;	mhcd->wakeup_irq = platform_get_irq_byname(pdev, "wakeup_irq");	if (mhcd->wakeup_irq > 0) {		dev_dbg(&pdev->dev, "wakeup irq:%d/n", mhcd->wakeup_irq);
开发者ID:Menpiko,项目名称:SnaPKernel-N6P,代码行数:67,


示例28: usb_hcd_fsl_probe

/** * 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. * */int usb_hcd_fsl_probe(const struct hc_driver *driver,		      struct platform_device *pdev){	struct fsl_usb2_platform_data *pdata;	struct usb_hcd *hcd;	struct resource *res;	int irq;	int retval;	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,			"No platform data for %s./n", dev_name(&pdev->dev));		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) ||	      (pdata->operating_mode == FSL_USB2_MPH_HOST) ||	      (pdata->operating_mode == FSL_USB2_DR_OTG))) {		dev_err(&pdev->dev,			"Non Host Mode configured for %s. Wrong driver linked./n",			dev_name(&pdev->dev));		return -ENODEV;	}	hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));	if (!hcd) {		retval = -ENOMEM;		goto err1;	}	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);	if (!res) {		dev_err(&pdev->dev,			"Found HC with no IRQ. Check %s setup!/n",			dev_name(&pdev->dev));		return -ENODEV;	}	irq = res->start;	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);	hcd->rsrc_start = res->start;	hcd->rsrc_len = resource_size(res);	if (pdata->operating_mode != FSL_USB2_DR_OTG) {		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;	}	pdata->regs = hcd->regs;	/*	 * do platform specific init: check the clock, grab/config pins, etc.	 */	if (pdata->platform_init && pdata->platform_init(pdev)) {		retval = -ENODEV;		goto err3;	}	fsl_platform_set_host_mode(hcd);	hcd->power_budget = pdata->power_budget;	retval = usb_add_hcd(hcd, irq, IRQF_DISABLED | IRQF_SHARED);	if (retval != 0)		goto err4;	if (pdata->operating_mode == FSL_USB2_DR_OTG) {		struct ehci_hcd *ehci = hcd_to_ehci(hcd);		dbg("pdev=0x%p  hcd=0x%p  ehci=0x%p/n", pdev, hcd, ehci);		ehci->transceiver = otg_get_transceiver();		dbg("ehci->transceiver=0x%p/n", ehci->transceiver);//.........这里部分代码省略.........
开发者ID:pocketbook,项目名称:801,代码行数:101,


示例29: ehci_orion_drv_probe

static int __init ehci_orion_drv_probe(struct platform_device *pdev){    struct orion_ehci_data *pd = pdev->dev.platform_data;    struct resource *res;    struct usb_hcd *hcd;    struct ehci_hcd *ehci;    void __iomem *regs;    int irq, err;    if (usb_disabled())        return -ENODEV;    pr_debug("Initializing Orion-SoC USB Host Controller/n");    irq = platform_get_irq(pdev, 0);    if (irq <= 0) {        dev_err(&pdev->dev,                "Found HC with no IRQ. Check %s setup!/n",                pdev->dev.bus_id);        err = -ENODEV;        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",                pdev->dev.bus_id);        err = -ENODEV;        goto err1;    }    if (!request_mem_region(res->start, res->end - res->start + 1,                            ehci_orion_hc_driver.description)) {        dev_dbg(&pdev->dev, "controller already in use/n");        err = -EBUSY;        goto err1;    }    regs = ioremap(res->start, res->end - res->start + 1);    if (regs == NULL) {        dev_dbg(&pdev->dev, "error mapping memory/n");        err = -EFAULT;        goto err2;    }    hcd = usb_create_hcd(&ehci_orion_hc_driver,                         &pdev->dev, pdev->dev.bus_id);    if (!hcd) {        err = -ENOMEM;        goto err3;    }    hcd->rsrc_start = res->start;    hcd->rsrc_len = res->end - res->start + 1;    hcd->regs = regs;    ehci = hcd_to_ehci(hcd);    ehci->caps = hcd->regs + 0x100;    ehci->regs = hcd->regs + 0x100 +                 HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase));    ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);    hcd->has_tt = 1;    ehci->sbrn = 0x20;    /*     * (Re-)program MBUS remapping windows if we are asked to.     */    if (pd != NULL && pd->dram != NULL)        ehci_orion_conf_mbus_windows(hcd, pd->dram);    /*     * setup Orion USB controller     */    orion_usb_setup(hcd);    err = usb_add_hcd(hcd, irq, IRQF_SHARED | IRQF_DISABLED);    if (err)        goto err4;    return 0;err4:    usb_put_hcd(hcd);err3:    iounmap(regs);err2:    release_mem_region(res->start, res->end - res->start + 1);err1:    dev_err(&pdev->dev, "init %s fail, %d/n",            pdev->dev.bus_id, err);    return err;}
开发者ID:sserg31,项目名称:sca3_main,代码行数:94,



注:本文中的usb_add_hcd函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ usb_alloc_urb函数代码示例
C++ usb_add_function函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。