LKML Archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Stephen Langstaff <stephenlangstaff1@gmail.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
	linux-kernel@vger.kernel.org, OlteanV@gmail.com
Subject: Re: drivers/net/dsa/dsa_loop_bdinfo.c build problems
Date: Tue, 14 May 2024 14:32:40 +0200	[thread overview]
Message-ID: <c8c01e53-0a45-4319-88ff-bfb0caba150c@lunn.ch> (raw)
In-Reply-To: <CAHx5RXDaweFTF_Qt0GdBH4nBeMqwL4VVto7xzHBvFgFL5n=Ebg@mail.gmail.com>

On Tue, May 14, 2024 at 10:28:55AM +0100, Stephen Langstaff wrote:
> On Mon, May 13, 2024 at 8:05 PM Florian Fainelli <f.fainelli@gmail.com> wrote:
> > Attached is a configuration that I use on a x86-64 VM for testing that
> > is started with:
> 
> That's kind of what I expect to be happening on my target, but it's not.
> 
> I notice that your configuration does not define CONFIG_FIXED_PHY as
> either a module or built-in - could that explain both the fact that my
> dsa_loop_bdinfo.c does not get compiled when using the default
> Makefiles, and that if I force compilation to a module it does not
> appear to create the expected lanX@eth0 interfaces?
> 
> I have added some printk debug lines to the dsa_loop_init and
> dsa_loop_drv_probe functions, and only see the one from the init
> function, which makes me suspect that something is stopping the probe
> from happening - I assume this should happen when the dsa_loop_bdinfo
> module is inserted?
> 
> root@machine:~/dsa_test# ls
> dsa_loop.ko  dsa_loop_bdinfo.ko
> 
> root@machine:~/dsa_test# modprobe dsa_core
> root@machine:~/dsa_test#
> 
> root@machine:~/dsa_test# insmod dsa_loop_bdinfo.ko
> [   51.742367] dsa_loop_bdinfo_init
> 
> root@machine:~/dsa_test# insmod dsa_loop.ko
> [   58.485104] dsa_loop_init

This is probably an ordering problem.

dsa_loop_bdinfo calls mdiobus_register_board_info() with the bus_id
"fixed-0". That call adds it to a linked list, but does nothing else.

mdiobus_setup_mdiodev_from_board_info() is what walks the linked list
and sees if an MDIO bus matches the ID, and if so, calls the callback
to add a device to the bus. mdiobus_setup_mdiodev_from_board_info() is
only called from __mdiobus_register(). So the boardinfo needs to be
registered before the bus is registers. The other way around does not
work.

So try to making FIXED_PHY = m, and load it after dsa_loop_bdinfo.ko.

   Andrew

  reply	other threads:[~2024-05-14 12:32 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-13 15:33 drivers/net/dsa/dsa_loop_bdinfo.c build problems Stephen Langstaff
2024-05-13 15:34 ` Florian Fainelli
2024-05-13 15:36   ` Stephen Langstaff
2024-05-13 15:40     ` Florian Fainelli
2024-05-13 15:45       ` Stephen Langstaff
2024-05-13 15:50         ` Florian Fainelli
2024-05-13 16:21           ` Stephen Langstaff
2024-05-13 16:54             ` Andrew Lunn
2024-05-13 17:40               ` Stephen Langstaff
2024-05-13 17:54                 ` Andrew Lunn
     [not found]                   ` <CAHx5RXCF0=Soz_k88RGvJFGrajaxn=mVnqpb99GAQ=b7XOcWiw@mail.gmail.com>
2024-05-13 19:05                     ` Florian Fainelli
2024-05-14  9:28                       ` Stephen Langstaff
2024-05-14 12:32                         ` Andrew Lunn [this message]
2024-05-14 16:08                           ` Stephen Langstaff
2024-05-14 16:17                             ` Andrew Lunn
2024-05-15  4:05                               ` Florian Fainelli
2024-05-15 19:20                                 ` Florian Fainelli
2024-05-16  2:17                                   ` Masahiro Yamada
2024-05-16  3:35                                     ` Florian Fainelli
2024-05-16  6:39                                       ` Masahiro Yamada
2024-05-15  9:23                               ` Stephen Langstaff
2024-05-15 19:26                                 ` Florian Fainelli
2024-05-16  9:27                                   ` Stephen Langstaff
  -- strict thread matches above, loose matches on Subject: below --
2024-05-13 14:43 Stephen Langstaff

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c8c01e53-0a45-4319-88ff-bfb0caba150c@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=OlteanV@gmail.com \
    --cc=f.fainelli@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stephenlangstaff1@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).