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

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

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

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

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

示例1: ehci_msm2_probe

//.........这里部分代码省略.........	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);		irq_set_status_flags(mhcd->wakeup_irq, IRQ_NOAUTOEN);		ret = request_irq(mhcd->wakeup_irq, msm_hsusb_wakeup_irq,				IRQF_TRIGGER_HIGH,				"msm_hsusb_wakeup", mhcd);		if (ret) {			dev_err(&pdev->dev, "request_irq(%d) failed:%d/n",					mhcd->wakeup_irq, ret);			mhcd->wakeup_irq = 0;		}	} else {		mhcd->wakeup_irq = 0;	}	device_init_wakeup(&pdev->dev, 1);	wakeup_source_init(&mhcd->ws, dev_name(&pdev->dev));	pm_stay_awake(mhcd->dev);	INIT_WORK(&mhcd->phy_susp_fail_work, msm_ehci_phy_susp_fail_work);	/*	 * This pdev->dev is assigned parent of root-hub by USB core,	 * hence, runtime framework automatically calls this driver's	 * runtime APIs based on root-hub's state.	 */	/* configure pmic_gpio_irq for D+ change */	if (pdata && pdata->pmic_gpio_dp_irq)		mhcd->pmic_gpio_dp_irq = pdata->pmic_gpio_dp_irq;	if (mhcd->pmic_gpio_dp_irq) {		ret = request_threaded_irq(mhcd->pmic_gpio_dp_irq, NULL,				msm_ehci_host_wakeup_irq,				IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,				"msm_ehci_host_wakeup", mhcd);		if (!ret) {			disable_irq_nosync(mhcd->pmic_gpio_dp_irq);		} else {			dev_err(&pdev->dev, "request_irq(%d) failed: %d/n",					mhcd->pmic_gpio_dp_irq, ret);			mhcd->pmic_gpio_dp_irq = 0;		}	}	pm_runtime_set_active(&pdev->dev);	pm_runtime_enable(&pdev->dev);	if (ehci_debugfs_init(mhcd) < 0)		dev_err(mhcd->dev, "%s: debugfs init failed/n", __func__);	return 0;vbus_deinit:	msm_ehci_init_vbus(mhcd, 0);disable_ldo:	msm_ehci_ldo_enable(mhcd, 0);deinit_ldo:	msm_ehci_ldo_init(mhcd, 0);deinit_vddcx:	msm_ehci_init_vddcx(mhcd, 0);pinctrl_sleep:	if (mhcd->hsusb_pinctrl) {		set_state = pinctrl_lookup_state(mhcd->hsusb_pinctrl,				"ehci_sleep");		if (IS_ERR(set_state))			pr_err("cannot get hsusb pinctrl sleep state/n");		else			pinctrl_select_state(mhcd->hsusb_pinctrl, set_state);	}devote_xo_handle:	if (mhcd->xo_clk)		clk_disable_unprepare(mhcd->xo_clk);free_xo_handle:	if (mhcd->xo_clk) {		clk_put(mhcd->xo_clk);		mhcd->xo_clk = NULL;	}	if (mhcd->async_irq)		free_irq(mhcd->async_irq, mhcd);unmap:	iounmap(hcd->regs);deinit_clocks:	msm_ehci_init_clocks(mhcd, 0);xo_put:	if (mhcd->xo_clk)		clk_put(mhcd->xo_clk);put_hcd:	usb_put_hcd(hcd);	return ret;}
开发者ID:Runner85sx,项目名称:android_kernel_huawei_msm8909,代码行数:101,


示例2: 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_to_bus(hcd)->skip_resume = true;	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(hcd->rsrc_start, hcd->rsrc_len);	if (!hcd->regs) {		dev_dbg(&pdev->dev, "error mapping memory/n");		ret = -EFAULT;		goto release_mem_region;	}	pm_runtime_set_active(&pdev->dev);	pm_runtime_enable(&pdev->dev);	pm_runtime_get_sync(&pdev->dev);	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;	}	hcd_to_bus(xhci->shared_hcd)->skip_resume = true;	/*	 * 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();	/* Register with OTG if present, ignore USB2 OTG using other PHY */	if (phy && phy->otg && !(phy->flags & ENABLE_SECONDARY_PHY)) {		dev_dbg(&pdev->dev, "%s otg support available/n", __func__);		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;		}	} else {		pm_runtime_no_callbacks(&pdev->dev);	}	pm_runtime_put(&pdev->dev);	return 0;put_usb3_hcd:	usb_put_hcd(xhci->shared_hcd);dealloc_usb2_hcd:	usb_remove_hcd(hcd);unmap_registers:	iounmap(hcd->regs);//.........这里部分代码省略.........
开发者ID:98416,项目名称:Z7Max_NX505J_H129_kernel,代码行数:101,


示例3: mv_ehci_probe

//.........这里部分代码省略.........		goto err_iounmap_phyreg;	}	retval = mv_ehci_enable(ehci_mv);	if (retval) {		dev_err(&pdev->dev, "init phy error %d/n", retval);		goto err_iounmap_capreg;	}	offset = readl(ehci_mv->cap_regs) & CAPLENGTH_MASK;	ehci_mv->op_regs =		(void __iomem *) ((unsigned long) ehci_mv->cap_regs + offset);	hcd->rsrc_start = r->start;	hcd->rsrc_len = r->end - r->start + 1;	hcd->regs = ehci_mv->op_regs;	hcd->irq = platform_get_irq(pdev, 0);	if (!hcd->irq) {		dev_err(&pdev->dev, "Cannot get irq.");		retval = -ENODEV;		goto err_disable_clk;	}	ehci = hcd_to_ehci(hcd);	ehci->caps = (struct ehci_caps *) ehci_mv->cap_regs;	ehci->regs = (struct ehci_regs *) ehci_mv->op_regs;	ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);	ehci_mv->mode = pdata->mode;	if (ehci_mv->mode == MV_USB_MODE_OTG) {#ifdef CONFIG_USB_OTG_UTILS		ehci_mv->otg = usb_get_transceiver();		if (!ehci_mv->otg) {			dev_err(&pdev->dev,				"unable to find transceiver/n");			retval = -ENODEV;			goto err_disable_clk;		}		retval = otg_set_host(ehci_mv->otg->otg, &hcd->self);		if (retval < 0) {			dev_err(&pdev->dev,				"unable to register with transceiver/n");			retval = -ENODEV;			goto err_put_transceiver;		}		/*                                          */		mv_ehci_disable(ehci_mv);#else		dev_info(&pdev->dev, "MV_USB_MODE_OTG "			 "must have CONFIG_USB_OTG_UTILS enabled/n");		goto err_disable_clk;#endif	} else {		if (pdata->set_vbus)			pdata->set_vbus(1);		retval = usb_add_hcd(hcd, hcd->irq, IRQF_SHARED);		if (retval) {			dev_err(&pdev->dev,				"failed to add hcd with err %d/n", retval);			goto err_set_vbus;		}	}	if (pdata->private_init)		pdata->private_init(ehci_mv->op_regs, ehci_mv->phy_regs);	dev_info(&pdev->dev,		 "successful find EHCI device with regs 0x%p irq %d"		 " working in %s mode/n", hcd->regs, hcd->irq,		 ehci_mv->mode == MV_USB_MODE_OTG ? "OTG" : "Host");	return 0;err_set_vbus:	if (pdata->set_vbus)		pdata->set_vbus(0);#ifdef CONFIG_USB_OTG_UTILSerr_put_transceiver:	if (ehci_mv->otg)		usb_put_transceiver(ehci_mv->otg);#endiferr_disable_clk:	mv_ehci_disable(ehci_mv);err_iounmap_capreg:	iounmap(ehci_mv->cap_regs);err_iounmap_phyreg:	iounmap(ehci_mv->phy_regs);err_put_clk:	for (clk_i--; clk_i >= 0; clk_i--)		clk_put(ehci_mv->clk[clk_i]);	platform_set_drvdata(pdev, NULL);	kfree(ehci_mv);err_put_hcd:	usb_put_hcd(hcd);	return retval;}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:101,


示例4: ehci_hcd_s5pv210_drv_probe

static int ehci_hcd_s5pv210_drv_probe(struct platform_device *pdev){	struct usb_hcd  *hcd = NULL;	struct ehci_hcd *ehci = NULL;	int retval = 0;	if (usb_disabled())		return -ENODEV;	if (pdev->resource[1].flags != IORESOURCE_IRQ) {		dev_err(&pdev->dev, "resource[1] is not IORESOURCE_IRQ./n");		return -ENODEV;	}	hcd = usb_create_hcd(&ehci_s5pv210_hc_driver, &pdev->dev, "s5pv210");	if (!hcd) {		dev_err(&pdev->dev, "usb_create_hcd failed!/n");		return -ENODEV;	}	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_err(&pdev->dev, "request_mem_region failed!/n");		retval = -EBUSY;		goto err1;	}	usb_host_phy_power_init(pdev);	s5pv210_start_ehc();	hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);	if (!hcd->regs) {		dev_err(&pdev->dev, "ioremap failed!/n");		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 chip reads */	ehci->hcs_params = readl(&ehci->caps->hcs_params);#if defined(CONFIG_ARCH_S5PV210) || defined(CONFIG_ARCH_S5P6450)	writel(0x000F0000, hcd->regs + 0x90);#endif#if defined(CONFIG_ARCH_S5PV310)	writel(0x03C00000, hcd->regs + 0x90);#endif	if (create_ehci_sys_file(ehci) < 0) {			dev_err(&pdev->dev, "Failed to create ehci sysfs/n");	}	retval = usb_add_hcd(hcd, pdev->resource[1].start,				IRQF_DISABLED | IRQF_SHARED);	if (retval == 0) {		platform_set_drvdata(pdev, hcd);		s5pv210_hcd = hcd;#ifdef CONFIG_USB_SUSPEND		pm_runtime_set_active(&pdev->dev);		pm_runtime_enable(&pdev->dev);		pm_runtime_forbid(&pdev->dev);#endif		/*HSIC IPC control the ACTIVE_STATE*/                #ifdef CONFIG_SAMSUNG_PHONE_SVNET		mc_control_active_state(1);                #endif		return retval;	}	remove_ehci_sys_file(ehci);	s5pv210_stop_ehc();	iounmap(hcd->regs);err2:	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);err1:	usb_put_hcd(hcd);	return retval;}
开发者ID:myfluxi,项目名称:xxKernel,代码行数:86,


示例5: ehci_hcd_xilinx_of_probe

/** * ehci_hcd_xilinx_of_probe - Probe method for the USB host controller * @op:		pointer to the of_device to which the host controller bound * @match:	pointer to of_device_id structure, not used * * 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 __devinitehci_hcd_xilinx_of_probe(struct of_device *op, const struct of_device_id *match){	struct device_node *dn = op->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 __FILE__ ": request_mem_region failed/n");		rv = -EBUSY;		goto err_rmr;	}	irq = irq_of_parse_and_map(dn, 0);	if (irq == NO_IRQ) {		printk(KERN_ERR __FILE__ ": irq_of_parse_and_map failed/n");		rv = -EBUSY;		goto err_irq;	}	hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);	if (!hcd->regs) {		printk(KERN_ERR __FILE__ ": ioremap failed/n");		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_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:AdrianHuang,项目名称:uclinux-robutest,代码行数:101,


示例6: mv_ehci_probe

//.........这里部分代码省略.........		dev_err(&pdev->dev, "error getting clock/n");		retval = PTR_ERR(ehci_mv->clk);		goto err_put_hcd;	}	r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phyregs");	ehci_mv->phy_regs = devm_ioremap_resource(&pdev->dev, r);	if (IS_ERR(ehci_mv->phy_regs)) {		retval = PTR_ERR(ehci_mv->phy_regs);		goto err_put_hcd;	}	r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "capregs");	ehci_mv->cap_regs = devm_ioremap_resource(&pdev->dev, r);	if (IS_ERR(ehci_mv->cap_regs)) {		retval = PTR_ERR(ehci_mv->cap_regs);		goto err_put_hcd;	}	retval = mv_ehci_enable(ehci_mv);	if (retval) {		dev_err(&pdev->dev, "init phy error %d/n", retval);		goto err_put_hcd;	}	offset = readl(ehci_mv->cap_regs) & CAPLENGTH_MASK;	ehci_mv->op_regs =		(void __iomem *) ((unsigned long) ehci_mv->cap_regs + offset);	hcd->rsrc_start = r->start;	hcd->rsrc_len = resource_size(r);	hcd->regs = ehci_mv->op_regs;	hcd->irq = platform_get_irq(pdev, 0);	if (!hcd->irq) {		dev_err(&pdev->dev, "Cannot get irq.");		retval = -ENODEV;		goto err_disable_clk;	}	ehci = hcd_to_ehci(hcd);	ehci->caps = (struct ehci_caps *) ehci_mv->cap_regs;	ehci_mv->mode = pdata->mode;	if (ehci_mv->mode == MV_USB_MODE_OTG) {		ehci_mv->otg = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2);		if (IS_ERR(ehci_mv->otg)) {			retval = PTR_ERR(ehci_mv->otg);			if (retval == -ENXIO)				dev_info(&pdev->dev, "MV_USB_MODE_OTG "						"must have CONFIG_USB_PHY enabled/n");			else				dev_err(&pdev->dev,						"unable to find transceiver/n");			goto err_disable_clk;		}		retval = otg_set_host(ehci_mv->otg->otg, &hcd->self);		if (retval < 0) {			dev_err(&pdev->dev,				"unable to register with transceiver/n");			retval = -ENODEV;			goto err_disable_clk;		}		/* otg will enable clock before use as host */		mv_ehci_disable(ehci_mv);	} else {		if (pdata->set_vbus)			pdata->set_vbus(1);		retval = usb_add_hcd(hcd, hcd->irq, IRQF_SHARED);		if (retval) {			dev_err(&pdev->dev,				"failed to add hcd with err %d/n", retval);			goto err_set_vbus;		}		device_wakeup_enable(hcd->self.controller);	}	if (pdata->private_init)		pdata->private_init(ehci_mv->op_regs, ehci_mv->phy_regs);	dev_info(&pdev->dev,		 "successful find EHCI device with regs 0x%p irq %d"		 " working in %s mode/n", hcd->regs, hcd->irq,		 ehci_mv->mode == MV_USB_MODE_OTG ? "OTG" : "Host");	return 0;err_set_vbus:	if (pdata->set_vbus)		pdata->set_vbus(0);err_disable_clk:	mv_ehci_disable(ehci_mv);err_put_hcd:	usb_put_hcd(hcd);	return retval;}
开发者ID:Lyude,项目名称:linux,代码行数:101,


示例7: s5p_ehci_probe

//.........这里部分代码省略.........	}	err = clk_enable(s5p_ehci->clk);	if (err)		goto fail_clken;	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);	if (!res) {		dev_err(&pdev->dev, "Failed to get I/O memory/n");		err = -ENXIO;		goto fail_io;	}	hcd->rsrc_start = res->start;	hcd->rsrc_len = resource_size(res);	hcd->regs = ioremap(res->start, resource_size(res));	if (!hcd->regs) {		dev_err(&pdev->dev, "Failed to remap I/O memory/n");		err = -ENOMEM;		goto fail_io;	}	irq = platform_get_irq(pdev, 0);	if (!irq) {		dev_err(&pdev->dev, "Failed to get IRQ/n");		err = -ENODEV;		goto fail;	}	platform_set_drvdata(pdev, s5p_ehci);	s5p_ehci_phy_init(pdev);	ehci = hcd_to_ehci(hcd);	ehci->caps = hcd->regs;	ehci->regs = hcd->regs +		HC_LENGTH(ehci, readl(&ehci->caps->hc_capbase));	dbg_hcs_params(ehci, "reset");	dbg_hcc_params(ehci, "reset");	/* cache this readonly data; minimize chip reads */	ehci->hcs_params = readl(&ehci->caps->hcs_params);	err = usb_add_hcd(hcd, irq, IRQF_DISABLED | IRQF_SHARED);	if (err) {		dev_err(&pdev->dev, "Failed to add USB HCD/n");		goto fail;	}	create_ehci_sys_file(ehci);	s5p_ehci->power_on = 1;#ifdef CONFIG_USB_SUSPEND	pm_runtime_set_active(&pdev->dev);	pm_runtime_enable(&pdev->dev);#endif#ifdef CONFIG_MDM_HSIC_PM	/* halt controller before driving suspend on ths bus */	ehci->susp_sof_bug = 1;	set_host_stat(hsic_pm_dev, POWER_ON);	pm_runtime_allow(&pdev->dev);	pm_runtime_set_autosuspend_delay(&hcd->self.root_hub->dev, 0);	pm_runtime_forbid(&pdev->dev);	enable_periodic(ehci);#endif#ifdef CONFIG_EHCI_IRQ_DISTRIBUTION	if (num_possible_cpus() > 1) {		s5p_ehci_irq_no = irq;		s5p_ehci_irq_cpu = s5p_ehci_cpus[num_possible_cpus() - 1];		irq_set_affinity(s5p_ehci_irq_no, cpumask_of(s5p_ehci_irq_cpu));		register_cpu_notifier(&s5p_ehci_cpu_notifier);	}#endif#if defined(CONFIG_LINK_DEVICE_HSIC) || defined(CONFIG_LINK_DEVICE_USB)	/* for cp enumeration */	pm_runtime_forbid(&pdev->dev);	/*HSIC IPC control the ACTIVE_STATE*/	if (pdata && pdata->noti_host_states)		pdata->noti_host_states(pdev, S5P_HOST_ON);#endif	return 0;fail:	iounmap(hcd->regs);fail_io:	clk_disable(s5p_ehci->clk);fail_clken:	clk_put(s5p_ehci->clk);fail_clk:	usb_put_hcd(hcd);fail_hcd:	kfree(s5p_ehci);	return err;}
开发者ID:charlie1024,项目名称:sgs3-kernel,代码行数:101,


示例8: ps3_ohci_probe

//.........这里部分代码省略.........            __func__, __LINE__, ps3_result(result));        result = -EPERM;        goto fail_open;    }    result = ps3_dma_region_create(dev->d_region);    if (result) {        dev_dbg(&dev->core, "%s:%d: ps3_dma_region_create failed: "            "(%d)/n", __func__, __LINE__, result);        BUG_ON("check region type");        goto fail_dma_region;    }    result = ps3_mmio_region_create(dev->m_region);    if (result) {        dev_dbg(&dev->core, "%s:%d: ps3_map_mmio_region failed/n",            __func__, __LINE__);        result = -EPERM;        goto fail_mmio_region;    }    dev_dbg(&dev->core, "%s:%d: mmio mapped_addr %lxh/n", __func__,        __LINE__, dev->m_region->lpar_addr);    result = ps3_io_irq_setup(PS3_BINDING_CPU_ANY, dev->interrupt_id, &virq);    if (result) {        dev_dbg(&dev->core, "%s:%d: ps3_construct_io_irq(%d) failed./n",            __func__, __LINE__, virq);        result = -EPERM;        goto fail_irq;    }    dev->core.dma_mask = &dummy_mask; /* FIXME: for improper usb code */    hcd = usb_create_hcd(&ps3_ohci_hc_driver, &dev->core, dev->core.bus_id);    if (!hcd) {        dev_dbg(&dev->core, "%s:%d: usb_create_hcd failed/n", __func__,            __LINE__);        result = -ENOMEM;        goto fail_create_hcd;    }    hcd->rsrc_start = dev->m_region->lpar_addr;    hcd->rsrc_len = dev->m_region->len;    if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name))        dev_dbg(&dev->core, "%s:%d: request_mem_region failed/n",            __func__, __LINE__);    hcd->regs = ioremap(dev->m_region->lpar_addr, dev->m_region->len);    if (!hcd->regs) {        dev_dbg(&dev->core, "%s:%d: ioremap failed/n", __func__,            __LINE__);        result = -EPERM;        goto fail_ioremap;    }    dev_dbg(&dev->core, "%s:%d: hcd->rsrc_start %lxh/n", __func__, __LINE__,        (unsigned long)hcd->rsrc_start);    dev_dbg(&dev->core, "%s:%d: hcd->rsrc_len   %lxh/n", __func__, __LINE__,        (unsigned long)hcd->rsrc_len);    dev_dbg(&dev->core, "%s:%d: hcd->regs       %lxh/n", __func__, __LINE__,        (unsigned long)hcd->regs);    dev_dbg(&dev->core, "%s:%d: virq            %lu/n", __func__, __LINE__,        (unsigned long)virq);    ps3_system_bus_set_driver_data(dev, hcd);    result = usb_add_hcd(hcd, virq, IRQF_DISABLED);    if (result) {        dev_dbg(&dev->core, "%s:%d: usb_add_hcd failed (%d)/n",            __func__, __LINE__, result);        goto fail_add_hcd;    }    return result;fail_add_hcd:    iounmap(hcd->regs);fail_ioremap:    release_mem_region(hcd->rsrc_start, hcd->rsrc_len);    usb_put_hcd(hcd);fail_create_hcd:    ps3_io_irq_destroy(virq);fail_irq:    ps3_free_mmio_region(dev->m_region);fail_mmio_region:    ps3_dma_region_free(dev->d_region);fail_dma_region:    ps3_close_hv_device(dev);fail_open:fail_start:    return result;}
开发者ID:274914765,项目名称:C,代码行数:101,


示例9: ehci_msm_probe

static int ehci_msm_probe(struct platform_device *pdev){	struct usb_hcd *hcd;	struct resource *res;	int ret;	dev_dbg(&pdev->dev, "ehci_msm_probe/n");	hcd = usb_create_hcd(&msm_hc_driver, &pdev->dev, dev_name(&pdev->dev));	if (!hcd) {		dev_err(&pdev->dev, "Unable to create HCD/n");		return  -ENOMEM;	}	hcd->irq = platform_get_irq(pdev, 0);	if (hcd->irq < 0) {		dev_err(&pdev->dev, "Unable to get IRQ resource/n");		ret = hcd->irq;		goto put_hcd;	}	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);	if (!res) {		dev_err(&pdev->dev, "Unable to get memory resource/n");		ret = -ENODEV;		goto put_hcd;	}	hcd->rsrc_start = res->start;	hcd->rsrc_len = resource_size(res);	hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);	if (!hcd->regs) {		dev_err(&pdev->dev, "ioremap failed/n");		ret = -ENOMEM;		goto put_hcd;	}	/*	 * OTG driver takes care of PHY initialization, clock management,	 * powering up VBUS, mapping of registers address space and power	 * management.	 */	otg = otg_get_transceiver();	if (!otg) {		dev_err(&pdev->dev, "unable to find transceiver/n");		ret = -ENODEV;		goto unmap;	}	ret = otg_set_host(otg, &hcd->self);	if (ret < 0) {		dev_err(&pdev->dev, "unable to register with transceiver/n");		goto put_transceiver;	}	//device_init_wakeup(&pdev->dev, 1);	/*	 * OTG device parent of HCD takes care of putting	 * hardware into low power mode.	 */	//pm_runtime_no_callbacks(&pdev->dev);	//pm_runtime_enable(&pdev->dev);	return 0;put_transceiver:	otg_put_transceiver(otg);unmap:	iounmap(hcd->regs);put_hcd:	usb_put_hcd(hcd);	return ret;}
开发者ID:maxwen,项目名称:primou-kernel-HELLBOY,代码行数:74,


示例10: 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",			dev_name(&pdev->dev));		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",			dev_name(&pdev->dev));		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, dev_name(&pdev->dev));	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.	 */	switch (pd->phy_version) {	case EHCI_PHY_NA:	/* dont change USB phy settings */		break;	case EHCI_PHY_ORION:		orion_usb_phy_v1_setup(hcd);		break;	case EHCI_PHY_DD:	case EHCI_PHY_KW:	default:		printk(KERN_WARNING "Orion ehci -USB phy version isn't supported./n");	}	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",//.........这里部分代码省略.........
开发者ID:458941968,项目名称:mini2440-kernel-2.6.29,代码行数:101,


示例11: ehci_msm2_probe

//.........这里部分代码省略.........	}	ret = msm_ehci_init_vddcx(mhcd, 1);	if (ret) {		dev_err(&pdev->dev, "unable to initialize VDDCX/n");		ret = -ENODEV;		goto deinit_clocks;	}	ret = msm_ehci_config_vddcx(mhcd, 1);	if (ret) {		dev_err(&pdev->dev, "hsusb vddcx configuration failed/n");		goto deinit_vddcx;	}	ret = msm_ehci_ldo_init(mhcd, 1);	if (ret) {		dev_err(&pdev->dev, "hsusb vreg configuration failed/n");		goto deinit_vddcx;	}	ret = msm_ehci_ldo_enable(mhcd, 1);	if (ret) {		dev_err(&pdev->dev, "hsusb vreg enable failed/n");		goto deinit_ldo;	}	ret = msm_ehci_init_vbus(mhcd, 1);	if (ret) {		dev_err(&pdev->dev, "unable to get vbus/n");		goto disable_ldo;	}	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;	}	pdata = mhcd->dev->platform_data;	if (pdata && (!pdata->dock_connect_irq ||				!irq_read_line(pdata->dock_connect_irq)))		msm_ehci_vbus_power(mhcd, 1);	device_init_wakeup(&pdev->dev, 1);	wake_lock_init(&mhcd->wlock, WAKE_LOCK_SUSPEND, dev_name(&pdev->dev));	wake_lock(&mhcd->wlock);	/*	 * This pdev->dev is assigned parent of root-hub by USB core,	 * hence, runtime framework automatically calls this driver's	 * runtime APIs based on root-hub's state.	 */	/* configure pmic_gpio_irq for D+ change */	if (pdata && pdata->pmic_gpio_dp_irq)		mhcd->pmic_gpio_dp_irq = pdata->pmic_gpio_dp_irq;	if (mhcd->pmic_gpio_dp_irq) {		ret = request_threaded_irq(mhcd->pmic_gpio_dp_irq, NULL,				msm_ehci_host_wakeup_irq,				IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,				"msm_ehci_host_wakeup", mhcd);		if (!ret) {			disable_irq_nosync(mhcd->pmic_gpio_dp_irq);		} else {			dev_err(&pdev->dev, "request_irq(%d) failed: %d/n",					mhcd->pmic_gpio_dp_irq, ret);			mhcd->pmic_gpio_dp_irq = 0;		}	}	pm_runtime_set_active(&pdev->dev);	pm_runtime_enable(&pdev->dev);	return 0;vbus_deinit:	msm_ehci_init_vbus(mhcd, 0);disable_ldo:	msm_ehci_ldo_enable(mhcd, 0);deinit_ldo:	msm_ehci_ldo_init(mhcd, 0);deinit_vddcx:	msm_ehci_init_vddcx(mhcd, 0);deinit_clocks:	msm_ehci_init_clocks(mhcd, 0);devote_xo_handle:	msm_xo_mode_vote(mhcd->xo_handle, MSM_XO_MODE_OFF);free_xo_handle:	msm_xo_put(mhcd->xo_handle);unmap:	iounmap(hcd->regs);put_hcd:	usb_put_hcd(hcd);	return ret;}
开发者ID:jassycliq,项目名称:mako,代码行数:101,


示例12: ehci_msm2_remove

static int ehci_msm2_remove(struct platform_device *pdev){	struct usb_hcd *hcd = platform_get_drvdata(pdev);	struct msm_hcd *mhcd = hcd_to_mhcd(hcd);	struct pinctrl_state *set_state;	if (mhcd->pmic_gpio_dp_irq) {		if (mhcd->pmic_gpio_dp_irq_enabled)			disable_irq_wake(mhcd->pmic_gpio_dp_irq);		free_irq(mhcd->pmic_gpio_dp_irq, mhcd);	}	if (mhcd->async_irq) {		if (mhcd->async_irq_enabled)			disable_irq_wake(mhcd->async_irq);		free_irq(mhcd->async_irq, mhcd);	}	if (mhcd->wakeup_irq) {		if (mhcd->wakeup_irq_enabled)			disable_irq_wake(mhcd->wakeup_irq);		free_irq(mhcd->wakeup_irq, mhcd);	}	/* If the device was removed no need to call pm_runtime_disable */	if (pdev->dev.power.power_state.event != PM_EVENT_INVALID)		pm_runtime_disable(&pdev->dev);	device_init_wakeup(&pdev->dev, 0);	pm_runtime_set_suspended(&pdev->dev);	usb_remove_hcd(hcd);	if (hcd->phy)		usb_phy_shutdown(hcd->phy);	if (mhcd->xo_clk) {		clk_disable_unprepare(mhcd->xo_clk);		clk_put(mhcd->xo_clk);	}	msm_ehci_vbus_power(mhcd, 0);	msm_ehci_init_vbus(mhcd, 0);	msm_ehci_ldo_enable(mhcd, 0);	msm_ehci_ldo_init(mhcd, 0);	msm_ehci_init_vddcx(mhcd, 0);	if (mhcd->hsusb_pinctrl) {		set_state = pinctrl_lookup_state(mhcd->hsusb_pinctrl,				"ehci_sleep");		if (IS_ERR(set_state))			pr_err("cannot get hsusb pinctrl sleep state/n");		else			pinctrl_select_state(mhcd->hsusb_pinctrl, set_state);	}	msm_ehci_init_clocks(mhcd, 0);	wakeup_source_trash(&mhcd->ws);	iounmap(hcd->regs);	usb_put_hcd(hcd);#if defined(CONFIG_DEBUG_FS)	debugfs_remove_recursive(dent_ehci);#endif	return 0;}
开发者ID:Runner85sx,项目名称:android_kernel_huawei_msm8909,代码行数:64,


示例13: usb_hcd_da8xx_probe

/** * usb_hcd_da8xx_probe - initialize DA8xx-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_da8xx_probe(const struct hc_driver *driver,			       struct platform_device *pdev){	struct da8xx_ohci_root_hub *hub	= pdev->dev.platform_data;	struct usb_hcd	*hcd;	struct resource *mem;	int error, irq;	if (hub == NULL)		return -ENODEV;	usb11_clk = clk_get(&pdev->dev, "USB11CLK");	if (IS_ERR(usb11_clk))		return PTR_ERR(usb11_clk);	usb20_clk = clk_get(&pdev->dev, "USB20CLK");	if (IS_ERR(usb20_clk)) {		error = PTR_ERR(usb20_clk);		goto err0;	}	hcd = usb_create_hcd(driver, &pdev->dev, pdev->dev.bus_id);	if (!hcd) {		error = -ENOMEM;		goto err1;	}	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);	if (!mem) {		error = -ENODEV;		goto err2;	}	hcd->rsrc_start = mem->start;	hcd->rsrc_len = mem->end - mem->start + 1;	if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {		dev_dbg(&pdev->dev, "request_mem_region failed/n");		error = -EBUSY;		goto err2;	}	hcd->regs = (void __iomem *)(long)IO_ADDRESS(hcd->rsrc_start);	ohci_hcd_init(hcd_to_ohci(hcd));	irq = platform_get_irq(pdev, 0);	if (irq < 0) {		error = -ENODEV;		goto err3;	}	error = usb_add_hcd(hcd, irq, IRQF_DISABLED);	if (error)		goto err4;	error = hub->ocic_notify(ohci_da8xx_ocic_handler);	if (!error)		return 0;err4:	usb_remove_hcd(hcd);err3:	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);err2:	usb_put_hcd(hcd);err1:	clk_put(usb20_clk);err0:	clk_put(usb11_clk);	return error;}
开发者ID:mrtos,项目名称:Logitech-Revue,代码行数:78,


示例14: usb_hcd_at91_probe

/** * usb_hcd_at91_probe - initialize AT91-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_at91_probe(const struct hc_driver *driver,			struct platform_device *pdev){	int retval;	struct usb_hcd *hcd = NULL;	if (pdev->num_resources != 2) {		pr_debug("hcd probe: invalid num_resources");		return -ENODEV;	}	if ((pdev->resource[0].flags != IORESOURCE_MEM)			|| (pdev->resource[1].flags != IORESOURCE_IRQ)) {		pr_debug("hcd probe: invalid resource type/n");		return -ENODEV;	}	hcd = usb_create_hcd(driver, &pdev->dev, "at91");	if (!hcd)		return -ENOMEM;	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)) {		pr_debug("request_mem_region failed/n");		retval = -EBUSY;		goto err1;	}	hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);	if (!hcd->regs) {		pr_debug("ioremap failed/n");		retval = -EIO;		goto err2;	}	iclk = clk_get(&pdev->dev, "ohci_clk");	fclk = clk_get(&pdev->dev, "uhpck");	if (cpu_is_at91sam9261())		hclk = clk_get(&pdev->dev, "hck0");	at91_start_hc(pdev);	ohci_hcd_init(hcd_to_ohci(hcd));	retval = usb_add_hcd(hcd, pdev->resource[1].start, IRQF_DISABLED);	if (retval == 0)		return retval;	/* Error handling */	at91_stop_hc(pdev);	if (cpu_is_at91sam9261())		clk_put(hclk);	clk_put(fclk);	clk_put(iclk);	iounmap(hcd->regs); err2:	release_mem_region(hcd->rsrc_start, hcd->rsrc_len); err1:	usb_put_hcd(hcd);	return retval;}
开发者ID:johnny,项目名称:CobraDroidBeta,代码行数:73,


示例15: st_ohci_platform_probe

//.........这里部分代码省略.........		return -ENODEV;	irq = platform_get_irq(dev, 0);	if (irq < 0) {		dev_err(&dev->dev, "no irq provided");		return irq;	}	res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0);	if (!res_mem) {		dev_err(&dev->dev, "no memory resource provided");		return -ENXIO;	}	hcd = usb_create_hcd(&ohci_platform_hc_driver, &dev->dev,			dev_name(&dev->dev));	if (!hcd)		return -ENOMEM;	platform_set_drvdata(dev, hcd);	dev->dev.platform_data = pdata;	priv = hcd_to_ohci_priv(hcd);	ohci = hcd_to_ohci(hcd);	priv->phy = devm_phy_get(&dev->dev, "usb");	if (IS_ERR(priv->phy)) {		err = PTR_ERR(priv->phy);		goto err_put_hcd;	}	for (clk = 0; clk < USB_MAX_CLKS; clk++) {		priv->clks[clk] = of_clk_get(dev->dev.of_node, clk);		if (IS_ERR(priv->clks[clk])) {			err = PTR_ERR(priv->clks[clk]);			if (err == -EPROBE_DEFER)				goto err_put_clks;			priv->clks[clk] = NULL;			break;		}	}	/* some SoCs don't have a dedicated 48Mhz clock, but those that	   do need the rate to be explicitly set */	priv->clk48 = devm_clk_get(&dev->dev, "clk48");	if (IS_ERR(priv->clk48)) {		dev_info(&dev->dev, "48MHz clk not found/n");		priv->clk48 = NULL;	}	priv->pwr = devm_reset_control_get_optional(&dev->dev, "power");	if (IS_ERR(priv->pwr)) {		err = PTR_ERR(priv->pwr);		goto err_put_clks;	}	priv->rst = devm_reset_control_get_optional(&dev->dev, "softreset");	if (IS_ERR(priv->rst)) {		err = PTR_ERR(priv->rst);		goto err_put_clks;	}	if (pdata->power_on) {		err = pdata->power_on(dev);		if (err < 0)			goto err_power;	}	hcd->rsrc_start = res_mem->start;	hcd->rsrc_len = resource_size(res_mem);	hcd->regs = devm_ioremap_resource(&dev->dev, res_mem);	if (IS_ERR(hcd->regs)) {		err = PTR_ERR(hcd->regs);		goto err_power;	}	err = usb_add_hcd(hcd, irq, IRQF_SHARED);	if (err)		goto err_power;	device_wakeup_enable(hcd->self.controller);	platform_set_drvdata(dev, hcd);	return err;err_power:	if (pdata->power_off)		pdata->power_off(dev);err_put_clks:	while (--clk >= 0)		clk_put(priv->clks[clk]);err_put_hcd:	if (pdata == &ohci_platform_defaults)		dev->dev.platform_data = NULL;	usb_put_hcd(hcd);	return err;}
开发者ID:020gzh,项目名称:linux,代码行数:101,


示例16: ehci_msm_probe

static int ehci_msm_probe(struct platform_device *pdev){	struct usb_hcd *hcd;	struct resource *res;	struct usb_phy *phy;	int ret;	dev_dbg(&pdev->dev, "ehci_msm proble/n");	hcd = usb_create_hcd(&msm_hc_driver, &pdev->dev, dev_name(&pdev->dev));	if (!hcd) {		dev_err(&pdev->dev, "Unable to create HCD/n");		return  -ENOMEM;	}	hcd->irq = platform_get_irq(pdev, 0);	if (hcd->irq < 0) {		dev_err(&pdev->dev, "Unable to get IRQ resource/n");		ret = hcd->irq;		goto put_hcd;	}	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);	if (!res) {		dev_err(&pdev->dev, "Unable to get memory resource/n");		ret = -ENODEV;		goto put_hcd;	}	hcd->rsrc_start = res->start;	hcd->rsrc_len = resource_size(res);	hcd->regs = devm_ioremap_resource(&pdev->dev, res);	if (IS_ERR(hcd->regs)) {		ret = PTR_ERR(hcd->regs);		goto put_hcd;	}	/*	 * OTG driver takes care of PHY initialization, clock management,	 * powering up VBUS, mapping of registers address space and power	 * management.	 */	if (pdev->dev.of_node)		phy = devm_usb_get_phy_by_phandle(&pdev->dev, "usb-phy", 0);	else		phy = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2);	if (IS_ERR(phy)) {		dev_err(&pdev->dev, "unable to find transceiver/n");		ret = -EPROBE_DEFER;		goto put_hcd;	}	ret = otg_set_host(phy->otg, &hcd->self);	if (ret < 0) {		dev_err(&pdev->dev, "unable to register with transceiver/n");		goto put_hcd;	}	hcd->phy = phy;	device_init_wakeup(&pdev->dev, 1);	/*	 * OTG device parent of HCD takes care of putting	 * hardware into low power mode.	 */	pm_runtime_no_callbacks(&pdev->dev);	pm_runtime_enable(&pdev->dev);	/* FIXME: need to call usb_add_hcd() here? */	return 0;put_hcd:	usb_put_hcd(hcd);	return ret;}
开发者ID:mikuhatsune001,项目名称:linux2.6.32,代码行数:77,


示例17: usb_hcd_pxa27x_probe

/** * usb_hcd_pxa27x_probe - initialize pxa27x-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_pxa27x_probe (const struct hc_driver *driver, struct platform_device *pdev){	int retval, irq;	struct usb_hcd *hcd;	struct pxaohci_platform_data *inf;	struct pxa27x_ohci *ohci;	struct resource *r;	struct clk *usb_clk;	retval = ohci_pxa_of_init(pdev);	if (retval)		return retval;	inf = pdev->dev.platform_data;	if (!inf)		return -ENODEV;	irq = platform_get_irq(pdev, 0);	if (irq < 0) {		pr_err("no resource of IORESOURCE_IRQ");		return -ENXIO;	}	usb_clk = clk_get(&pdev->dev, NULL);	if (IS_ERR(usb_clk))		return PTR_ERR(usb_clk);	hcd = usb_create_hcd (driver, &pdev->dev, "pxa27x");	if (!hcd) {		retval = -ENOMEM;		goto err0;	}	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);	if (!r) {		pr_err("no resource of IORESOURCE_MEM");		retval = -ENXIO;		goto err1;	}	hcd->rsrc_start = r->start;	hcd->rsrc_len = resource_size(r);	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;	}	/* initialize "struct pxa27x_ohci" */	ohci = (struct pxa27x_ohci *)hcd_to_ohci(hcd);	ohci->dev = &pdev->dev;	ohci->clk = usb_clk;	ohci->mmio_base = (void __iomem *)hcd->regs;	if ((retval = pxa27x_start_hc(ohci, &pdev->dev)) < 0) {		pr_debug("pxa27x_start_hc failed");		goto err3;	}	/* Select Power Management Mode */	pxa27x_ohci_select_pmm(ohci, inf->port_mode);	if (inf->power_budget)		hcd->power_budget = inf->power_budget;	ohci_hcd_init(hcd_to_ohci(hcd));	retval = usb_add_hcd(hcd, irq, 0);	if (retval == 0)		return retval;	pxa27x_stop_hc(ohci, &pdev->dev); err3:	iounmap(hcd->regs); err2:	release_mem_region(hcd->rsrc_start, hcd->rsrc_len); err1:	usb_put_hcd(hcd); err0:	clk_put(usb_clk);	return retval;}
开发者ID:Cool-Joe,项目名称:imx23-audio,代码行数:100,


示例18: container_of

/** * usb_alloc_dev - usb device constructor (usbcore-internal) * @parent: hub to which device is connected; null to allocate a root hub * @bus: bus used to access the device * @port1: one-based index of port; ignored for root hubs * Context: !in_interrupt() * * Only hub drivers (including virtual root hub drivers for host * controllers) should ever call this. * * This call may not be used in a non-sleeping context. */struct usb_device *usb_alloc_dev(struct usb_device *parent,				 struct usb_bus *bus, unsigned port1){	struct usb_device *dev;	struct usb_hcd *usb_hcd = container_of(bus, struct usb_hcd, self);	unsigned root_hub = 0;	dev = kzalloc(sizeof(*dev), GFP_KERNEL);	if (!dev)		return NULL;	if (!usb_get_hcd(bus_to_hcd(bus))) {		kfree(dev);		return NULL;	}	/* Root hubs aren't true devices, so don't allocate HCD resources */	if (usb_hcd->driver->alloc_dev && parent &&		!usb_hcd->driver->alloc_dev(usb_hcd, dev)) {		usb_put_hcd(bus_to_hcd(bus));		kfree(dev);		return NULL;	}	device_initialize(&dev->dev);	dev->dev.bus = &usb_bus_type;	dev->dev.type = &usb_device_type;	dev->dev.groups = usb_device_groups;	dev->dev.dma_mask = bus->controller->dma_mask;	set_dev_node(&dev->dev, dev_to_node(bus->controller));	dev->state = USB_STATE_ATTACHED;	atomic_set(&dev->urbnum, 0);	INIT_LIST_HEAD(&dev->ep0.urb_list);	dev->ep0.desc.bLength = USB_DT_ENDPOINT_SIZE;	dev->ep0.desc.bDescriptorType = USB_DT_ENDPOINT;	/* ep0 maxpacket comes later, from device descriptor */	usb_enable_endpoint(dev, &dev->ep0, false);	dev->can_submit = 1;	/* Save readable and stable topology id, distinguishing devices	 * by location for diagnostics, tools, driver model, etc.  The	 * string is a path along hub ports, from the root.  Each device's	 * dev->devpath will be stable until USB is re-cabled, and hubs	 * are often labeled with these port numbers.  The name isn't	 * as stable:  bus->busnum changes easily from modprobe order,	 * cardbus or pci hotplugging, and so on.	 */	if (unlikely(!parent)) {		dev->devpath[0] = '0';		dev->route = 0;		dev->dev.parent = bus->controller;		dev_set_name(&dev->dev, "usb%d", bus->busnum);		root_hub = 1;	} else {		/* match any labeling on the hubs; it's one-based */		if (parent->devpath[0] == '0') {			snprintf(dev->devpath, sizeof dev->devpath,				"%d", port1);			/* Root ports are not counted in route string */			dev->route = 0;		} else {			snprintf(dev->devpath, sizeof dev->devpath,				"%s.%d", parent->devpath, port1);			/* Route string assumes hubs have less than 16 ports */			if (port1 < 15)				dev->route = parent->route +					(port1 << ((parent->level - 1)*4));			else				dev->route = parent->route +					(15 << ((parent->level - 1)*4));		}		dev->dev.parent = &parent->dev;		dev_set_name(&dev->dev, "%d-%s", bus->busnum, dev->devpath);		/* hub driver sets up TT records */	}	dev->portnum = port1;	dev->bus = bus;	dev->parent = parent;	INIT_LIST_HEAD(&dev->filelist);#ifdef	CONFIG_PM	pm_runtime_set_autosuspend_delay(&dev->dev,			usb_autosuspend_delay * 1000);	dev->connect_time = jiffies;//.........这里部分代码省略.........
开发者ID:fr34k8,项目名称:DT_Hybrid_GPL_1.00.053,代码行数:101,


示例19: ohci_platform_probe

//.........这里部分代码省略.........				err = PTR_ERR(priv->phys[phy_num]);				goto err_put_hcd;			}		}		for (clk = 0; clk < OHCI_MAX_CLKS; clk++) {			priv->clks[clk] = of_clk_get(dev->dev.of_node, clk);			if (IS_ERR(priv->clks[clk])) {				err = PTR_ERR(priv->clks[clk]);				if (err == -EPROBE_DEFER)					goto err_put_clks;				priv->clks[clk] = NULL;				break;			}		}		for (rst = 0; rst < OHCI_MAX_RESETS; rst++) {			priv->resets[rst] =				devm_reset_control_get_shared_by_index(								&dev->dev, rst);			if (IS_ERR(priv->resets[rst])) {				err = PTR_ERR(priv->resets[rst]);				if (err == -EPROBE_DEFER)					goto err_reset;				priv->resets[rst] = NULL;				break;			}			err = reset_control_deassert(priv->resets[rst]);			if (err)				goto err_reset;		}	}	if (pdata->big_endian_desc)		ohci->flags |= OHCI_QUIRK_BE_DESC;	if (pdata->big_endian_mmio)		ohci->flags |= OHCI_QUIRK_BE_MMIO;	if (pdata->no_big_frame_no)		ohci->flags |= OHCI_QUIRK_FRAME_NO;	if (pdata->num_ports)		ohci->num_ports = pdata->num_ports;#ifndef CONFIG_USB_OHCI_BIG_ENDIAN_MMIO	if (ohci->flags & OHCI_QUIRK_BE_MMIO) {		dev_err(&dev->dev,			"Error: CONFIG_USB_OHCI_BIG_ENDIAN_MMIO not set/n");		err = -EINVAL;		goto err_reset;	}#endif#ifndef CONFIG_USB_OHCI_BIG_ENDIAN_DESC	if (ohci->flags & OHCI_QUIRK_BE_DESC) {		dev_err(&dev->dev,			"Error: CONFIG_USB_OHCI_BIG_ENDIAN_DESC not set/n");		err = -EINVAL;		goto err_reset;	}#endif	if (pdata->power_on) {		err = pdata->power_on(dev);		if (err < 0)			goto err_reset;	}	res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0);	hcd->regs = devm_ioremap_resource(&dev->dev, res_mem);	if (IS_ERR(hcd->regs)) {		err = PTR_ERR(hcd->regs);		goto err_power;	}	hcd->rsrc_start = res_mem->start;	hcd->rsrc_len = resource_size(res_mem);	err = usb_add_hcd(hcd, irq, IRQF_SHARED);	if (err)		goto err_power;	device_wakeup_enable(hcd->self.controller);	platform_set_drvdata(dev, hcd);	return err;err_power:	if (pdata->power_off)		pdata->power_off(dev);err_reset:	while (--rst >= 0)		reset_control_assert(priv->resets[rst]);err_put_clks:	while (--clk >= 0)		clk_put(priv->clks[clk]);err_put_hcd:	if (pdata == &ohci_platform_defaults)		dev->dev.platform_data = NULL;	usb_put_hcd(hcd);	return err;}
开发者ID:AK101111,项目名称:linux,代码行数:101,


示例20: 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;	}	/* The sm501 chip is equipped with local memory that may be used	 * by on-chip devices such as the video controller and the usb host.	 * This driver uses dma_declare_coherent_memory() to make sure	 * usb allocations with dma_alloc_coherent() allocate from	 * this local memory. The dma_handle returned by dma_alloc_coherent()	 * will be an offset starting from 0 for the first local memory byte.	 *	 * So as long as data is allocated using dma_alloc_coherent() all is	 * fine. This is however not always the case - buffers may be allocated	 * using kmalloc() - so the usb core needs to be told that it must copy	 * data into our local memory if the buffers happen to be placed in	 * regular memory. The HCD_LOCAL_MEM flag does just that.	 */	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;	}	/* allocate, reserve and remap resources for registers */	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;	/* enable power and unmask interrupts */	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://.........这里部分代码省略.........
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:101,


示例21: ohci_hcd_ppc_of_probe

static int ohci_hcd_ppc_of_probe(struct platform_device *op){	struct device_node *dn = op->dev.of_node;	struct usb_hcd *hcd;	struct ohci_hcd	*ohci;	struct resource res;	int irq;	int rv;	int is_bigendian;	struct device_node *np;	if (usb_disabled())		return -ENODEV;	is_bigendian =		of_device_is_compatible(dn, "ohci-bigendian") ||		of_device_is_compatible(dn, "ohci-be");	dev_dbg(&op->dev, "initializing PPC-OF USB Controller/n");	rv = of_address_to_resource(dn, 0, &res);	if (rv)		return rv;	hcd = usb_create_hcd(&ohci_ppc_of_hc_driver, &op->dev, "PPC-OF 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;	}	ohci = hcd_to_ohci(hcd);	if (is_bigendian) {		ohci->flags |= OHCI_QUIRK_BE_MMIO | OHCI_QUIRK_BE_DESC;		if (of_device_is_compatible(dn, "fsl,mpc5200-ohci"))			ohci->flags |= OHCI_QUIRK_FRAME_NO;		if (of_device_is_compatible(dn, "mpc5200-ohci"))			ohci->flags |= OHCI_QUIRK_FRAME_NO;	}	ohci_hcd_init(ohci);	rv = usb_add_hcd(hcd, irq, 0);	if (rv == 0)		return 0;	/* by now, 440epx is known to show usb_23 erratum */	np = of_find_compatible_node(NULL, NULL, "ibm,usb-ehci-440epx");	/* Work around - At this point ohci_run has executed, the	* controller is running, everything, the root ports, etc., is	* set up.  If the ehci driver is loaded, put the ohci core in	* the suspended state.  The ehci driver will bring it out of	* suspended state when / if a non-high speed USB device is	* attached to the USB Host port.  If the ehci driver is not	* loaded, do nothing. request_mem_region is used to test if	* the ehci driver is loaded.	*/	if (np !=  NULL) {		if (!of_address_to_resource(np, 0, &res)) {			if (!request_mem_region(res.start, 0x4, hcd_name)) {				writel_be((readl_be(&ohci->regs->control) |					OHCI_USB_SUSPEND), &ohci->regs->control);					(void) readl_be(&ohci->regs->control);			} else				release_mem_region(res.start, 0x4);		} else			pr_debug("%s: cannot get ehci offset from fdt/n", __FILE__);	}	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:PKUCloud,项目名称:samsara-linux-3.11,代码行数:101,


示例22: ehci_msm_probe

static int __devinit ehci_msm_probe(struct platform_device *pdev){    struct usb_hcd *hcd;    struct resource *res;    struct msm_usb_host_platform_data *pdata;    int retval;    struct msmusb_hcd *mhcd;    hcd = usb_create_hcd(&msm_hc_driver, &pdev->dev, dev_name(&pdev->dev));    if (!hcd)        return  -ENOMEM;    hcd->irq = platform_get_irq(pdev, 0);    if (hcd->irq < 0) {        usb_put_hcd(hcd);        return hcd->irq;    }    res = platform_get_resource(pdev, IORESOURCE_MEM, 0);    if (!res) {        usb_put_hcd(hcd);        return -ENODEV;    }    hcd->rsrc_start = res->start;    hcd->rsrc_len = resource_size(res);    mhcd = hcd_to_mhcd(hcd);    spin_lock_init(&mhcd->lock);    mhcd->in_lpm = 0;    mhcd->running = 0;    device_init_wakeup(&pdev->dev, 1);    pdata = pdev->dev.platform_data;    if (PHY_TYPE(pdata->phy_info) == USB_PHY_UNDEFINED) {        usb_put_hcd(hcd);        return -ENODEV;    }    hcd->power_budget = pdata->power_budget;    mhcd->pdata = pdata;    INIT_WORK(&mhcd->lpm_exit_work, usb_lpm_exit_w);    wake_lock_init(&mhcd->wlock, WAKE_LOCK_SUSPEND, dev_name(&pdev->dev));    pdata->ebi1_clk = clk_get(&pdev->dev, "core_clk");    if (IS_ERR(pdata->ebi1_clk))        pdata->ebi1_clk = NULL;    else        clk_set_rate(pdata->ebi1_clk, INT_MAX);    retval = msm_xusb_init_host(pdev, mhcd);    if (retval < 0) {        wake_lock_destroy(&mhcd->wlock);        usb_put_hcd(hcd);        clk_put(pdata->ebi1_clk);    }    pm_runtime_enable(&pdev->dev);    return retval;}
开发者ID:weritos666,项目名称:ARCHOS_50_Platinum,代码行数:61,


示例23: ehci_hcd_sh_probe

static int ehci_hcd_sh_probe(struct platform_device *pdev){	const struct hc_driver *driver = &ehci_sh_hc_driver;	struct resource *res;	struct ehci_sh_priv *priv;	struct usb_hcd *hcd;	int irq, ret;	if (usb_disabled())		return -ENODEV;	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));		ret = -ENODEV;		goto fail_create_hcd;	}	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));		ret = -ENODEV;		goto fail_create_hcd;	}	/* initialize hcd */	hcd = usb_create_hcd(&ehci_sh_hc_driver, &pdev->dev,			     dev_name(&pdev->dev));	if (!hcd) {		ret = -ENOMEM;		goto fail_create_hcd;	}	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 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");		ret = -ENXIO;		goto fail_ioremap;	}	priv = kmalloc(sizeof(struct ehci_sh_priv), GFP_KERNEL);	if (!priv) {		dev_dbg(&pdev->dev, "error allocating priv data/n");		ret = -ENOMEM;		goto fail_alloc;	}	/* These are optional, we don't care if they fail */	priv->fclk = clk_get(&pdev->dev, "usb_fck");	if (IS_ERR(priv->fclk))		priv->fclk = NULL;	priv->iclk = clk_get(&pdev->dev, "usb_ick");	if (IS_ERR(priv->iclk))		priv->iclk = NULL;	clk_enable(priv->fclk);	clk_enable(priv->iclk);	ret = usb_add_hcd(hcd, irq, IRQF_DISABLED | IRQF_SHARED);	if (ret != 0) {		dev_err(&pdev->dev, "Failed to add hcd");		goto fail_add_hcd;	}	priv->hcd = hcd;	platform_set_drvdata(pdev, priv);	return ret;fail_add_hcd:	clk_disable(priv->iclk);	clk_disable(priv->fclk);	clk_put(priv->iclk);	clk_put(priv->fclk);	kfree(priv);fail_alloc:	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), ret);//.........这里部分代码省略.........
开发者ID:119-org,项目名称:hi3518-osdrv,代码行数:101,


示例24: ehci_hcd_ppc_of_probe

static int __devinitehci_hcd_ppc_of_probe(struct of_device *op, const struct of_device_id *match){	struct device_node *dn = op->node;	struct usb_hcd *hcd;	struct ehci_hcd	*ehci;	struct resource res;	int irq;	int rv;	if (usb_disabled())		return -ENODEV;	dev_dbg(&op->dev, "initializing PPC-OF USB Controller/n");	rv = of_address_to_resource(dn, 0, &res);	if (rv)		return rv;	hcd = usb_create_hcd(&ehci_ppc_of_hc_driver, &op->dev, "PPC-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 __FILE__ ": request_mem_region failed/n");		rv = -EBUSY;		goto err_rmr;	}	irq = irq_of_parse_and_map(dn, 0);	if (irq == NO_IRQ) {		printk(KERN_ERR __FILE__ ": irq_of_parse_and_map failed/n");		rv = -EBUSY;		goto err_irq;	}	hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);	if (!hcd->regs) {		printk(KERN_ERR __FILE__ ": ioremap failed/n");		rv = -ENOMEM;		goto err_ioremap;	}	ehci = hcd_to_ehci(hcd);	if (of_get_property(dn, "big-endian", NULL)) {		ehci->big_endian_mmio = 1;		ehci->big_endian_desc = 1;	}	if (of_get_property(dn, "big-endian-regs", NULL))		ehci->big_endian_mmio = 1;	if (of_get_property(dn, "big-endian-desc", NULL))		ehci->big_endian_desc = 1;	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);	if (of_device_is_compatible(dn, "ibm,usb-ehci-440epx")) {		rv = ppc44x_enable_bmt(dn);		ehci_dbg(ehci, "Break Memory Transfer (BMT) is %senabled!/n",				rv ? "NOT ": "");	}	rv = usb_add_hcd(hcd, irq, 0);	if (rv == 0)		return 0;	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:mrtos,项目名称:Logitech-Revue,代码行数:84,


示例25: ehci_platform_probe

//.........这里部分代码省略.........			priv->phys[phy_num] = devm_of_phy_get_by_index(					&dev->dev, dev->dev.of_node, phy_num);			if (IS_ERR(priv->phys[phy_num])) {				err = PTR_ERR(priv->phys[phy_num]);					goto err_put_hcd;			} else if (!hcd->phy) {				/* Avoiding phy_get() in usb_add_hcd() */				hcd->phy = priv->phys[phy_num];			}		}		for (clk = 0; clk < EHCI_MAX_CLKS; clk++) {			priv->clks[clk] = of_clk_get(dev->dev.of_node, clk);			if (IS_ERR(priv->clks[clk])) {				err = PTR_ERR(priv->clks[clk]);				if (err == -EPROBE_DEFER)					goto err_put_clks;				priv->clks[clk] = NULL;				break;			}		}	}	priv->rsts = devm_reset_control_array_get_optional_shared(&dev->dev);	if (IS_ERR(priv->rsts)) {		err = PTR_ERR(priv->rsts);		goto err_put_clks;	}	err = reset_control_deassert(priv->rsts);	if (err)		goto err_put_clks;	if (pdata->big_endian_desc)		ehci->big_endian_desc = 1;	if (pdata->big_endian_mmio)		ehci->big_endian_mmio = 1;	if (pdata->has_tt)		hcd->has_tt = 1;	if (pdata->reset_on_resume)		priv->reset_on_resume = true;#ifndef CONFIG_USB_EHCI_BIG_ENDIAN_MMIO	if (ehci->big_endian_mmio) {		dev_err(&dev->dev,			"Error: CONFIG_USB_EHCI_BIG_ENDIAN_MMIO not set/n");		err = -EINVAL;		goto err_reset;	}#endif#ifndef CONFIG_USB_EHCI_BIG_ENDIAN_DESC	if (ehci->big_endian_desc) {		dev_err(&dev->dev,			"Error: CONFIG_USB_EHCI_BIG_ENDIAN_DESC not set/n");		err = -EINVAL;		goto err_reset;	}#endif	if (pdata->power_on) {		err = pdata->power_on(dev);		if (err < 0)			goto err_reset;	}	res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0);	hcd->regs = devm_ioremap_resource(&dev->dev, res_mem);	if (IS_ERR(hcd->regs)) {		err = PTR_ERR(hcd->regs);		goto err_power;	}	hcd->rsrc_start = res_mem->start;	hcd->rsrc_len = resource_size(res_mem);	err = usb_add_hcd(hcd, irq, IRQF_SHARED);	if (err)		goto err_power;	device_wakeup_enable(hcd->self.controller);	device_enable_async_suspend(hcd->self.controller);	platform_set_drvdata(dev, hcd);	return err;err_power:	if (pdata->power_off)		pdata->power_off(dev);err_reset:	reset_control_assert(priv->rsts);err_put_clks:	while (--clk >= 0)		clk_put(priv->clks[clk]);err_put_hcd:	if (pdata == &ehci_platform_defaults)		dev->dev.platform_data = NULL;	usb_put_hcd(hcd);	return err;}
开发者ID:ReneNyffenegger,项目名称:linux,代码行数:101,


示例26: rt3xxx_ehci_probe

static int rt3xxx_ehci_probe(struct platform_device *pdev){	struct usb_hcd *hcd;	const struct hc_driver *driver = &rt3xxx_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./n");		return -ENODEV;	}	irq = res->start;	hcd = usb_create_hcd(driver, &pdev->dev, "rt3xxx" /*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./n");		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;	}	// reset host controller	//rt_usbhost_reset();	// wake up usb module from power saving mode...	try_wake_up();#ifdef CONFIG_USB_GADGET_RT#warning	"*********************************************************"#warning	"*    EHCI will yield USB port0 to device controller!    *"#warning	"*********************************************************""#else	// change port0 to host mode	rt_set_host();#endif	retval = usb_add_hcd(hcd, irq, IRQF_DISABLED | 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, "RT3xxx EHCI init fail. %d/n", retval);	return retval;}
开发者ID:patrick-ken,项目名称:kernel_808l,代码行数:77,


示例27: ohci_hcd_tmio_drv_probe

static int ohci_hcd_tmio_drv_probe(struct platform_device *dev){	const struct mfd_cell *cell = mfd_get_cell(dev);	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_name(&dev->dev));	if (!hcd) {		ret = -ENOMEM;		goto err_usb_create_hcd;	}	hcd->rsrc_start = regs->start;	hcd->rsrc_len = resource_size(regs);	tmio = hcd_to_tmio(hcd);	spin_lock_init(&tmio->lock);	tmio->ccr = ioremap(config->start, resource_size(config));	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;	}	ret = dma_declare_coherent_memory(&dev->dev, sram->start, sram->start,				resource_size(sram));	if (ret)		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, 0);	if (ret)		goto err_add_hcd;	device_wakeup_enable(hcd->self.controller);	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:Anjali05,项目名称:linux,代码行数:84,



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


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