blob: a7d7e3f044aeafeb8f9af084f6394eb96cfd03da [file] [log] [blame]
Jagan Tekid3c38282018-05-07 13:03:26 +05301/*
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
13#include <common.h>
14#include <dm.h>
15#include <dm/device.h>
16#include <generic-phy.h>
Jagan Teki21fc42d2018-05-07 13:03:27 +053017#include <phy-sun4i-usb.h>
Jagan Tekid3c38282018-05-07 13:03:26 +053018#include <asm/gpio.h>
19#include <asm/io.h>
20#include <asm/arch/clock.h>
21#include <asm/arch/cpu.h>
22
23#define REG_ISCR 0x00
24#define REG_PHYCTL_A10 0x04
25#define REG_PHYBIST 0x08
26#define REG_PHYTUNE 0x0c
27#define REG_PHYCTL_A33 0x10
28#define REG_PHY_OTGCTL 0x20
29#define REG_PMU_UNK1 0x10
30
31/* Common Control Bits for Both PHYs */
32#define PHY_PLL_BW 0x03
33#define PHY_RES45_CAL_EN 0x0c
34
35/* Private Control Bits for Each PHY */
36#define PHY_TX_AMPLITUDE_TUNE 0x20
37#define PHY_TX_SLEWRATE_TUNE 0x22
38#define PHY_DISCON_TH_SEL 0x2a
Jagan Teki37671e12018-05-07 13:03:37 +053039#define PHY_SQUELCH_DETECT 0x3c
Jagan Tekid3c38282018-05-07 13:03:26 +053040
41#define PHYCTL_DATA BIT(7)
42#define OTGCTL_ROUTE_MUSB BIT(0)
43
44#define PHY_TX_RATE BIT(4)
45#define PHY_TX_MAGNITUDE BIT(2)
46#define PHY_TX_AMPLITUDE_LEN 5
47
48#define PHY_RES45_CAL_DATA BIT(0)
49#define PHY_RES45_CAL_LEN 1
50#define PHY_DISCON_TH_LEN 2
51
52#define SUNXI_AHB_ICHR8_EN BIT(10)
53#define SUNXI_AHB_INCR4_BURST_EN BIT(9)
54#define SUNXI_AHB_INCRX_ALIGN_EN BIT(8)
55#define SUNXI_ULPI_BYPASS_EN BIT(0)
56
Jagan Teki05a7b9f2018-05-07 13:03:30 +053057/* A83T specific control bits for PHY0 */
58#define PHY_CTL_VBUSVLDEXT BIT(5)
59#define PHY_CTL_SIDDQ BIT(3)
60
61/* A83T specific control bits for PHY2 HSIC */
62#define SUNXI_EHCI_HS_FORCE BIT(20)
63#define SUNXI_HSIC_CONNECT_INT BIT(16)
64#define SUNXI_HSIC BIT(1)
65
Jagan Tekid3c38282018-05-07 13:03:26 +053066#define MAX_PHYS 4
67
68enum sun4i_usb_phy_type {
Jagan Teki5a3000f2018-05-07 13:03:31 +053069 sun4i_a10_phy,
Jagan Teki1cbc80c2018-05-07 13:03:32 +053070 sun6i_a31_phy,
Jagan Teki0e574bb2018-05-07 13:03:33 +053071 sun8i_a33_phy,
Jagan Teki05a7b9f2018-05-07 13:03:30 +053072 sun8i_a83t_phy,
Jagan Tekic1b0e5a2018-05-07 13:03:28 +053073 sun8i_h3_phy,
Jagan Tekiac4bab42018-05-07 13:03:29 +053074 sun8i_v3s_phy,
Jagan Tekid3c38282018-05-07 13:03:26 +053075 sun50i_a64_phy,
76};
77
78struct sun4i_usb_phy_cfg {
79 int num_phys;
80 enum sun4i_usb_phy_type type;
81 u32 disc_thresh;
82 u8 phyctl_offset;
83 bool enable_pmu_unk1;
84 bool phy0_dual_route;
85};
86
87struct sun4i_usb_phy_info {
88 const char *gpio_vbus;
89 const char *gpio_vbus_det;
90 const char *gpio_id_det;
91 int rst_mask;
92} phy_info[] = {
93 {
94 .gpio_vbus = CONFIG_USB0_VBUS_PIN,
95 .gpio_vbus_det = CONFIG_USB0_VBUS_DET,
96 .gpio_id_det = CONFIG_USB0_ID_DET,
97 .rst_mask = (CCM_USB_CTRL_PHY0_RST | CCM_USB_CTRL_PHY0_CLK),
98 },
99 {
100 .gpio_vbus = CONFIG_USB1_VBUS_PIN,
101 .gpio_vbus_det = NULL,
102 .gpio_id_det = NULL,
103 .rst_mask = (CCM_USB_CTRL_PHY1_RST | CCM_USB_CTRL_PHY1_CLK),
104 },
105 {
106 .gpio_vbus = CONFIG_USB2_VBUS_PIN,
107 .gpio_vbus_det = NULL,
108 .gpio_id_det = NULL,
Jagan Teki05a7b9f2018-05-07 13:03:30 +0530109#ifdef CONFIG_MACH_SUN8I_A83T
110 .rst_mask = (CCM_USB_CTRL_HSIC_RST | CCM_USB_CTRL_HSIC_CLK |
111 CCM_USB_CTRL_12M_CLK),
112#else
Jagan Tekid3c38282018-05-07 13:03:26 +0530113 .rst_mask = (CCM_USB_CTRL_PHY2_RST | CCM_USB_CTRL_PHY2_CLK),
Jagan Teki05a7b9f2018-05-07 13:03:30 +0530114#endif
Jagan Tekid3c38282018-05-07 13:03:26 +0530115 },
116 {
117 .gpio_vbus = CONFIG_USB3_VBUS_PIN,
118 .gpio_vbus_det = NULL,
119 .gpio_id_det = NULL,
Jagan Tekid3c38282018-05-07 13:03:26 +0530120 },
121};
122
123struct sun4i_usb_phy_plat {
124 void __iomem *pmu;
125 int power_on_count;
126 int gpio_vbus;
127 int gpio_vbus_det;
128 int gpio_id_det;
129 int rst_mask;
130 int id;
131};
132
133struct sun4i_usb_phy_data {
134 void __iomem *base;
135 struct sunxi_ccm_reg *ccm;
136 const struct sun4i_usb_phy_cfg *cfg;
137 struct sun4i_usb_phy_plat *usb_phy;
138};
139
140static int initial_usb_scan_delay = CONFIG_INITIAL_USB_SCAN_DELAY;
141
142static void sun4i_usb_phy_write(struct phy *phy, u32 addr, u32 data, int len)
143{
144 struct sun4i_usb_phy_data *phy_data = dev_get_priv(phy->dev);
145 struct sun4i_usb_phy_plat *usb_phy = &phy_data->usb_phy[phy->id];
146 u32 temp, usbc_bit = BIT(usb_phy->id * 2);
147 void __iomem *phyctl = phy_data->base + phy_data->cfg->phyctl_offset;
148 int i;
149
150 if (phy_data->cfg->phyctl_offset == REG_PHYCTL_A33) {
151 /* SoCs newer than A33 need us to set phyctl to 0 explicitly */
152 writel(0, phyctl);
153 }
154
155 for (i = 0; i < len; i++) {
156 temp = readl(phyctl);
157
158 /* clear the address portion */
159 temp &= ~(0xff << 8);
160
161 /* set the address */
162 temp |= ((addr + i) << 8);
163 writel(temp, phyctl);
164
165 /* set the data bit and clear usbc bit*/
166 temp = readb(phyctl);
167 if (data & 0x1)
168 temp |= PHYCTL_DATA;
169 else
170 temp &= ~PHYCTL_DATA;
171 temp &= ~usbc_bit;
172 writeb(temp, phyctl);
173
174 /* pulse usbc_bit */
175 temp = readb(phyctl);
176 temp |= usbc_bit;
177 writeb(temp, phyctl);
178
179 temp = readb(phyctl);
180 temp &= ~usbc_bit;
181 writeb(temp, phyctl);
182
183 data >>= 1;
184 }
185}
186
Jagan Teki05a7b9f2018-05-07 13:03:30 +0530187static void sun4i_usb_phy_passby(struct phy *phy, bool enable)
Jagan Tekid3c38282018-05-07 13:03:26 +0530188{
Jagan Teki05a7b9f2018-05-07 13:03:30 +0530189 struct sun4i_usb_phy_data *data = dev_get_priv(phy->dev);
190 struct sun4i_usb_phy_plat *usb_phy = &data->usb_phy[phy->id];
Jagan Tekid3c38282018-05-07 13:03:26 +0530191 u32 bits, reg_value;
192
193 if (!usb_phy->pmu)
194 return;
195
196 bits = SUNXI_AHB_ICHR8_EN | SUNXI_AHB_INCR4_BURST_EN |
197 SUNXI_AHB_INCRX_ALIGN_EN | SUNXI_ULPI_BYPASS_EN;
Jagan Teki05a7b9f2018-05-07 13:03:30 +0530198
199 /* A83T USB2 is HSIC */
200 if (data->cfg->type == sun8i_a83t_phy && usb_phy->id == 2)
201 bits |= SUNXI_EHCI_HS_FORCE | SUNXI_HSIC_CONNECT_INT |
202 SUNXI_HSIC;
203
Jagan Tekid3c38282018-05-07 13:03:26 +0530204 reg_value = readl(usb_phy->pmu);
205
206 if (enable)
207 reg_value |= bits;
208 else
209 reg_value &= ~bits;
210
211 writel(reg_value, usb_phy->pmu);
212}
213
214static int sun4i_usb_phy_power_on(struct phy *phy)
215{
216 struct sun4i_usb_phy_data *data = dev_get_priv(phy->dev);
217 struct sun4i_usb_phy_plat *usb_phy = &data->usb_phy[phy->id];
218
219 if (initial_usb_scan_delay) {
220 mdelay(initial_usb_scan_delay);
221 initial_usb_scan_delay = 0;
222 }
223
224 usb_phy->power_on_count++;
225 if (usb_phy->power_on_count != 1)
226 return 0;
227
228 if (usb_phy->gpio_vbus >= 0)
229 gpio_set_value(usb_phy->gpio_vbus, SUNXI_GPIO_PULL_UP);
230
231 return 0;
232}
233
234static int sun4i_usb_phy_power_off(struct phy *phy)
235{
236 struct sun4i_usb_phy_data *data = dev_get_priv(phy->dev);
237 struct sun4i_usb_phy_plat *usb_phy = &data->usb_phy[phy->id];
238
239 usb_phy->power_on_count--;
240 if (usb_phy->power_on_count != 0)
241 return 0;
242
243 if (usb_phy->gpio_vbus >= 0)
244 gpio_set_value(usb_phy->gpio_vbus, SUNXI_GPIO_PULL_DISABLE);
245
246 return 0;
247}
248
249static void sun4i_usb_phy0_reroute(struct sun4i_usb_phy_data *data, bool id_det)
250{
251 u32 regval;
252
253 regval = readl(data->base + REG_PHY_OTGCTL);
254 if (!id_det) {
255 /* Host mode. Route phy0 to EHCI/OHCI */
256 regval &= ~OTGCTL_ROUTE_MUSB;
257 } else {
258 /* Peripheral mode. Route phy0 to MUSB */
259 regval |= OTGCTL_ROUTE_MUSB;
260 }
261 writel(regval, data->base + REG_PHY_OTGCTL);
262}
263
264static int sun4i_usb_phy_init(struct phy *phy)
265{
266 struct sun4i_usb_phy_data *data = dev_get_priv(phy->dev);
267 struct sun4i_usb_phy_plat *usb_phy = &data->usb_phy[phy->id];
268 u32 val;
269
270 setbits_le32(&data->ccm->usb_clk_cfg, usb_phy->rst_mask);
271
Jagan Teki05a7b9f2018-05-07 13:03:30 +0530272 if (data->cfg->type == sun8i_a83t_phy) {
273 if (phy->id == 0) {
274 val = readl(data->base + data->cfg->phyctl_offset);
275 val |= PHY_CTL_VBUSVLDEXT;
276 val &= ~PHY_CTL_SIDDQ;
277 writel(val, data->base + data->cfg->phyctl_offset);
278 }
279 } else {
280 if (usb_phy->pmu && data->cfg->enable_pmu_unk1) {
281 val = readl(usb_phy->pmu + REG_PMU_UNK1);
282 writel(val & ~2, usb_phy->pmu + REG_PMU_UNK1);
283 }
Jagan Tekid3c38282018-05-07 13:03:26 +0530284
Jagan Teki05a7b9f2018-05-07 13:03:30 +0530285 if (usb_phy->id == 0)
286 sun4i_usb_phy_write(phy, PHY_RES45_CAL_EN,
287 PHY_RES45_CAL_DATA,
288 PHY_RES45_CAL_LEN);
Jagan Tekid3c38282018-05-07 13:03:26 +0530289
Jagan Teki05a7b9f2018-05-07 13:03:30 +0530290 /* Adjust PHY's magnitude and rate */
291 sun4i_usb_phy_write(phy, PHY_TX_AMPLITUDE_TUNE,
292 PHY_TX_MAGNITUDE | PHY_TX_RATE,
293 PHY_TX_AMPLITUDE_LEN);
Jagan Tekid3c38282018-05-07 13:03:26 +0530294
Jagan Teki05a7b9f2018-05-07 13:03:30 +0530295 /* Disconnect threshold adjustment */
296 sun4i_usb_phy_write(phy, PHY_DISCON_TH_SEL,
297 data->cfg->disc_thresh, PHY_DISCON_TH_LEN);
298 }
Jagan Tekid3c38282018-05-07 13:03:26 +0530299
Jagan Tekib8cbf9d2018-07-20 12:34:20 +0530300 sun4i_usb_phy_passby(phy, true);
Jagan Tekid3c38282018-05-07 13:03:26 +0530301
302 sun4i_usb_phy0_reroute(data, true);
303
304 return 0;
305}
306
307static int sun4i_usb_phy_exit(struct phy *phy)
308{
309 struct sun4i_usb_phy_data *data = dev_get_priv(phy->dev);
310 struct sun4i_usb_phy_plat *usb_phy = &data->usb_phy[phy->id];
311
Jagan Teki05a7b9f2018-05-07 13:03:30 +0530312 if (phy->id == 0) {
313 if (data->cfg->type == sun8i_a83t_phy) {
314 void __iomem *phyctl = data->base +
315 data->cfg->phyctl_offset;
316
317 writel(readl(phyctl) | PHY_CTL_SIDDQ, phyctl);
318 }
319 }
320
321 sun4i_usb_phy_passby(phy, false);
Jagan Tekid3c38282018-05-07 13:03:26 +0530322
323 clrbits_le32(&data->ccm->usb_clk_cfg, usb_phy->rst_mask);
324
325 return 0;
326}
327
328static int sun4i_usb_phy_xlate(struct phy *phy,
329 struct ofnode_phandle_args *args)
330{
331 struct sun4i_usb_phy_data *data = dev_get_priv(phy->dev);
332
333 if (args->args_count >= data->cfg->num_phys)
334 return -EINVAL;
335
336 if (args->args_count)
337 phy->id = args->args[0];
338 else
339 phy->id = 0;
340
341 debug("%s: phy_id = %ld\n", __func__, phy->id);
342 return 0;
343}
344
Jagan Teki21fc42d2018-05-07 13:03:27 +0530345int sun4i_usb_phy_vbus_detect(struct phy *phy)
346{
347 struct sun4i_usb_phy_data *data = dev_get_priv(phy->dev);
348 struct sun4i_usb_phy_plat *usb_phy = &data->usb_phy[phy->id];
349 int err, retries = 3;
350
351 debug("%s: id_det = %d\n", __func__, usb_phy->gpio_id_det);
352
353 if (usb_phy->gpio_vbus_det < 0)
354 return usb_phy->gpio_vbus_det;
355
356 err = gpio_get_value(usb_phy->gpio_vbus_det);
357 /*
358 * Vbus may have been provided by the board and just been turned of
359 * some milliseconds ago on reset, what we're measuring then is a
360 * residual charge on Vbus, sleep a bit and try again.
361 */
362 while (err > 0 && retries--) {
363 mdelay(100);
364 err = gpio_get_value(usb_phy->gpio_vbus_det);
365 }
366
367 return err;
368}
369
370int sun4i_usb_phy_id_detect(struct phy *phy)
371{
372 struct sun4i_usb_phy_data *data = dev_get_priv(phy->dev);
373 struct sun4i_usb_phy_plat *usb_phy = &data->usb_phy[phy->id];
374
375 debug("%s: id_det = %d\n", __func__, usb_phy->gpio_id_det);
376
377 if (usb_phy->gpio_id_det < 0)
378 return usb_phy->gpio_id_det;
379
380 return gpio_get_value(usb_phy->gpio_id_det);
381}
382
Jagan Teki37671e12018-05-07 13:03:37 +0530383void sun4i_usb_phy_set_squelch_detect(struct phy *phy, bool enabled)
384{
385 sun4i_usb_phy_write(phy, PHY_SQUELCH_DETECT, enabled ? 0 : 2, 2);
386}
387
Jagan Tekid3c38282018-05-07 13:03:26 +0530388static struct phy_ops sun4i_usb_phy_ops = {
389 .of_xlate = sun4i_usb_phy_xlate,
390 .init = sun4i_usb_phy_init,
391 .power_on = sun4i_usb_phy_power_on,
392 .power_off = sun4i_usb_phy_power_off,
393 .exit = sun4i_usb_phy_exit,
394};
395
396static int sun4i_usb_phy_probe(struct udevice *dev)
397{
398 struct sun4i_usb_phy_plat *plat = dev_get_platdata(dev);
399 struct sun4i_usb_phy_data *data = dev_get_priv(dev);
400 int i, ret;
401
402 data->cfg = (const struct sun4i_usb_phy_cfg *)dev_get_driver_data(dev);
403 if (!data->cfg)
404 return -EINVAL;
405
406 data->base = (void __iomem *)devfdt_get_addr_name(dev, "phy_ctrl");
407 if (IS_ERR(data->base))
408 return PTR_ERR(data->base);
409
410 data->ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
411 if (IS_ERR(data->ccm))
412 return PTR_ERR(data->ccm);
413
414 data->usb_phy = plat;
415 for (i = 0; i < data->cfg->num_phys; i++) {
416 struct sun4i_usb_phy_plat *phy = &plat[i];
417 struct sun4i_usb_phy_info *info = &phy_info[i];
418 char name[16];
419
420 phy->gpio_vbus = sunxi_name_to_gpio(info->gpio_vbus);
421 if (phy->gpio_vbus >= 0) {
422 ret = gpio_request(phy->gpio_vbus, "usb_vbus");
423 if (ret)
424 return ret;
425 ret = gpio_direction_output(phy->gpio_vbus, 0);
426 if (ret)
427 return ret;
428 }
429
430 phy->gpio_vbus_det = sunxi_name_to_gpio(info->gpio_vbus_det);
431 if (phy->gpio_vbus_det >= 0) {
432 ret = gpio_request(phy->gpio_vbus_det, "usb_vbus_det");
433 if (ret)
434 return ret;
435 ret = gpio_direction_input(phy->gpio_vbus_det);
436 if (ret)
437 return ret;
438 }
439
440 phy->gpio_id_det = sunxi_name_to_gpio(info->gpio_id_det);
441 if (phy->gpio_id_det >= 0) {
442 ret = gpio_request(phy->gpio_id_det, "usb_id_det");
443 if (ret)
444 return ret;
445 ret = gpio_direction_input(phy->gpio_id_det);
446 if (ret)
447 return ret;
448 sunxi_gpio_set_pull(phy->gpio_id_det, SUNXI_GPIO_PULL_UP);
449 }
450
451 if (i || data->cfg->phy0_dual_route) {
452 snprintf(name, sizeof(name), "pmu%d", i);
453 phy->pmu = (void __iomem *)devfdt_get_addr_name(dev, name);
454 if (IS_ERR(phy->pmu))
455 return PTR_ERR(phy->pmu);
456 }
457
458 phy->id = i;
459 phy->rst_mask = info->rst_mask;
Jagan Teki0c8d0cc2018-07-20 12:34:22 +0530460 if ((data->cfg->type == sun8i_h3_phy) && (phy->id == 3))
461 phy->rst_mask = (BIT(3) | BIT(11));
Jagan Tekid3c38282018-05-07 13:03:26 +0530462 };
463
Jagan Tekid3c38282018-05-07 13:03:26 +0530464 debug("Allwinner Sun4I USB PHY driver loaded\n");
465 return 0;
466}
467
Jagan Teki5a3000f2018-05-07 13:03:31 +0530468static const struct sun4i_usb_phy_cfg sun4i_a10_cfg = {
469 .num_phys = 3,
470 .type = sun4i_a10_phy,
471 .disc_thresh = 3,
472 .phyctl_offset = REG_PHYCTL_A10,
473 .enable_pmu_unk1 = false,
474};
475
476static const struct sun4i_usb_phy_cfg sun5i_a13_cfg = {
477 .num_phys = 2,
478 .type = sun4i_a10_phy,
479 .disc_thresh = 2,
480 .phyctl_offset = REG_PHYCTL_A10,
481 .enable_pmu_unk1 = false,
482};
483
Jagan Teki1cbc80c2018-05-07 13:03:32 +0530484static const struct sun4i_usb_phy_cfg sun6i_a31_cfg = {
485 .num_phys = 3,
486 .type = sun6i_a31_phy,
487 .disc_thresh = 3,
488 .phyctl_offset = REG_PHYCTL_A10,
489 .enable_pmu_unk1 = false,
490};
491
Jagan Teki5a3000f2018-05-07 13:03:31 +0530492static const struct sun4i_usb_phy_cfg sun7i_a20_cfg = {
493 .num_phys = 3,
494 .type = sun4i_a10_phy,
495 .disc_thresh = 2,
496 .phyctl_offset = REG_PHYCTL_A10,
497 .enable_pmu_unk1 = false,
498};
499
Jagan Teki00f9f6b2018-05-07 13:03:34 +0530500static const struct sun4i_usb_phy_cfg sun8i_a23_cfg = {
501 .num_phys = 2,
502 .type = sun4i_a10_phy,
503 .disc_thresh = 3,
504 .phyctl_offset = REG_PHYCTL_A10,
505 .enable_pmu_unk1 = false,
506};
507
Jagan Teki0e574bb2018-05-07 13:03:33 +0530508static const struct sun4i_usb_phy_cfg sun8i_a33_cfg = {
509 .num_phys = 2,
510 .type = sun8i_a33_phy,
511 .disc_thresh = 3,
512 .phyctl_offset = REG_PHYCTL_A33,
513 .enable_pmu_unk1 = false,
514};
515
Jagan Teki05a7b9f2018-05-07 13:03:30 +0530516static const struct sun4i_usb_phy_cfg sun8i_a83t_cfg = {
517 .num_phys = 3,
518 .type = sun8i_a83t_phy,
519 .phyctl_offset = REG_PHYCTL_A33,
520};
521
Jagan Tekic1b0e5a2018-05-07 13:03:28 +0530522static const struct sun4i_usb_phy_cfg sun8i_h3_cfg = {
523 .num_phys = 4,
524 .type = sun8i_h3_phy,
525 .disc_thresh = 3,
526 .phyctl_offset = REG_PHYCTL_A33,
527 .enable_pmu_unk1 = true,
528 .phy0_dual_route = true,
529};
530
Jagan Tekiac4bab42018-05-07 13:03:29 +0530531static const struct sun4i_usb_phy_cfg sun8i_v3s_cfg = {
532 .num_phys = 1,
533 .type = sun8i_v3s_phy,
534 .disc_thresh = 3,
535 .phyctl_offset = REG_PHYCTL_A33,
536 .enable_pmu_unk1 = true,
537 .phy0_dual_route = true,
538};
539
Jagan Tekid3c38282018-05-07 13:03:26 +0530540static const struct sun4i_usb_phy_cfg sun50i_a64_cfg = {
541 .num_phys = 2,
542 .type = sun50i_a64_phy,
543 .disc_thresh = 3,
544 .phyctl_offset = REG_PHYCTL_A33,
545 .enable_pmu_unk1 = true,
546 .phy0_dual_route = true,
547};
548
549static const struct udevice_id sun4i_usb_phy_ids[] = {
Jagan Teki5a3000f2018-05-07 13:03:31 +0530550 { .compatible = "allwinner,sun4i-a10-usb-phy", .data = (ulong)&sun4i_a10_cfg },
551 { .compatible = "allwinner,sun5i-a13-usb-phy", .data = (ulong)&sun5i_a13_cfg },
Jagan Teki1cbc80c2018-05-07 13:03:32 +0530552 { .compatible = "allwinner,sun6i-a31-usb-phy", .data = (ulong)&sun6i_a31_cfg },
Jagan Teki5a3000f2018-05-07 13:03:31 +0530553 { .compatible = "allwinner,sun7i-a20-usb-phy", .data = (ulong)&sun7i_a20_cfg },
Jagan Teki00f9f6b2018-05-07 13:03:34 +0530554 { .compatible = "allwinner,sun8i-a23-usb-phy", .data = (ulong)&sun8i_a23_cfg },
Jagan Teki0e574bb2018-05-07 13:03:33 +0530555 { .compatible = "allwinner,sun8i-a33-usb-phy", .data = (ulong)&sun8i_a33_cfg },
Jagan Teki05a7b9f2018-05-07 13:03:30 +0530556 { .compatible = "allwinner,sun8i-a83t-usb-phy", .data = (ulong)&sun8i_a83t_cfg },
Jagan Tekic1b0e5a2018-05-07 13:03:28 +0530557 { .compatible = "allwinner,sun8i-h3-usb-phy", .data = (ulong)&sun8i_h3_cfg },
Jagan Tekiac4bab42018-05-07 13:03:29 +0530558 { .compatible = "allwinner,sun8i-v3s-usb-phy", .data = (ulong)&sun8i_v3s_cfg },
Jagan Tekid3c38282018-05-07 13:03:26 +0530559 { .compatible = "allwinner,sun50i-a64-usb-phy", .data = (ulong)&sun50i_a64_cfg},
560 { }
561};
562
563U_BOOT_DRIVER(sun4i_usb_phy) = {
564 .name = "sun4i_usb_phy",
565 .id = UCLASS_PHY,
566 .of_match = sun4i_usb_phy_ids,
567 .ops = &sun4i_usb_phy_ops,
568 .probe = sun4i_usb_phy_probe,
569 .platdata_auto_alloc_size = sizeof(struct sun4i_usb_phy_plat[MAX_PHYS]),
570 .priv_auto_alloc_size = sizeof(struct sun4i_usb_phy_data),
571};