From: Giulio Benetti <giulio.benetti@benettiengineering.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Broadcom internal kernel review list
<bcm-kernel-feedback-list@broadcom.com>,
Heiner Kallweit <hkallweit1@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Florian Fainelli <florian.fainelli@broadcom.com>,
Russell King <linux@armlinux.org.uk>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Jim Reinhart <jimr@tekvox.com>, James Autry <jautry@tekvox.com>,
Matthew Maron <matthewm@tekvox.com>
Subject: Re: [PATCH] net: phy: broadcom: add support for BCM5221 phy
Date: Sat, 12 Aug 2023 19:12:19 +0200 [thread overview]
Message-ID: <05fbb2b3-17cb-3d4d-5787-50825c090451@benettiengineering.com> (raw)
In-Reply-To: <0188dd19-7fcb-4bfe-945d-6cb5b57ae80a@lunn.ch>
Hello Andrew,
thank you for reviewing,
On 12/08/23 00:16, Andrew Lunn wrote:
> On Fri, Aug 11, 2023 at 11:53:22PM +0200, Giulio Benetti wrote:
>> This patch adds the BCM5221 PHY support by reusing
>> brcm_fet_config_intr() and brcm_fet_handle_interrupt() and
>> implementing config_init()/suspend()/resume().
>>
>> Sponsored by: Tekvox Inc.
>
> That is a new tag. Maybe you should update
> Documentation/process/submitting-patches.rst ?
I've picked this tag from commit:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=73c289bac05919286f8c7e1660fcaf6ec0468363
it's not "Sponsored-by:", do you think it's better using this last form?
I can send a patch along with V2 of this one for that.
>> +static int bcm5221_config_init(struct phy_device *phydev)
>> +{
>> + int reg, err, err2, brcmtest;
>> +
>> + /* Reset the PHY to bring it to a known state. */
>> + err = phy_write(phydev, MII_BMCR, BMCR_RESET);
>> + if (err < 0)
>> + return err;
>> +
>> + /* The datasheet indicates the PHY needs up to 1us to complete a reset,
>> + * build some slack here.
>> + */
>> + usleep_range(1000, 2000);
>> +
>> + /* The PHY requires 65 MDC clock cycles to complete a write operation
>> + * and turnaround the line properly.
>> + *
>> + * We ignore -EIO here as the MDIO controller (e.g.: mdio-bcm-unimac)
>> + * may flag the lack of turn-around as a read failure. This is
>> + * particularly true with this combination since the MDIO controller
>> + * only used 64 MDC cycles. This is not a critical failure in this
>> + * specific case and it has no functional impact otherwise, so we let
>> + * that one go through. If there is a genuine bus error, the next read
>> + * of MII_BRCM_FET_INTREG will error out.
>> + */
>> + err = phy_read(phydev, MII_BMCR);
>> + if (err < 0 && err != -EIO)
>> + return err;
>
> It is pretty normal to check the value of MII_BMCR and ensure that
> BMCR_RESET has cleared. See phy_poll_reset(). It might not be needed,
> if you trust the datasheet, but 802.3 C22 says it should clear.
oh ok, I'll do that on V2
>
>> + /* Enable auto MDIX */
>> + err = phy_clear_bits(phydev, BCM5221_AEGSR, BCM5221_AEGSR_MDIX_DIS);
>> + if (err < 0)
>> + return err;
>
> It is better to set it based on phydev->mdix_ctrl.
ok,
>
>> @@ -1288,6 +1431,7 @@ static struct mdio_device_id __maybe_unused broadcom_tbl[] = {
>> { PHY_ID_BCM53125, 0xfffffff0 },
>> { PHY_ID_BCM53128, 0xfffffff0 },
>> { PHY_ID_BCM89610, 0xfffffff0 },
>> + { PHY_ID_BCM5221, 0xfffffff0 },
>
> This table has some sort of sorting. I would put this new entry before
> PHY_ID_BCM5241.
right, this and even the struct phy_driver driver entry too then,
>
>> #define PHY_ID_BCM50610 0x0143bd60
>> #define PHY_ID_BCM50610M 0x0143bd70
>> #define PHY_ID_BCM5241 0x0143bc30
>> +#define PHY_ID_BCM5221 0x004061e0
>
> The value looks odd. Is the OUI correct? Is that a broadcom OUI?
Yes, you can check it in the pdf page 37:
https://docs.broadcom.com/doc/5221-DS07-405-RDS.pdf
and yes, it's odd.
Thanks again for the review, I'll do the changes here and the others
suggested by the other and send V2 patch.
Best regards
--
Giulio Benetti
CEO&CTO@Benetti Engineering sas
next prev parent reply other threads:[~2023-08-12 17:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-11 21:53 [PATCH] net: phy: broadcom: add support for BCM5221 phy Giulio Benetti
2023-08-11 22:16 ` Andrew Lunn
2023-08-11 22:39 ` Florian Fainelli
2023-08-12 14:19 ` Andrew Lunn
2023-08-12 17:12 ` Giulio Benetti [this message]
2023-08-11 22:22 ` Russell King (Oracle)
2023-08-12 17:15 ` Giulio Benetti
2023-08-11 23:52 ` Florian Fainelli
2023-08-12 17:27 ` Giulio Benetti
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=05fbb2b3-17cb-3d4d-5787-50825c090451@benettiengineering.com \
--to=giulio.benetti@benettiengineering.com \
--cc=andrew@lunn.ch \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=florian.fainelli@broadcom.com \
--cc=hkallweit1@gmail.com \
--cc=jautry@tekvox.com \
--cc=jimr@tekvox.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=matthewm@tekvox.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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 NNTP newsgroup(s).