diff --git a/drivers/net/ep93xx.c b/drivers/net/ep93xx.c index 527ce25..0acb9b6 100644 --- a/drivers/net/ep93xx.c +++ b/drivers/net/ep93xx.c @@ -38,6 +38,7 @@ #include #include #include +#include #include "ep93xx.h" #define EP93XX_MAX_PKT_SIZE 1536 @@ -203,8 +204,8 @@ pr_debug("+ep93xx_eth_open\n"); - ret = phy_device_connect(edev, &priv->miibus, 0, NULL, - 0, PHY_INTERFACE_MODE_NA); + ret = phy_device_connect(edev, &priv->miibus, priv->phy_addr, NULL, + 0, priv->interface); if (ret) return ret; @@ -482,6 +483,7 @@ static int ep93xx_eth_probe(struct device_d *dev) { + struct ep93xx_eth_platform_data *pdata = (struct ep93xx_eth_platform_data *)dev->platform_data; struct eth_device *edev; struct ep93xx_eth_priv *priv; int ret = -1; @@ -504,6 +506,14 @@ edev->set_ethaddr = ep93xx_eth_set_ethaddr; edev->parent = dev; + if (pdata) { + priv->interface = pdata->xcv_type; + priv->phy_addr = pdata->phy_addr; + } else { + priv->interface = PHY_INTERFACE_MODE_NA; + priv->phy_addr = 0; + } + priv->miibus.read = ep93xx_phy_read; priv->miibus.write = ep93xx_phy_write; priv->miibus.parent = dev; diff --git a/drivers/net/ep93xx.h b/drivers/net/ep93xx.h index 89451b8..32ae57f 100644 --- a/drivers/net/ep93xx.h +++ b/drivers/net/ep93xx.h @@ -137,6 +137,8 @@ struct tx_descriptor_queue tx_dq; struct tx_status_queue tx_sq; + int phy_addr; + phy_interface_t interface; struct mii_bus miibus; }; diff --git a/include/net/ep93xx_eth.h b/include/net/ep93xx_eth.h new file mode 100644 index 0000000..0fb11d0 --- /dev/null +++ b/include/net/ep93xx_eth.h @@ -0,0 +1,26 @@ +/* + * (C) Copyright 2016 Alexander Kurz + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef __NET_EP93XX_ETH_H +#define __NET_EP93XX_ETH_H + +#include + +struct ep93xx_eth_platform_data { + phy_interface_t xcv_type; + int phy_addr; +}; + +#endif /* __NET_EP93XX_ETH_H */