netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: bcmgenet: remove unused platform code
@ 2025-10-14  6:02 Heiner Kallweit
  2025-10-14 13:13 ` Simon Horman
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Heiner Kallweit @ 2025-10-14  6:02 UTC (permalink / raw)
  To: Doug Berger, Florian Fainelli,
	Broadcom internal kernel review list, Andrew Lunn, Paolo Abeni,
	Eric Dumazet, Jakub Kicinski, David Miller, Florian Fainelli
  Cc: netdev@vger.kernel.org

This effectively reverts b0ba512e25d7 ("net: bcmgenet: enable driver to
work without a device tree"). There has never been an in-tree user of
struct bcmgenet_platform_data, all devices use OF or ACPI.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 MAINTAINERS                                   |  1 -
 .../net/ethernet/broadcom/genet/bcmgenet.c    | 20 ++---
 drivers/net/ethernet/broadcom/genet/bcmmii.c  | 75 +------------------
 include/linux/platform_data/bcmgenet.h        | 19 -----
 4 files changed, 7 insertions(+), 108 deletions(-)
 delete mode 100644 include/linux/platform_data/bcmgenet.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 07363437c..cf00f6327 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5111,7 +5111,6 @@ F:	Documentation/devicetree/bindings/net/brcm,unimac-mdio.yaml
 F:	drivers/net/ethernet/broadcom/genet/
 F:	drivers/net/ethernet/broadcom/unimac.h
 F:	drivers/net/mdio/mdio-bcm-unimac.c
-F:	include/linux/platform_data/bcmgenet.h
 F:	include/linux/platform_data/mdio-bcm-unimac.h
 
 BROADCOM IPROC ARM ARCHITECTURE
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 98971ae4f..d99ef92fe 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -35,7 +35,6 @@
 #include <linux/ip.h>
 #include <linux/ipv6.h>
 #include <linux/phy.h>
-#include <linux/platform_data/bcmgenet.h>
 
 #include <linux/unaligned.h>
 
@@ -3926,7 +3925,6 @@ MODULE_DEVICE_TABLE(of, bcmgenet_match);
 
 static int bcmgenet_probe(struct platform_device *pdev)
 {
-	struct bcmgenet_platform_data *pd = pdev->dev.platform_data;
 	const struct bcmgenet_plat_data *pdata;
 	struct bcmgenet_priv *priv;
 	struct net_device *dev;
@@ -4010,9 +4008,6 @@ static int bcmgenet_probe(struct platform_device *pdev)
 		priv->version = pdata->version;
 		priv->dma_max_burst_length = pdata->dma_max_burst_length;
 		priv->flags = pdata->flags;
-	} else {
-		priv->version = pd->genet_version;
-		priv->dma_max_burst_length = DMA_MAX_BURST_LENGTH;
 	}
 
 	priv->clk = devm_clk_get_optional(&priv->pdev->dev, "enet");
@@ -4062,16 +4057,13 @@ static int bcmgenet_probe(struct platform_device *pdev)
 	if (device_get_phy_mode(&pdev->dev) == PHY_INTERFACE_MODE_INTERNAL)
 		bcmgenet_power_up(priv, GENET_POWER_PASSIVE);
 
-	if (pd && !IS_ERR_OR_NULL(pd->mac_address))
-		eth_hw_addr_set(dev, pd->mac_address);
-	else
-		if (device_get_ethdev_address(&pdev->dev, dev))
-			if (has_acpi_companion(&pdev->dev)) {
-				u8 addr[ETH_ALEN];
+	if (device_get_ethdev_address(&pdev->dev, dev))
+		if (has_acpi_companion(&pdev->dev)) {
+			u8 addr[ETH_ALEN];
 
-				bcmgenet_get_hw_addr(priv, addr);
-				eth_hw_addr_set(dev, addr);
-			}
+			bcmgenet_get_hw_addr(priv, addr);
+			eth_hw_addr_set(dev, addr);
+		}
 
 	if (!is_valid_ether_addr(dev->dev_addr)) {
 		dev_warn(&pdev->dev, "using random Ethernet MAC\n");
diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
index 573e8b279..ce60b7330 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
@@ -20,7 +20,6 @@
 #include <linux/of.h>
 #include <linux/of_net.h>
 #include <linux/of_mdio.h>
-#include <linux/platform_data/bcmgenet.h>
 #include <linux/platform_data/mdio-bcm-unimac.h>
 
 #include "bcmgenet.h"
@@ -436,23 +435,6 @@ static struct device_node *bcmgenet_mii_of_find_mdio(struct bcmgenet_priv *priv)
 	return priv->mdio_dn;
 }
 
-static void bcmgenet_mii_pdata_init(struct bcmgenet_priv *priv,
-				    struct unimac_mdio_pdata *ppd)
-{
-	struct device *kdev = &priv->pdev->dev;
-	struct bcmgenet_platform_data *pd = kdev->platform_data;
-
-	if (pd->phy_interface != PHY_INTERFACE_MODE_MOCA && pd->mdio_enabled) {
-		/*
-		 * Internal or external PHY with MDIO access
-		 */
-		if (pd->phy_address >= 0 && pd->phy_address < PHY_MAX_ADDR)
-			ppd->phy_mask = 1 << pd->phy_address;
-		else
-			ppd->phy_mask = 0;
-	}
-}
-
 static int bcmgenet_mii_wait(void *wait_func_data)
 {
 	struct bcmgenet_priv *priv = wait_func_data;
@@ -467,7 +449,6 @@ static int bcmgenet_mii_wait(void *wait_func_data)
 static int bcmgenet_mii_register(struct bcmgenet_priv *priv)
 {
 	struct platform_device *pdev = priv->pdev;
-	struct bcmgenet_platform_data *pdata = pdev->dev.platform_data;
 	struct device_node *dn = pdev->dev.of_node;
 	struct unimac_mdio_pdata ppd;
 	struct platform_device *ppdev;
@@ -511,8 +492,6 @@ static int bcmgenet_mii_register(struct bcmgenet_priv *priv)
 	ppdev->dev.parent = &pdev->dev;
 	if (dn)
 		ppdev->dev.of_node = bcmgenet_mii_of_find_mdio(priv);
-	else if (pdata)
-		bcmgenet_mii_pdata_init(priv, &ppd);
 	else
 		ppd.phy_mask = ~0;
 
@@ -594,58 +573,6 @@ static int bcmgenet_mii_of_init(struct bcmgenet_priv *priv)
 	return 0;
 }
 
-static int bcmgenet_mii_pd_init(struct bcmgenet_priv *priv)
-{
-	struct device *kdev = &priv->pdev->dev;
-	struct bcmgenet_platform_data *pd = kdev->platform_data;
-	char phy_name[MII_BUS_ID_SIZE + 3];
-	char mdio_bus_id[MII_BUS_ID_SIZE];
-	struct phy_device *phydev;
-
-	snprintf(mdio_bus_id, MII_BUS_ID_SIZE, "%s-%d",
-		 UNIMAC_MDIO_DRV_NAME, priv->pdev->id);
-
-	if (pd->phy_interface != PHY_INTERFACE_MODE_MOCA && pd->mdio_enabled) {
-		snprintf(phy_name, MII_BUS_ID_SIZE, PHY_ID_FMT,
-			 mdio_bus_id, pd->phy_address);
-
-		/*
-		 * Internal or external PHY with MDIO access
-		 */
-		phydev = phy_attach(priv->dev, phy_name, pd->phy_interface);
-		if (IS_ERR(phydev)) {
-			dev_err(kdev, "failed to register PHY device\n");
-			return PTR_ERR(phydev);
-		}
-	} else {
-		/*
-		 * MoCA port or no MDIO access.
-		 * Use fixed PHY to represent the link layer.
-		 */
-		struct fixed_phy_status fphy_status = {
-			.link = 1,
-			.speed = pd->phy_speed,
-			.duplex = pd->phy_duplex,
-			.pause = 0,
-			.asym_pause = 0,
-		};
-
-		phydev = fixed_phy_register(&fphy_status, NULL);
-		if (IS_ERR(phydev)) {
-			dev_err(kdev, "failed to register fixed PHY device\n");
-			return PTR_ERR(phydev);
-		}
-
-		/* Make sure we initialize MoCA PHYs with a link down */
-		phydev->link = 0;
-
-	}
-
-	priv->phy_interface = pd->phy_interface;
-
-	return 0;
-}
-
 static int bcmgenet_mii_bus_init(struct bcmgenet_priv *priv)
 {
 	struct device *kdev = &priv->pdev->dev;
@@ -656,7 +583,7 @@ static int bcmgenet_mii_bus_init(struct bcmgenet_priv *priv)
 	else if (has_acpi_companion(kdev))
 		return bcmgenet_phy_interface_init(priv);
 	else
-		return bcmgenet_mii_pd_init(priv);
+		return -EINVAL;
 }
 
 int bcmgenet_mii_init(struct net_device *dev)
diff --git a/include/linux/platform_data/bcmgenet.h b/include/linux/platform_data/bcmgenet.h
deleted file mode 100644
index d8f873862..000000000
--- a/include/linux/platform_data/bcmgenet.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef __LINUX_PLATFORM_DATA_BCMGENET_H__
-#define __LINUX_PLATFORM_DATA_BCMGENET_H__
-
-#include <linux/types.h>
-#include <linux/if_ether.h>
-#include <linux/phy.h>
-
-struct bcmgenet_platform_data {
-	bool		mdio_enabled;
-	phy_interface_t	phy_interface;
-	int		phy_address;
-	int		phy_speed;
-	int		phy_duplex;
-	u8		mac_address[ETH_ALEN];
-	int		genet_version;
-};
-
-#endif
-- 
2.51.0


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

* Re: [PATCH net-next] net: bcmgenet: remove unused platform code
  2025-10-14  6:02 [PATCH net-next] net: bcmgenet: remove unused platform code Heiner Kallweit
@ 2025-10-14 13:13 ` Simon Horman
  2025-10-14 17:00   ` Florian Fainelli
  2025-10-14 16:59 ` Florian Fainelli
  2025-10-15 20:40 ` patchwork-bot+netdevbpf
  2 siblings, 1 reply; 5+ messages in thread
From: Simon Horman @ 2025-10-14 13:13 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: Doug Berger, Florian Fainelli,
	Broadcom internal kernel review list, Andrew Lunn, Paolo Abeni,
	Eric Dumazet, Jakub Kicinski, David Miller, Florian Fainelli,
	netdev@vger.kernel.org

On Tue, Oct 14, 2025 at 08:02:47AM +0200, Heiner Kallweit wrote:
> This effectively reverts b0ba512e25d7 ("net: bcmgenet: enable driver to
> work without a device tree"). There has never been an in-tree user of
> struct bcmgenet_platform_data, all devices use OF or ACPI.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

I'm actually kind of surprised platform driver support was added as
recently as 2014. But I guess there was a reason at the time.

Reviewed-by: Simon Horman <horms@kernel.org>

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

* Re: [PATCH net-next] net: bcmgenet: remove unused platform code
  2025-10-14  6:02 [PATCH net-next] net: bcmgenet: remove unused platform code Heiner Kallweit
  2025-10-14 13:13 ` Simon Horman
@ 2025-10-14 16:59 ` Florian Fainelli
  2025-10-15 20:40 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: Florian Fainelli @ 2025-10-14 16:59 UTC (permalink / raw)
  To: Heiner Kallweit, Doug Berger,
	Broadcom internal kernel review list, Andrew Lunn, Paolo Abeni,
	Eric Dumazet, Jakub Kicinski, David Miller, Florian Fainelli
  Cc: netdev@vger.kernel.org

On 10/13/25 23:02, Heiner Kallweit wrote:
> This effectively reverts b0ba512e25d7 ("net: bcmgenet: enable driver to
> work without a device tree"). There has never been an in-tree user of
> struct bcmgenet_platform_data, all devices use OF or ACPI.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
-- 
Florian

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

* Re: [PATCH net-next] net: bcmgenet: remove unused platform code
  2025-10-14 13:13 ` Simon Horman
@ 2025-10-14 17:00   ` Florian Fainelli
  0 siblings, 0 replies; 5+ messages in thread
From: Florian Fainelli @ 2025-10-14 17:00 UTC (permalink / raw)
  To: Simon Horman, Heiner Kallweit
  Cc: Doug Berger, Broadcom internal kernel review list, Andrew Lunn,
	Paolo Abeni, Eric Dumazet, Jakub Kicinski, David Miller,
	Florian Fainelli, netdev@vger.kernel.org

On 10/14/25 06:13, Simon Horman wrote:
> On Tue, Oct 14, 2025 at 08:02:47AM +0200, Heiner Kallweit wrote:
>> This effectively reverts b0ba512e25d7 ("net: bcmgenet: enable driver to
>> work without a device tree"). There has never been an in-tree user of
>> struct bcmgenet_platform_data, all devices use OF or ACPI.
>>
>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> 
> I'm actually kind of surprised platform driver support was added as
> recently as 2014. But I guess there was a reason at the time.

Upstreaming of that driver was done in 2014 and as a result there was 
interest from a customer at a time to continue to work with the modern 
driver from upstream copied nearly as-is into the vendor tree, hence 
support for platform data was submitted and accepted to facilitate that.

Since said platforms are now supported by the BMIPS_GENERIC platform, 
which is DT only, it makes sense to remove the platform data code now.

Thanks!
-- 
Florian

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

* Re: [PATCH net-next] net: bcmgenet: remove unused platform code
  2025-10-14  6:02 [PATCH net-next] net: bcmgenet: remove unused platform code Heiner Kallweit
  2025-10-14 13:13 ` Simon Horman
  2025-10-14 16:59 ` Florian Fainelli
@ 2025-10-15 20:40 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-10-15 20:40 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: opendmb, florian.fainelli, bcm-kernel-feedback-list,
	andrew+netdev, pabeni, edumazet, kuba, davem, f.fainelli, netdev

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 14 Oct 2025 08:02:47 +0200 you wrote:
> This effectively reverts b0ba512e25d7 ("net: bcmgenet: enable driver to
> work without a device tree"). There has never been an in-tree user of
> struct bcmgenet_platform_data, all devices use OF or ACPI.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  MAINTAINERS                                   |  1 -
>  .../net/ethernet/broadcom/genet/bcmgenet.c    | 20 ++---
>  drivers/net/ethernet/broadcom/genet/bcmmii.c  | 75 +------------------
>  include/linux/platform_data/bcmgenet.h        | 19 -----
>  4 files changed, 7 insertions(+), 108 deletions(-)
>  delete mode 100644 include/linux/platform_data/bcmgenet.h

Here is the summary with links:
  - [net-next] net: bcmgenet: remove unused platform code
    https://git.kernel.org/netdev/net-next/c/378e6523ebb1

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] 5+ messages in thread

end of thread, other threads:[~2025-10-15 20:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-14  6:02 [PATCH net-next] net: bcmgenet: remove unused platform code Heiner Kallweit
2025-10-14 13:13 ` Simon Horman
2025-10-14 17:00   ` Florian Fainelli
2025-10-14 16:59 ` Florian Fainelli
2025-10-15 20:40 ` 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).