From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tim Harvey Date: Thu, 29 Apr 2021 07:27:09 -0700 Subject: [PATCH 6/6] net: octeontx: smi: fix mii probe In-Reply-To: <16361117-ae8e-fbd1-a67e-d15a0e90b892@denx.de> References: <20210326000737.9764-1-tharvey@gateworks.com> <20210326000737.9764-7-tharvey@gateworks.com> <3e01286d-e9b2-7445-b626-b03eaa1a8a95@denx.de> <37bcc0a1-2f01-91c7-ae6e-9cefbe650a28@denx.de> <16361117-ae8e-fbd1-a67e-d15a0e90b892@denx.de> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wed, Apr 28, 2021 at 10:21 PM Stefan Roese wrote: > > Hi Tim, > > On 28.04.21 17:11, Tim Harvey wrote: > > On Mon, Apr 26, 2021 at 10:19 PM Stefan Roese wrote: > >> > >> Hi Tim, > >> > >> On 26.03.21 16:55, Tim Harvey wrote: > >>> On Thu, Mar 25, 2021 at 11:48 PM Stefan Roese wrote: > >>>> > >>>> On 26.03.21 01:07, Tim Harvey wrote: > >>>>> The fdt node offset is apparently not set properly when probed > >>>>> causing no MDIO busses to be found. Fix this by obtaining the > >>>>> offset. > >>>>> > >>>>> Signed-off-by: Tim Harvey > >>>> > >>>> Reviewed-by: Stefan Roese > >>>> > >>>> Thanks, > >>>> Stefan > >>>> > >>>>> --- > >>>>> drivers/net/octeontx/smi.c | 2 ++ > >>>>> 1 file changed, 2 insertions(+) > >>>>> > >>>>> diff --git a/drivers/net/octeontx/smi.c b/drivers/net/octeontx/smi.c > >>>>> index 91dcd05e4b..27f4423c6a 100644 > >>>>> --- a/drivers/net/octeontx/smi.c > >>>>> +++ b/drivers/net/octeontx/smi.c > >>>>> @@ -325,6 +325,8 @@ int octeontx_smi_probe(struct udevice *dev) > >>>>> return -1; > >>>>> } > >>>>> > >>>>> + node = fdt_node_offset_by_compatible(gd->fdt_blob, -1, > >>>>> + "cavium,thunder-8890-mdio-nexus"); > >>>>> fdt_for_each_subnode(subnode, gd->fdt_blob, node) { > >>>>> ret = fdt_node_check_compatible(gd->fdt_blob, subnode, > >>>>> "cavium,thunder-8890-mdio"); > >>>>> > >>> > >>> Honestly this is the wrong fix for this issue and I'm hoping someone > >>> could educate me. I'm a bit confused at why there are several ways to > >>> work with dt (int offsets vs ofnodes which are unions of int offsets > >>> and node pointers???). > >>> > >>> The above patch was not needed previously so something changed in the > >>> ofnode field of struct udevice between v2019.10 and v2021.01. > >>> > >>> Simon, could you explain what the proper way to work with dev->ofnode > >>> in probe functions is to loop over subnodes? > >> > >> This version is in mainline now. Tim, could you please re-visit this > >> and perhaps switch to using live tree API, as suggested by Suneel: > >> > >> ofnode_for_each_subnode(subnode, dev_ofnode(dev)) { > >> ret = ofnode_device_is_compatible(subnode, > >> "cavium,thunder-8890-mdio"); > >> > > > > Stefan, > > > > Yes, I can submit this but I would really like to understand the > > original issue. Do you or Simon perhaps know why the fdt node offset > > in dev passed to probe is wrong? It's not null but it does not appear > > to point to a device-tree (or perhaps I was using the wrong functions > > on it not fully understanding the current state of this live tree > > API). > > I don't have an OcteonTX board installed right now, so it's not easy to > really verify this. AFAIU, fdt_for_each_subnode() etc is deprecated and > the use of e.g. this API seems "more modern": > > ofnode subnode; > > dev_for_each_subnode(subnode, dev) { > ... > > Does this work for you? > Stefan, Yes thanks - I didn't read your original suggestion closely enough. I have a patch I will submit. Thanks, Tim