netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] Support for 16nm EPHY in GENET
@ 2021-10-22 16:17 Florian Fainelli
  2021-10-22 16:17 ` [PATCH net-next 1/3] net: phy: bcm7xxx: Add EPHY entry for 7712 Florian Fainelli
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Florian Fainelli @ 2021-10-22 16:17 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, Doug Berger, David S. Miller, Jakub Kicinski,
	open list:BROADCOM GENET ETHERNET DRIVER, open list

Hi David, Jakub,

Recent Broadcom STB devices using GENET are taped out in a 16nm process
and utilize an internal 10/100 EPHY which requires a small set of
changes to the GENET driver for power up/down. The first patch adds an
EPHY driver entry for 7712, the second patch updates the DT binding and
the last patch modifies GENET accordingly.

Florian Fainelli (3):
  net: phy: bcm7xxx: Add EPHY entry for 7712
  dt-bindings: net: bcmgenet: Document 7712 binding
  net: bcmgenet: Add support for 7712 16nm internal EPHY

 .../devicetree/bindings/net/brcm,bcmgenet.txt       |  3 ++-
 drivers/net/ethernet/broadcom/genet/bcmgenet.c      | 13 +++++++++++--
 drivers/net/ethernet/broadcom/genet/bcmgenet.h      |  2 ++
 drivers/net/ethernet/broadcom/genet/bcmmii.c        |  7 ++++---
 drivers/net/phy/bcm7xxx.c                           |  2 ++
 include/linux/brcmphy.h                             |  1 +
 6 files changed, 22 insertions(+), 6 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH net-next 1/3] net: phy: bcm7xxx: Add EPHY entry for 7712
  2021-10-22 16:17 [PATCH net-next 0/3] Support for 16nm EPHY in GENET Florian Fainelli
@ 2021-10-22 16:17 ` Florian Fainelli
  2021-10-22 19:30   ` Andrew Lunn
  2021-10-22 16:17 ` [PATCH net-next 2/3] dt-bindings: net: bcmgenet: Document 7712 binding Florian Fainelli
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Florian Fainelli @ 2021-10-22 16:17 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, Doug Berger, David S. Miller, Jakub Kicinski,
	open list:BROADCOM GENET ETHERNET DRIVER, open list

7712 is a 16nm process SoC with a 10/100 integrated Ethernet PHY,
utilize the recently defined 16nm EPHY macro to configure that PHY.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/phy/bcm7xxx.c | 2 ++
 include/linux/brcmphy.h   | 1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/net/phy/bcm7xxx.c b/drivers/net/phy/bcm7xxx.c
index 6ceadd2a0082..75593e7d1118 100644
--- a/drivers/net/phy/bcm7xxx.c
+++ b/drivers/net/phy/bcm7xxx.c
@@ -936,6 +936,7 @@ static struct phy_driver bcm7xxx_driver[] = {
 	BCM7XXX_40NM_EPHY(PHY_ID_BCM7425, "Broadcom BCM7425"),
 	BCM7XXX_40NM_EPHY(PHY_ID_BCM7429, "Broadcom BCM7429"),
 	BCM7XXX_40NM_EPHY(PHY_ID_BCM7435, "Broadcom BCM7435"),
+	BCM7XXX_16NM_EPHY(PHY_ID_BCM7712, "Broadcom BCM7712"),
 };
 
 static struct mdio_device_id __maybe_unused bcm7xxx_tbl[] = {
@@ -958,6 +959,7 @@ static struct mdio_device_id __maybe_unused bcm7xxx_tbl[] = {
 	{ PHY_ID_BCM7439, 0xfffffff0, },
 	{ PHY_ID_BCM7435, 0xfffffff0, },
 	{ PHY_ID_BCM7445, 0xfffffff0, },
+	{ PHY_ID_BCM7712, 0xfffffff0, },
 	{ }
 };
 
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index 27d9b6683f0e..747fad264033 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -50,6 +50,7 @@
 #define PHY_ID_BCM7439			0x600d8480
 #define PHY_ID_BCM7439_2		0xae025080
 #define PHY_ID_BCM7445			0x600d8510
+#define PHY_ID_BCM7712			0x35905330
 
 #define PHY_ID_BCM_CYGNUS		0xae025200
 #define PHY_ID_BCM_OMEGA		0xae025100
-- 
2.25.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH net-next 2/3] dt-bindings: net: bcmgenet: Document 7712 binding
  2021-10-22 16:17 [PATCH net-next 0/3] Support for 16nm EPHY in GENET Florian Fainelli
  2021-10-22 16:17 ` [PATCH net-next 1/3] net: phy: bcm7xxx: Add EPHY entry for 7712 Florian Fainelli
@ 2021-10-22 16:17 ` Florian Fainelli
  2021-10-22 19:30   ` Andrew Lunn
  2021-10-22 16:17 ` [PATCH net-next 3/3] net: bcmgenet: Add support for 7712 16nm internal EPHY Florian Fainelli
  2021-10-24 12:50 ` [PATCH net-next 0/3] Support for 16nm EPHY in GENET patchwork-bot+netdevbpf
  3 siblings, 1 reply; 9+ messages in thread
From: Florian Fainelli @ 2021-10-22 16:17 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, Doug Berger, David S. Miller, Jakub Kicinski,
	open list:BROADCOM GENET ETHERNET DRIVER, open list

7712 includes a GENETv5 adapter with an on-chip 10/100 16nm Ethernet PHY
which requires us to document that controller's integration specifically
for proper driver keying.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 Documentation/devicetree/bindings/net/brcm,bcmgenet.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/brcm,bcmgenet.txt b/Documentation/devicetree/bindings/net/brcm,bcmgenet.txt
index 33a0d67e4ce5..0b5994fba35f 100644
--- a/Documentation/devicetree/bindings/net/brcm,bcmgenet.txt
+++ b/Documentation/devicetree/bindings/net/brcm,bcmgenet.txt
@@ -2,7 +2,8 @@
 
 Required properties:
 - compatible: should contain one of "brcm,genet-v1", "brcm,genet-v2",
-  "brcm,genet-v3", "brcm,genet-v4", "brcm,genet-v5", "brcm,bcm2711-genet-v5".
+  "brcm,genet-v3", "brcm,genet-v4", "brcm,genet-v5", "brcm,bcm2711-genet-v5" or
+  "brcm,bcm7712-genet-v5".
 - reg: address and length of the register set for the device
 - interrupts and/or interrupts-extended: must be two cells, the first cell
   is the general purpose interrupt line, while the second cell is the
-- 
2.25.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH net-next 3/3] net: bcmgenet: Add support for 7712 16nm internal EPHY
  2021-10-22 16:17 [PATCH net-next 0/3] Support for 16nm EPHY in GENET Florian Fainelli
  2021-10-22 16:17 ` [PATCH net-next 1/3] net: phy: bcm7xxx: Add EPHY entry for 7712 Florian Fainelli
  2021-10-22 16:17 ` [PATCH net-next 2/3] dt-bindings: net: bcmgenet: Document 7712 binding Florian Fainelli
@ 2021-10-22 16:17 ` Florian Fainelli
  2021-10-22 19:36   ` Andrew Lunn
  2021-10-24 12:50 ` [PATCH net-next 0/3] Support for 16nm EPHY in GENET patchwork-bot+netdevbpf
  3 siblings, 1 reply; 9+ messages in thread
From: Florian Fainelli @ 2021-10-22 16:17 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, Doug Berger, David S. Miller, Jakub Kicinski,
	open list:BROADCOM GENET ETHERNET DRIVER, open list

The 16nm internal EPHY that is present in 7712 is actually a 16nm
Gigabit PHY which has been forced to operate in 10/100 mode. Its
controls are therefore via the EXT_GPHY_CTRL registers and not via the
EXT_EPHY_CTRL which are used for all GENETv5 adapters. Add a match on
the 7712 compatible string to allow that differentiation to happen.

On previous GENETv4 chips the EXT_CFG_IDDQ_GLOBAL_PWR bit was cleared by
default, but this is not the case with this chip, so we need to make
sure we clear it to power on the EPHY.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 13 +++++++++++--
 drivers/net/ethernet/broadcom/genet/bcmgenet.h |  2 ++
 drivers/net/ethernet/broadcom/genet/bcmmii.c   |  7 ++++---
 3 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 5da9c00b43b1..226f4403cfed 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -1653,7 +1653,7 @@ static int bcmgenet_power_down(struct bcmgenet_priv *priv,
 		/* Power down LED */
 		if (priv->hw_params->flags & GENET_HAS_EXT) {
 			reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT);
-			if (GENET_IS_V5(priv))
+			if (GENET_IS_V5(priv) && !priv->ephy_16nm)
 				reg |= EXT_PWR_DOWN_PHY_EN |
 				       EXT_PWR_DOWN_PHY_RD |
 				       EXT_PWR_DOWN_PHY_SD |
@@ -1690,7 +1690,7 @@ static void bcmgenet_power_up(struct bcmgenet_priv *priv,
 	case GENET_POWER_PASSIVE:
 		reg &= ~(EXT_PWR_DOWN_DLL | EXT_PWR_DOWN_BIAS |
 			 EXT_ENERGY_DET_MASK);
-		if (GENET_IS_V5(priv)) {
+		if (GENET_IS_V5(priv) && !priv->ephy_16nm) {
 			reg &= ~(EXT_PWR_DOWN_PHY_EN |
 				 EXT_PWR_DOWN_PHY_RD |
 				 EXT_PWR_DOWN_PHY_SD |
@@ -3910,6 +3910,7 @@ static void bcmgenet_set_hw_params(struct bcmgenet_priv *priv)
 struct bcmgenet_plat_data {
 	enum bcmgenet_version version;
 	u32 dma_max_burst_length;
+	bool ephy_16nm;
 };
 
 static const struct bcmgenet_plat_data v1_plat_data = {
@@ -3942,6 +3943,12 @@ static const struct bcmgenet_plat_data bcm2711_plat_data = {
 	.dma_max_burst_length = 0x08,
 };
 
+static const struct bcmgenet_plat_data bcm7712_plat_data = {
+	.version = GENET_V5,
+	.dma_max_burst_length = DMA_MAX_BURST_LENGTH,
+	.ephy_16nm = true,
+};
+
 static const struct of_device_id bcmgenet_match[] = {
 	{ .compatible = "brcm,genet-v1", .data = &v1_plat_data },
 	{ .compatible = "brcm,genet-v2", .data = &v2_plat_data },
@@ -3949,6 +3956,7 @@ static const struct of_device_id bcmgenet_match[] = {
 	{ .compatible = "brcm,genet-v4", .data = &v4_plat_data },
 	{ .compatible = "brcm,genet-v5", .data = &v5_plat_data },
 	{ .compatible = "brcm,bcm2711-genet-v5", .data = &bcm2711_plat_data },
+	{ .compatible = "brcm,bcm7712-genet-v5", .data = &bcm7712_plat_data },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, bcmgenet_match);
@@ -4029,6 +4037,7 @@ static int bcmgenet_probe(struct platform_device *pdev)
 	if (pdata) {
 		priv->version = pdata->version;
 		priv->dma_max_burst_length = pdata->dma_max_burst_length;
+		priv->ephy_16nm = pdata->ephy_16nm;
 	} else {
 		priv->version = pd->genet_version;
 		priv->dma_max_burst_length = DMA_MAX_BURST_LENGTH;
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.h b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
index 1cc2838e52c6..946f6e283c4e 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.h
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
@@ -329,6 +329,7 @@ struct bcmgenet_mib_counters {
 #define  EXT_CFG_IDDQ_BIAS		(1 << 0)
 #define  EXT_CFG_PWR_DOWN		(1 << 1)
 #define  EXT_CK25_DIS			(1 << 4)
+#define  EXT_CFG_IDDQ_GLOBAL_PWR	(1 << 3)
 #define  EXT_GPHY_RESET			(1 << 5)
 
 /* DMA rings size */
@@ -612,6 +613,7 @@ struct bcmgenet_priv {
 	phy_interface_t phy_interface;
 	int phy_addr;
 	int ext_phy;
+	bool ephy_16nm;
 
 	/* Interrupt variables */
 	struct work_struct bcmgenet_irq_work;
diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
index ad56f54eda0a..5f259641437a 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
@@ -139,14 +139,15 @@ void bcmgenet_phy_power_set(struct net_device *dev, bool enable)
 	u32 reg = 0;
 
 	/* EXT_GPHY_CTRL is only valid for GENETv4 and onward */
-	if (GENET_IS_V4(priv)) {
+	if (GENET_IS_V4(priv) || priv->ephy_16nm) {
 		reg = bcmgenet_ext_readl(priv, EXT_GPHY_CTRL);
 		if (enable) {
 			reg &= ~EXT_CK25_DIS;
 			bcmgenet_ext_writel(priv, reg, EXT_GPHY_CTRL);
 			mdelay(1);
 
-			reg &= ~(EXT_CFG_IDDQ_BIAS | EXT_CFG_PWR_DOWN);
+			reg &= ~(EXT_CFG_IDDQ_BIAS | EXT_CFG_PWR_DOWN |
+				 EXT_CFG_IDDQ_GLOBAL_PWR);
 			reg |= EXT_GPHY_RESET;
 			bcmgenet_ext_writel(priv, reg, EXT_GPHY_CTRL);
 			mdelay(1);
@@ -154,7 +155,7 @@ void bcmgenet_phy_power_set(struct net_device *dev, bool enable)
 			reg &= ~EXT_GPHY_RESET;
 		} else {
 			reg |= EXT_CFG_IDDQ_BIAS | EXT_CFG_PWR_DOWN |
-			       EXT_GPHY_RESET;
+			       EXT_GPHY_RESET | EXT_CFG_IDDQ_GLOBAL_PWR;
 			bcmgenet_ext_writel(priv, reg, EXT_GPHY_CTRL);
 			mdelay(1);
 			reg |= EXT_CK25_DIS;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next 1/3] net: phy: bcm7xxx: Add EPHY entry for 7712
  2021-10-22 16:17 ` [PATCH net-next 1/3] net: phy: bcm7xxx: Add EPHY entry for 7712 Florian Fainelli
@ 2021-10-22 19:30   ` Andrew Lunn
  0 siblings, 0 replies; 9+ messages in thread
From: Andrew Lunn @ 2021-10-22 19:30 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: netdev, Doug Berger, David S. Miller, Jakub Kicinski,
	open list:BROADCOM GENET ETHERNET DRIVER, open list

On Fri, Oct 22, 2021 at 09:17:01AM -0700, Florian Fainelli wrote:
> 7712 is a 16nm process SoC with a 10/100 integrated Ethernet PHY,
> utilize the recently defined 16nm EPHY macro to configure that PHY.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next 2/3] dt-bindings: net: bcmgenet: Document 7712 binding
  2021-10-22 16:17 ` [PATCH net-next 2/3] dt-bindings: net: bcmgenet: Document 7712 binding Florian Fainelli
@ 2021-10-22 19:30   ` Andrew Lunn
  0 siblings, 0 replies; 9+ messages in thread
From: Andrew Lunn @ 2021-10-22 19:30 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: netdev, Doug Berger, David S. Miller, Jakub Kicinski,
	open list:BROADCOM GENET ETHERNET DRIVER, open list

On Fri, Oct 22, 2021 at 09:17:02AM -0700, Florian Fainelli wrote:
> 7712 includes a GENETv5 adapter with an on-chip 10/100 16nm Ethernet PHY
> which requires us to document that controller's integration specifically
> for proper driver keying.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next 3/3] net: bcmgenet: Add support for 7712 16nm internal EPHY
  2021-10-22 16:17 ` [PATCH net-next 3/3] net: bcmgenet: Add support for 7712 16nm internal EPHY Florian Fainelli
@ 2021-10-22 19:36   ` Andrew Lunn
  2021-10-22 19:38     ` Florian Fainelli
  0 siblings, 1 reply; 9+ messages in thread
From: Andrew Lunn @ 2021-10-22 19:36 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: netdev, Doug Berger, David S. Miller, Jakub Kicinski,
	open list:BROADCOM GENET ETHERNET DRIVER, open list

On Fri, Oct 22, 2021 at 09:17:03AM -0700, Florian Fainelli wrote:
> The 16nm internal EPHY that is present in 7712 is actually a 16nm
> Gigabit PHY which has been forced to operate in 10/100 mode.

Hi Florian

Will genphy_read_abilities() detect it as a 1G PHY? Does bcmgenet.c
need to call phy_set_max_speed() to stop it advertising 1G?

Andrew

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next 3/3] net: bcmgenet: Add support for 7712 16nm internal EPHY
  2021-10-22 19:36   ` Andrew Lunn
@ 2021-10-22 19:38     ` Florian Fainelli
  0 siblings, 0 replies; 9+ messages in thread
From: Florian Fainelli @ 2021-10-22 19:38 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli
  Cc: netdev, Doug Berger, David S. Miller, Jakub Kicinski,
	open list:BROADCOM GENET ETHERNET DRIVER, open list

Hello Andrew,

On 10/22/21 12:36 PM, Andrew Lunn wrote:
> On Fri, Oct 22, 2021 at 09:17:03AM -0700, Florian Fainelli wrote:
>> The 16nm internal EPHY that is present in 7712 is actually a 16nm
>> Gigabit PHY which has been forced to operate in 10/100 mode.
> 
> Hi Florian
> 
> Will genphy_read_abilities() detect it as a 1G PHY? Does bcmgenet.c
> need to call phy_set_max_speed() to stop it advertising 1G?

That is not necessary, the capabilities have been adjusted accordingly,
the PHY only advertises 10/100 and not above.
-- 
Florian

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next 0/3] Support for 16nm EPHY in GENET
  2021-10-22 16:17 [PATCH net-next 0/3] Support for 16nm EPHY in GENET Florian Fainelli
                   ` (2 preceding siblings ...)
  2021-10-22 16:17 ` [PATCH net-next 3/3] net: bcmgenet: Add support for 7712 16nm internal EPHY Florian Fainelli
@ 2021-10-24 12:50 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 9+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-10-24 12:50 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: netdev, opendmb, davem, kuba, bcm-kernel-feedback-list, linux-kernel

Hello:

This series was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Fri, 22 Oct 2021 09:17:00 -0700 you wrote:
> Hi David, Jakub,
> 
> Recent Broadcom STB devices using GENET are taped out in a 16nm process
> and utilize an internal 10/100 EPHY which requires a small set of
> changes to the GENET driver for power up/down. The first patch adds an
> EPHY driver entry for 7712, the second patch updates the DT binding and
> the last patch modifies GENET accordingly.
> 
> [...]

Here is the summary with links:
  - [net-next,1/3] net: phy: bcm7xxx: Add EPHY entry for 7712
    https://git.kernel.org/netdev/net-next/c/218f23e8a96f
  - [net-next,2/3] dt-bindings: net: bcmgenet: Document 7712 binding
    https://git.kernel.org/netdev/net-next/c/f4b054d9bb2b
  - [net-next,3/3] net: bcmgenet: Add support for 7712 16nm internal EPHY
    https://git.kernel.org/netdev/net-next/c/3cd92eae9104

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-10-24 12:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-22 16:17 [PATCH net-next 0/3] Support for 16nm EPHY in GENET Florian Fainelli
2021-10-22 16:17 ` [PATCH net-next 1/3] net: phy: bcm7xxx: Add EPHY entry for 7712 Florian Fainelli
2021-10-22 19:30   ` Andrew Lunn
2021-10-22 16:17 ` [PATCH net-next 2/3] dt-bindings: net: bcmgenet: Document 7712 binding Florian Fainelli
2021-10-22 19:30   ` Andrew Lunn
2021-10-22 16:17 ` [PATCH net-next 3/3] net: bcmgenet: Add support for 7712 16nm internal EPHY Florian Fainelli
2021-10-22 19:36   ` Andrew Lunn
2021-10-22 19:38     ` Florian Fainelli
2021-10-24 12:50 ` [PATCH net-next 0/3] Support for 16nm EPHY in GENET patchwork-bot+netdevbpf

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).