blob: 1a4a95cddea34a9f65b08e5e916a6b11516e944f [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Simon Glass47a0fd32017-05-18 20:09:04 -06002/*
3 * Copyright (c) 2017 Google, Inc
4 * Written by Simon Glass <sjg@chromium.org>
Simon Glass47a0fd32017-05-18 20:09:04 -06005 */
6
7#include <common.h>
8#include <dm.h>
9#include <dm/of_access.h>
Stefan Roese979afd12020-04-29 09:08:44 +020010#include <mapmem.h>
Simon Glass401d1c42020-10-30 21:38:53 -060011#include <asm/global_data.h>
Stefan Roese979afd12020-04-29 09:08:44 +020012#include <asm/types.h>
13#include <asm/io.h>
Stefan Roese68f81b82020-08-05 13:56:11 +020014#include <linux/ioport.h>
Simon Glass47a0fd32017-05-18 20:09:04 -060015
Stefan Herbrechtsmeierb471bdc2022-06-14 15:21:30 +020016int dev_read_u8(const struct udevice *dev, const char *propname, u8 *outp)
17{
18 return ofnode_read_u8(dev_ofnode(dev), propname, outp);
19}
20
21u8 dev_read_u8_default(const struct udevice *dev, const char *propname, u8 def)
22{
23 return ofnode_read_u8_default(dev_ofnode(dev), propname, def);
24}
25
26int dev_read_u16(const struct udevice *dev, const char *propname, u16 *outp)
27{
28 return ofnode_read_u16(dev_ofnode(dev), propname, outp);
29}
30
31u16 dev_read_u16_default(const struct udevice *dev, const char *propname,
32 u16 def)
33{
34 return ofnode_read_u16_default(dev_ofnode(dev), propname, def);
35}
36
Simon Glass88b3a372020-01-27 08:49:40 -070037int dev_read_u32(const struct udevice *dev, const char *propname, u32 *outp)
Masahiro Yamada3ab48f62017-12-30 02:00:05 +090038{
39 return ofnode_read_u32(dev_ofnode(dev), propname, outp);
40}
41
Simon Glass88b3a372020-01-27 08:49:40 -070042int dev_read_u32_default(const struct udevice *dev, const char *propname,
43 int def)
Simon Glass47a0fd32017-05-18 20:09:04 -060044{
45 return ofnode_read_u32_default(dev_ofnode(dev), propname, def);
46}
47
Dario Binacchi4bb70752020-03-29 18:04:41 +020048int dev_read_u32_index(struct udevice *dev, const char *propname, int index,
49 u32 *outp)
50{
51 return ofnode_read_u32_index(dev_ofnode(dev), propname, index, outp);
52}
53
54u32 dev_read_u32_index_default(struct udevice *dev, const char *propname,
55 int index, u32 def)
56{
57 return ofnode_read_u32_index_default(dev_ofnode(dev), propname, index,
58 def);
59}
60
Simon Glass88b3a372020-01-27 08:49:40 -070061int dev_read_s32(const struct udevice *dev, const char *propname, s32 *outp)
Simon Glassa1b17e42018-12-10 10:37:37 -070062{
63 return ofnode_read_u32(dev_ofnode(dev), propname, (u32 *)outp);
64}
65
Simon Glass88b3a372020-01-27 08:49:40 -070066int dev_read_s32_default(const struct udevice *dev, const char *propname,
67 int def)
Simon Glassa1b17e42018-12-10 10:37:37 -070068{
69 return ofnode_read_u32_default(dev_ofnode(dev), propname, def);
70}
71
Simon Glass88b3a372020-01-27 08:49:40 -070072int dev_read_u32u(const struct udevice *dev, const char *propname, uint *outp)
Simon Glassa1b17e42018-12-10 10:37:37 -070073{
74 u32 val;
75 int ret;
76
77 ret = ofnode_read_u32(dev_ofnode(dev), propname, &val);
78 if (ret)
79 return ret;
80 *outp = val;
81
82 return 0;
83}
84
Simon Glass88b3a372020-01-27 08:49:40 -070085int dev_read_u64(const struct udevice *dev, const char *propname, u64 *outp)
T Karthik Reddy3f3d7712019-09-02 16:34:30 +020086{
87 return ofnode_read_u64(dev_ofnode(dev), propname, outp);
88}
89
Simon Glass88b3a372020-01-27 08:49:40 -070090u64 dev_read_u64_default(const struct udevice *dev, const char *propname,
91 u64 def)
T Karthik Reddy3f3d7712019-09-02 16:34:30 +020092{
93 return ofnode_read_u64_default(dev_ofnode(dev), propname, def);
94}
95
Simon Glass88b3a372020-01-27 08:49:40 -070096const char *dev_read_string(const struct udevice *dev, const char *propname)
Simon Glass47a0fd32017-05-18 20:09:04 -060097{
98 return ofnode_read_string(dev_ofnode(dev), propname);
99}
100
Simon Glass88b3a372020-01-27 08:49:40 -0700101bool dev_read_bool(const struct udevice *dev, const char *propname)
Simon Glass47a0fd32017-05-18 20:09:04 -0600102{
103 return ofnode_read_bool(dev_ofnode(dev), propname);
104}
105
Simon Glass88b3a372020-01-27 08:49:40 -0700106ofnode dev_read_subnode(const struct udevice *dev, const char *subnode_name)
Simon Glass47a0fd32017-05-18 20:09:04 -0600107{
108 return ofnode_find_subnode(dev_ofnode(dev), subnode_name);
109}
110
Simon Glass88b3a372020-01-27 08:49:40 -0700111ofnode dev_read_first_subnode(const struct udevice *dev)
Simon Glass47a0fd32017-05-18 20:09:04 -0600112{
113 return ofnode_first_subnode(dev_ofnode(dev));
114}
115
116ofnode dev_read_next_subnode(ofnode node)
117{
118 return ofnode_next_subnode(node);
119}
120
Simon Glass88b3a372020-01-27 08:49:40 -0700121int dev_read_size(const struct udevice *dev, const char *propname)
Simon Glass47a0fd32017-05-18 20:09:04 -0600122{
123 return ofnode_read_size(dev_ofnode(dev), propname);
124}
125
Simon Glass88b3a372020-01-27 08:49:40 -0700126fdt_addr_t dev_read_addr_index(const struct udevice *dev, int index)
Simon Glass47a0fd32017-05-18 20:09:04 -0600127{
128 if (ofnode_is_np(dev_ofnode(dev)))
129 return ofnode_get_addr_index(dev_ofnode(dev), index);
130 else
131 return devfdt_get_addr_index(dev, index);
132}
133
Johan Jonkerb5266562023-03-13 01:31:25 +0100134void *dev_read_addr_index_ptr(const struct udevice *dev, int index)
135{
136 fdt_addr_t addr = dev_read_addr_index(dev, index);
137
138 if (addr == FDT_ADDR_T_NONE)
139 return NULL;
140
141 return map_sysmem(addr, 0);
142}
143
Simon Glass88b3a372020-01-27 08:49:40 -0700144fdt_addr_t dev_read_addr_size_index(const struct udevice *dev, int index,
Sekhar Norif5b90472019-08-01 19:12:56 +0530145 fdt_size_t *size)
146{
147 if (ofnode_is_np(dev_ofnode(dev)))
148 return ofnode_get_addr_size_index(dev_ofnode(dev), index, size);
149 else
150 return devfdt_get_addr_size_index(dev, index, size);
151}
152
Jonas Karlman5e030632023-07-22 13:30:15 +0000153void *dev_read_addr_size_index_ptr(const struct udevice *dev, int index,
154 fdt_size_t *size)
155{
156 fdt_addr_t addr = dev_read_addr_size_index(dev, index, size);
157
158 if (addr == FDT_ADDR_T_NONE)
159 return NULL;
160
161 return map_sysmem(addr, 0);
162}
163
Simon Glass88b3a372020-01-27 08:49:40 -0700164void *dev_remap_addr_index(const struct udevice *dev, int index)
Álvaro Fernández Rojas30a90f52018-04-29 21:56:54 +0200165{
166 fdt_addr_t addr = dev_read_addr_index(dev, index);
167
168 if (addr == FDT_ADDR_T_NONE)
169 return NULL;
170
171 return map_physmem(addr, 0, MAP_NOCACHE);
172}
173
Simon Glass88b3a372020-01-27 08:49:40 -0700174fdt_addr_t dev_read_addr_name(const struct udevice *dev, const char *name)
Álvaro Fernández Rojas79598822018-12-03 19:37:09 +0100175{
176 int index = dev_read_stringlist_search(dev, "reg-names", name);
177
178 if (index < 0)
179 return FDT_ADDR_T_NONE;
180 else
181 return dev_read_addr_index(dev, index);
182}
183
Matthias Schifferbc8fa1c2023-09-27 15:33:32 +0200184void *dev_read_addr_name_ptr(const struct udevice *dev, const char *name)
185{
186 fdt_addr_t addr = dev_read_addr_name(dev, name);
187
188 if (addr == FDT_ADDR_T_NONE)
189 return NULL;
190
191 return map_sysmem(addr, 0);
192}
193
Simon Glass88b3a372020-01-27 08:49:40 -0700194fdt_addr_t dev_read_addr_size_name(const struct udevice *dev, const char *name,
Sekhar Norif5b90472019-08-01 19:12:56 +0530195 fdt_size_t *size)
196{
197 int index = dev_read_stringlist_search(dev, "reg-names", name);
198
199 if (index < 0)
200 return FDT_ADDR_T_NONE;
201 else
202 return dev_read_addr_size_index(dev, index, size);
203}
204
Matthias Schifferbc8fa1c2023-09-27 15:33:32 +0200205void *dev_read_addr_size_name_ptr(const struct udevice *dev, const char *name,
206 fdt_size_t *size)
207{
208 fdt_addr_t addr = dev_read_addr_size_name(dev, name, size);
209
210 if (addr == FDT_ADDR_T_NONE)
211 return NULL;
212
213 return map_sysmem(addr, 0);
214}
215
Simon Glass88b3a372020-01-27 08:49:40 -0700216void *dev_remap_addr_name(const struct udevice *dev, const char *name)
Álvaro Fernández Rojas79598822018-12-03 19:37:09 +0100217{
218 fdt_addr_t addr = dev_read_addr_name(dev, name);
219
220 if (addr == FDT_ADDR_T_NONE)
221 return NULL;
222
223 return map_physmem(addr, 0, MAP_NOCACHE);
224}
225
Simon Glass88b3a372020-01-27 08:49:40 -0700226fdt_addr_t dev_read_addr(const struct udevice *dev)
Simon Glass47a0fd32017-05-18 20:09:04 -0600227{
228 return dev_read_addr_index(dev, 0);
229}
230
Simon Glass88b3a372020-01-27 08:49:40 -0700231void *dev_read_addr_ptr(const struct udevice *dev)
Philipp Tomsichc131c8b2017-09-11 22:04:12 +0200232{
233 fdt_addr_t addr = dev_read_addr(dev);
234
Johan Jonkerb5266562023-03-13 01:31:25 +0100235 if (addr == FDT_ADDR_T_NONE)
236 return NULL;
237
238 return map_sysmem(addr, 0);
Philipp Tomsichc131c8b2017-09-11 22:04:12 +0200239}
240
Simon Glass88b3a372020-01-27 08:49:40 -0700241void *dev_remap_addr(const struct udevice *dev)
Álvaro Fernández Rojas30a90f52018-04-29 21:56:54 +0200242{
243 return dev_remap_addr_index(dev, 0);
244}
245
John Keeping77224322023-06-01 15:11:19 +0100246fdt_addr_t dev_read_addr_size(const struct udevice *dev, fdt_size_t *sizep)
Simon Glass47a0fd32017-05-18 20:09:04 -0600247{
John Keeping77224322023-06-01 15:11:19 +0100248 return dev_read_addr_size_index(dev, 0, sizep);
Simon Glass47a0fd32017-05-18 20:09:04 -0600249}
250
Simon Glass88b3a372020-01-27 08:49:40 -0700251const char *dev_read_name(const struct udevice *dev)
Simon Glass47a0fd32017-05-18 20:09:04 -0600252{
253 return ofnode_get_name(dev_ofnode(dev));
254}
255
Simon Glass88b3a372020-01-27 08:49:40 -0700256int dev_read_stringlist_search(const struct udevice *dev, const char *property,
Mario Six83a462a2018-01-15 11:07:18 +0100257 const char *string)
Simon Glass47a0fd32017-05-18 20:09:04 -0600258{
259 return ofnode_stringlist_search(dev_ofnode(dev), property, string);
260}
261
Simon Glass88b3a372020-01-27 08:49:40 -0700262int dev_read_string_index(const struct udevice *dev, const char *propname,
263 int index, const char **outp)
Jean-Jacques Hiblotb5a144a2017-09-21 17:03:09 +0200264{
265 return ofnode_read_string_index(dev_ofnode(dev), propname, index, outp);
266}
267
Simon Glass88b3a372020-01-27 08:49:40 -0700268int dev_read_string_count(const struct udevice *dev, const char *propname)
Jean-Jacques Hiblotb5a144a2017-09-21 17:03:09 +0200269{
270 return ofnode_read_string_count(dev_ofnode(dev), propname);
271}
272
Simon Glass075bfc92021-10-23 17:26:07 -0600273int dev_read_string_list(const struct udevice *dev, const char *propname,
274 const char ***listp)
275{
276 return ofnode_read_string_list(dev_ofnode(dev), propname, listp);
277}
278
Simon Glass88b3a372020-01-27 08:49:40 -0700279int dev_read_phandle_with_args(const struct udevice *dev, const char *list_name,
Mario Six83a462a2018-01-15 11:07:18 +0100280 const char *cells_name, int cell_count,
281 int index, struct ofnode_phandle_args *out_args)
Simon Glass47a0fd32017-05-18 20:09:04 -0600282{
283 return ofnode_parse_phandle_with_args(dev_ofnode(dev), list_name,
284 cells_name, cell_count, index,
285 out_args);
286}
287
Simon Glass88b3a372020-01-27 08:49:40 -0700288int dev_count_phandle_with_args(const struct udevice *dev,
Patrick Delaunay89f68302020-09-25 09:41:14 +0200289 const char *list_name, const char *cells_name,
290 int cell_count)
Patrice Chotardea8cd652017-11-29 09:06:10 +0100291{
292 return ofnode_count_phandle_with_args(dev_ofnode(dev), list_name,
Patrick Delaunay89f68302020-09-25 09:41:14 +0200293 cells_name, cell_count);
Patrice Chotardea8cd652017-11-29 09:06:10 +0100294}
295
Simon Glass88b3a372020-01-27 08:49:40 -0700296int dev_read_addr_cells(const struct udevice *dev)
Simon Glass47a0fd32017-05-18 20:09:04 -0600297{
298 return ofnode_read_addr_cells(dev_ofnode(dev));
299}
300
Simon Glass88b3a372020-01-27 08:49:40 -0700301int dev_read_size_cells(const struct udevice *dev)
Simon Glass47a0fd32017-05-18 20:09:04 -0600302{
303 return ofnode_read_size_cells(dev_ofnode(dev));
304}
305
Simon Glass88b3a372020-01-27 08:49:40 -0700306int dev_read_simple_addr_cells(const struct udevice *dev)
Simon Glass878d68c2017-06-12 06:21:31 -0600307{
308 return ofnode_read_simple_addr_cells(dev_ofnode(dev));
309}
310
Simon Glass88b3a372020-01-27 08:49:40 -0700311int dev_read_simple_size_cells(const struct udevice *dev)
Simon Glass878d68c2017-06-12 06:21:31 -0600312{
313 return ofnode_read_simple_size_cells(dev_ofnode(dev));
314}
315
Simon Glass88b3a372020-01-27 08:49:40 -0700316int dev_read_phandle(const struct udevice *dev)
Simon Glass47a0fd32017-05-18 20:09:04 -0600317{
318 ofnode node = dev_ofnode(dev);
319
320 if (ofnode_is_np(node))
321 return ofnode_to_np(node)->phandle;
322 else
323 return fdt_get_phandle(gd->fdt_blob, ofnode_to_offset(node));
324}
325
Simon Glass88b3a372020-01-27 08:49:40 -0700326const void *dev_read_prop(const struct udevice *dev, const char *propname,
327 int *lenp)
Simon Glass47a0fd32017-05-18 20:09:04 -0600328{
Masahiro Yamada61e51ba2017-06-22 16:54:05 +0900329 return ofnode_get_property(dev_ofnode(dev), propname, lenp);
Simon Glass47a0fd32017-05-18 20:09:04 -0600330}
331
Patrick Delaunayce891fca2020-01-13 11:34:56 +0100332int dev_read_first_prop(const struct udevice *dev, struct ofprop *prop)
333{
Simon Glass4b1f5712022-09-06 20:27:13 -0600334 return ofnode_first_property(dev_ofnode(dev), prop);
Patrick Delaunayce891fca2020-01-13 11:34:56 +0100335}
336
337int dev_read_next_prop(struct ofprop *prop)
338{
Simon Glass4b1f5712022-09-06 20:27:13 -0600339 return ofnode_next_property(prop);
Patrick Delaunayce891fca2020-01-13 11:34:56 +0100340}
341
342const void *dev_read_prop_by_prop(struct ofprop *prop,
343 const char **propname, int *lenp)
344{
Simon Glass92432242022-09-06 20:27:14 -0600345 return ofprop_get_property(prop, propname, lenp);
Patrick Delaunayce891fca2020-01-13 11:34:56 +0100346}
347
Simon Glass88b3a372020-01-27 08:49:40 -0700348int dev_read_alias_seq(const struct udevice *dev, int *devnump)
Simon Glass47a0fd32017-05-18 20:09:04 -0600349{
350 ofnode node = dev_ofnode(dev);
351 const char *uc_name = dev->uclass->uc_drv->name;
Marcel Ziswiler45224e82019-05-20 02:44:57 +0200352 int ret = -ENOTSUPP;
Simon Glass47a0fd32017-05-18 20:09:04 -0600353
354 if (ofnode_is_np(node)) {
355 ret = of_alias_get_id(ofnode_to_np(node), uc_name);
Simon Glass4153e3a2020-12-16 21:20:12 -0700356 if (ret >= 0) {
Simon Glass47a0fd32017-05-18 20:09:04 -0600357 *devnump = ret;
Simon Glass4153e3a2020-12-16 21:20:12 -0700358 ret = 0;
359 }
Simon Glass47a0fd32017-05-18 20:09:04 -0600360 } else {
Marcel Ziswiler45224e82019-05-20 02:44:57 +0200361#if CONFIG_IS_ENABLED(OF_CONTROL)
Simon Glass47a0fd32017-05-18 20:09:04 -0600362 ret = fdtdec_get_alias_seq(gd->fdt_blob, uc_name,
363 ofnode_to_offset(node), devnump);
Marcel Ziswiler45224e82019-05-20 02:44:57 +0200364#endif
Simon Glass47a0fd32017-05-18 20:09:04 -0600365 }
366
367 return ret;
368}
369
Simon Glass88b3a372020-01-27 08:49:40 -0700370int dev_read_u32_array(const struct udevice *dev, const char *propname,
Simon Glass47a0fd32017-05-18 20:09:04 -0600371 u32 *out_values, size_t sz)
372{
373 return ofnode_read_u32_array(dev_ofnode(dev), propname, out_values, sz);
374}
375
Simon Glass88b3a372020-01-27 08:49:40 -0700376const uint8_t *dev_read_u8_array_ptr(const struct udevice *dev,
377 const char *propname, size_t sz)
Simon Glass47a0fd32017-05-18 20:09:04 -0600378{
379 return ofnode_read_u8_array_ptr(dev_ofnode(dev), propname, sz);
380}
Simon Glassf7d6fcf2017-06-12 06:21:30 -0600381
Simon Glass88b3a372020-01-27 08:49:40 -0700382int dev_read_enabled(const struct udevice *dev)
Simon Glassf7d6fcf2017-06-12 06:21:30 -0600383{
384 ofnode node = dev_ofnode(dev);
385
386 if (ofnode_is_np(node))
387 return of_device_is_available(ofnode_to_np(node));
388 else
389 return fdtdec_get_is_enabled(gd->fdt_blob,
390 ofnode_to_offset(node));
391}
Simon Glassdcf98852017-07-25 08:29:55 -0600392
Simon Glass88b3a372020-01-27 08:49:40 -0700393int dev_read_resource(const struct udevice *dev, uint index,
394 struct resource *res)
Simon Glassdcf98852017-07-25 08:29:55 -0600395{
396 return ofnode_read_resource(dev_ofnode(dev), index, res);
397}
Masahiro Yamada7b8b47b2017-08-26 01:12:30 +0900398
Simon Glass88b3a372020-01-27 08:49:40 -0700399int dev_read_resource_byname(const struct udevice *dev, const char *name,
Masahiro Yamada7b8b47b2017-08-26 01:12:30 +0900400 struct resource *res)
401{
402 return ofnode_read_resource_byname(dev_ofnode(dev), name, res);
403}
Mario Six147c6072018-01-15 11:07:19 +0100404
Simon Glass88b3a372020-01-27 08:49:40 -0700405u64 dev_translate_address(const struct udevice *dev, const fdt32_t *in_addr)
Mario Six147c6072018-01-15 11:07:19 +0100406{
407 return ofnode_translate_address(dev_ofnode(dev), in_addr);
408}
Michal Simek83e4c7e2019-01-31 16:30:59 +0100409
Simon Glass88b3a372020-01-27 08:49:40 -0700410u64 dev_translate_dma_address(const struct udevice *dev, const fdt32_t *in_addr)
Fabien Dessenne641067f2019-05-31 15:11:30 +0200411{
412 return ofnode_translate_dma_address(dev_ofnode(dev), in_addr);
413}
414
Nicolas Saenz Julienne51bdb502021-01-12 13:55:22 +0100415int dev_get_dma_range(const struct udevice *dev, phys_addr_t *cpu,
416 dma_addr_t *bus, u64 *size)
417{
418 return ofnode_get_dma_range(dev_ofnode(dev), cpu, bus, size);
419}
420
Michal Simek83e4c7e2019-01-31 16:30:59 +0100421int dev_read_alias_highest_id(const char *stem)
422{
423 if (of_live_active())
424 return of_alias_get_highest_id(stem);
425
426 return fdtdec_get_alias_highest_id(gd->fdt_blob, stem);
427}
Simon Glass33c215a2019-09-15 12:08:58 -0600428
Simon Glassf69d3d62023-09-26 08:14:58 -0600429fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep)
Simon Glass33c215a2019-09-15 12:08:58 -0600430{
431 ulong addr;
432
433 addr = dev_read_addr(dev);
Simon Glassf69d3d62023-09-26 08:14:58 -0600434 if (sizep)
435 *sizep = 0;
Simon Glass33c215a2019-09-15 12:08:58 -0600436 if (addr == FDT_ADDR_T_NONE && !of_live_active())
Simon Glassf69d3d62023-09-26 08:14:58 -0600437 addr = devfdt_get_addr_pci(dev, sizep);
Simon Glass33c215a2019-09-15 12:08:58 -0600438
439 return addr;
440}
Chunfeng Yun89b84b82020-05-02 11:35:09 +0200441
442int dev_get_child_count(const struct udevice *dev)
443{
444 return ofnode_get_child_count(dev_ofnode(dev));
445}
Stefan Roese68f81b82020-08-05 13:56:11 +0200446
447int dev_read_pci_bus_range(const struct udevice *dev,
448 struct resource *res)
449{
450 const u32 *values;
451 int len;
452
453 values = dev_read_prop(dev, "bus-range", &len);
454 if (!values || len < sizeof(*values) * 2)
455 return -EINVAL;
456
457 res->start = *values++;
458 res->end = *values;
459
460 return 0;
461}
Dario Binacchi15daa482020-12-30 00:16:26 +0100462
463int dev_decode_display_timing(const struct udevice *dev, int index,
464 struct display_timing *config)
465{
466 return ofnode_decode_display_timing(dev_ofnode(dev), index, config);
467}
Marek Behúnf3dd2132022-04-07 00:32:57 +0200468
Nikhil M Jain0347cc72023-01-31 15:35:14 +0530469int dev_decode_panel_timing(const struct udevice *dev,
470 struct display_timing *config)
471{
472 return ofnode_decode_panel_timing(dev_ofnode(dev), config);
473}
474
Marek Behúnf3dd2132022-04-07 00:32:57 +0200475ofnode dev_get_phy_node(const struct udevice *dev)
476{
477 return ofnode_get_phy_node(dev_ofnode(dev));
478}
Marek Behún123ca112022-04-07 00:33:01 +0200479
480phy_interface_t dev_read_phy_mode(const struct udevice *dev)
481{
482 return ofnode_read_phy_mode(dev_ofnode(dev));
483}