summaryrefslogtreecommitdiffstats
path: root/drivers/net/smc911x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/smc911x.c')
-rw-r--r--drivers/net/smc911x.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index 1edc16ce44..767d51761b 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -32,6 +32,8 @@ struct smc911x_priv {
unsigned int using_extphy;
unsigned int phy_mask;
+ void *rx_buf;
+
u32 (*reg_read)(struct smc911x_priv *priv, u32 reg);
void (*reg_write)(struct smc911x_priv *priv, u32 reg, u32 val);
};
@@ -447,7 +449,7 @@ static void smc911x_eth_halt(struct eth_device *edev)
static int smc911x_eth_rx(struct eth_device *edev)
{
struct smc911x_priv *priv = (struct smc911x_priv *)edev->priv;
- u32 *data = (u32 *)NetRxPackets[0];
+ u32 *data = priv->rx_buf;
u32 pktlen, tmplen;
u32 status;
@@ -465,7 +467,7 @@ static int smc911x_eth_rx(struct eth_device *edev)
dev_err(&edev->dev, "dropped bad packet. Status: 0x%08x\n",
status);
else
- net_receive(edev, NetRxPackets[0], pktlen);
+ net_receive(edev, priv->rx_buf, pktlen);
}
return 0;
@@ -479,7 +481,7 @@ static int smc911x_init_dev(struct eth_device *edev)
return 0;
}
-static int smc911x_probe(struct device_d *dev)
+static int smc911x_probe(struct device *dev)
{
struct resource *iores;
struct eth_device *edev;
@@ -503,18 +505,18 @@ static int smc911x_probe(struct device_d *dev)
priv->shift = pdata->shift;
priv->flags = pdata->flags;
priv->phy_mask = pdata->phy_mask;
- } else if (IS_ENABLED(CONFIG_OFDEVICE) && dev->device_node) {
- ret = of_property_read_u32(dev->device_node, "reg-io-width", &val);
+ } else if (IS_ENABLED(CONFIG_OFDEVICE) && dev->of_node) {
+ ret = of_property_read_u32(dev->of_node, "reg-io-width", &val);
if (ret)
return ret;
is_32bit = (val == 4);
- of_property_read_u32(dev->device_node, "reg-shift", &priv->shift);
+ of_property_read_u32(dev->of_node, "reg-shift", &priv->shift);
- if (of_property_read_bool(dev->device_node, "smsc,force-internal-phy"))
+ if (of_property_read_bool(dev->of_node, "smsc,force-internal-phy"))
priv->flags |= SMC911X_FORCE_INTERNAL_PHY;
- if (of_property_read_bool(dev->device_node, "smsc,force-external-phy"))
+ if (of_property_read_bool(dev->of_node, "smsc,force-external-phy"))
priv->flags |= SMC911X_FORCE_EXTERNAL_PHY;
}
@@ -608,6 +610,8 @@ static int smc911x_probe(struct device_d *dev)
dev_info(dev, "LAN911x identified, idrev: 0x%08X, generation: %d\n",
val, priv->generation);
+ priv->rx_buf = xmalloc(PKTSIZE);
+
edev = &priv->edev;
edev->priv = priv;
@@ -638,8 +642,9 @@ static const struct of_device_id smsc911x_dt_ids[] = {
{ .compatible = "smsc,lan9115", },
{ /* sentinel */ }
};
+MODULE_DEVICE_TABLE(of, smsc911x_dt_ids);
-static struct driver_d smc911x_driver = {
+static struct driver smc911x_driver = {
.name = "smc911x",
.probe = smc911x_probe,
.of_compatible = DRV_OF_COMPAT(smsc911x_dt_ids),