phy-sun4i-usb.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  1. /*
  2. * Allwinner sun4i USB PHY driver
  3. *
  4. * Copyright (C) 2017 Jagan Teki <jagan@amarulasolutions.com>
  5. * Copyright (C) 2015 Hans de Goede <hdegoede@redhat.com>
  6. * Copyright (C) 2014 Roman Byshko <rbyshko@gmail.com>
  7. *
  8. * Modelled arch/arm/mach-sunxi/usb_phy.c to compatible with generic-phy.
  9. *
  10. * SPDX-License-Identifier: GPL-2.0+
  11. */
  12. #include <common.h>
  13. #include <dm.h>
  14. #include <dm/device.h>
  15. #include <generic-phy.h>
  16. #include <phy-sun4i-usb.h>
  17. #include <asm/gpio.h>
  18. #include <asm/io.h>
  19. #include <asm/arch/clock.h>
  20. #include <asm/arch/cpu.h>
  21. #define REG_ISCR 0x00
  22. #define REG_PHYCTL_A10 0x04
  23. #define REG_PHYBIST 0x08
  24. #define REG_PHYTUNE 0x0c
  25. #define REG_PHYCTL_A33 0x10
  26. #define REG_PHY_OTGCTL 0x20
  27. #define REG_PMU_UNK1 0x10
  28. /* Common Control Bits for Both PHYs */
  29. #define PHY_PLL_BW 0x03
  30. #define PHY_RES45_CAL_EN 0x0c
  31. /* Private Control Bits for Each PHY */
  32. #define PHY_TX_AMPLITUDE_TUNE 0x20
  33. #define PHY_TX_SLEWRATE_TUNE 0x22
  34. #define PHY_DISCON_TH_SEL 0x2a
  35. #define PHY_SQUELCH_DETECT 0x3c
  36. #define PHYCTL_DATA BIT(7)
  37. #define OTGCTL_ROUTE_MUSB BIT(0)
  38. #define PHY_TX_RATE BIT(4)
  39. #define PHY_TX_MAGNITUDE BIT(2)
  40. #define PHY_TX_AMPLITUDE_LEN 5
  41. #define PHY_RES45_CAL_DATA BIT(0)
  42. #define PHY_RES45_CAL_LEN 1
  43. #define PHY_DISCON_TH_LEN 2
  44. #define SUNXI_AHB_ICHR8_EN BIT(10)
  45. #define SUNXI_AHB_INCR4_BURST_EN BIT(9)
  46. #define SUNXI_AHB_INCRX_ALIGN_EN BIT(8)
  47. #define SUNXI_ULPI_BYPASS_EN BIT(0)
  48. /* A83T specific control bits for PHY0 */
  49. #define PHY_CTL_VBUSVLDEXT BIT(5)
  50. #define PHY_CTL_SIDDQ BIT(3)
  51. /* A83T specific control bits for PHY2 HSIC */
  52. #define SUNXI_EHCI_HS_FORCE BIT(20)
  53. #define SUNXI_HSIC_CONNECT_INT BIT(16)
  54. #define SUNXI_HSIC BIT(1)
  55. #define MAX_PHYS 4
  56. enum sun4i_usb_phy_type {
  57. sun4i_a10_phy,
  58. sun6i_a31_phy,
  59. sun8i_a33_phy,
  60. sun8i_a83t_phy,
  61. sun8i_h3_phy,
  62. sun8i_v3s_phy,
  63. sun50i_a64_phy,
  64. };
  65. struct sun4i_usb_phy_cfg {
  66. int num_phys;
  67. enum sun4i_usb_phy_type type;
  68. u32 disc_thresh;
  69. u8 phyctl_offset;
  70. bool enable_pmu_unk1;
  71. bool phy0_dual_route;
  72. };
  73. struct sun4i_usb_phy_info {
  74. const char *gpio_vbus;
  75. const char *gpio_vbus_det;
  76. const char *gpio_id_det;
  77. int rst_mask;
  78. } phy_info[] = {
  79. {
  80. .gpio_vbus = CONFIG_USB0_VBUS_PIN,
  81. .gpio_vbus_det = CONFIG_USB0_VBUS_DET,
  82. .gpio_id_det = CONFIG_USB0_ID_DET,
  83. .rst_mask = (CCM_USB_CTRL_PHY0_RST | CCM_USB_CTRL_PHY0_CLK),
  84. },
  85. {
  86. .gpio_vbus = CONFIG_USB1_VBUS_PIN,
  87. .gpio_vbus_det = NULL,
  88. .gpio_id_det = NULL,
  89. .rst_mask = (CCM_USB_CTRL_PHY1_RST | CCM_USB_CTRL_PHY1_CLK),
  90. },
  91. {
  92. .gpio_vbus = CONFIG_USB2_VBUS_PIN,
  93. .gpio_vbus_det = NULL,
  94. .gpio_id_det = NULL,
  95. #ifdef CONFIG_MACH_SUN8I_A83T
  96. .rst_mask = (CCM_USB_CTRL_HSIC_RST | CCM_USB_CTRL_HSIC_CLK |
  97. CCM_USB_CTRL_12M_CLK),
  98. #else
  99. .rst_mask = (CCM_USB_CTRL_PHY2_RST | CCM_USB_CTRL_PHY2_CLK),
  100. #endif
  101. },
  102. {
  103. .gpio_vbus = CONFIG_USB3_VBUS_PIN,
  104. .gpio_vbus_det = NULL,
  105. .gpio_id_det = NULL,
  106. },
  107. };
  108. struct sun4i_usb_phy_plat {
  109. void __iomem *pmu;
  110. int power_on_count;
  111. int gpio_vbus;
  112. int gpio_vbus_det;
  113. int gpio_id_det;
  114. int rst_mask;
  115. int id;
  116. };
  117. struct sun4i_usb_phy_data {
  118. void __iomem *base;
  119. struct sunxi_ccm_reg *ccm;
  120. const struct sun4i_usb_phy_cfg *cfg;
  121. struct sun4i_usb_phy_plat *usb_phy;
  122. };
  123. static int initial_usb_scan_delay = CONFIG_INITIAL_USB_SCAN_DELAY;
  124. static void sun4i_usb_phy_write(struct phy *phy, u32 addr, u32 data, int len)
  125. {
  126. struct sun4i_usb_phy_data *phy_data = dev_get_priv(phy->dev);
  127. struct sun4i_usb_phy_plat *usb_phy = &phy_data->usb_phy[phy->id];
  128. u32 temp, usbc_bit = BIT(usb_phy->id * 2);
  129. void __iomem *phyctl = phy_data->base + phy_data->cfg->phyctl_offset;
  130. int i;
  131. if (phy_data->cfg->phyctl_offset == REG_PHYCTL_A33) {
  132. /* SoCs newer than A33 need us to set phyctl to 0 explicitly */
  133. writel(0, phyctl);
  134. }
  135. for (i = 0; i < len; i++) {
  136. temp = readl(phyctl);
  137. /* clear the address portion */
  138. temp &= ~(0xff << 8);
  139. /* set the address */
  140. temp |= ((addr + i) << 8);
  141. writel(temp, phyctl);
  142. /* set the data bit and clear usbc bit*/
  143. temp = readb(phyctl);
  144. if (data & 0x1)
  145. temp |= PHYCTL_DATA;
  146. else
  147. temp &= ~PHYCTL_DATA;
  148. temp &= ~usbc_bit;
  149. writeb(temp, phyctl);
  150. /* pulse usbc_bit */
  151. temp = readb(phyctl);
  152. temp |= usbc_bit;
  153. writeb(temp, phyctl);
  154. temp = readb(phyctl);
  155. temp &= ~usbc_bit;
  156. writeb(temp, phyctl);
  157. data >>= 1;
  158. }
  159. }
  160. static void sun4i_usb_phy_passby(struct phy *phy, bool enable)
  161. {
  162. struct sun4i_usb_phy_data *data = dev_get_priv(phy->dev);
  163. struct sun4i_usb_phy_plat *usb_phy = &data->usb_phy[phy->id];
  164. u32 bits, reg_value;
  165. if (!usb_phy->pmu)
  166. return;
  167. bits = SUNXI_AHB_ICHR8_EN | SUNXI_AHB_INCR4_BURST_EN |
  168. SUNXI_AHB_INCRX_ALIGN_EN | SUNXI_ULPI_BYPASS_EN;
  169. /* A83T USB2 is HSIC */
  170. if (data->cfg->type == sun8i_a83t_phy && usb_phy->id == 2)
  171. bits |= SUNXI_EHCI_HS_FORCE | SUNXI_HSIC_CONNECT_INT |
  172. SUNXI_HSIC;
  173. reg_value = readl(usb_phy->pmu);
  174. if (enable)
  175. reg_value |= bits;
  176. else
  177. reg_value &= ~bits;
  178. writel(reg_value, usb_phy->pmu);
  179. }
  180. static int sun4i_usb_phy_power_on(struct phy *phy)
  181. {
  182. struct sun4i_usb_phy_data *data = dev_get_priv(phy->dev);
  183. struct sun4i_usb_phy_plat *usb_phy = &data->usb_phy[phy->id];
  184. if (initial_usb_scan_delay) {
  185. mdelay(initial_usb_scan_delay);
  186. initial_usb_scan_delay = 0;
  187. }
  188. usb_phy->power_on_count++;
  189. if (usb_phy->power_on_count != 1)
  190. return 0;
  191. if (usb_phy->gpio_vbus >= 0)
  192. gpio_set_value(usb_phy->gpio_vbus, SUNXI_GPIO_PULL_UP);
  193. return 0;
  194. }
  195. static int sun4i_usb_phy_power_off(struct phy *phy)
  196. {
  197. struct sun4i_usb_phy_data *data = dev_get_priv(phy->dev);
  198. struct sun4i_usb_phy_plat *usb_phy = &data->usb_phy[phy->id];
  199. usb_phy->power_on_count--;
  200. if (usb_phy->power_on_count != 0)
  201. return 0;
  202. if (usb_phy->gpio_vbus >= 0)
  203. gpio_set_value(usb_phy->gpio_vbus, SUNXI_GPIO_PULL_DISABLE);
  204. return 0;
  205. }
  206. static void sun4i_usb_phy0_reroute(struct sun4i_usb_phy_data *data, bool id_det)
  207. {
  208. u32 regval;
  209. regval = readl(data->base + REG_PHY_OTGCTL);
  210. if (!id_det) {
  211. /* Host mode. Route phy0 to EHCI/OHCI */
  212. regval &= ~OTGCTL_ROUTE_MUSB;
  213. } else {
  214. /* Peripheral mode. Route phy0 to MUSB */
  215. regval |= OTGCTL_ROUTE_MUSB;
  216. }
  217. writel(regval, data->base + REG_PHY_OTGCTL);
  218. }
  219. static int sun4i_usb_phy_init(struct phy *phy)
  220. {
  221. struct sun4i_usb_phy_data *data = dev_get_priv(phy->dev);
  222. struct sun4i_usb_phy_plat *usb_phy = &data->usb_phy[phy->id];
  223. u32 val;
  224. setbits_le32(&data->ccm->usb_clk_cfg, usb_phy->rst_mask);
  225. if (data->cfg->type == sun8i_a83t_phy) {
  226. if (phy->id == 0) {
  227. val = readl(data->base + data->cfg->phyctl_offset);
  228. val |= PHY_CTL_VBUSVLDEXT;
  229. val &= ~PHY_CTL_SIDDQ;
  230. writel(val, data->base + data->cfg->phyctl_offset);
  231. }
  232. } else {
  233. if (usb_phy->pmu && data->cfg->enable_pmu_unk1) {
  234. val = readl(usb_phy->pmu + REG_PMU_UNK1);
  235. writel(val & ~2, usb_phy->pmu + REG_PMU_UNK1);
  236. }
  237. if (usb_phy->id == 0)
  238. sun4i_usb_phy_write(phy, PHY_RES45_CAL_EN,
  239. PHY_RES45_CAL_DATA,
  240. PHY_RES45_CAL_LEN);
  241. /* Adjust PHY's magnitude and rate */
  242. sun4i_usb_phy_write(phy, PHY_TX_AMPLITUDE_TUNE,
  243. PHY_TX_MAGNITUDE | PHY_TX_RATE,
  244. PHY_TX_AMPLITUDE_LEN);
  245. /* Disconnect threshold adjustment */
  246. sun4i_usb_phy_write(phy, PHY_DISCON_TH_SEL,
  247. data->cfg->disc_thresh, PHY_DISCON_TH_LEN);
  248. }
  249. sun4i_usb_phy_passby(phy, true);
  250. sun4i_usb_phy0_reroute(data, true);
  251. return 0;
  252. }
  253. static int sun4i_usb_phy_exit(struct phy *phy)
  254. {
  255. struct sun4i_usb_phy_data *data = dev_get_priv(phy->dev);
  256. struct sun4i_usb_phy_plat *usb_phy = &data->usb_phy[phy->id];
  257. if (phy->id == 0) {
  258. if (data->cfg->type == sun8i_a83t_phy) {
  259. void __iomem *phyctl = data->base +
  260. data->cfg->phyctl_offset;
  261. writel(readl(phyctl) | PHY_CTL_SIDDQ, phyctl);
  262. }
  263. }
  264. sun4i_usb_phy_passby(phy, false);
  265. clrbits_le32(&data->ccm->usb_clk_cfg, usb_phy->rst_mask);
  266. return 0;
  267. }
  268. static int sun4i_usb_phy_xlate(struct phy *phy,
  269. struct ofnode_phandle_args *args)
  270. {
  271. struct sun4i_usb_phy_data *data = dev_get_priv(phy->dev);
  272. if (args->args_count >= data->cfg->num_phys)
  273. return -EINVAL;
  274. if (args->args_count)
  275. phy->id = args->args[0];
  276. else
  277. phy->id = 0;
  278. debug("%s: phy_id = %ld\n", __func__, phy->id);
  279. return 0;
  280. }
  281. int sun4i_usb_phy_vbus_detect(struct phy *phy)
  282. {
  283. struct sun4i_usb_phy_data *data = dev_get_priv(phy->dev);
  284. struct sun4i_usb_phy_plat *usb_phy = &data->usb_phy[phy->id];
  285. int err, retries = 3;
  286. debug("%s: id_det = %d\n", __func__, usb_phy->gpio_id_det);
  287. if (usb_phy->gpio_vbus_det < 0)
  288. return usb_phy->gpio_vbus_det;
  289. err = gpio_get_value(usb_phy->gpio_vbus_det);
  290. /*
  291. * Vbus may have been provided by the board and just been turned of
  292. * some milliseconds ago on reset, what we're measuring then is a
  293. * residual charge on Vbus, sleep a bit and try again.
  294. */
  295. while (err > 0 && retries--) {
  296. mdelay(100);
  297. err = gpio_get_value(usb_phy->gpio_vbus_det);
  298. }
  299. return err;
  300. }
  301. int sun4i_usb_phy_id_detect(struct phy *phy)
  302. {
  303. struct sun4i_usb_phy_data *data = dev_get_priv(phy->dev);
  304. struct sun4i_usb_phy_plat *usb_phy = &data->usb_phy[phy->id];
  305. debug("%s: id_det = %d\n", __func__, usb_phy->gpio_id_det);
  306. if (usb_phy->gpio_id_det < 0)
  307. return usb_phy->gpio_id_det;
  308. return gpio_get_value(usb_phy->gpio_id_det);
  309. }
  310. void sun4i_usb_phy_set_squelch_detect(struct phy *phy, bool enabled)
  311. {
  312. sun4i_usb_phy_write(phy, PHY_SQUELCH_DETECT, enabled ? 0 : 2, 2);
  313. }
  314. static struct phy_ops sun4i_usb_phy_ops = {
  315. .of_xlate = sun4i_usb_phy_xlate,
  316. .init = sun4i_usb_phy_init,
  317. .power_on = sun4i_usb_phy_power_on,
  318. .power_off = sun4i_usb_phy_power_off,
  319. .exit = sun4i_usb_phy_exit,
  320. };
  321. static int sun4i_usb_phy_probe(struct udevice *dev)
  322. {
  323. struct sun4i_usb_phy_plat *plat = dev_get_platdata(dev);
  324. struct sun4i_usb_phy_data *data = dev_get_priv(dev);
  325. int i, ret;
  326. data->cfg = (const struct sun4i_usb_phy_cfg *)dev_get_driver_data(dev);
  327. if (!data->cfg)
  328. return -EINVAL;
  329. data->base = (void __iomem *)devfdt_get_addr_name(dev, "phy_ctrl");
  330. if (IS_ERR(data->base))
  331. return PTR_ERR(data->base);
  332. data->ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
  333. if (IS_ERR(data->ccm))
  334. return PTR_ERR(data->ccm);
  335. data->usb_phy = plat;
  336. for (i = 0; i < data->cfg->num_phys; i++) {
  337. struct sun4i_usb_phy_plat *phy = &plat[i];
  338. struct sun4i_usb_phy_info *info = &phy_info[i];
  339. char name[16];
  340. phy->gpio_vbus = sunxi_name_to_gpio(info->gpio_vbus);
  341. if (phy->gpio_vbus >= 0) {
  342. ret = gpio_request(phy->gpio_vbus, "usb_vbus");
  343. if (ret)
  344. return ret;
  345. ret = gpio_direction_output(phy->gpio_vbus, 0);
  346. if (ret)
  347. return ret;
  348. }
  349. phy->gpio_vbus_det = sunxi_name_to_gpio(info->gpio_vbus_det);
  350. if (phy->gpio_vbus_det >= 0) {
  351. ret = gpio_request(phy->gpio_vbus_det, "usb_vbus_det");
  352. if (ret)
  353. return ret;
  354. ret = gpio_direction_input(phy->gpio_vbus_det);
  355. if (ret)
  356. return ret;
  357. }
  358. phy->gpio_id_det = sunxi_name_to_gpio(info->gpio_id_det);
  359. if (phy->gpio_id_det >= 0) {
  360. ret = gpio_request(phy->gpio_id_det, "usb_id_det");
  361. if (ret)
  362. return ret;
  363. ret = gpio_direction_input(phy->gpio_id_det);
  364. if (ret)
  365. return ret;
  366. sunxi_gpio_set_pull(phy->gpio_id_det, SUNXI_GPIO_PULL_UP);
  367. }
  368. if (i || data->cfg->phy0_dual_route) {
  369. snprintf(name, sizeof(name), "pmu%d", i);
  370. phy->pmu = (void __iomem *)devfdt_get_addr_name(dev, name);
  371. if (IS_ERR(phy->pmu))
  372. return PTR_ERR(phy->pmu);
  373. }
  374. phy->id = i;
  375. phy->rst_mask = info->rst_mask;
  376. if ((data->cfg->type == sun8i_h3_phy) && (phy->id == 3))
  377. phy->rst_mask = (BIT(3) | BIT(11));
  378. };
  379. debug("Allwinner Sun4I USB PHY driver loaded\n");
  380. return 0;
  381. }
  382. static const struct sun4i_usb_phy_cfg sun4i_a10_cfg = {
  383. .num_phys = 3,
  384. .type = sun4i_a10_phy,
  385. .disc_thresh = 3,
  386. .phyctl_offset = REG_PHYCTL_A10,
  387. .enable_pmu_unk1 = false,
  388. };
  389. static const struct sun4i_usb_phy_cfg sun5i_a13_cfg = {
  390. .num_phys = 2,
  391. .type = sun4i_a10_phy,
  392. .disc_thresh = 2,
  393. .phyctl_offset = REG_PHYCTL_A10,
  394. .enable_pmu_unk1 = false,
  395. };
  396. static const struct sun4i_usb_phy_cfg sun6i_a31_cfg = {
  397. .num_phys = 3,
  398. .type = sun6i_a31_phy,
  399. .disc_thresh = 3,
  400. .phyctl_offset = REG_PHYCTL_A10,
  401. .enable_pmu_unk1 = false,
  402. };
  403. static const struct sun4i_usb_phy_cfg sun7i_a20_cfg = {
  404. .num_phys = 3,
  405. .type = sun4i_a10_phy,
  406. .disc_thresh = 2,
  407. .phyctl_offset = REG_PHYCTL_A10,
  408. .enable_pmu_unk1 = false,
  409. };
  410. static const struct sun4i_usb_phy_cfg sun8i_a23_cfg = {
  411. .num_phys = 2,
  412. .type = sun4i_a10_phy,
  413. .disc_thresh = 3,
  414. .phyctl_offset = REG_PHYCTL_A10,
  415. .enable_pmu_unk1 = false,
  416. };
  417. static const struct sun4i_usb_phy_cfg sun8i_a33_cfg = {
  418. .num_phys = 2,
  419. .type = sun8i_a33_phy,
  420. .disc_thresh = 3,
  421. .phyctl_offset = REG_PHYCTL_A33,
  422. .enable_pmu_unk1 = false,
  423. };
  424. static const struct sun4i_usb_phy_cfg sun8i_a83t_cfg = {
  425. .num_phys = 3,
  426. .type = sun8i_a83t_phy,
  427. .phyctl_offset = REG_PHYCTL_A33,
  428. };
  429. static const struct sun4i_usb_phy_cfg sun8i_h3_cfg = {
  430. .num_phys = 4,
  431. .type = sun8i_h3_phy,
  432. .disc_thresh = 3,
  433. .phyctl_offset = REG_PHYCTL_A33,
  434. .enable_pmu_unk1 = true,
  435. .phy0_dual_route = true,
  436. };
  437. static const struct sun4i_usb_phy_cfg sun8i_v3s_cfg = {
  438. .num_phys = 1,
  439. .type = sun8i_v3s_phy,
  440. .disc_thresh = 3,
  441. .phyctl_offset = REG_PHYCTL_A33,
  442. .enable_pmu_unk1 = true,
  443. .phy0_dual_route = true,
  444. };
  445. static const struct sun4i_usb_phy_cfg sun50i_a64_cfg = {
  446. .num_phys = 2,
  447. .type = sun50i_a64_phy,
  448. .disc_thresh = 3,
  449. .phyctl_offset = REG_PHYCTL_A33,
  450. .enable_pmu_unk1 = true,
  451. .phy0_dual_route = true,
  452. };
  453. static const struct udevice_id sun4i_usb_phy_ids[] = {
  454. { .compatible = "allwinner,sun4i-a10-usb-phy", .data = (ulong)&sun4i_a10_cfg },
  455. { .compatible = "allwinner,sun5i-a13-usb-phy", .data = (ulong)&sun5i_a13_cfg },
  456. { .compatible = "allwinner,sun6i-a31-usb-phy", .data = (ulong)&sun6i_a31_cfg },
  457. { .compatible = "allwinner,sun7i-a20-usb-phy", .data = (ulong)&sun7i_a20_cfg },
  458. { .compatible = "allwinner,sun8i-a23-usb-phy", .data = (ulong)&sun8i_a23_cfg },
  459. { .compatible = "allwinner,sun8i-a33-usb-phy", .data = (ulong)&sun8i_a33_cfg },
  460. { .compatible = "allwinner,sun8i-a83t-usb-phy", .data = (ulong)&sun8i_a83t_cfg },
  461. { .compatible = "allwinner,sun8i-h3-usb-phy", .data = (ulong)&sun8i_h3_cfg },
  462. { .compatible = "allwinner,sun8i-v3s-usb-phy", .data = (ulong)&sun8i_v3s_cfg },
  463. { .compatible = "allwinner,sun50i-a64-usb-phy", .data = (ulong)&sun50i_a64_cfg},
  464. { }
  465. };
  466. U_BOOT_DRIVER(sun4i_usb_phy) = {
  467. .name = "sun4i_usb_phy",
  468. .id = UCLASS_PHY,
  469. .of_match = sun4i_usb_phy_ids,
  470. .ops = &sun4i_usb_phy_ops,
  471. .probe = sun4i_usb_phy_probe,
  472. .platdata_auto_alloc_size = sizeof(struct sun4i_usb_phy_plat[MAX_PHYS]),
  473. .priv_auto_alloc_size = sizeof(struct sun4i_usb_phy_data),
  474. };