blob: 70e61eccb79a6da0928547fc39220b80313d64e3 [file] [log] [blame]
Jagan Teki70e882f2020-05-26 11:33:44 +08001// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Rockchip USB2.0 PHY with Innosilicon IP block driver
4 *
5 * Copyright (C) 2016 Fuzhou Rockchip Electronics Co., Ltd
6 * Copyright (C) 2020 Amarula Solutions(India)
7 */
8
9#include <common.h>
Xavier Drudis Ferranc3dd0612023-06-05 17:05:53 +020010#include <clk-uclass.h>
Jagan Teki70e882f2020-05-26 11:33:44 +080011#include <dm.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060012#include <asm/global_data.h>
Jagan Teki70e882f2020-05-26 11:33:44 +080013#include <dm/device_compat.h>
Xavier Drudis Ferranc3dd0612023-06-05 17:05:53 +020014#include <dm/device-internal.h>
Jagan Teki70e882f2020-05-26 11:33:44 +080015#include <dm/lists.h>
16#include <generic-phy.h>
17#include <reset.h>
18#include <syscon.h>
19#include <asm/gpio.h>
20#include <asm/io.h>
21#include <linux/iopoll.h>
22#include <asm/arch-rockchip/clock.h>
23
24DECLARE_GLOBAL_DATA_PTR;
25
26#define usleep_range(a, b) udelay((b))
27#define BIT_WRITEABLE_SHIFT 16
28
29enum rockchip_usb2phy_port_id {
30 USB2PHY_PORT_OTG,
31 USB2PHY_PORT_HOST,
32 USB2PHY_NUM_PORTS,
33};
34
35struct usb2phy_reg {
36 unsigned int offset;
37 unsigned int bitend;
38 unsigned int bitstart;
39 unsigned int disable;
40 unsigned int enable;
41};
42
43struct rockchip_usb2phy_port_cfg {
44 struct usb2phy_reg phy_sus;
45 struct usb2phy_reg bvalid_det_en;
46 struct usb2phy_reg bvalid_det_st;
47 struct usb2phy_reg bvalid_det_clr;
48 struct usb2phy_reg ls_det_en;
49 struct usb2phy_reg ls_det_st;
50 struct usb2phy_reg ls_det_clr;
51 struct usb2phy_reg utmi_avalid;
52 struct usb2phy_reg utmi_bvalid;
53 struct usb2phy_reg utmi_ls;
54 struct usb2phy_reg utmi_hstdet;
55};
56
57struct rockchip_usb2phy_cfg {
58 unsigned int reg;
Xavier Drudis Ferran1ef47772023-06-05 17:06:57 +020059 struct usb2phy_reg clkout_ctl;
Jagan Teki70e882f2020-05-26 11:33:44 +080060 const struct rockchip_usb2phy_port_cfg port_cfgs[USB2PHY_NUM_PORTS];
61};
62
63struct rockchip_usb2phy {
64 void *reg_base;
65 struct clk phyclk;
66 const struct rockchip_usb2phy_cfg *phy_cfg;
67};
68
69static inline int property_enable(void *reg_base,
70 const struct usb2phy_reg *reg, bool en)
71{
72 unsigned int val, mask, tmp;
73
74 tmp = en ? reg->enable : reg->disable;
75 mask = GENMASK(reg->bitend, reg->bitstart);
76 val = (tmp << reg->bitstart) | (mask << BIT_WRITEABLE_SHIFT);
77
78 return writel(val, reg_base + reg->offset);
79}
80
Xavier Drudis Ferran1ef47772023-06-05 17:06:57 +020081static inline bool property_enabled(void *reg_base,
82 const struct usb2phy_reg *reg)
83{
84 unsigned int tmp, orig;
85 unsigned int mask = GENMASK(reg->bitend, reg->bitstart);
86
87 orig = readl(reg_base + reg->offset);
88
89 tmp = (orig & mask) >> reg->bitstart;
90 return tmp != reg->disable;
91}
92
Jagan Teki70e882f2020-05-26 11:33:44 +080093static const
94struct rockchip_usb2phy_port_cfg *us2phy_get_port(struct phy *phy)
95{
96 struct udevice *parent = dev_get_parent(phy->dev);
97 struct rockchip_usb2phy *priv = dev_get_priv(parent);
98 const struct rockchip_usb2phy_cfg *phy_cfg = priv->phy_cfg;
99
100 return &phy_cfg->port_cfgs[phy->id];
101}
102
103static int rockchip_usb2phy_power_on(struct phy *phy)
104{
105 struct udevice *parent = dev_get_parent(phy->dev);
106 struct rockchip_usb2phy *priv = dev_get_priv(parent);
107 const struct rockchip_usb2phy_port_cfg *port_cfg = us2phy_get_port(phy);
108
109 property_enable(priv->reg_base, &port_cfg->phy_sus, false);
110
111 /* waiting for the utmi_clk to become stable */
112 usleep_range(1500, 2000);
113
114 return 0;
115}
116
117static int rockchip_usb2phy_power_off(struct phy *phy)
118{
119 struct udevice *parent = dev_get_parent(phy->dev);
120 struct rockchip_usb2phy *priv = dev_get_priv(parent);
121 const struct rockchip_usb2phy_port_cfg *port_cfg = us2phy_get_port(phy);
122
123 property_enable(priv->reg_base, &port_cfg->phy_sus, true);
124
125 return 0;
126}
127
128static int rockchip_usb2phy_init(struct phy *phy)
129{
130 struct udevice *parent = dev_get_parent(phy->dev);
131 struct rockchip_usb2phy *priv = dev_get_priv(parent);
132 const struct rockchip_usb2phy_port_cfg *port_cfg = us2phy_get_port(phy);
133 int ret;
134
135 ret = clk_enable(&priv->phyclk);
John Keeping86cd8342022-12-06 12:48:55 +0000136 if (ret && ret != -ENOSYS) {
Jagan Teki70e882f2020-05-26 11:33:44 +0800137 dev_err(phy->dev, "failed to enable phyclk (ret=%d)\n", ret);
138 return ret;
139 }
140
141 if (phy->id == USB2PHY_PORT_OTG) {
142 property_enable(priv->reg_base, &port_cfg->bvalid_det_clr, true);
143 property_enable(priv->reg_base, &port_cfg->bvalid_det_en, true);
144 } else if (phy->id == USB2PHY_PORT_HOST) {
145 property_enable(priv->reg_base, &port_cfg->bvalid_det_clr, true);
146 property_enable(priv->reg_base, &port_cfg->bvalid_det_en, true);
147 }
148
149 return 0;
150}
151
152static int rockchip_usb2phy_exit(struct phy *phy)
153{
154 struct udevice *parent = dev_get_parent(phy->dev);
155 struct rockchip_usb2phy *priv = dev_get_priv(parent);
156
157 clk_disable(&priv->phyclk);
158
159 return 0;
160}
161
162static int rockchip_usb2phy_of_xlate(struct phy *phy,
163 struct ofnode_phandle_args *args)
164{
165 const char *name = phy->dev->name;
166
167 if (!strcasecmp(name, "host-port"))
168 phy->id = USB2PHY_PORT_HOST;
169 else if (!strcasecmp(name, "otg-port"))
170 phy->id = USB2PHY_PORT_OTG;
171 else
172 dev_err(phy->dev, "improper %s device\n", name);
173
174 return 0;
175}
176
177static struct phy_ops rockchip_usb2phy_ops = {
178 .init = rockchip_usb2phy_init,
179 .exit = rockchip_usb2phy_exit,
180 .power_on = rockchip_usb2phy_power_on,
181 .power_off = rockchip_usb2phy_power_off,
182 .of_xlate = rockchip_usb2phy_of_xlate,
183};
184
Xavier Drudis Ferran1ef47772023-06-05 17:06:57 +0200185/**
186 * round_rate() - Adjust a rate to the exact rate a clock can provide.
187 * @clk: The clock to manipulate.
188 * @rate: Desidered clock rate in Hz.
189 *
190 * Return: rounded rate in Hz, or -ve error code.
191 */
192ulong rockchip_usb2phy_clk_round_rate(struct clk *clk, ulong rate)
193{
194 return 480000000;
195}
196
197/**
198 * enable() - Enable a clock.
199 * @clk: The clock to manipulate.
200 *
201 * Return: zero on success, or -ve error code.
202 */
203int rockchip_usb2phy_clk_enable(struct clk *clk)
204{
205 struct udevice *parent = dev_get_parent(clk->dev);
206 struct rockchip_usb2phy *priv = dev_get_priv(parent);
207 const struct rockchip_usb2phy_cfg *phy_cfg = priv->phy_cfg;
208
209 /* turn on 480m clk output if it is off */
210 if (!property_enabled(priv->reg_base, &phy_cfg->clkout_ctl)) {
211 property_enable(priv->reg_base, &phy_cfg->clkout_ctl, true);
212
213 /* waiting for the clk become stable */
214 usleep_range(1200, 1300);
215 }
216
217 return 0;
218}
219
220/**
221 * disable() - Disable a clock.
222 * @clk: The clock to manipulate.
223 *
224 * Return: zero on success, or -ve error code.
225 */
226int rockchip_usb2phy_clk_disable(struct clk *clk)
227{
228 struct udevice *parent = dev_get_parent(clk->dev);
229 struct rockchip_usb2phy *priv = dev_get_priv(parent);
230 const struct rockchip_usb2phy_cfg *phy_cfg = priv->phy_cfg;
231
232 /* turn off 480m clk output */
233 property_enable(priv->reg_base, &phy_cfg->clkout_ctl, false);
234
235 return 0;
236}
237
Xavier Drudis Ferranc3dd0612023-06-05 17:05:53 +0200238static struct clk_ops rockchip_usb2phy_clk_ops = {
Xavier Drudis Ferran1ef47772023-06-05 17:06:57 +0200239 .enable = rockchip_usb2phy_clk_enable,
240 .disable = rockchip_usb2phy_clk_disable,
241 .round_rate = rockchip_usb2phy_clk_round_rate
Xavier Drudis Ferranc3dd0612023-06-05 17:05:53 +0200242};
243
Jagan Teki70e882f2020-05-26 11:33:44 +0800244static int rockchip_usb2phy_probe(struct udevice *dev)
245{
246 struct rockchip_usb2phy *priv = dev_get_priv(dev);
247 const struct rockchip_usb2phy_cfg *phy_cfgs;
248 unsigned int reg;
249 int index, ret;
250
251 priv->reg_base = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
252 if (IS_ERR(priv->reg_base))
253 return PTR_ERR(priv->reg_base);
254
Jagan Teki1b799512023-02-17 17:28:39 +0530255 ret = ofnode_read_u32_index(dev_ofnode(dev), "reg", 0, &reg);
Jagan Teki70e882f2020-05-26 11:33:44 +0800256 if (ret) {
257 dev_err(dev, "failed to read reg property (ret = %d)\n", ret);
258 return ret;
259 }
260
Jagan Teki1b799512023-02-17 17:28:39 +0530261 /* support address_cells=2 */
Eugen Hristev27125162023-05-22 11:39:58 +0300262 if (dev_read_addr_cells(dev) == 2 && reg == 0) {
Jagan Teki1b799512023-02-17 17:28:39 +0530263 if (ofnode_read_u32_index(dev_ofnode(dev), "reg", 1, &reg)) {
264 dev_err(dev, "%s must have reg[1]\n",
265 ofnode_get_name(dev_ofnode(dev)));
266 return -EINVAL;
267 }
268 }
269
Jagan Teki70e882f2020-05-26 11:33:44 +0800270 phy_cfgs = (const struct rockchip_usb2phy_cfg *)
271 dev_get_driver_data(dev);
272 if (!phy_cfgs)
273 return -EINVAL;
274
275 /* find out a proper config which can be matched with dt. */
276 index = 0;
Eugen Hristev33642262023-05-15 12:59:49 +0300277 do {
Jagan Teki70e882f2020-05-26 11:33:44 +0800278 if (phy_cfgs[index].reg == reg) {
279 priv->phy_cfg = &phy_cfgs[index];
280 break;
281 }
282
283 ++index;
Eugen Hristev33642262023-05-15 12:59:49 +0300284 } while (phy_cfgs[index].reg);
Jagan Teki70e882f2020-05-26 11:33:44 +0800285
286 if (!priv->phy_cfg) {
287 dev_err(dev, "failed find proper phy-cfg\n");
288 return -EINVAL;
289 }
290
291 ret = clk_get_by_name(dev, "phyclk", &priv->phyclk);
292 if (ret) {
293 dev_err(dev, "failed to get the phyclk (ret=%d)\n", ret);
294 return ret;
295 }
296
297 return 0;
298}
299
300static int rockchip_usb2phy_bind(struct udevice *dev)
301{
302 struct udevice *usb2phy_dev;
303 ofnode node;
304 const char *name;
305 int ret = 0;
306
307 dev_for_each_subnode(node, dev) {
308 if (!ofnode_valid(node)) {
309 dev_info(dev, "subnode %s not found\n", dev->name);
Xavier Drudis Ferranc3dd0612023-06-05 17:05:53 +0200310 ret = -ENXIO;
311 goto bind_fail;
Jagan Teki70e882f2020-05-26 11:33:44 +0800312 }
313
314 name = ofnode_get_name(node);
315 dev_dbg(dev, "subnode %s\n", name);
316
317 ret = device_bind_driver_to_node(dev, "rockchip_usb2phy_port",
318 name, node, &usb2phy_dev);
319 if (ret) {
320 dev_err(dev,
321 "'%s' cannot bind 'rockchip_usb2phy_port'\n", name);
Xavier Drudis Ferranc3dd0612023-06-05 17:05:53 +0200322 goto bind_fail;
Jagan Teki70e882f2020-05-26 11:33:44 +0800323 }
324 }
325
Xavier Drudis Ferranc3dd0612023-06-05 17:05:53 +0200326 node = dev_ofnode(dev);
Xavier Drudis Ferran1ef47772023-06-05 17:06:57 +0200327 name = "clk_usbphy_480m";
328 dev_read_string_index(dev, "clock-output-names", 0, &name);
329
330 dev_dbg(dev, "clk %s for node %s\n", name, ofnode_get_name(node));
331
Xavier Drudis Ferranc3dd0612023-06-05 17:05:53 +0200332 ret = device_bind_driver_to_node(dev, "rockchip_usb2phy_clock",
333 name, node, &usb2phy_dev);
334 if (ret) {
335 dev_err(dev,
336 "'%s' cannot bind 'rockchip_usb2phy_clock'\n", name);
337 goto bind_fail;
338 }
339
340 return 0;
341
342bind_fail:
343 device_chld_unbind(dev, NULL);
344
Jagan Teki70e882f2020-05-26 11:33:44 +0800345 return ret;
346}
347
Jagan Teki0f514e62023-06-06 22:39:16 +0530348static const struct rockchip_usb2phy_cfg rk3328_usb2phy_cfgs[] = {
349 {
350 .reg = 0x100,
351 .clkout_ctl = { 0x108, 4, 4, 1, 0 },
352 .port_cfgs = {
353 [USB2PHY_PORT_OTG] = {
354 .phy_sus = { 0x0100, 15, 0, 0, 0x1d1 },
355 .bvalid_det_en = { 0x0110, 3, 2, 0, 3 },
356 .bvalid_det_st = { 0x0114, 3, 2, 0, 3 },
357 .bvalid_det_clr = { 0x0118, 3, 2, 0, 3 },
358 .ls_det_en = { 0x0110, 0, 0, 0, 1 },
359 .ls_det_st = { 0x0114, 0, 0, 0, 1 },
360 .ls_det_clr = { 0x0118, 0, 0, 0, 1 },
361 .utmi_avalid = { 0x0120, 10, 10, 0, 1 },
362 .utmi_bvalid = { 0x0120, 9, 9, 0, 1 },
363 .utmi_ls = { 0x0120, 5, 4, 0, 1 },
364 },
365 [USB2PHY_PORT_HOST] = {
366 .phy_sus = { 0x104, 15, 0, 0, 0x1d1 },
367 .ls_det_en = { 0x110, 1, 1, 0, 1 },
368 .ls_det_st = { 0x114, 1, 1, 0, 1 },
369 .ls_det_clr = { 0x118, 1, 1, 0, 1 },
370 .utmi_ls = { 0x120, 17, 16, 0, 1 },
371 .utmi_hstdet = { 0x120, 19, 19, 0, 1 }
372 }
373 },
374 },
375 { /* sentinel */ }
376};
377
Jagan Teki70e882f2020-05-26 11:33:44 +0800378static const struct rockchip_usb2phy_cfg rk3399_usb2phy_cfgs[] = {
379 {
380 .reg = 0xe450,
Xavier Drudis Ferran1ef47772023-06-05 17:06:57 +0200381 .clkout_ctl = { 0xe450, 4, 4, 1, 0 },
Jagan Teki70e882f2020-05-26 11:33:44 +0800382 .port_cfgs = {
383 [USB2PHY_PORT_OTG] = {
384 .phy_sus = { 0xe454, 1, 0, 2, 1 },
385 .bvalid_det_en = { 0xe3c0, 3, 3, 0, 1 },
386 .bvalid_det_st = { 0xe3e0, 3, 3, 0, 1 },
387 .bvalid_det_clr = { 0xe3d0, 3, 3, 0, 1 },
388 .utmi_avalid = { 0xe2ac, 7, 7, 0, 1 },
389 .utmi_bvalid = { 0xe2ac, 12, 12, 0, 1 },
390 },
391 [USB2PHY_PORT_HOST] = {
392 .phy_sus = { 0xe458, 1, 0, 0x2, 0x1 },
393 .ls_det_en = { 0xe3c0, 6, 6, 0, 1 },
394 .ls_det_st = { 0xe3e0, 6, 6, 0, 1 },
395 .ls_det_clr = { 0xe3d0, 6, 6, 0, 1 },
396 .utmi_ls = { 0xe2ac, 22, 21, 0, 1 },
397 .utmi_hstdet = { 0xe2ac, 23, 23, 0, 1 }
398 }
399 },
400 },
401 {
402 .reg = 0xe460,
Xavier Drudis Ferran1ef47772023-06-05 17:06:57 +0200403 .clkout_ctl = { 0xe460, 4, 4, 1, 0 },
Jagan Teki70e882f2020-05-26 11:33:44 +0800404 .port_cfgs = {
405 [USB2PHY_PORT_OTG] = {
406 .phy_sus = { 0xe464, 1, 0, 2, 1 },
407 .bvalid_det_en = { 0xe3c0, 8, 8, 0, 1 },
408 .bvalid_det_st = { 0xe3e0, 8, 8, 0, 1 },
409 .bvalid_det_clr = { 0xe3d0, 8, 8, 0, 1 },
410 .utmi_avalid = { 0xe2ac, 10, 10, 0, 1 },
411 .utmi_bvalid = { 0xe2ac, 16, 16, 0, 1 },
412 },
413 [USB2PHY_PORT_HOST] = {
414 .phy_sus = { 0xe468, 1, 0, 0x2, 0x1 },
415 .ls_det_en = { 0xe3c0, 11, 11, 0, 1 },
416 .ls_det_st = { 0xe3e0, 11, 11, 0, 1 },
417 .ls_det_clr = { 0xe3d0, 11, 11, 0, 1 },
418 .utmi_ls = { 0xe2ac, 26, 25, 0, 1 },
419 .utmi_hstdet = { 0xe2ac, 27, 27, 0, 1 }
420 }
421 },
422 },
423 { /* sentinel */ }
424};
425
Manoj Sai3a111672023-02-17 17:28:40 +0530426static const struct rockchip_usb2phy_cfg rk3568_phy_cfgs[] = {
427 {
428 .reg = 0xfe8a0000,
Xavier Drudis Ferran1ef47772023-06-05 17:06:57 +0200429 .clkout_ctl = { 0x0008, 4, 4, 1, 0 },
Manoj Sai3a111672023-02-17 17:28:40 +0530430 .port_cfgs = {
431 [USB2PHY_PORT_OTG] = {
432 .phy_sus = { 0x0000, 8, 0, 0x052, 0x1d1 },
433 .bvalid_det_en = { 0x0080, 2, 2, 0, 1 },
434 .bvalid_det_st = { 0x0084, 2, 2, 0, 1 },
435 .bvalid_det_clr = { 0x0088, 2, 2, 0, 1 },
436 .ls_det_en = { 0x0080, 0, 0, 0, 1 },
437 .ls_det_st = { 0x0084, 0, 0, 0, 1 },
438 .ls_det_clr = { 0x0088, 0, 0, 0, 1 },
439 .utmi_avalid = { 0x00c0, 10, 10, 0, 1 },
440 .utmi_bvalid = { 0x00c0, 9, 9, 0, 1 },
441 .utmi_ls = { 0x00c0, 5, 4, 0, 1 },
442 },
443 [USB2PHY_PORT_HOST] = {
444 .phy_sus = { 0x0004, 8, 0, 0x1d2, 0x1d1 },
445 .ls_det_en = { 0x0080, 1, 1, 0, 1 },
446 .ls_det_st = { 0x0084, 1, 1, 0, 1 },
447 .ls_det_clr = { 0x0088, 1, 1, 0, 1 },
448 .utmi_ls = { 0x00c0, 17, 16, 0, 1 },
449 .utmi_hstdet = { 0x00c0, 19, 19, 0, 1 }
450 }
451 },
452 },
453 {
454 .reg = 0xfe8b0000,
Xavier Drudis Ferran1ef47772023-06-05 17:06:57 +0200455 .clkout_ctl = { 0x0008, 4, 4, 1, 0 },
Manoj Sai3a111672023-02-17 17:28:40 +0530456 .port_cfgs = {
457 [USB2PHY_PORT_OTG] = {
458 .phy_sus = { 0x0000, 8, 0, 0x1d2, 0x1d1 },
459 .ls_det_en = { 0x0080, 0, 0, 0, 1 },
460 .ls_det_st = { 0x0084, 0, 0, 0, 1 },
461 .ls_det_clr = { 0x0088, 0, 0, 0, 1 },
462 .utmi_ls = { 0x00c0, 5, 4, 0, 1 },
463 .utmi_hstdet = { 0x00c0, 7, 7, 0, 1 }
464 },
465 [USB2PHY_PORT_HOST] = {
466 .phy_sus = { 0x0004, 8, 0, 0x1d2, 0x1d1 },
467 .ls_det_en = { 0x0080, 1, 1, 0, 1 },
468 .ls_det_st = { 0x0084, 1, 1, 0, 1 },
469 .ls_det_clr = { 0x0088, 1, 1, 0, 1 },
470 .utmi_ls = { 0x00c0, 17, 16, 0, 1 },
471 .utmi_hstdet = { 0x00c0, 19, 19, 0, 1 }
472 }
473 },
474 },
Eugen Hristev33642262023-05-15 12:59:49 +0300475 { /* sentinel */ }
476};
477
478static const struct rockchip_usb2phy_cfg rk3588_phy_cfgs[] = {
479 {
480 .reg = 0x0000,
481 .port_cfgs = {
482 [USB2PHY_PORT_OTG] = {
483 .phy_sus = { 0x000c, 11, 11, 0, 1 },
484 .ls_det_en = { 0x0080, 0, 0, 0, 1 },
485 .ls_det_st = { 0x0084, 0, 0, 0, 1 },
486 .ls_det_clr = { 0x0088, 0, 0, 0, 1 },
487 .utmi_ls = { 0x00c0, 10, 9, 0, 1 },
488 }
489 },
490 },
491 {
492 .reg = 0x4000,
493 .port_cfgs = {
494 [USB2PHY_PORT_OTG] = {
495 .phy_sus = { 0x000c, 11, 11, 0, 0 },
496 .ls_det_en = { 0x0080, 0, 0, 0, 1 },
497 .ls_det_st = { 0x0084, 0, 0, 0, 1 },
498 .ls_det_clr = { 0x0088, 0, 0, 0, 1 },
499 .utmi_ls = { 0x00c0, 10, 9, 0, 1 },
500 }
501 },
502 },
503 {
504 .reg = 0x8000,
505 .port_cfgs = {
506 [USB2PHY_PORT_HOST] = {
507 .phy_sus = { 0x0008, 2, 2, 0, 1 },
508 .ls_det_en = { 0x0080, 0, 0, 0, 1 },
509 .ls_det_st = { 0x0084, 0, 0, 0, 1 },
510 .ls_det_clr = { 0x0088, 0, 0, 0, 1 },
511 .utmi_ls = { 0x00c0, 10, 9, 0, 1 },
512 }
513 },
514 },
515 {
516 .reg = 0xc000,
517 .port_cfgs = {
518 [USB2PHY_PORT_HOST] = {
519 .phy_sus = { 0x0008, 2, 2, 0, 1 },
520 .ls_det_en = { 0x0080, 0, 0, 0, 1 },
521 .ls_det_st = { 0x0084, 0, 0, 0, 1 },
522 .ls_det_clr = { 0x0088, 0, 0, 0, 1 },
523 .utmi_ls = { 0x00c0, 10, 9, 0, 1 },
524 }
525 },
526 },
Manoj Sai3a111672023-02-17 17:28:40 +0530527 { /* sentinel */ }
528};
529
Jagan Teki70e882f2020-05-26 11:33:44 +0800530static const struct udevice_id rockchip_usb2phy_ids[] = {
531 {
Jagan Teki0f514e62023-06-06 22:39:16 +0530532 .compatible = "rockchip,rk3328-usb2phy",
533 .data = (ulong)&rk3328_usb2phy_cfgs,
534 },
535 {
Jagan Teki70e882f2020-05-26 11:33:44 +0800536 .compatible = "rockchip,rk3399-usb2phy",
537 .data = (ulong)&rk3399_usb2phy_cfgs,
538 },
Manoj Sai3a111672023-02-17 17:28:40 +0530539 {
540 .compatible = "rockchip,rk3568-usb2phy",
541 .data = (ulong)&rk3568_phy_cfgs,
542 },
Eugen Hristev33642262023-05-15 12:59:49 +0300543 {
544 .compatible = "rockchip,rk3588-usb2phy",
545 .data = (ulong)&rk3588_phy_cfgs,
546 },
Jagan Teki70e882f2020-05-26 11:33:44 +0800547 { /* sentinel */ }
548};
549
550U_BOOT_DRIVER(rockchip_usb2phy_port) = {
551 .name = "rockchip_usb2phy_port",
552 .id = UCLASS_PHY,
553 .ops = &rockchip_usb2phy_ops,
554};
555
Xavier Drudis Ferranc3dd0612023-06-05 17:05:53 +0200556U_BOOT_DRIVER(rockchip_usb2phy_clock) = {
557 .name = "rockchip_usb2phy_clock",
558 .id = UCLASS_CLK,
559 .ops = &rockchip_usb2phy_clk_ops,
560};
561
Jagan Teki70e882f2020-05-26 11:33:44 +0800562U_BOOT_DRIVER(rockchip_usb2phy) = {
563 .name = "rockchip_usb2phy",
564 .id = UCLASS_PHY,
565 .of_match = rockchip_usb2phy_ids,
566 .probe = rockchip_usb2phy_probe,
567 .bind = rockchip_usb2phy_bind,
Simon Glass8a2b47f2020-12-03 16:55:17 -0700568 .priv_auto = sizeof(struct rockchip_usb2phy),
Jagan Teki70e882f2020-05-26 11:33:44 +0800569};