[U-Boot] [PATCH v2 05/18] net: macb: Prepare for driver-model conversion
Andreas Bießmann
andreas at biessmann.org
Sun May 29 00:32:18 CEST 2016
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 at chromium.org>
> Reviewed-by: Heiko Schocher <hs at denx.de>
> Tested-on: smartweb, corvus, taurus, axm
> Tested-by: Heiko Schocher <hs at denx.de>
> Reviewed-by: Joe Hershberger <joe.hershberger at 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 at biessmann.org>
More information about the U-Boot
mailing list