Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v3.16-rc2 121 lines 3.1 kB view raw
1/* Copyright (c) 2010, Code Aurora Forum. All rights reserved. 2 * 3 * This program is free software; you can redistribute it and/or modify 4 * it under the terms of the GNU General Public License version 2 and 5 * only version 2 as published by the Free Software Foundation. 6 */ 7 8#include <linux/module.h> 9#include <linux/platform_device.h> 10#include <linux/pm_runtime.h> 11#include <linux/usb/msm_hsusb_hw.h> 12#include <linux/usb/ulpi.h> 13#include <linux/usb/gadget.h> 14#include <linux/usb/chipidea.h> 15 16#include "ci.h" 17 18#define MSM_USB_BASE (ci->hw_bank.abs) 19 20static void ci_hdrc_msm_notify_event(struct ci_hdrc *ci, unsigned event) 21{ 22 struct device *dev = ci->gadget.dev.parent; 23 int val; 24 25 switch (event) { 26 case CI_HDRC_CONTROLLER_RESET_EVENT: 27 dev_dbg(dev, "CI_HDRC_CONTROLLER_RESET_EVENT received\n"); 28 writel(0, USB_AHBBURST); 29 writel(0, USB_AHBMODE); 30 break; 31 case CI_HDRC_CONTROLLER_STOPPED_EVENT: 32 dev_dbg(dev, "CI_HDRC_CONTROLLER_STOPPED_EVENT received\n"); 33 /* 34 * Put the transceiver in non-driving mode. Otherwise host 35 * may not detect soft-disconnection. 36 */ 37 val = usb_phy_io_read(ci->transceiver, ULPI_FUNC_CTRL); 38 val &= ~ULPI_FUNC_CTRL_OPMODE_MASK; 39 val |= ULPI_FUNC_CTRL_OPMODE_NONDRIVING; 40 usb_phy_io_write(ci->transceiver, val, ULPI_FUNC_CTRL); 41 break; 42 default: 43 dev_dbg(dev, "unknown ci_hdrc event\n"); 44 break; 45 } 46} 47 48static struct ci_hdrc_platform_data ci_hdrc_msm_platdata = { 49 .name = "ci_hdrc_msm", 50 .capoffset = DEF_CAPOFFSET, 51 .flags = CI_HDRC_REGS_SHARED | 52 CI_HDRC_REQUIRE_TRANSCEIVER | 53 CI_HDRC_DISABLE_STREAMING, 54 55 .notify_event = ci_hdrc_msm_notify_event, 56}; 57 58static int ci_hdrc_msm_probe(struct platform_device *pdev) 59{ 60 struct platform_device *plat_ci; 61 struct usb_phy *phy; 62 63 dev_dbg(&pdev->dev, "ci_hdrc_msm_probe\n"); 64 65 /* 66 * OTG(PHY) driver takes care of PHY initialization, clock management, 67 * powering up VBUS, mapping of registers address space and power 68 * management. 69 */ 70 phy = devm_usb_get_phy_by_phandle(&pdev->dev, "usb-phy", 0); 71 if (IS_ERR(phy)) 72 return PTR_ERR(phy); 73 74 ci_hdrc_msm_platdata.phy = phy; 75 76 plat_ci = ci_hdrc_add_device(&pdev->dev, 77 pdev->resource, pdev->num_resources, 78 &ci_hdrc_msm_platdata); 79 if (IS_ERR(plat_ci)) { 80 dev_err(&pdev->dev, "ci_hdrc_add_device failed!\n"); 81 return PTR_ERR(plat_ci); 82 } 83 84 platform_set_drvdata(pdev, plat_ci); 85 86 pm_runtime_no_callbacks(&pdev->dev); 87 pm_runtime_enable(&pdev->dev); 88 89 return 0; 90} 91 92static int ci_hdrc_msm_remove(struct platform_device *pdev) 93{ 94 struct platform_device *plat_ci = platform_get_drvdata(pdev); 95 96 pm_runtime_disable(&pdev->dev); 97 ci_hdrc_remove_device(plat_ci); 98 99 return 0; 100} 101 102static const struct of_device_id msm_ci_dt_match[] = { 103 { .compatible = "qcom,ci-hdrc", }, 104 { } 105}; 106MODULE_DEVICE_TABLE(of, msm_ci_dt_match); 107 108static struct platform_driver ci_hdrc_msm_driver = { 109 .probe = ci_hdrc_msm_probe, 110 .remove = ci_hdrc_msm_remove, 111 .driver = { 112 .name = "msm_hsusb", 113 .of_match_table = msm_ci_dt_match, 114 }, 115}; 116 117module_platform_driver(ci_hdrc_msm_driver); 118 119MODULE_ALIAS("platform:msm_hsusb"); 120MODULE_ALIAS("platform:ci13xxx_msm"); 121MODULE_LICENSE("GPL v2");