phy-msm-snps-hs.c 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2022-2024, Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #include <linux/module.h>
  7. #include <linux/kernel.h>
  8. #include <linux/err.h>
  9. #include <linux/slab.h>
  10. #include <linux/clk.h>
  11. #include <linux/delay.h>
  12. #include <linux/io.h>
  13. #include <linux/mutex.h>
  14. #include <linux/of.h>
  15. #include <linux/of_platform.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/power_supply.h>
  18. #include <linux/regulator/consumer.h>
  19. #include <linux/regulator/driver.h>
  20. #include <linux/regulator/machine.h>
  21. #include <linux/usb/phy.h>
  22. #include <linux/usb/dwc3-msm.h>
  23. #include <linux/reset.h>
  24. #include <linux/debugfs.h>
  25. #include <linux/qcom_scm.h>
  26. #include <linux/types.h>
  27. #define USB2_PHY_USB_PHY_UTMI_CTRL0 (0x3c)
  28. #define OPMODE_MASK (0x3 << 3)
  29. #define OPMODE_NONDRIVING (0x1 << 3)
  30. #define SLEEPM BIT(0)
  31. #define USB2_PHY_USB_PHY_UTMI_CTRL5 (0x50)
  32. #define POR BIT(1)
  33. #define USB2_PHY_USB_PHY_HS_PHY_CTRL_COMMON0 (0x54)
  34. #define SIDDQ BIT(2)
  35. #define RETENABLEN BIT(3)
  36. #define FSEL_MASK (0x7 << 4)
  37. #define FSEL_DEFAULT (0x3 << 4)
  38. #define USB2_PHY_USB_PHY_HS_PHY_CTRL_COMMON1 (0x58)
  39. #define VBUSVLDEXTSEL0 BIT(4)
  40. #define PLLBTUNE BIT(5)
  41. #define USB2_PHY_USB_PHY_HS_PHY_CTRL_COMMON2 (0x5c)
  42. #define VREGBYPASS BIT(0)
  43. #define USB2_PHY_USB_PHY_HS_PHY_CTRL1 (0x60)
  44. #define VBUSVLDEXT0 BIT(0)
  45. #define USB2_PHY_USB_PHY_HS_PHY_CTRL2 (0x64)
  46. #define USB2_AUTO_RESUME BIT(0)
  47. #define USB2_SUSPEND_N BIT(2)
  48. #define USB2_SUSPEND_N_SEL BIT(3)
  49. #define USB2_PHY_USB_PHY_CFG0 (0x94)
  50. #define UTMI_PHY_DATAPATH_CTRL_OVERRIDE_EN BIT(0)
  51. #define UTMI_PHY_CMN_CTRL_OVERRIDE_EN BIT(1)
  52. #define USB2_PHY_USB_PHY_REFCLK_CTRL (0xa0)
  53. #define REFCLK_SEL_MASK (0x3 << 0)
  54. #define REFCLK_SEL_DEFAULT (0x2 << 0)
  55. #define USB2_PHY_USB_PHY_PWRDOWN_CTRL (0xa4)
  56. #define PWRDOWN_B BIT(0)
  57. #define USB2PHY_USB_PHY_RTUNE_SEL (0xb4)
  58. #define RTUNE_SEL BIT(0)
  59. #define TXPREEMPAMPTUNE0(x) (x << 6)
  60. #define TXPREEMPAMPTUNE0_MASK (BIT(7) | BIT(6))
  61. #define USB2PHY_USB_PHY_PARAMETER_OVERRIDE_X0 0x6c
  62. #define USB2PHY_USB_PHY_PARAMETER_OVERRIDE_X1 0x70
  63. #define USB2PHY_USB_PHY_PARAMETER_OVERRIDE_X2 0x74
  64. #define USB2PHY_USB_PHY_PARAMETER_OVERRIDE_X3 0x78
  65. #define TXVREFTUNE0_MASK 0xF
  66. #define PARAM_OVRD_MASK 0xFF
  67. #define USB_HSPHY_3P3_VOL_MIN 3050000 /* uV */
  68. #define USB_HSPHY_3P3_VOL_MAX 3300000 /* uV */
  69. #define USB_HSPHY_3P3_HPM_LOAD 16000 /* uA */
  70. #define USB_HSPHY_3P3_VOL_FSHOST 3150000 /* uV */
  71. #define USB_HSPHY_1P8_VOL_MIN 1704000 /* uV */
  72. #define USB_HSPHY_1P8_VOL_MAX 1800000 /* uV */
  73. #define USB_HSPHY_1P8_HPM_LOAD 19000 /* uA */
  74. #define USB2PHY_REFGEN_HPM_LOAD 1200000 /* uA */
  75. #define USB_HSPHY_VDD_HPM_LOAD 30000 /* uA */
  76. /* struct hs_phy_priv_data - target specific private data */
  77. struct hs_phy_priv_data {
  78. bool limit_control_vdd;
  79. bool limit_control_vdda_18;
  80. bool limit_control_vdda33;
  81. };
  82. struct msm_hsphy {
  83. struct usb_phy phy;
  84. void __iomem *base;
  85. phys_addr_t eud_reg;
  86. void __iomem *eud_enable_reg;
  87. bool re_enable_eud;
  88. struct clk *ref_clk_src;
  89. struct clk *cfg_ahb_clk;
  90. struct clk *ref_clk;
  91. struct reset_control *phy_reset;
  92. struct regulator *vdd;
  93. struct regulator *vdda33;
  94. struct regulator *vdda18;
  95. struct regulator *refgen;
  96. int vdd_levels[3]; /* none, low, high */
  97. int refgen_levels[3]; /* 0, REFGEN_VOL_MIN, REFGEN_VOL_MAX */
  98. bool clocks_enabled;
  99. bool power_enabled;
  100. bool suspended;
  101. bool cable_connected;
  102. bool dpdm_enable;
  103. int *param_override_seq;
  104. int param_override_seq_cnt;
  105. void __iomem *phy_rcal_reg;
  106. u32 rcal_mask;
  107. struct mutex phy_lock;
  108. struct regulator_desc dpdm_rdesc;
  109. struct regulator_dev *dpdm_rdev;
  110. struct power_supply *usb_psy;
  111. unsigned int vbus_draw;
  112. struct work_struct vbus_draw_work;
  113. /* debugfs entries */
  114. struct dentry *root;
  115. u8 txvref_tune0;
  116. u8 pre_emphasis;
  117. u8 param_ovrd0;
  118. u8 param_ovrd1;
  119. u8 param_ovrd2;
  120. u8 param_ovrd3;
  121. const struct hs_phy_priv_data *phy_priv_data;
  122. };
  123. static void msm_hsphy_enable_clocks(struct msm_hsphy *phy, bool on)
  124. {
  125. dev_dbg(phy->phy.dev, "%s(): clocks_enabled:%d on:%d\n",
  126. __func__, phy->clocks_enabled, on);
  127. if (!phy->clocks_enabled && on) {
  128. clk_prepare_enable(phy->ref_clk_src);
  129. if (phy->ref_clk)
  130. clk_prepare_enable(phy->ref_clk);
  131. if (phy->cfg_ahb_clk)
  132. clk_prepare_enable(phy->cfg_ahb_clk);
  133. phy->clocks_enabled = true;
  134. }
  135. if (phy->clocks_enabled && !on) {
  136. if (phy->ref_clk)
  137. clk_disable_unprepare(phy->ref_clk);
  138. if (phy->cfg_ahb_clk)
  139. clk_disable_unprepare(phy->cfg_ahb_clk);
  140. clk_disable_unprepare(phy->ref_clk_src);
  141. phy->clocks_enabled = false;
  142. }
  143. }
  144. static int vdd_phy_enable_disable(struct msm_hsphy *phy, bool on)
  145. {
  146. int ret = 0;
  147. if (!on)
  148. goto disable_vdd;
  149. if (phy->phy_priv_data == NULL || !phy->phy_priv_data->limit_control_vdd) {
  150. ret = regulator_set_load(phy->vdd, USB_HSPHY_VDD_HPM_LOAD);
  151. if (ret < 0) {
  152. dev_err(phy->phy.dev, "Unable to set HPM of vdd:%d\n", ret);
  153. goto err_vdd;
  154. }
  155. ret = regulator_set_voltage(phy->vdd, phy->vdd_levels[1],
  156. phy->vdd_levels[2]);
  157. if (ret) {
  158. dev_err(phy->phy.dev, "unable to set voltage for hsusb vdd\n");
  159. goto put_vdd_lpm;
  160. }
  161. }
  162. ret = regulator_enable(phy->vdd);
  163. if (ret) {
  164. dev_err(phy->phy.dev, "Unable to enable VDD\n");
  165. goto unconfig_vdd;
  166. }
  167. dev_dbg(phy->phy.dev, "%s(): HSUSB PHY's vdd turned ON.\n", __func__);
  168. return ret;
  169. disable_vdd:
  170. ret = regulator_disable(phy->vdd);
  171. if (ret)
  172. dev_err(phy->phy.dev, "Unable to disable vdd:%d\n", ret);
  173. unconfig_vdd:
  174. if (phy->phy_priv_data == NULL || !phy->phy_priv_data->limit_control_vdd) {
  175. ret = regulator_set_voltage(phy->vdd, phy->vdd_levels[0],
  176. phy->vdd_levels[2]);
  177. if (ret)
  178. dev_err(phy->phy.dev, "unable to set voltage for hsusb vdd\n");
  179. }
  180. put_vdd_lpm:
  181. if (phy->phy_priv_data == NULL || !phy->phy_priv_data->limit_control_vdd) {
  182. ret = regulator_set_load(phy->vdd, 0);
  183. if (ret < 0)
  184. dev_err(phy->phy.dev, "Unable to set LPM of vdd\n");
  185. }
  186. err_vdd:
  187. return ret;
  188. }
  189. static int vdda18_phy_enable_disable(struct msm_hsphy *phy, bool on)
  190. {
  191. int ret = 0;
  192. if (!on)
  193. goto disable_vdda18;
  194. if (phy->phy_priv_data == NULL || !phy->phy_priv_data->limit_control_vdda_18) {
  195. ret = regulator_set_load(phy->vdda18, USB_HSPHY_1P8_HPM_LOAD);
  196. if (ret < 0) {
  197. dev_err(phy->phy.dev, "Unable to set HPM of vdda18:%d\n", ret);
  198. goto err_vdda18;
  199. }
  200. ret = regulator_set_voltage(phy->vdda18, USB_HSPHY_1P8_VOL_MIN,
  201. USB_HSPHY_1P8_VOL_MAX);
  202. if (ret) {
  203. dev_err(phy->phy.dev,
  204. "Unable to set voltage for vdda18:%d\n", ret);
  205. goto put_vdda18_lpm;
  206. }
  207. }
  208. ret = regulator_enable(phy->vdda18);
  209. if (ret) {
  210. dev_err(phy->phy.dev, "Unable to enable vdda18:%d\n", ret);
  211. goto unset_vdda18;
  212. }
  213. dev_dbg(phy->phy.dev, "%s(): HSUSB PHY's vdda18 turned ON.\n", __func__);
  214. return ret;
  215. disable_vdda18:
  216. ret = regulator_disable(phy->vdda18);
  217. if (ret)
  218. dev_err(phy->phy.dev, "Unable to disable vdda18:%d\n", ret);
  219. unset_vdda18:
  220. if (phy->phy_priv_data == NULL || !phy->phy_priv_data->limit_control_vdda_18) {
  221. ret = regulator_set_voltage(phy->vdda18, 0, USB_HSPHY_1P8_VOL_MAX);
  222. if (ret)
  223. dev_err(phy->phy.dev,
  224. "Unable to set (0) voltage for vdda18:%d\n", ret);
  225. }
  226. put_vdda18_lpm:
  227. if (phy->phy_priv_data == NULL || !phy->phy_priv_data->limit_control_vdda_18) {
  228. ret = regulator_set_load(phy->vdda18, 0);
  229. if (ret < 0)
  230. dev_err(phy->phy.dev, "Unable to set LPM of vdda18\n");
  231. }
  232. err_vdda18:
  233. return ret;
  234. }
  235. static int vdda33_phy_enable_disable(struct msm_hsphy *phy, bool on)
  236. {
  237. int ret = 0;
  238. if (!on) {
  239. if (phy->refgen)
  240. goto disable_refgen;
  241. else
  242. goto disable_vdda33;
  243. }
  244. if (phy->phy_priv_data == NULL || !phy->phy_priv_data->limit_control_vdda33) {
  245. ret = regulator_set_load(phy->vdda33, USB_HSPHY_3P3_HPM_LOAD);
  246. if (ret < 0) {
  247. dev_err(phy->phy.dev, "Unable to set HPM of vdda33:%d\n", ret);
  248. goto err_vdda33;
  249. }
  250. ret = regulator_set_voltage(phy->vdda33, USB_HSPHY_3P3_VOL_MIN,
  251. USB_HSPHY_3P3_VOL_MAX);
  252. if (ret) {
  253. dev_err(phy->phy.dev,
  254. "Unable to set voltage for vdda33:%d\n", ret);
  255. goto put_vdda33_lpm;
  256. }
  257. }
  258. ret = regulator_enable(phy->vdda33);
  259. if (ret) {
  260. dev_err(phy->phy.dev, "Unable to enable vdda33:%d\n", ret);
  261. goto unset_vdd33;
  262. }
  263. if (phy->refgen) {
  264. ret = regulator_set_load(phy->refgen, USB2PHY_REFGEN_HPM_LOAD);
  265. if (ret < 0) {
  266. dev_err(phy->phy.dev, "Unable to set HPM of refgen:%d\n", ret);
  267. goto disable_vdda33;
  268. }
  269. ret = regulator_set_voltage(phy->refgen, phy->refgen_levels[1],
  270. phy->refgen_levels[2]);
  271. if (ret) {
  272. dev_err(phy->phy.dev,
  273. "Unable to set voltage for refgen:%d\n", ret);
  274. goto put_refgen_lpm;
  275. }
  276. ret = regulator_enable(phy->refgen);
  277. if (ret) {
  278. dev_err(phy->phy.dev, "Unable to enable refgen:%d\n", ret);
  279. goto unset_refgen;
  280. }
  281. }
  282. dev_dbg(phy->phy.dev, "%s(): HSUSB PHY's vdda33 turned ON.\n", __func__);
  283. return ret;
  284. disable_refgen:
  285. ret = regulator_disable(phy->refgen);
  286. if (ret)
  287. dev_err(phy->phy.dev, "Unable to disable refgen:%d\n", ret);
  288. unset_refgen:
  289. ret = regulator_set_voltage(phy->refgen, phy->refgen_levels[0], phy->refgen_levels[2]);
  290. if (ret)
  291. dev_err(phy->phy.dev,
  292. "Unable to set (0) voltage for refgen:%d\n", ret);
  293. put_refgen_lpm:
  294. ret = regulator_set_load(phy->refgen, 0);
  295. if (ret < 0)
  296. dev_err(phy->phy.dev, "Unable to set (0) HPM of refgen\n");
  297. disable_vdda33:
  298. ret = regulator_disable(phy->vdda33);
  299. if (ret)
  300. dev_err(phy->phy.dev, "Unable to disable vdda33:%d\n", ret);
  301. unset_vdd33:
  302. if (phy->phy_priv_data == NULL || !phy->phy_priv_data->limit_control_vdda33) {
  303. ret = regulator_set_voltage(phy->vdda33, 0, USB_HSPHY_3P3_VOL_MAX);
  304. if (ret)
  305. dev_err(phy->phy.dev,
  306. "Unable to set (0) voltage for vdda33:%d\n", ret);
  307. }
  308. put_vdda33_lpm:
  309. if (phy->phy_priv_data == NULL || !phy->phy_priv_data->limit_control_vdda33) {
  310. ret = regulator_set_load(phy->vdda33, 0);
  311. if (ret < 0)
  312. dev_err(phy->phy.dev, "Unable to set (0) HPM of vdda33\n");
  313. }
  314. err_vdda33:
  315. return ret;
  316. }
  317. static int msm_hsphy_enable_power(struct msm_hsphy *phy, bool on)
  318. {
  319. int ret = 0;
  320. dev_dbg(phy->phy.dev, "%s turn %s regulators. power_enabled:%d\n",
  321. __func__, on ? "on" : "off", phy->power_enabled);
  322. if (phy->power_enabled == on) {
  323. dev_dbg(phy->phy.dev, "PHYs' regulators are already ON.\n");
  324. return 0;
  325. }
  326. ret = vdd_phy_enable_disable(phy, on);
  327. if (ret < 0)
  328. goto err_hs_reg;
  329. ret = vdda18_phy_enable_disable(phy, on);
  330. if (ret < 0)
  331. goto err_hs_reg;
  332. ret = vdda33_phy_enable_disable(phy, on);
  333. if (ret < 0)
  334. goto err_hs_reg;
  335. if (on)
  336. phy->power_enabled = true;
  337. else
  338. phy->power_enabled = false;
  339. return ret;
  340. err_hs_reg:
  341. dev_err(phy->phy.dev, "HSUSB PHY's regulators set/unset failed\n");
  342. dev_err(phy->phy.dev, "Some or all HSUSB PHY's regulators are turned OFF\n");
  343. return ret;
  344. }
  345. static void msm_usb_write_readback(void __iomem *base, u32 offset,
  346. const u32 mask, u32 val)
  347. {
  348. u32 write_val, tmp = readl_relaxed(base + offset);
  349. tmp &= ~mask; /* retain other bits */
  350. write_val = tmp | val;
  351. writel_relaxed(write_val, base + offset);
  352. /* Read back to see if val was written */
  353. tmp = readl_relaxed(base + offset);
  354. tmp &= mask; /* clear other bits */
  355. if (tmp != val)
  356. pr_err("%s: write: %x to QSCRATCH: %x FAILED\n",
  357. __func__, val, offset);
  358. }
  359. static void msm_hsphy_reset(struct msm_hsphy *phy)
  360. {
  361. int ret;
  362. ret = reset_control_assert(phy->phy_reset);
  363. if (ret)
  364. dev_err(phy->phy.dev, "%s: phy_reset assert failed\n",
  365. __func__);
  366. usleep_range(100, 150);
  367. ret = reset_control_deassert(phy->phy_reset);
  368. if (ret)
  369. dev_err(phy->phy.dev, "%s: phy_reset deassert failed\n",
  370. __func__);
  371. }
  372. static void hsusb_phy_write_seq(void __iomem *base, u32 *seq, int cnt,
  373. unsigned long delay)
  374. {
  375. int i;
  376. pr_debug("Seq count:%d\n", cnt);
  377. for (i = 0; i < cnt; i = i+2) {
  378. pr_debug("write 0x%02x to 0x%02x\n", seq[i], seq[i+1]);
  379. writel_relaxed(seq[i], base + seq[i+1]);
  380. if (delay)
  381. usleep_range(delay, (delay + 2000));
  382. }
  383. }
  384. #define EUD_EN2 BIT(0)
  385. static int msm_hsphy_init(struct usb_phy *uphy)
  386. {
  387. struct msm_hsphy *phy = container_of(uphy, struct msm_hsphy, phy);
  388. int ret;
  389. u32 rcal_code = 0, eud_csr_reg = 0;
  390. dev_dbg(uphy->dev, "%s phy_flags:0x%x\n", __func__, phy->phy.flags);
  391. if (phy->eud_enable_reg) {
  392. eud_csr_reg = readl_relaxed(phy->eud_enable_reg);
  393. if (eud_csr_reg & EUD_EN2) {
  394. dev_dbg(phy->phy.dev, "csr:0x%x eud is enabled\n",
  395. eud_csr_reg);
  396. /* if in host mode, disable EUD */
  397. if (phy->phy.flags & PHY_HOST_MODE) {
  398. qcom_scm_io_writel(phy->eud_reg, 0x0);
  399. phy->re_enable_eud = true;
  400. } else {
  401. msm_hsphy_enable_power(phy, true);
  402. msm_hsphy_enable_clocks(phy, true);
  403. return 0;
  404. }
  405. }
  406. }
  407. ret = msm_hsphy_enable_power(phy, true);
  408. if (ret)
  409. return ret;
  410. msm_hsphy_enable_clocks(phy, true);
  411. msm_hsphy_reset(phy);
  412. msm_usb_write_readback(phy->base, USB2_PHY_USB_PHY_CFG0,
  413. UTMI_PHY_CMN_CTRL_OVERRIDE_EN,
  414. UTMI_PHY_CMN_CTRL_OVERRIDE_EN);
  415. msm_usb_write_readback(phy->base, USB2_PHY_USB_PHY_UTMI_CTRL5,
  416. POR, POR);
  417. msm_usb_write_readback(phy->base, USB2_PHY_USB_PHY_HS_PHY_CTRL_COMMON0,
  418. FSEL_MASK, 0);
  419. msm_usb_write_readback(phy->base, USB2_PHY_USB_PHY_HS_PHY_CTRL_COMMON1,
  420. PLLBTUNE, PLLBTUNE);
  421. msm_usb_write_readback(phy->base, USB2_PHY_USB_PHY_REFCLK_CTRL,
  422. REFCLK_SEL_MASK, REFCLK_SEL_DEFAULT);
  423. msm_usb_write_readback(phy->base, USB2_PHY_USB_PHY_HS_PHY_CTRL_COMMON1,
  424. VBUSVLDEXTSEL0, VBUSVLDEXTSEL0);
  425. msm_usb_write_readback(phy->base, USB2_PHY_USB_PHY_HS_PHY_CTRL1,
  426. VBUSVLDEXT0, VBUSVLDEXT0);
  427. /* set parameter ovrride if needed */
  428. if (phy->param_override_seq)
  429. hsusb_phy_write_seq(phy->base, phy->param_override_seq,
  430. phy->param_override_seq_cnt, 0);
  431. if (phy->pre_emphasis) {
  432. u8 val = TXPREEMPAMPTUNE0(phy->pre_emphasis) &
  433. TXPREEMPAMPTUNE0_MASK;
  434. if (val)
  435. msm_usb_write_readback(phy->base,
  436. USB2PHY_USB_PHY_PARAMETER_OVERRIDE_X1,
  437. TXPREEMPAMPTUNE0_MASK, val);
  438. }
  439. if (phy->txvref_tune0) {
  440. u8 val = phy->txvref_tune0 & TXVREFTUNE0_MASK;
  441. msm_usb_write_readback(phy->base,
  442. USB2PHY_USB_PHY_PARAMETER_OVERRIDE_X1,
  443. TXVREFTUNE0_MASK, val);
  444. }
  445. if (phy->param_ovrd0) {
  446. msm_usb_write_readback(phy->base,
  447. USB2PHY_USB_PHY_PARAMETER_OVERRIDE_X0,
  448. PARAM_OVRD_MASK, phy->param_ovrd0);
  449. }
  450. if (phy->param_ovrd1) {
  451. msm_usb_write_readback(phy->base,
  452. USB2PHY_USB_PHY_PARAMETER_OVERRIDE_X1,
  453. PARAM_OVRD_MASK, phy->param_ovrd1);
  454. }
  455. if (phy->param_ovrd2) {
  456. msm_usb_write_readback(phy->base,
  457. USB2PHY_USB_PHY_PARAMETER_OVERRIDE_X2,
  458. PARAM_OVRD_MASK, phy->param_ovrd2);
  459. }
  460. if (phy->param_ovrd3) {
  461. msm_usb_write_readback(phy->base,
  462. USB2PHY_USB_PHY_PARAMETER_OVERRIDE_X3,
  463. PARAM_OVRD_MASK, phy->param_ovrd3);
  464. }
  465. dev_dbg(uphy->dev, "x0:%08x x1:%08x x2:%08x x3:%08x\n",
  466. readl_relaxed(phy->base + USB2PHY_USB_PHY_PARAMETER_OVERRIDE_X0),
  467. readl_relaxed(phy->base + USB2PHY_USB_PHY_PARAMETER_OVERRIDE_X1),
  468. readl_relaxed(phy->base + USB2PHY_USB_PHY_PARAMETER_OVERRIDE_X2),
  469. readl_relaxed(phy->base + USB2PHY_USB_PHY_PARAMETER_OVERRIDE_X3));
  470. if (phy->phy_rcal_reg) {
  471. rcal_code = readl_relaxed(phy->phy_rcal_reg) & phy->rcal_mask;
  472. dev_dbg(uphy->dev, "rcal_mask:%08x reg:%pK code:%08x\n",
  473. phy->rcal_mask, phy->phy_rcal_reg, rcal_code);
  474. }
  475. msm_usb_write_readback(phy->base, USB2_PHY_USB_PHY_HS_PHY_CTRL_COMMON2,
  476. VREGBYPASS, VREGBYPASS);
  477. msm_usb_write_readback(phy->base, USB2_PHY_USB_PHY_HS_PHY_CTRL2,
  478. USB2_SUSPEND_N_SEL | USB2_SUSPEND_N,
  479. USB2_SUSPEND_N_SEL | USB2_SUSPEND_N);
  480. msm_usb_write_readback(phy->base, USB2_PHY_USB_PHY_UTMI_CTRL0,
  481. SLEEPM, SLEEPM);
  482. msm_usb_write_readback(phy->base, USB2_PHY_USB_PHY_HS_PHY_CTRL_COMMON0,
  483. SIDDQ, 0);
  484. msm_usb_write_readback(phy->base, USB2_PHY_USB_PHY_UTMI_CTRL5,
  485. POR, 0);
  486. msm_usb_write_readback(phy->base, USB2_PHY_USB_PHY_HS_PHY_CTRL2,
  487. USB2_SUSPEND_N_SEL, 0);
  488. msm_usb_write_readback(phy->base, USB2_PHY_USB_PHY_CFG0,
  489. UTMI_PHY_CMN_CTRL_OVERRIDE_EN, 0);
  490. return 0;
  491. }
  492. static int msm_hsphy_set_suspend(struct usb_phy *uphy, int suspend)
  493. {
  494. struct msm_hsphy *phy = container_of(uphy, struct msm_hsphy, phy);
  495. bool eud_active = false;
  496. if (phy->suspended && suspend) {
  497. if (phy->phy.flags & PHY_SUS_OVERRIDE)
  498. goto suspend;
  499. dev_dbg(uphy->dev, "%s: USB PHY is already suspended\n",
  500. __func__);
  501. return 0;
  502. }
  503. if (phy->eud_enable_reg && readl_relaxed(phy->eud_enable_reg))
  504. eud_active = true;
  505. suspend:
  506. if (suspend) { /* Bus suspend */
  507. /*
  508. * The HUB class drivers calls usb_phy_notify_disconnect() upon a device
  509. * disconnect. Consider a scenario where a USB device is disconnected without
  510. * detaching the OTG cable. phy->cable_connected is marked false due to above
  511. * mentioned call path. Now, while entering low power mode (host bus suspend),
  512. * we come here and turn off regulators thinking no cable is connected. Prevent
  513. * this by not turning off regulators while in host mode.
  514. */
  515. if (phy->cable_connected || (phy->phy.flags & PHY_HOST_MODE)) {
  516. /* Enable auto-resume functionality during host mode
  517. * bus suspend with some FS/HS peripheral connected.
  518. */
  519. if ((phy->phy.flags & PHY_HOST_MODE) &&
  520. (phy->phy.flags & PHY_HSFS_MODE)) {
  521. /* Enable auto-resume functionality by pulsing
  522. * signal
  523. */
  524. msm_usb_write_readback(phy->base,
  525. USB2_PHY_USB_PHY_HS_PHY_CTRL2,
  526. USB2_AUTO_RESUME, USB2_AUTO_RESUME);
  527. usleep_range(500, 1000);
  528. msm_usb_write_readback(phy->base,
  529. USB2_PHY_USB_PHY_HS_PHY_CTRL2,
  530. USB2_AUTO_RESUME, 0);
  531. }
  532. msm_hsphy_enable_clocks(phy, false);
  533. } else {/* Cable disconnect */
  534. mutex_lock(&phy->phy_lock);
  535. dev_dbg(uphy->dev, "phy->flags:0x%x\n", phy->phy.flags);
  536. if (phy->re_enable_eud) {
  537. dev_dbg(uphy->dev, "re-enabling EUD\n");
  538. qcom_scm_io_writel(phy->eud_reg, 0x1);
  539. phy->re_enable_eud = false;
  540. }
  541. if (!phy->dpdm_enable && !eud_active) {
  542. if (!(phy->phy.flags & EUD_SPOOF_DISCONNECT)) {
  543. dev_dbg(uphy->dev, "turning off clocks/ldo\n");
  544. if (!(phy->phy.flags & PHY_HOST_MODE)) {
  545. msm_usb_write_readback(phy->base,
  546. USB2_PHY_USB_PHY_PWRDOWN_CTRL,
  547. PWRDOWN_B, 0);
  548. }
  549. msm_hsphy_enable_clocks(phy, false);
  550. msm_hsphy_enable_power(phy, false);
  551. }
  552. } else {
  553. dev_dbg(uphy->dev, "dpdm reg still active. Keep clocks/ldo ON\n");
  554. }
  555. mutex_unlock(&phy->phy_lock);
  556. }
  557. phy->suspended = true;
  558. } else { /* Bus resume and cable connect */
  559. msm_hsphy_enable_power(phy, true);
  560. msm_hsphy_enable_clocks(phy, true);
  561. phy->suspended = false;
  562. }
  563. return 0;
  564. }
  565. static int msm_hsphy_notify_connect(struct usb_phy *uphy,
  566. enum usb_device_speed speed)
  567. {
  568. struct msm_hsphy *phy = container_of(uphy, struct msm_hsphy, phy);
  569. phy->cable_connected = true;
  570. return 0;
  571. }
  572. static int msm_hsphy_notify_disconnect(struct usb_phy *uphy,
  573. enum usb_device_speed speed)
  574. {
  575. struct msm_hsphy *phy = container_of(uphy, struct msm_hsphy, phy);
  576. phy->cable_connected = false;
  577. return 0;
  578. }
  579. static void msm_hsphy_vbus_draw_work(struct work_struct *w)
  580. {
  581. struct msm_hsphy *phy = container_of(w, struct msm_hsphy,
  582. vbus_draw_work);
  583. union power_supply_propval val = {0};
  584. int ret;
  585. if (!phy->usb_psy) {
  586. phy->usb_psy = power_supply_get_by_name("usb");
  587. if (!phy->usb_psy) {
  588. dev_err(phy->phy.dev, "Could not get usb psy\n");
  589. return;
  590. }
  591. }
  592. dev_info(phy->phy.dev, "Avail curr from USB = %u\n", phy->vbus_draw);
  593. /* Set max current limit in uA */
  594. val.intval = 1000 * phy->vbus_draw;
  595. ret = power_supply_set_property(phy->usb_psy, POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT, &val);
  596. if (ret) {
  597. dev_dbg(phy->phy.dev, "Error (%d) setting input current limit\n", ret);
  598. return;
  599. }
  600. }
  601. static int msm_hsphy_set_power(struct usb_phy *uphy, unsigned int mA)
  602. {
  603. struct msm_hsphy *phy = container_of(uphy, struct msm_hsphy, phy);
  604. if (phy->cable_connected && (mA == 0))
  605. return 0;
  606. phy->vbus_draw = mA;
  607. schedule_work(&phy->vbus_draw_work);
  608. return 0;
  609. }
  610. static int msm_hsphy_dpdm_regulator_enable(struct regulator_dev *rdev)
  611. {
  612. int ret = 0;
  613. struct msm_hsphy *phy = rdev_get_drvdata(rdev);
  614. dev_dbg(phy->phy.dev, "%s dpdm_enable:%d\n",
  615. __func__, phy->dpdm_enable);
  616. if (phy->eud_enable_reg && readl_relaxed(phy->eud_enable_reg)) {
  617. dev_err(phy->phy.dev, "eud is enabled\n");
  618. return 0;
  619. }
  620. mutex_lock(&phy->phy_lock);
  621. if (!phy->dpdm_enable) {
  622. ret = msm_hsphy_enable_power(phy, true);
  623. if (ret) {
  624. mutex_unlock(&phy->phy_lock);
  625. return ret;
  626. }
  627. msm_hsphy_enable_clocks(phy, true);
  628. msm_hsphy_reset(phy);
  629. /*
  630. * For PMIC charger detection, place PHY in UTMI non-driving
  631. * mode which leaves Dp and Dm lines in high-Z state.
  632. */
  633. msm_usb_write_readback(phy->base, USB2_PHY_USB_PHY_HS_PHY_CTRL2,
  634. USB2_SUSPEND_N_SEL | USB2_SUSPEND_N,
  635. USB2_SUSPEND_N_SEL | USB2_SUSPEND_N);
  636. msm_usb_write_readback(phy->base, USB2_PHY_USB_PHY_UTMI_CTRL0,
  637. OPMODE_MASK, OPMODE_NONDRIVING);
  638. msm_usb_write_readback(phy->base, USB2_PHY_USB_PHY_CFG0,
  639. UTMI_PHY_DATAPATH_CTRL_OVERRIDE_EN,
  640. UTMI_PHY_DATAPATH_CTRL_OVERRIDE_EN);
  641. phy->dpdm_enable = true;
  642. }
  643. mutex_unlock(&phy->phy_lock);
  644. return ret;
  645. }
  646. static int msm_hsphy_dpdm_regulator_disable(struct regulator_dev *rdev)
  647. {
  648. int ret = 0;
  649. struct msm_hsphy *phy = rdev_get_drvdata(rdev);
  650. dev_dbg(phy->phy.dev, "%s dpdm_enable:%d\n",
  651. __func__, phy->dpdm_enable);
  652. mutex_lock(&phy->phy_lock);
  653. if (phy->dpdm_enable) {
  654. if (!phy->cable_connected) {
  655. msm_hsphy_enable_clocks(phy, false);
  656. ret = msm_hsphy_enable_power(phy, false);
  657. if (ret < 0) {
  658. mutex_unlock(&phy->phy_lock);
  659. return ret;
  660. }
  661. }
  662. phy->dpdm_enable = false;
  663. }
  664. mutex_unlock(&phy->phy_lock);
  665. return ret;
  666. }
  667. static int msm_hsphy_dpdm_regulator_is_enabled(struct regulator_dev *rdev)
  668. {
  669. struct msm_hsphy *phy = rdev_get_drvdata(rdev);
  670. dev_dbg(phy->phy.dev, "%s dpdm_enable:%d\n",
  671. __func__, phy->dpdm_enable);
  672. return phy->dpdm_enable;
  673. }
  674. static const struct regulator_ops msm_hsphy_dpdm_regulator_ops = {
  675. .enable = msm_hsphy_dpdm_regulator_enable,
  676. .disable = msm_hsphy_dpdm_regulator_disable,
  677. .is_enabled = msm_hsphy_dpdm_regulator_is_enabled,
  678. };
  679. static int msm_hsphy_regulator_init(struct msm_hsphy *phy)
  680. {
  681. struct device *dev = phy->phy.dev;
  682. struct regulator_config cfg = {};
  683. struct regulator_init_data *init_data;
  684. init_data = devm_kzalloc(dev, sizeof(*init_data), GFP_KERNEL);
  685. if (!init_data)
  686. return -ENOMEM;
  687. init_data->constraints.valid_ops_mask |= REGULATOR_CHANGE_STATUS;
  688. phy->dpdm_rdesc.owner = THIS_MODULE;
  689. phy->dpdm_rdesc.type = REGULATOR_VOLTAGE;
  690. phy->dpdm_rdesc.ops = &msm_hsphy_dpdm_regulator_ops;
  691. phy->dpdm_rdesc.name = kbasename(dev->of_node->full_name);
  692. cfg.dev = dev;
  693. cfg.init_data = init_data;
  694. cfg.driver_data = phy;
  695. cfg.of_node = dev->of_node;
  696. phy->dpdm_rdev = devm_regulator_register(dev, &phy->dpdm_rdesc, &cfg);
  697. return PTR_ERR_OR_ZERO(phy->dpdm_rdev);
  698. }
  699. static void msm_hsphy_create_debugfs(struct msm_hsphy *phy)
  700. {
  701. phy->root = debugfs_create_dir(dev_name(phy->phy.dev), NULL);
  702. debugfs_create_x8("pre_emphasis", 0644, phy->root, &phy->pre_emphasis);
  703. debugfs_create_x8("txvref_tune0", 0644, phy->root, &phy->txvref_tune0);
  704. debugfs_create_x8("param_ovrd0", 0644, phy->root, &phy->param_ovrd0);
  705. debugfs_create_x8("param_ovrd1", 0644, phy->root, &phy->param_ovrd1);
  706. debugfs_create_x8("param_ovrd2", 0644, phy->root, &phy->param_ovrd2);
  707. debugfs_create_x8("param_ovrd3", 0644, phy->root, &phy->param_ovrd3);
  708. }
  709. static int usb2_get_regulators(struct msm_hsphy *phy)
  710. {
  711. struct device *dev = phy->phy.dev;
  712. int ret = 0;
  713. phy->refgen = NULL;
  714. phy->vdd = devm_regulator_get(dev, "vdd");
  715. if (IS_ERR(phy->vdd)) {
  716. ret = PTR_ERR(phy->vdd);
  717. if (ret != -EPROBE_DEFER)
  718. dev_err(dev, "unable to get vdd supply\n");
  719. return ret;
  720. }
  721. phy->vdda33 = devm_regulator_get(dev, "vdda33");
  722. if (IS_ERR(phy->vdda33)) {
  723. ret = PTR_ERR(phy->vdda33);
  724. if (ret != -EPROBE_DEFER)
  725. dev_err(dev, "unable to get vdda33 supply\n");
  726. return ret;
  727. }
  728. phy->vdda18 = devm_regulator_get(dev, "vdda18");
  729. if (IS_ERR(phy->vdda18)) {
  730. ret = PTR_ERR(phy->vdda18);
  731. if (ret != -EPROBE_DEFER)
  732. dev_err(dev, "unable to get vdda18 supply\n");
  733. return ret;
  734. }
  735. if (of_property_read_bool(dev->of_node, "refgen-supply")) {
  736. phy->refgen = devm_regulator_get_optional(dev, "refgen");
  737. if (IS_ERR(phy->refgen))
  738. dev_err(dev, "unable to get refgen supply\n");
  739. }
  740. return 0;
  741. }
  742. static int msm_hsphy_probe(struct platform_device *pdev)
  743. {
  744. struct msm_hsphy *phy;
  745. struct device *dev = &pdev->dev;
  746. struct resource *res;
  747. const struct hs_phy_priv_data *driver_data;
  748. int ret = 0;
  749. phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL);
  750. if (!phy) {
  751. ret = -ENOMEM;
  752. goto err_ret;
  753. }
  754. driver_data = of_device_get_match_data(dev);
  755. phy->phy_priv_data = driver_data;
  756. phy->phy.dev = dev;
  757. res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
  758. "hsusb_phy_base");
  759. if (!res) {
  760. dev_err(dev, "missing memory base resource\n");
  761. ret = -ENODEV;
  762. goto err_ret;
  763. }
  764. phy->base = devm_ioremap_resource(dev, res);
  765. if (IS_ERR(phy->base)) {
  766. dev_err(dev, "ioremap failed\n");
  767. ret = -ENODEV;
  768. goto err_ret;
  769. }
  770. res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
  771. "phy_rcal_reg");
  772. if (res) {
  773. phy->phy_rcal_reg = devm_ioremap(dev,
  774. res->start, resource_size(res));
  775. if (IS_ERR(phy->phy_rcal_reg)) {
  776. dev_err(dev, "couldn't ioremap phy_rcal_reg\n");
  777. phy->phy_rcal_reg = NULL;
  778. }
  779. if (of_property_read_u32(dev->of_node,
  780. "qcom,rcal-mask", &phy->rcal_mask)) {
  781. dev_err(dev, "unable to read phy rcal mask\n");
  782. phy->phy_rcal_reg = NULL;
  783. }
  784. dev_dbg(dev, "rcal_mask:%08x reg:%pK\n", phy->rcal_mask,
  785. phy->phy_rcal_reg);
  786. }
  787. res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
  788. "eud_enable_reg");
  789. if (res) {
  790. phy->eud_enable_reg = devm_ioremap_resource(dev, res);
  791. if (IS_ERR(phy->eud_enable_reg)) {
  792. dev_err(dev, "err getting eud_enable_reg address\n");
  793. return PTR_ERR(phy->eud_enable_reg);
  794. }
  795. phy->eud_reg = res->start;
  796. }
  797. /* ref_clk_src is needed irrespective of SE_CLK or DIFF_CLK usage */
  798. phy->ref_clk_src = devm_clk_get(dev, "ref_clk_src");
  799. if (IS_ERR(phy->ref_clk_src)) {
  800. dev_dbg(dev, "clk get failed for ref_clk_src\n");
  801. ret = PTR_ERR(phy->ref_clk_src);
  802. return ret;
  803. }
  804. phy->ref_clk = devm_clk_get_optional(dev, "ref_clk");
  805. if (IS_ERR(phy->ref_clk)) {
  806. dev_dbg(dev, "clk get failed for ref_clk\n");
  807. ret = PTR_ERR(phy->ref_clk);
  808. return ret;
  809. }
  810. if (of_property_match_string(pdev->dev.of_node,
  811. "clock-names", "cfg_ahb_clk") >= 0) {
  812. phy->cfg_ahb_clk = devm_clk_get(dev, "cfg_ahb_clk");
  813. if (IS_ERR(phy->cfg_ahb_clk)) {
  814. ret = PTR_ERR(phy->cfg_ahb_clk);
  815. if (ret != -EPROBE_DEFER)
  816. dev_err(dev,
  817. "clk get failed for cfg_ahb_clk ret %d\n", ret);
  818. return ret;
  819. }
  820. }
  821. phy->phy_reset = devm_reset_control_get(dev, "phy_reset");
  822. if (IS_ERR(phy->phy_reset))
  823. return PTR_ERR(phy->phy_reset);
  824. phy->param_override_seq_cnt = of_property_count_elems_of_size(
  825. dev->of_node,
  826. "qcom,param-override-seq",
  827. sizeof(*phy->param_override_seq));
  828. if (phy->param_override_seq_cnt > 0) {
  829. phy->param_override_seq = devm_kcalloc(dev,
  830. phy->param_override_seq_cnt,
  831. sizeof(*phy->param_override_seq),
  832. GFP_KERNEL);
  833. if (!phy->param_override_seq)
  834. return -ENOMEM;
  835. if (phy->param_override_seq_cnt % 2) {
  836. dev_err(dev, "invalid param_override_seq_len\n");
  837. return -EINVAL;
  838. }
  839. ret = of_property_read_u32_array(dev->of_node,
  840. "qcom,param-override-seq",
  841. phy->param_override_seq,
  842. phy->param_override_seq_cnt);
  843. if (ret) {
  844. dev_err(dev, "qcom,param-override-seq read failed %d\n",
  845. ret);
  846. return ret;
  847. }
  848. }
  849. ret = of_property_read_u32_array(dev->of_node, "qcom,vdd-voltage-level",
  850. (u32 *) phy->vdd_levels,
  851. ARRAY_SIZE(phy->vdd_levels));
  852. if (ret) {
  853. dev_err(dev, "error reading qcom,vdd-voltage-level property\n");
  854. goto err_ret;
  855. }
  856. ret = of_property_read_u32_array(dev->of_node, "qcom,refgen-voltage-level",
  857. (u32 *) phy->refgen_levels,
  858. ARRAY_SIZE(phy->refgen_levels));
  859. if (ret)
  860. dev_err(dev, "error reading qcom,refgen-voltage-level property\n");
  861. ret = usb2_get_regulators(phy);
  862. if (ret)
  863. return ret;
  864. mutex_init(&phy->phy_lock);
  865. platform_set_drvdata(pdev, phy);
  866. phy->phy.init = msm_hsphy_init;
  867. phy->phy.set_suspend = msm_hsphy_set_suspend;
  868. phy->phy.notify_connect = msm_hsphy_notify_connect;
  869. phy->phy.notify_disconnect = msm_hsphy_notify_disconnect;
  870. phy->phy.set_power = msm_hsphy_set_power;
  871. phy->phy.type = USB_PHY_TYPE_USB2;
  872. ret = usb_add_phy_dev(&phy->phy);
  873. if (ret)
  874. return ret;
  875. ret = msm_hsphy_regulator_init(phy);
  876. if (ret) {
  877. usb_remove_phy(&phy->phy);
  878. return ret;
  879. }
  880. INIT_WORK(&phy->vbus_draw_work, msm_hsphy_vbus_draw_work);
  881. msm_hsphy_create_debugfs(phy);
  882. /*
  883. * EUD may be enable in boot loader and to keep EUD session alive across
  884. * kernel boot till USB phy driver is initialized based on cable status,
  885. * keep LDOs on here.
  886. */
  887. if (phy->eud_enable_reg && readl_relaxed(phy->eud_enable_reg)) {
  888. msm_hsphy_enable_power(phy, true);
  889. msm_hsphy_enable_clocks(phy, true);
  890. }
  891. return 0;
  892. err_ret:
  893. return ret;
  894. }
  895. static int msm_hsphy_remove(struct platform_device *pdev)
  896. {
  897. struct msm_hsphy *phy = platform_get_drvdata(pdev);
  898. if (!phy)
  899. return 0;
  900. if (phy->usb_psy)
  901. power_supply_put(phy->usb_psy);
  902. debugfs_remove_recursive(phy->root);
  903. usb_remove_phy(&phy->phy);
  904. clk_disable_unprepare(phy->ref_clk_src);
  905. msm_hsphy_enable_clocks(phy, false);
  906. msm_hsphy_enable_power(phy, false);
  907. return 0;
  908. }
  909. static const struct hs_phy_priv_data priv_data_lemans = {
  910. .limit_control_vdda_18 = true,
  911. };
  912. static const struct of_device_id msm_usb_id_table[] = {
  913. {
  914. .compatible = "qcom,usb-hsphy-snps-femto",
  915. },
  916. {
  917. .compatible = "qcom,usb-hsphy-snps-femto-lemans",
  918. .data = &priv_data_lemans,
  919. },
  920. { },
  921. };
  922. MODULE_DEVICE_TABLE(of, msm_usb_id_table);
  923. static struct platform_driver msm_hsphy_driver = {
  924. .probe = msm_hsphy_probe,
  925. .remove = msm_hsphy_remove,
  926. .driver = {
  927. .name = "msm-usb-hsphy",
  928. .of_match_table = of_match_ptr(msm_usb_id_table),
  929. },
  930. };
  931. module_platform_driver(msm_hsphy_driver);
  932. MODULE_DESCRIPTION("MSM USB HS PHY driver");
  933. MODULE_LICENSE("GPL v2");