All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roger Quadros <rogerq@kernel.org>
To: "Chintan Vankar" <c-vankar@ti.com>,
	"Marek Behún" <kabel@kernel.org>,
	"Michal Simek" <michal.simek@amd.com>,
	"Vignesh Raghavendra" <vigneshr@ti.com>,
	"MD Danish Anwar" <danishanwar@ti.com>,
	"Udit Kumar" <u-kumar1@ti.com>,
	"Matthias Schiffer" <matthias.schiffer@ew.tq-group.com>,
	"Andreas Dannenberg" <dannenberg@ti.com>,
	"Devarsh Thakkar" <devarsht@ti.com>,
	"Bin Meng" <bmeng@tinylab.org>,
	"Sean Anderson" <seanga2@gmail.com>,
	"Kishon Vijay Abraham I" <kishon@ti.com>,
	"Nikhil M Jain" <n-jain1@ti.com>,
	"Wadim Egorov" <w.egorov@phytec.de>,
	"Joao Paulo Goncalves" <joao.goncalves@toradex.com>,
	"Mattijs Korpershoek" <mkorpershoek@baylibre.com>,
	"Dhruva Gole" <d-gole@ti.com>,
	"Francesco Dolcini" <francesco.dolcini@toradex.com>,
	"Andrew Davis" <afd@ti.com>, "Maxime Ripard" <mripard@kernel.org>,
	"Neha Malcom Francis" <n-francis@ti.com>,
	"Simon Glass" <sjg@chromium.org>,
	"Siddharth Vadapalli" <s-vadapalli@ti.com>,
	"Nishanth Menon" <nm@ti.com>, "Tom Rini" <trini@konsulko.com>
Cc: u-boot@lists.denx.de
Subject: Re: [PATCH v2 06/10] arm: mach-k3: am625_init: Probe AM65 CPSW NUSS
Date: Wed, 22 May 2024 23:18:40 +0300	[thread overview]
Message-ID: <d68c8045-116a-49c0-9e74-d6a366e6f008@kernel.org> (raw)
In-Reply-To: <7f264a02-f80f-46fd-9aec-780b7bbe27bf@ti.com>



On 21/05/2024 08:34, Chintan Vankar wrote:
> 
> 
> On 20/05/24 17:42, Roger Quadros wrote:
>>
>>
>> On 25/04/2024 15:59, Chintan Vankar wrote:
>>>
>>>
>>> On 25/04/24 17:57, Roger Quadros wrote:
>>>>
>>>>
>>>> On 25/04/2024 15:08, Chintan Vankar wrote:
>>>>> From: Kishon Vijay Abraham I <kishon@ti.com>
>>>>>
>>>>> In order to support Ethernet boot on AM62x, probe AM65 CPSW NUSS
>>>>> driver in board_init_f().
>>>>>
>>>>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>>>>> Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
>>>>> Signed-off-by: Chintan Vankar <c-vankar@ti.com>
>>>>> ---
>>>>>
>>>>> Link to v1:
>>>>> https://lore.kernel.org/r/20240112064759.1801600-8-s-vadapalli@ti.com/
>>>>>
>>>>> Changes from v1 to v2:
>>>>> - No changes.
>>>>>
>>>>>    arch/arm/mach-k3/am625_init.c | 10 ++++++++++
>>>>>    1 file changed, 10 insertions(+)
>>>>>
>>>>> diff --git a/arch/arm/mach-k3/am625_init.c b/arch/arm/mach-k3/am625_init.c
>>>>> index 668f9a51ef..9bf61b1e83 100644
>>>>> --- a/arch/arm/mach-k3/am625_init.c
>>>>> +++ b/arch/arm/mach-k3/am625_init.c
>>>>> @@ -277,6 +277,16 @@ void board_init_f(ulong dummy)
>>>>>            if (ret)
>>>>>                panic("DRAM init failed: %d\n", ret);
>>>>>        }
>>>>> +
>>>>> +    if (IS_ENABLED(CONFIG_SPL_ETH) && IS_ENABLED(CONFIG_TI_AM65_CPSW_NUSS) &&
>>>>> +        spl_boot_device() == BOOT_DEVICE_ETHERNET) {
>>>>> +        struct udevice *cpswdev;
>>>>> +
>>>>> +        if (uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(am65_cpsw_nuss),
>>>>> +                        &cpswdev))
>>>>> +            printf("Failed to probe am65_cpsw_nuss driver\n");
>>>>> +    }
>>>>> +
>>>>
>>>> This looks like a HACK.
>>>> The network driver should be probed only when the networking feature is actually required.
>>>>
>>>
>>> Driver is probed only when the condition above
>>> "spl_boot_device() == BOOT_DEVICE_ETHERNET" is true, which says Boot
>>> device is Ethernet, and here we are booting with Ethernet so driver is
>>> getting probed.
>>
>> I think you misunderstood what I was saying as am625_init.c is not using
>> any Ethernet function it should not cause the Ethernet driver to probe.
>>
>> Instead it should be probed by the networking use case.
>>
>> What happens if you don't use this patch? Where is it failing?
>>
> 
> You are correct that it should be probed by the networking use case and
> we are using networking functionality of "Booting via Ethernet".
> Regarding its probing, I already had discussion that why do I have to
> probe it explicitly at here:
> https://lore.kernel.org/r/ee1d16fd-b99b-4b07-97bb-a896e179157a@ti.com/
> 
> Now if I don't use this patch then Ethernet will not get initialized at
> SPL stage, and in "spl_net_load_image()" function, there will be an
> error saying "No Ethernet Found", and since we selected booting via
> Ethernet it will fail to boot.

OK Now I see the problem.

in am65-cpsw-nuss.c the following is defined:

> U_BOOT_DRIVER(am65_cpsw_nuss) = {
>         .name   = "am65_cpsw_nuss",
>         .id     = UCLASS_MISC,
>         .of_match = am65_cpsw_nuss_ids,
>         .probe  = am65_cpsw_probe_nuss,
>         .priv_auto = sizeof(struct am65_cpsw_common),
> };
> 
> U_BOOT_DRIVER(am65_cpsw_nuss_port) = {
>         .name   = "am65_cpsw_nuss_port",
>         .id     = UCLASS_ETH,
>         .probe  = am65_cpsw_port_probe,
>         .ops    = &am65_cpsw_ops,
>         .priv_auto      = sizeof(struct am65_cpsw_priv),
>         .plat_auto      = sizeof(struct eth_pdata),
>         .flags = DM_FLAG_ALLOC_PRIV_DMA | DM_FLAG_OS_PREPARE,
> };

Now I suppose spl_net_load_image() tries to probe all UCLASS_ETH devices
which should call am65_cpsw_port_probe() but it fails to probe am65_cpsw_probe_nuss().

This limitation was introduced by commit
38922b1f4acc ("net: ti: am65-cpsw: Add support for multi port independent MAC mode")

which says "Since top level driver is now UCLASS_MISC, board
files would need to instantiate this driver explicitly.

I wonder if there can be a better solution to this?

-- 
cheers,
-roger

  reply	other threads:[~2024-05-22 20:19 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-25 12:08 [PATCH v2 00/10] Add support for Ethernet Boot on SK-AM62 Chintan Vankar
2024-04-25 12:08 ` [PATCH v2 01/10] common: spl: spl: Init DRAM size in R5/A53 SPL Chintan Vankar
2024-04-25 12:08 ` [PATCH v2 02/10] firmware: ti_sci: Add No-OP for "RX_FL_CFG" Chintan Vankar
2024-04-25 12:08 ` [PATCH v2 03/10] soc: ti: k3-navss-ringacc: Initialize base address of ring cfg registers Chintan Vankar
2024-04-25 12:08 ` [PATCH v2 04/10] soc: ti: k3-navss-ringacc: Fix reset ring API Chintan Vankar
2024-04-25 12:08 ` [PATCH v2 05/10] dma: ti: k3-udma: Add support for native configuration of chan/flow Chintan Vankar
2024-04-25 12:08 ` [PATCH v2 06/10] arm: mach-k3: am625_init: Probe AM65 CPSW NUSS Chintan Vankar
2024-04-25 12:27   ` Roger Quadros
2024-04-25 12:59     ` Chintan Vankar
2024-05-20 12:12       ` Roger Quadros
2024-05-21  5:34         ` Chintan Vankar
2024-05-22 20:18           ` Roger Quadros [this message]
2024-04-25 12:08 ` [PATCH v2 07/10] configs: am62: Add configs for enabling ETHBOOT in R5SPL Chintan Vankar
2024-04-25 12:08 ` [PATCH v2 08/10] configs: am62: Enable configs required for Ethboot Chintan Vankar
2024-04-25 12:08 ` [PATCH v2 09/10] arm: dts: k3-am625-r5-sk: Enable DM services for main_pktdma Chintan Vankar
2024-04-25 12:08 ` [PATCH v2 10/10] arch: arm: dts: k3-am62-sk-u-boot: Add missing "bootph-all" property to phy_gmii_sel node Chintan Vankar
2024-04-25 12:31   ` Roger Quadros
2024-04-25 12:36     ` Chintan Vankar
2024-05-20  6:04       ` Chintan Vankar
2024-05-20 12:13         ` Roger Quadros
2024-05-21  5:36           ` Chintan Vankar

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=d68c8045-116a-49c0-9e74-d6a366e6f008@kernel.org \
    --to=rogerq@kernel.org \
    --cc=afd@ti.com \
    --cc=bmeng@tinylab.org \
    --cc=c-vankar@ti.com \
    --cc=d-gole@ti.com \
    --cc=danishanwar@ti.com \
    --cc=dannenberg@ti.com \
    --cc=devarsht@ti.com \
    --cc=francesco.dolcini@toradex.com \
    --cc=joao.goncalves@toradex.com \
    --cc=kabel@kernel.org \
    --cc=kishon@ti.com \
    --cc=matthias.schiffer@ew.tq-group.com \
    --cc=michal.simek@amd.com \
    --cc=mkorpershoek@baylibre.com \
    --cc=mripard@kernel.org \
    --cc=n-francis@ti.com \
    --cc=n-jain1@ti.com \
    --cc=nm@ti.com \
    --cc=s-vadapalli@ti.com \
    --cc=seanga2@gmail.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=u-kumar1@ti.com \
    --cc=vigneshr@ti.com \
    --cc=w.egorov@phytec.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.