
Hi Andreas,
On 28 May 2016 at 16:32, Andreas Bießmann andreas@biessmann.org wrote:
Hi Simon,
On 05.05.16 15:28, Simon Glass wrote:
Adjust this driver to avoid using struct netdev in functions that driver model will call. Also refactor the receive function to be compatible with driver model.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Heiko Schocher hs@denx.de Tested-on: smartweb, corvus, taurus, axm Tested-by: Heiko Schocher hs@denx.de Reviewed-by: Joe Hershberger joe.hershberger@ni.com
Changes in v2: None
drivers/net/macb.c | 199 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 124 insertions(+), 75 deletions(-)
<snip>
-static int macb_phy_init(struct macb_device *macb) +static int macb_phy_init(struct macb_device *macb, const char *name) {
struct eth_device *netdev = &macb->netdev;
#ifdef CONFIG_PHYLIB struct phy_device *phydev; #endif @@ -452,7 +450,7 @@ static int macb_phy_init(struct macb_device *macb) int media, speed, duplex; int i;
arch_get_mdio_control(netdev->name);
arch_get_mdio_control(name);
#ifdef CONFIG_MACB_SEARCH_PHY /* Auto-detect phy_addr */ if (!macb_phy_find(macb)) @@ -462,13 +460,13 @@ static int macb_phy_init(struct macb_device *macb) /* Check if the PHY is up to snuff... */ phy_id = macb_mdio_read(macb, MII_PHYSID1); if (phy_id == 0xffff) {
printf("%s: No PHY present\n", netdev->name);
printf("%s: No PHY present\n", name); return 0; }
#ifdef CONFIG_PHYLIB /* need to consider other phy interface mode */
phydev = phy_connect(macb->bus, macb->phy_addr, netdev,
phydev = phy_connect(macb->bus, macb->phy_addr, &macb->netdev,
is this intentional? You removed every reference to netdev but retained this one. Well, it's clear to me that you have to provide an eth_device to phy_connect() but why change the function then and add the *name to function parameters?
PHY_INTERFACE_MODE_RGMII); if (!phydev) { printf("phy_connect failed\n");
No more questions ...
Reviewed-by: Andreas Bießmann andreas@biessmann.org
Sorry for missing this. Actually this will need tweaking - I think Joe pointed out that CONFIG_PHYLIB should not be used in modern code. But in any case it is closer to converted (to driver model) than it was. I think when something tries this out on a board that uses that they can fix it and test. It will need to call phy_connect_dev() instead.
Regards, Simon