Skip to content

Commit c8200f4

Browse files
author
Linus Walleij
committed
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>
1 parent 8754a7e commit c8200f4

File tree

3 files changed

+21
-89
lines changed

3 files changed

+21
-89
lines changed

drivers/net/ethernet/xscale/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ if NET_VENDOR_XSCALE
2020

2121
config IXP4XX_ETH
2222
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
2424
select PHYLIB
25-
select OF_MDIO if OF
25+
select OF_MDIO
2626
select NET_PTP_CLASSIFY
2727
help
2828
Say Y here if you want to use built-in Ethernet ports

drivers/net/ethernet/xscale/ixp4xx_eth.c

Lines changed: 19 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,18 @@
3030
#include <linux/of.h>
3131
#include <linux/of_mdio.h>
3232
#include <linux/phy.h>
33-
#include <linux/platform_data/eth_ixp4xx.h>
3433
#include <linux/platform_device.h>
3534
#include <linux/ptp_classify.h>
3635
#include <linux/slab.h>
3736
#include <linux/module.h>
3837
#include <linux/soc/ixp4xx/npe.h>
3938
#include <linux/soc/ixp4xx/qmgr.h>
4039
#include <linux/soc/ixp4xx/cpu.h>
40+
#include <linux/types.h>
41+
42+
#define IXP4XX_ETH_NPEA 0x00
43+
#define IXP4XX_ETH_NPEB 0x10
44+
#define IXP4XX_ETH_NPEC 0x20
4145

4246
#include "ixp46x_ts.h"
4347

@@ -147,6 +151,16 @@ typedef void buffer_t;
147151
#define free_buffer_irq kfree
148152
#endif
149153

154+
/* Information about built-in Ethernet MAC interfaces */
155+
struct eth_plat_info {
156+
u8 phy; /* MII PHY ID, 0 - 31 */
157+
u8 rxq; /* configurable, currently 0 - 31 only */
158+
u8 txreadyq;
159+
u8 hwaddr[6];
160+
u8 npe; /* NPE instance used by this interface */
161+
bool has_mdio; /* If this instance has an MDIO bus */
162+
};
163+
150164
struct eth_regs {
151165
u32 tx_control[2], __res1[2]; /* 000 */
152166
u32 rx_control[2], __res2[2]; /* 010 */
@@ -1366,7 +1380,6 @@ static const struct net_device_ops ixp4xx_netdev_ops = {
13661380
.ndo_validate_addr = eth_validate_addr,
13671381
};
13681382

1369-
#ifdef CONFIG_OF
13701383
static struct eth_plat_info *ixp4xx_of_get_platdata(struct device *dev)
13711384
{
13721385
struct device_node *np = dev->of_node;
@@ -1417,12 +1430,6 @@ static struct eth_plat_info *ixp4xx_of_get_platdata(struct device *dev)
14171430

14181431
return plat;
14191432
}
1420-
#else
1421-
static struct eth_plat_info *ixp4xx_of_get_platdata(struct device *dev)
1422-
{
1423-
return NULL;
1424-
}
1425-
#endif
14261433

14271434
static int ixp4xx_eth_probe(struct platform_device *pdev)
14281435
{
@@ -1434,49 +1441,9 @@ static int ixp4xx_eth_probe(struct platform_device *pdev)
14341441
struct port *port;
14351442
int err;
14361443

1437-
if (np) {
1438-
plat = ixp4xx_of_get_platdata(dev);
1439-
if (!plat)
1440-
return -ENODEV;
1441-
} else {
1442-
plat = dev_get_platdata(dev);
1443-
if (!plat)
1444-
return -ENODEV;
1445-
plat->npe = pdev->id;
1446-
switch (plat->npe) {
1447-
case IXP4XX_ETH_NPEA:
1448-
/* If the MDIO bus is not up yet, defer probe */
1449-
break;
1450-
case IXP4XX_ETH_NPEB:
1451-
/* On all except IXP43x, NPE-B is used for the MDIO bus.
1452-
* If there is no NPE-B in the feature set, bail out,
1453-
* else we have the MDIO bus here.
1454-
*/
1455-
if (!cpu_is_ixp43x()) {
1456-
if (!(ixp4xx_read_feature_bits() &
1457-
IXP4XX_FEATURE_NPEB_ETH0))
1458-
return -ENODEV;
1459-
/* Else register the MDIO bus on NPE-B */
1460-
plat->has_mdio = true;
1461-
}
1462-
break;
1463-
case IXP4XX_ETH_NPEC:
1464-
/* IXP43x lacks NPE-B and uses NPE-C for the MDIO bus
1465-
* access, if there is no NPE-C, no bus, nothing works,
1466-
* so bail out.
1467-
*/
1468-
if (cpu_is_ixp43x()) {
1469-
if (!(ixp4xx_read_feature_bits() &
1470-
IXP4XX_FEATURE_NPEC_ETH))
1471-
return -ENODEV;
1472-
/* Else register the MDIO bus on NPE-B */
1473-
plat->has_mdio = true;
1474-
}
1475-
break;
1476-
default:
1477-
return -ENODEV;
1478-
}
1479-
}
1444+
plat = ixp4xx_of_get_platdata(dev);
1445+
if (!plat)
1446+
return -ENODEV;
14801447

14811448
if (!(ndev = devm_alloc_etherdev(dev, sizeof(struct port))))
14821449
return -ENOMEM;
@@ -1530,21 +1497,7 @@ static int ixp4xx_eth_probe(struct platform_device *pdev)
15301497
__raw_writel(DEFAULT_CORE_CNTRL, &port->regs->core_control);
15311498
udelay(50);
15321499

1533-
if (np) {
1534-
phydev = of_phy_get_and_connect(ndev, np, ixp4xx_adjust_link);
1535-
} else {
1536-
phydev = mdiobus_get_phy(mdio_bus, plat->phy);
1537-
if (!phydev) {
1538-
err = -ENODEV;
1539-
dev_err(dev, "could not connect phydev (%d)\n", err);
1540-
goto err_free_mem;
1541-
}
1542-
err = phy_connect_direct(ndev, phydev, ixp4xx_adjust_link,
1543-
PHY_INTERFACE_MODE_MII);
1544-
if (err)
1545-
goto err_free_mem;
1546-
1547-
}
1500+
phydev = of_phy_get_and_connect(ndev, np, ixp4xx_adjust_link);
15481501
if (!phydev) {
15491502
err = -ENODEV;
15501503
dev_err(dev, "no phydev\n");

include/linux/platform_data/eth_ixp4xx.h

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)