* [PATCH net] net: phy: broadcom: add support for BCM54811 PHY
@ 2020-05-15 5:22 Kevin Lo
2020-05-15 15:53 ` Florian Fainelli
0 siblings, 1 reply; 3+ messages in thread
From: Kevin Lo @ 2020-05-15 5:22 UTC (permalink / raw)
To: netdev; +Cc: Andrew Lunn, Florian Fainelli, David S. Miller
The BCM54811 PHY shares many similarities with the already supported BCM54810
PHY but additionally requires some semi-unique configuration.
Signed-off-by: Kevin Lo <kevlo@kevlo.org>
---
diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
index d14d91b759b7..0360a5cfdb9e 100644
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -195,7 +195,8 @@ static void bcm54xx_adjust_rxrefclk(struct phy_device *phydev)
if (BRCM_PHY_MODEL(phydev) != PHY_ID_BCM57780 &&
BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610 &&
BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610M &&
- BRCM_PHY_MODEL(phydev) != PHY_ID_BCM54810)
+ BRCM_PHY_MODEL(phydev) != PHY_ID_BCM54810 &&
+ BRCM_PHY_MODEL(phydev) != PHY_ID_BCM54811)
return;
val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_SCR3);
@@ -214,8 +215,10 @@ static void bcm54xx_adjust_rxrefclk(struct phy_device *phydev)
clk125en = false;
} else {
if (phydev->dev_flags & PHY_BRCM_RX_REFCLK_UNUSED) {
- /* Here, bit 0 _enables_ CLK125 when set */
- val &= ~BCM54XX_SHD_SCR3_DEF_CLK125;
+ if (BRCM_PHY_MODEL(phydev) != PHY_ID_BCM54811) {
+ /* Here, bit 0 _enables_ CLK125 when set */
+ val &= ~BCM54XX_SHD_SCR3_DEF_CLK125;
+ }
clk125en = false;
}
}
@@ -226,7 +229,8 @@ static void bcm54xx_adjust_rxrefclk(struct phy_device *phydev)
val |= BCM54XX_SHD_SCR3_DLLAPD_DIS;
if (phydev->dev_flags & PHY_BRCM_DIS_TXCRXC_NOENRGY) {
- if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54810)
+ if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54810 ||
+ BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54811)
val |= BCM54810_SHD_SCR3_TRDDAPD;
else
val |= BCM54XX_SHD_SCR3_TRDDAPD;
@@ -331,6 +335,32 @@ static int bcm54xx_resume(struct phy_device *phydev)
return bcm54xx_config_init(phydev);
}
+static int bcm54811_config_init(struct phy_device *phydev)
+{
+ int err, reg;
+
+ /* Disable BroadR-Reach function. */
+ reg = bcm_phy_read_exp(phydev, BCM54810_EXP_BROADREACH_LRE_MISC_CTL);
+ reg &= ~BCM54810_EXP_BROADREACH_LRE_MISC_CTL_EN;
+ err = bcm_phy_write_exp(phydev, BCM54810_EXP_BROADREACH_LRE_MISC_CTL,
+ reg);
+ if (err < 0)
+ return err;
+
+ err = bcm54xx_config_init(phydev);
+
+ /* Enable CLK125 MUX on LED4 if ref clock is enabled. */
+ if (!(phydev->dev_flags & PHY_BRCM_RX_REFCLK_UNUSED)) {
+ reg = bcm_phy_read_exp(phydev, BCM54612E_EXP_SPARE0);
+ err = bcm_phy_write_exp(phydev, BCM54612E_EXP_SPARE0,
+ BCM54612E_LED4_CLK125OUT_EN | reg);
+ if (err < 0)
+ return err;
+ }
+
+ return err;
+}
+
static int bcm5482_config_init(struct phy_device *phydev)
{
int err, reg;
@@ -726,6 +756,17 @@ static struct phy_driver broadcom_drivers[] = {
.config_intr = bcm_phy_config_intr,
.suspend = genphy_suspend,
.resume = bcm54xx_resume,
+}, {
+ .phy_id = PHY_ID_BCM54811,
+ .phy_id_mask = 0xfffffff0,
+ .name = "Broadcom BCM54811",
+ /* PHY_GBIT_FEATURES */
+ .config_init = bcm54811_config_init,
+ .config_aneg = bcm5481_config_aneg,
+ .ack_interrupt = bcm_phy_ack_intr,
+ .config_intr = bcm_phy_config_intr,
+ .suspend = genphy_suspend,
+ .resume = bcm54xx_resume,
}, {
.phy_id = PHY_ID_BCM5482,
.phy_id_mask = 0xfffffff0,
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index f4b77018c625..8f1a06bb3ac2 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -16,6 +16,7 @@
#define PHY_ID_BCM5481 0x0143bca0
#define PHY_ID_BCM5395 0x0143bcf0
#define PHY_ID_BCM54810 0x03625d00
+#define PHY_ID_BCM54811 0x03625cc0
#define PHY_ID_BCM5482 0x0143bcb0
#define PHY_ID_BCM5411 0x00206070
#define PHY_ID_BCM5421 0x002060e0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: phy: broadcom: add support for BCM54811 PHY
2020-05-15 5:22 [PATCH net] net: phy: broadcom: add support for BCM54811 PHY Kevin Lo
@ 2020-05-15 15:53 ` Florian Fainelli
2020-05-15 17:22 ` Kevin Lo
0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2020-05-15 15:53 UTC (permalink / raw)
To: Kevin Lo, netdev; +Cc: Andrew Lunn, David S. Miller
On 5/14/2020 10:22 PM, Kevin Lo wrote:
> The BCM54811 PHY shares many similarities with the already supported BCM54810
> PHY but additionally requires some semi-unique configuration.
This looks mostly fine, just a couple of nits:
- the patch should be submitted against net-next, since it is a new
feature/addition and not a bug fix
- you need an additional entry to support the automatic loading of the
PHY driver, that means adding an entry to the broadcom_tbl array.
With that:
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: phy: broadcom: add support for BCM54811 PHY
2020-05-15 15:53 ` Florian Fainelli
@ 2020-05-15 17:22 ` Kevin Lo
0 siblings, 0 replies; 3+ messages in thread
From: Kevin Lo @ 2020-05-15 17:22 UTC (permalink / raw)
To: Florian Fainelli; +Cc: netdev, Andrew Lunn, David S. Miller
On Fri, May 15, 2020 at 08:53:37AM -0700, Florian Fainelli wrote:
>
>
>
> On 5/14/2020 10:22 PM, Kevin Lo wrote:
> > The BCM54811 PHY shares many similarities with the already supported BCM54810
> > PHY but additionally requires some semi-unique configuration.
>
> This looks mostly fine, just a couple of nits:
>
> - the patch should be submitted against net-next, since it is a new
> feature/addition and not a bug fix
>
> - you need an additional entry to support the automatic loading of the
> PHY driver, that means adding an entry to the broadcom_tbl array.
Thanks for the review. I'm going to send it to net-next.
>
> With that:
>
> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
> --
> Florian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-15 20:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-15 5:22 [PATCH net] net: phy: broadcom: add support for BCM54811 PHY Kevin Lo
2020-05-15 15:53 ` Florian Fainelli
2020-05-15 17:22 ` Kevin Lo
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).