From: "Rafał Miłecki" <zajec5@gmail.com>
To: Florian Fainelli <f.fainelli@gmail.com>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org,
bcm-kernel-feedback-list@broadcom.com,
"Rafał Miłecki" <rafal@milecki.pl>
Subject: Re: [PATCH net-next] net: bgmac: support MDIO described in DT
Date: Mon, 20 Sep 2021 19:57:06 +0200 [thread overview]
Message-ID: <79c91b0e-7f6a-ef40-9ab2-ee8212bf5791@gmail.com> (raw)
In-Reply-To: <168e00d3-f335-4e62-341f-224e79a08558@gmail.com>
On 20.09.2021 18:11, Florian Fainelli wrote:
> On 9/20/21 5:34 AM, Rafał Miłecki wrote:
>> From: Rafał Miłecki <rafal@milecki.pl>
>>
>> Check ethernet controller DT node for "mdio" subnode and use it with
>> of_mdiobus_register() when present. That allows specifying MDIO and its
>> PHY devices in a standard DT based way.
>>
>> This is required for BCM53573 SoC support which has an MDIO attached
>> switch.
>>
>> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
>> ---
>> drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c b/drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c
>> index 6ce80cbcb48e..086739e4f40a 100644
>> --- a/drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c
>> +++ b/drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c
>> @@ -10,6 +10,7 @@
>>
>> #include <linux/bcma/bcma.h>
>> #include <linux/brcmphy.h>
>> +#include <linux/of_mdio.h>
>> #include "bgmac.h"
>>
>> static bool bcma_mdio_wait_value(struct bcma_device *core, u16 reg, u32 mask,
>> @@ -211,6 +212,7 @@ struct mii_bus *bcma_mdio_mii_register(struct bgmac *bgmac)
>> {
>> struct bcma_device *core = bgmac->bcma.core;
>> struct mii_bus *mii_bus;
>> + struct device_node *np;
>> int err;
>>
>> mii_bus = mdiobus_alloc();
>> @@ -229,7 +231,9 @@ struct mii_bus *bcma_mdio_mii_register(struct bgmac *bgmac)
>> mii_bus->parent = &core->dev;
>> mii_bus->phy_mask = ~(1 << bgmac->phyaddr);
>>
>> - err = mdiobus_register(mii_bus);
>> + np = of_get_child_by_name(core->dev.of_node, "mdio");
>
> I believe this leaks np and the use case is not exactly clear to me
> here. AFAICT the Northstar SoCs have two MDIO controllers: one for
> internal PHYs and one for external PHYs which how you would attach a
> switch to the chip (in chipcommonA). Is 53573 somewhat different here?
> What is the MDIO bus driver that is being used?
of_get_child_by_name() doesn't seem to increase refcount or anything and
I think it's how most drivers handle it. I don't think it should leak.
BCM53573 is a built with some older blocks. Please check:
4ebd50472899 ("ARM: BCM53573: Initial support for Broadcom BCM53573 SoCs")
BCM53573 series is a new family with embedded wireless. By marketing
people it's sometimes called Northstar but it uses different CPU and has
different architecture so we need a new symbol for it.
Fortunately it shares some peripherals with other iProc based SoCs so we
will be able to reuse some drivers/bindings.
e90d2d51c412 ("ARM: BCM5301X: Add basic dts for BCM53573 based Tenda AC9")
BCM53573 seems to be low priced alternative for Northstar chipsts. It
uses single core Cortex-A7 and doesn't have SDU or local (TWD) timer. It
was also stripped out of independent SPI controller and 2 GMACs.
Northstar uses SRAB which is some memory based (0x18007000) access to
switch register space.
BCM53573 uses different blocks & mappings and it doesn't include SRAB at
0x18007000. Accessing switch registers is handled over MDIO.
next prev parent reply other threads:[~2021-09-21 0:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-20 12:34 [PATCH net-next] net: bgmac: support MDIO described in DT Rafał Miłecki
2021-09-20 16:11 ` Florian Fainelli
2021-09-20 17:57 ` Rafał Miłecki [this message]
2021-09-30 14:29 ` Rafał Miłecki
2021-09-30 23:04 ` Florian Fainelli
2021-10-02 11:46 ` Rafał Miłecki
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=79c91b0e-7f6a-ef40-9ab2-ee8212bf5791@gmail.com \
--to=zajec5@gmail.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=rafal@milecki.pl \
/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 NNTP newsgroup(s).