blob: 55c19f335ae12b8d9f83d1cb2a10e2ffc13cf935 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Simon Glasscfdae5c2017-05-18 20:09:04 -06002/*
3 * Copyright (c) 2017 Google, Inc
4 * Written by Simon Glass <sjg@chromium.org>
Simon Glasscfdae5c2017-05-18 20:09:04 -06005 */
6
Simon Glasscfdae5c2017-05-18 20:09:04 -06007#include <dm.h>
8#include <dm/of_access.h>
Stefan Roesea8c43062020-04-29 09:08:44 +02009#include <mapmem.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060010#include <asm/global_data.h>
Stefan Roesea8c43062020-04-29 09:08:44 +020011#include <asm/types.h>
12#include <asm/io.h>
Stefan Roese0a9ecc52020-08-05 13:56:11 +020013#include <linux/ioport.h>
Simon Glasscfdae5c2017-05-18 20:09:04 -060014
Stefan Herbrechtsmeier1b090e62022-06-14 15:21:30 +020015int dev_read_u8(const struct udevice *dev, const char *propname, u8 *outp)
16{
17 return ofnode_read_u8(dev_ofnode(dev), propname, outp);
18}
19
20u8 dev_read_u8_default(const struct udevice *dev, const char *propname, u8 def)
21{
22 return ofnode_read_u8_default(dev_ofnode(dev), propname, def);
23}
24
25int dev_read_u16(const struct udevice *dev, const char *propname, u16 *outp)
26{
27 return ofnode_read_u16(dev_ofnode(dev), propname, outp);
28}
29
30u16 dev_read_u16_default(const struct udevice *dev, const char *propname,
31 u16 def)
32{
33 return ofnode_read_u16_default(dev_ofnode(dev), propname, def);
34}
35
Simon Glass2f9a6122020-01-27 08:49:40 -070036int dev_read_u32(const struct udevice *dev, const char *propname, u32 *outp)
Masahiro Yamada71d115f2017-12-30 02:00:05 +090037{
38 return ofnode_read_u32(dev_ofnode(dev), propname, outp);
39}
40
Simon Glass2f9a6122020-01-27 08:49:40 -070041int dev_read_u32_default(const struct udevice *dev, const char *propname,
42 int def)
Simon Glasscfdae5c2017-05-18 20:09:04 -060043{
44 return ofnode_read_u32_default(dev_ofnode(dev), propname, def);
45}
46
Dario Binacchi81d80b52020-03-29 18:04:41 +020047int dev_read_u32_index(struct udevice *dev, const char *propname, int index,
48 u32 *outp)
49{
50 return ofnode_read_u32_index(dev_ofnode(dev), propname, index, outp);
51}
52
53u32 dev_read_u32_index_default(struct udevice *dev, const char *propname,
54 int index, u32 def)
55{
56 return ofnode_read_u32_index_default(dev_ofnode(dev), propname, index,
57 def);
58}
59
Simon Glass2f9a6122020-01-27 08:49:40 -070060int dev_read_s32(const struct udevice *dev, const char *propname, s32 *outp)
Simon Glass6df01f92018-12-10 10:37:37 -070061{
62 return ofnode_read_u32(dev_ofnode(dev), propname, (u32 *)outp);
63}
64
Simon Glass2f9a6122020-01-27 08:49:40 -070065int dev_read_s32_default(const struct udevice *dev, const char *propname,
66 int def)
Simon Glass6df01f92018-12-10 10:37:37 -070067{
68 return ofnode_read_u32_default(dev_ofnode(dev), propname, def);
69}
70
Simon Glass2f9a6122020-01-27 08:49:40 -070071int dev_read_u32u(const struct udevice *dev, const char *propname, uint *outp)
Simon Glass6df01f92018-12-10 10:37:37 -070072{
73 u32 val;
74 int ret;
75
76 ret = ofnode_read_u32(dev_ofnode(dev), propname, &val);
77 if (ret)
78 return ret;
79 *outp = val;
80
81 return 0;
82}
83
Simon Glass2f9a6122020-01-27 08:49:40 -070084int dev_read_u64(const struct udevice *dev, const char *propname, u64 *outp)
T Karthik Reddy478860d2019-09-02 16:34:30 +020085{
86 return ofnode_read_u64(dev_ofnode(dev), propname, outp);
87}
88
Simon Glass2f9a6122020-01-27 08:49:40 -070089u64 dev_read_u64_default(const struct udevice *dev, const char *propname,
90 u64 def)
T Karthik Reddy478860d2019-09-02 16:34:30 +020091{
92 return ofnode_read_u64_default(dev_ofnode(dev), propname, def);
93}
94
Simon Glass2f9a6122020-01-27 08:49:40 -070095const char *dev_read_string(const struct udevice *dev, const char *propname)
Simon Glasscfdae5c2017-05-18 20:09:04 -060096{
97 return ofnode_read_string(dev_ofnode(dev), propname);
98}
99
Simon Glass2f9a6122020-01-27 08:49:40 -0700100bool dev_read_bool(const struct udevice *dev, const char *propname)
Simon Glasscfdae5c2017-05-18 20:09:04 -0600101{
102 return ofnode_read_bool(dev_ofnode(dev), propname);
103}
104
Simon Glass2f9a6122020-01-27 08:49:40 -0700105ofnode dev_read_subnode(const struct udevice *dev, const char *subnode_name)
Simon Glasscfdae5c2017-05-18 20:09:04 -0600106{
107 return ofnode_find_subnode(dev_ofnode(dev), subnode_name);
108}
109
Simon Glass2f9a6122020-01-27 08:49:40 -0700110ofnode dev_read_first_subnode(const struct udevice *dev)
Simon Glasscfdae5c2017-05-18 20:09:04 -0600111{
112 return ofnode_first_subnode(dev_ofnode(dev));
113}
114
115ofnode dev_read_next_subnode(ofnode node)
116{
117 return ofnode_next_subnode(node);
118}
119
Simon Glass2f9a6122020-01-27 08:49:40 -0700120int dev_read_size(const struct udevice *dev, const char *propname)
Simon Glasscfdae5c2017-05-18 20:09:04 -0600121{
122 return ofnode_read_size(dev_ofnode(dev), propname);
123}
124
Simon Glass2f9a6122020-01-27 08:49:40 -0700125fdt_addr_t dev_read_addr_index(const struct udevice *dev, int index)
Simon Glasscfdae5c2017-05-18 20:09:04 -0600126{
127 if (ofnode_is_np(dev_ofnode(dev)))
128 return ofnode_get_addr_index(dev_ofnode(dev), index);
129 else
130 return devfdt_get_addr_index(dev, index);
131}
132
Johan Jonker54ab0442023-03-13 01:31:25 +0100133void *dev_read_addr_index_ptr(const struct udevice *dev, int index)
134{
135 fdt_addr_t addr = dev_read_addr_index(dev, index);
136
137 if (addr == FDT_ADDR_T_NONE)
138 return NULL;
139
140 return map_sysmem(addr, 0);
141}
142
Simon Glass2f9a6122020-01-27 08:49:40 -0700143fdt_addr_t dev_read_addr_size_index(const struct udevice *dev, int index,
Sekhar Norif677c6f2019-08-01 19:12:56 +0530144 fdt_size_t *size)
145{
146 if (ofnode_is_np(dev_ofnode(dev)))
147 return ofnode_get_addr_size_index(dev_ofnode(dev), index, size);
148 else
149 return devfdt_get_addr_size_index(dev, index, size);
150}
151
Jonas Karlman3b007302023-07-22 13:30:15 +0000152void *dev_read_addr_size_index_ptr(const struct udevice *dev, int index,
153 fdt_size_t *size)
154{
155 fdt_addr_t addr = dev_read_addr_size_index(dev, index, size);
156
157 if (addr == FDT_ADDR_T_NONE)
158 return NULL;
159
160 return map_sysmem(addr, 0);
161}
162
Simon Glass2f9a6122020-01-27 08:49:40 -0700163void *dev_remap_addr_index(const struct udevice *dev, int index)
Álvaro Fernández Rojas670361292018-04-29 21:56:54 +0200164{
165 fdt_addr_t addr = dev_read_addr_index(dev, index);
166
167 if (addr == FDT_ADDR_T_NONE)
168 return NULL;
169
170 return map_physmem(addr, 0, MAP_NOCACHE);
171}
172
Simon Glass2f9a6122020-01-27 08:49:40 -0700173fdt_addr_t dev_read_addr_name(const struct udevice *dev, const char *name)
Álvaro Fernández Rojasa3181152018-12-03 19:37:09 +0100174{
175 int index = dev_read_stringlist_search(dev, "reg-names", name);
176
177 if (index < 0)
178 return FDT_ADDR_T_NONE;
179 else
180 return dev_read_addr_index(dev, index);
181}
182
Matthias Schiffer5e90d4e2023-09-27 15:33:32 +0200183void *dev_read_addr_name_ptr(const struct udevice *dev, const char *name)
184{
185 fdt_addr_t addr = dev_read_addr_name(dev, name);
186
187 if (addr == FDT_ADDR_T_NONE)
188 return NULL;
189
190 return map_sysmem(addr, 0);
191}
192
Simon Glass2f9a6122020-01-27 08:49:40 -0700193fdt_addr_t dev_read_addr_size_name(const struct udevice *dev, const char *name,
Sekhar Norif677c6f2019-08-01 19:12:56 +0530194 fdt_size_t *size)
195{
196 int index = dev_read_stringlist_search(dev, "reg-names", name);
197
198 if (index < 0)
199 return FDT_ADDR_T_NONE;
200 else
201 return dev_read_addr_size_index(dev, index, size);
202}
203
Matthias Schiffer5e90d4e2023-09-27 15:33:32 +0200204void *dev_read_addr_size_name_ptr(const struct udevice *dev, const char *name,
205 fdt_size_t *size)
206{
207 fdt_addr_t addr = dev_read_addr_size_name(dev, name, size);
208
209 if (addr == FDT_ADDR_T_NONE)
210 return NULL;
211
212 return map_sysmem(addr, 0);
213}
214
Simon Glass2f9a6122020-01-27 08:49:40 -0700215void *dev_remap_addr_name(const struct udevice *dev, const char *name)
Álvaro Fernández Rojasa3181152018-12-03 19:37:09 +0100216{
217 fdt_addr_t addr = dev_read_addr_name(dev, name);
218
219 if (addr == FDT_ADDR_T_NONE)
220 return NULL;
221
222 return map_physmem(addr, 0, MAP_NOCACHE);
223}
224
Simon Glass2f9a6122020-01-27 08:49:40 -0700225fdt_addr_t dev_read_addr(const struct udevice *dev)
Simon Glasscfdae5c2017-05-18 20:09:04 -0600226{
227 return dev_read_addr_index(dev, 0);
228}
229
Simon Glass2f9a6122020-01-27 08:49:40 -0700230void *dev_read_addr_ptr(const struct udevice *dev)
Philipp Tomsich7719b392017-09-11 22:04:12 +0200231{
232 fdt_addr_t addr = dev_read_addr(dev);
233
Johan Jonker54ab0442023-03-13 01:31:25 +0100234 if (addr == FDT_ADDR_T_NONE)
235 return NULL;
236
237 return map_sysmem(addr, 0);
Philipp Tomsich7719b392017-09-11 22:04:12 +0200238}
239
Simon Glass2f9a6122020-01-27 08:49:40 -0700240void *dev_remap_addr(const struct udevice *dev)
Álvaro Fernández Rojas670361292018-04-29 21:56:54 +0200241{
242 return dev_remap_addr_index(dev, 0);
243}
244
John Keepingab62d0b2023-06-01 15:11:19 +0100245fdt_addr_t dev_read_addr_size(const struct udevice *dev, fdt_size_t *sizep)
Simon Glasscfdae5c2017-05-18 20:09:04 -0600246{
John Keepingab62d0b2023-06-01 15:11:19 +0100247 return dev_read_addr_size_index(dev, 0, sizep);
Simon Glasscfdae5c2017-05-18 20:09:04 -0600248}
249
Simon Glass2f9a6122020-01-27 08:49:40 -0700250const char *dev_read_name(const struct udevice *dev)
Simon Glasscfdae5c2017-05-18 20:09:04 -0600251{
252 return ofnode_get_name(dev_ofnode(dev));
253}
254
Simon Glass2f9a6122020-01-27 08:49:40 -0700255int dev_read_stringlist_search(const struct udevice *dev, const char *property,
Mario Six6eac2222018-01-15 11:07:18 +0100256 const char *string)
Simon Glasscfdae5c2017-05-18 20:09:04 -0600257{
258 return ofnode_stringlist_search(dev_ofnode(dev), property, string);
259}
260
Simon Glass2f9a6122020-01-27 08:49:40 -0700261int dev_read_string_index(const struct udevice *dev, const char *propname,
262 int index, const char **outp)
Jean-Jacques Hiblot8365ebd2017-09-21 17:03:09 +0200263{
264 return ofnode_read_string_index(dev_ofnode(dev), propname, index, outp);
265}
266
Simon Glass2f9a6122020-01-27 08:49:40 -0700267int dev_read_string_count(const struct udevice *dev, const char *propname)
Jean-Jacques Hiblot8365ebd2017-09-21 17:03:09 +0200268{
269 return ofnode_read_string_count(dev_ofnode(dev), propname);
270}
271
Simon Glass9580bfc2021-10-23 17:26:07 -0600272int dev_read_string_list(const struct udevice *dev, const char *propname,
273 const char ***listp)
274{
275 return ofnode_read_string_list(dev_ofnode(dev), propname, listp);
276}
277
Simon Glass2f9a6122020-01-27 08:49:40 -0700278int dev_read_phandle_with_args(const struct udevice *dev, const char *list_name,
Mario Six6eac2222018-01-15 11:07:18 +0100279 const char *cells_name, int cell_count,
280 int index, struct ofnode_phandle_args *out_args)
Simon Glasscfdae5c2017-05-18 20:09:04 -0600281{
282 return ofnode_parse_phandle_with_args(dev_ofnode(dev), list_name,
283 cells_name, cell_count, index,
284 out_args);
285}
286
Simon Glass2f9a6122020-01-27 08:49:40 -0700287int dev_count_phandle_with_args(const struct udevice *dev,
Patrick Delaunayd776a842020-09-25 09:41:14 +0200288 const char *list_name, const char *cells_name,
289 int cell_count)
Patrice Chotard99503c12017-11-29 09:06:10 +0100290{
291 return ofnode_count_phandle_with_args(dev_ofnode(dev), list_name,
Patrick Delaunayd776a842020-09-25 09:41:14 +0200292 cells_name, cell_count);
Patrice Chotard99503c12017-11-29 09:06:10 +0100293}
294
Simon Glass2f9a6122020-01-27 08:49:40 -0700295int dev_read_addr_cells(const struct udevice *dev)
Simon Glasscfdae5c2017-05-18 20:09:04 -0600296{
297 return ofnode_read_addr_cells(dev_ofnode(dev));
298}
299
Simon Glass2f9a6122020-01-27 08:49:40 -0700300int dev_read_size_cells(const struct udevice *dev)
Simon Glasscfdae5c2017-05-18 20:09:04 -0600301{
302 return ofnode_read_size_cells(dev_ofnode(dev));
303}
304
Simon Glass2f9a6122020-01-27 08:49:40 -0700305int dev_read_simple_addr_cells(const struct udevice *dev)
Simon Glass4191dc12017-06-12 06:21:31 -0600306{
307 return ofnode_read_simple_addr_cells(dev_ofnode(dev));
308}
309
Simon Glass2f9a6122020-01-27 08:49:40 -0700310int dev_read_simple_size_cells(const struct udevice *dev)
Simon Glass4191dc12017-06-12 06:21:31 -0600311{
312 return ofnode_read_simple_size_cells(dev_ofnode(dev));
313}
314
Simon Glass2f9a6122020-01-27 08:49:40 -0700315int dev_read_phandle(const struct udevice *dev)
Simon Glasscfdae5c2017-05-18 20:09:04 -0600316{
317 ofnode node = dev_ofnode(dev);
318
319 if (ofnode_is_np(node))
320 return ofnode_to_np(node)->phandle;
321 else
322 return fdt_get_phandle(gd->fdt_blob, ofnode_to_offset(node));
323}
324
Simon Glass2f9a6122020-01-27 08:49:40 -0700325const void *dev_read_prop(const struct udevice *dev, const char *propname,
326 int *lenp)
Simon Glasscfdae5c2017-05-18 20:09:04 -0600327{
Masahiro Yamada9cf85cb2017-06-22 16:54:05 +0900328 return ofnode_get_property(dev_ofnode(dev), propname, lenp);
Simon Glasscfdae5c2017-05-18 20:09:04 -0600329}
330
Patrick Delaunaycaee1552020-01-13 11:34:56 +0100331int dev_read_first_prop(const struct udevice *dev, struct ofprop *prop)
332{
Simon Glassfec058d2022-09-06 20:27:13 -0600333 return ofnode_first_property(dev_ofnode(dev), prop);
Patrick Delaunaycaee1552020-01-13 11:34:56 +0100334}
335
336int dev_read_next_prop(struct ofprop *prop)
337{
Simon Glassfec058d2022-09-06 20:27:13 -0600338 return ofnode_next_property(prop);
Patrick Delaunaycaee1552020-01-13 11:34:56 +0100339}
340
341const void *dev_read_prop_by_prop(struct ofprop *prop,
342 const char **propname, int *lenp)
343{
Simon Glassd0aff8b2022-09-06 20:27:14 -0600344 return ofprop_get_property(prop, propname, lenp);
Patrick Delaunaycaee1552020-01-13 11:34:56 +0100345}
346
Simon Glass2f9a6122020-01-27 08:49:40 -0700347int dev_read_alias_seq(const struct udevice *dev, int *devnump)
Simon Glasscfdae5c2017-05-18 20:09:04 -0600348{
349 ofnode node = dev_ofnode(dev);
350 const char *uc_name = dev->uclass->uc_drv->name;
Marcel Ziswiler65c2bf62019-05-20 02:44:57 +0200351 int ret = -ENOTSUPP;
Simon Glasscfdae5c2017-05-18 20:09:04 -0600352
353 if (ofnode_is_np(node)) {
354 ret = of_alias_get_id(ofnode_to_np(node), uc_name);
Simon Glassa2b58552020-12-16 21:20:12 -0700355 if (ret >= 0) {
Simon Glasscfdae5c2017-05-18 20:09:04 -0600356 *devnump = ret;
Simon Glassa2b58552020-12-16 21:20:12 -0700357 ret = 0;
358 }
Simon Glasscfdae5c2017-05-18 20:09:04 -0600359 } else {
Marcel Ziswiler65c2bf62019-05-20 02:44:57 +0200360#if CONFIG_IS_ENABLED(OF_CONTROL)
Simon Glasscfdae5c2017-05-18 20:09:04 -0600361 ret = fdtdec_get_alias_seq(gd->fdt_blob, uc_name,
362 ofnode_to_offset(node), devnump);
Marcel Ziswiler65c2bf62019-05-20 02:44:57 +0200363#endif
Simon Glasscfdae5c2017-05-18 20:09:04 -0600364 }
365
366 return ret;
367}
368
Simon Glass2f9a6122020-01-27 08:49:40 -0700369int dev_read_u32_array(const struct udevice *dev, const char *propname,
Simon Glasscfdae5c2017-05-18 20:09:04 -0600370 u32 *out_values, size_t sz)
371{
372 return ofnode_read_u32_array(dev_ofnode(dev), propname, out_values, sz);
373}
374
Simon Glass2f9a6122020-01-27 08:49:40 -0700375const uint8_t *dev_read_u8_array_ptr(const struct udevice *dev,
376 const char *propname, size_t sz)
Simon Glasscfdae5c2017-05-18 20:09:04 -0600377{
378 return ofnode_read_u8_array_ptr(dev_ofnode(dev), propname, sz);
379}
Simon Glassfa031f82017-06-12 06:21:30 -0600380
Simon Glass2f9a6122020-01-27 08:49:40 -0700381int dev_read_enabled(const struct udevice *dev)
Simon Glassfa031f82017-06-12 06:21:30 -0600382{
383 ofnode node = dev_ofnode(dev);
384
385 if (ofnode_is_np(node))
386 return of_device_is_available(ofnode_to_np(node));
387 else
388 return fdtdec_get_is_enabled(gd->fdt_blob,
389 ofnode_to_offset(node));
390}
Simon Glassf7bfcc42017-07-25 08:29:55 -0600391
Simon Glass2f9a6122020-01-27 08:49:40 -0700392int dev_read_resource(const struct udevice *dev, uint index,
393 struct resource *res)
Simon Glassf7bfcc42017-07-25 08:29:55 -0600394{
395 return ofnode_read_resource(dev_ofnode(dev), index, res);
396}
Masahiro Yamada4dada2c2017-08-26 01:12:30 +0900397
Simon Glass2f9a6122020-01-27 08:49:40 -0700398int dev_read_resource_byname(const struct udevice *dev, const char *name,
Masahiro Yamada4dada2c2017-08-26 01:12:30 +0900399 struct resource *res)
400{
401 return ofnode_read_resource_byname(dev_ofnode(dev), name, res);
402}
Mario Sixaefac062018-01-15 11:07:19 +0100403
Simon Glass2f9a6122020-01-27 08:49:40 -0700404u64 dev_translate_address(const struct udevice *dev, const fdt32_t *in_addr)
Mario Sixaefac062018-01-15 11:07:19 +0100405{
406 return ofnode_translate_address(dev_ofnode(dev), in_addr);
407}
Michal Simekd0e30a02019-01-31 16:30:59 +0100408
Simon Glass2f9a6122020-01-27 08:49:40 -0700409u64 dev_translate_dma_address(const struct udevice *dev, const fdt32_t *in_addr)
Fabien Dessenne22236e02019-05-31 15:11:30 +0200410{
411 return ofnode_translate_dma_address(dev_ofnode(dev), in_addr);
412}
413
Nicolas Saenz Julienne50d2fa42021-01-12 13:55:22 +0100414int dev_get_dma_range(const struct udevice *dev, phys_addr_t *cpu,
415 dma_addr_t *bus, u64 *size)
416{
417 return ofnode_get_dma_range(dev_ofnode(dev), cpu, bus, size);
418}
419
Michal Simekd0e30a02019-01-31 16:30:59 +0100420int dev_read_alias_highest_id(const char *stem)
421{
422 if (of_live_active())
423 return of_alias_get_highest_id(stem);
424
425 return fdtdec_get_alias_highest_id(gd->fdt_blob, stem);
426}
Simon Glass23b27592019-09-15 12:08:58 -0600427
Simon Glass4289c262023-09-26 08:14:58 -0600428fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
Simon Glass23b27592019-09-15 12:08:58 -0600429{
430 ulong addr;
431
432 addr = dev_read_addr(dev);
Simon Glass4289c262023-09-26 08:14:58 -0600433 if (sizep)
434 *sizep = 0;
Simon Glass23b27592019-09-15 12:08:58 -0600435 if (addr == FDT_ADDR_T_NONE && !of_live_active())
Simon Glass4289c262023-09-26 08:14:58 -0600436 addr = devfdt_get_addr_pci(dev, sizep);
Simon Glass23b27592019-09-15 12:08:58 -0600437
438 return addr;
439}
developerd93c8b42020-05-02 11:35:09 +0200440
441int dev_get_child_count(const struct udevice *dev)
442{
443 return ofnode_get_child_count(dev_ofnode(dev));
444}
Stefan Roese0a9ecc52020-08-05 13:56:11 +0200445
446int dev_read_pci_bus_range(const struct udevice *dev,
447 struct resource *res)
448{
449 const u32 *values;
450 int len;
451
452 values = dev_read_prop(dev, "bus-range", &len);
453 if (!values || len < sizeof(*values) * 2)
454 return -EINVAL;
455
456 res->start = *values++;
457 res->end = *values;
458
459 return 0;
460}
Dario Binacchi836cc9d2020-12-30 00:16:26 +0100461
462int dev_decode_display_timing(const struct udevice *dev, int index,
463 struct display_timing *config)
464{
465 return ofnode_decode_display_timing(dev_ofnode(dev), index, config);
466}
Marek Behúnf4f1ddc2022-04-07 00:32:57 +0200467
Nikhil M Jainff407062023-01-31 15:35:14 +0530468int dev_decode_panel_timing(const struct udevice *dev,
469 struct display_timing *config)
470{
471 return ofnode_decode_panel_timing(dev_ofnode(dev), config);
472}
473
Marek Behúnf4f1ddc2022-04-07 00:32:57 +0200474ofnode dev_get_phy_node(const struct udevice *dev)
475{
476 return ofnode_get_phy_node(dev_ofnode(dev));
477}
Marek Behúnbc194772022-04-07 00:33:01 +0200478
479phy_interface_t dev_read_phy_mode(const struct udevice *dev)
480{
481 return ofnode_read_phy_mode(dev_ofnode(dev));
482}