Signed-off-by: Luca Ceresoli <luca.ceres...@comelit.it> --- This patch is my implementation of the same functionality that Helmut's patch implements. I'm sending it as a reference for him to look at the error checking code and possibly merge it into his own patch.
drivers/net/smc911x.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 41 insertions(+), 0 deletions(-) diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c index aeafeba..d946fd4 100644 --- a/drivers/net/smc911x.c +++ b/drivers/net/smc911x.c @@ -82,6 +82,42 @@ static int smc911x_miiphy_write(struct eth_device *dev, return 0; } +static int smc911x_miiphy_read_byname(char *devname, unsigned char addr, + unsigned char reg, unsigned short *value) +{ + struct eth_device *dev; + + if (devname == NULL) + return -1; + + dev = eth_get_dev_by_name(devname); + + if (dev == NULL) { + printf(DRIVERNAME ": device %s not found\n", devname); + return -1; + } + + return smc911x_miiphy_read(dev, addr, reg, value); +} + +static int smc911x_miiphy_write_byname(char *devname, unsigned char addr, + unsigned char reg, unsigned short value) +{ + struct eth_device *dev; + + if (devname == NULL) + return -1; + + dev = eth_get_dev_by_name(devname); + + if (dev == NULL) { + printf(DRIVERNAME ": device %s not found\n", devname); + return -1; + } + + return smc911x_miiphy_write(dev, addr, reg, value); +} + static int smc911x_phy_reset(struct eth_device *dev) { u32 reg; @@ -273,5 +309,10 @@ int smc911x_initialize(u8 dev_num, int base_addr) sprintf(dev->name, "%s-%hu", DRIVERNAME, dev_num); eth_register(dev); + +#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) + miiphy_register(dev->name, smc911x_miiphy_read_byname, smc911x_miiphy_write_byname); +#endif + return 1; } -- 1.7.4.1 -------------------------------------------------------------------------- Luca Ceresoli Comelit R&D - Progettazione Software Phone Fax Mail Web YouTube luca.ceres...@comelit.it http://www.comelitgroup.com/ http://www.youtube.com/comelitgroup -------------------------------------------------------------------------- Prima di stampare pensa all'ambiente / Think about environment before printing AVVISO DI CONFIDENZIALITÀ Questo messaggio ed i suoi eventuali allegati può contenere informazioni confidenziali, di proprietà, legalmente protette.È destinato all'utilizzo esclusivo del destinatario sopra indicato; privatezza e confidenzialità non sono modificati da eventuali errori di trasmissione. Se il messaggio non è a lei destinato, non deve utilizzarlo, diffonderlo, copiarlo con qualunque mezzo, o intraprendere azioni basandosi su di esso. Se ha ricevuto questo messaggio per errore, la preghiamo di volerlo distruggere (unitamente ad eventuali copie dello stesso) e di volerci cortesemente informare del fatto scrivendo al mittente. CONFIDENTIALITY NOTICE This message and its attachments (if any) may contain confidential, proprietary or legally privileged information and it is intended only for the use of the addressee named above. No confidentiality or privilege is waived or lost by any erroneous transmission. If you are not the intended recipient of this message you are hereby notified that you must not use, disseminate, copy it in any form or take any action in reliance on it. If you have received this message in error, please, delete it (and any copies of it) and kindly inform the sender. _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot