Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: ixp4xx_eth: Drop platform data support

All IXP4xx platforms are converted to device tree, the platform
data path is no longer used. Drop the code and custom include,
confine the driver in its own file.

Depend on OF and remove ifdefs around this, as we are all probing
from OF now.

Cc: David S. Miller <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Jakub Kicinski <kuba@kernel.org>
Link: https://lore.kernel.org/r/20220211223238.648934-9-linus.walleij@linaro.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

+21 -89
+2 -2
drivers/net/ethernet/xscale/Kconfig
··· 20 20 21 21 config IXP4XX_ETH 22 22 tristate "Intel IXP4xx Ethernet support" 23 - depends on ARM && ARCH_IXP4XX && IXP4XX_NPE && IXP4XX_QMGR 23 + depends on ARM && ARCH_IXP4XX && IXP4XX_NPE && IXP4XX_QMGR && OF 24 24 select PHYLIB 25 - select OF_MDIO if OF 25 + select OF_MDIO 26 26 select NET_PTP_CLASSIFY 27 27 help 28 28 Say Y here if you want to use built-in Ethernet ports
+19 -66
drivers/net/ethernet/xscale/ixp4xx_eth.c
··· 30 30 #include <linux/of.h> 31 31 #include <linux/of_mdio.h> 32 32 #include <linux/phy.h> 33 - #include <linux/platform_data/eth_ixp4xx.h> 34 33 #include <linux/platform_device.h> 35 34 #include <linux/ptp_classify.h> 36 35 #include <linux/slab.h> ··· 37 38 #include <linux/soc/ixp4xx/npe.h> 38 39 #include <linux/soc/ixp4xx/qmgr.h> 39 40 #include <linux/soc/ixp4xx/cpu.h> 41 + #include <linux/types.h> 42 + 43 + #define IXP4XX_ETH_NPEA 0x00 44 + #define IXP4XX_ETH_NPEB 0x10 45 + #define IXP4XX_ETH_NPEC 0x20 40 46 41 47 #include "ixp46x_ts.h" 42 48 ··· 150 146 #define free_buffer kfree 151 147 #define free_buffer_irq kfree 152 148 #endif 149 + 150 + /* Information about built-in Ethernet MAC interfaces */ 151 + struct eth_plat_info { 152 + u8 phy; /* MII PHY ID, 0 - 31 */ 153 + u8 rxq; /* configurable, currently 0 - 31 only */ 154 + u8 txreadyq; 155 + u8 hwaddr[6]; 156 + u8 npe; /* NPE instance used by this interface */ 157 + bool has_mdio; /* If this instance has an MDIO bus */ 158 + }; 153 159 154 160 struct eth_regs { 155 161 u32 tx_control[2], __res1[2]; /* 000 */ ··· 1380 1366 .ndo_validate_addr = eth_validate_addr, 1381 1367 }; 1382 1368 1383 - #ifdef CONFIG_OF 1384 1369 static struct eth_plat_info *ixp4xx_of_get_platdata(struct device *dev) 1385 1370 { 1386 1371 struct device_node *np = dev->of_node; ··· 1430 1417 1431 1418 return plat; 1432 1419 } 1433 - #else 1434 - static struct eth_plat_info *ixp4xx_of_get_platdata(struct device *dev) 1435 - { 1436 - return NULL; 1437 - } 1438 - #endif 1439 1420 1440 1421 static int ixp4xx_eth_probe(struct platform_device *pdev) 1441 1422 { ··· 1441 1434 struct port *port; 1442 1435 int err; 1443 1436 1444 - if (np) { 1445 - plat = ixp4xx_of_get_platdata(dev); 1446 - if (!plat) 1447 - return -ENODEV; 1448 - } else { 1449 - plat = dev_get_platdata(dev); 1450 - if (!plat) 1451 - return -ENODEV; 1452 - plat->npe = pdev->id; 1453 - switch (plat->npe) { 1454 - case IXP4XX_ETH_NPEA: 1455 - /* If the MDIO bus is not up yet, defer probe */ 1456 - break; 1457 - case IXP4XX_ETH_NPEB: 1458 - /* On all except IXP43x, NPE-B is used for the MDIO bus. 1459 - * If there is no NPE-B in the feature set, bail out, 1460 - * else we have the MDIO bus here. 1461 - */ 1462 - if (!cpu_is_ixp43x()) { 1463 - if (!(ixp4xx_read_feature_bits() & 1464 - IXP4XX_FEATURE_NPEB_ETH0)) 1465 - return -ENODEV; 1466 - /* Else register the MDIO bus on NPE-B */ 1467 - plat->has_mdio = true; 1468 - } 1469 - break; 1470 - case IXP4XX_ETH_NPEC: 1471 - /* IXP43x lacks NPE-B and uses NPE-C for the MDIO bus 1472 - * access, if there is no NPE-C, no bus, nothing works, 1473 - * so bail out. 1474 - */ 1475 - if (cpu_is_ixp43x()) { 1476 - if (!(ixp4xx_read_feature_bits() & 1477 - IXP4XX_FEATURE_NPEC_ETH)) 1478 - return -ENODEV; 1479 - /* Else register the MDIO bus on NPE-B */ 1480 - plat->has_mdio = true; 1481 - } 1482 - break; 1483 - default: 1484 - return -ENODEV; 1485 - } 1486 - } 1437 + plat = ixp4xx_of_get_platdata(dev); 1438 + if (!plat) 1439 + return -ENODEV; 1487 1440 1488 1441 if (!(ndev = devm_alloc_etherdev(dev, sizeof(struct port)))) 1489 1442 return -ENOMEM; ··· 1497 1530 __raw_writel(DEFAULT_CORE_CNTRL, &port->regs->core_control); 1498 1531 udelay(50); 1499 1532 1500 - if (np) { 1501 - phydev = of_phy_get_and_connect(ndev, np, ixp4xx_adjust_link); 1502 - } else { 1503 - phydev = mdiobus_get_phy(mdio_bus, plat->phy); 1504 - if (!phydev) { 1505 - err = -ENODEV; 1506 - dev_err(dev, "could not connect phydev (%d)\n", err); 1507 - goto err_free_mem; 1508 - } 1509 - err = phy_connect_direct(ndev, phydev, ixp4xx_adjust_link, 1510 - PHY_INTERFACE_MODE_MII); 1511 - if (err) 1512 - goto err_free_mem; 1513 - 1514 - } 1533 + phydev = of_phy_get_and_connect(ndev, np, ixp4xx_adjust_link); 1515 1534 if (!phydev) { 1516 1535 err = -ENODEV; 1517 1536 dev_err(dev, "no phydev\n");
-21
include/linux/platform_data/eth_ixp4xx.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef __PLATFORM_DATA_ETH_IXP4XX 3 - #define __PLATFORM_DATA_ETH_IXP4XX 4 - 5 - #include <linux/types.h> 6 - 7 - #define IXP4XX_ETH_NPEA 0x00 8 - #define IXP4XX_ETH_NPEB 0x10 9 - #define IXP4XX_ETH_NPEC 0x20 10 - 11 - /* Information about built-in Ethernet MAC interfaces */ 12 - struct eth_plat_info { 13 - u8 phy; /* MII PHY ID, 0 - 31 */ 14 - u8 rxq; /* configurable, currently 0 - 31 only */ 15 - u8 txreadyq; 16 - u8 hwaddr[6]; 17 - u8 npe; /* NPE instance used by this interface */ 18 - bool has_mdio; /* If this instance has an MDIO bus */ 19 - }; 20 - 21 - #endif