[U-Boot] [PATCH 5/7] Add mdio command for new PHY infrastructure

Detlev Zundel dzu at denx.de
Wed Mar 30 13:55:58 CEST 2011


Hi Andy,

> The new mdio command doesn't have all of the features of the mii
> command, but it provides the necessary read/write primitives, and allows
> users to interact with 10G PHYs, and other PHYs which use Clause 45 of
> 802.3.  This means that the mdio command requires a "Device Address"
> argument, though for clause 22 PHYs, the argument can be "-".
>
> Signed-off-by: Andy Fleming <afleming at freescale.com>
> ---
>  common/Makefile   |    3 +
>  common/cmd_mdio.c |  293 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 296 insertions(+), 0 deletions(-)
>  create mode 100644 common/cmd_mdio.c

[...]

> +static int extract_range(char *input, int *plo, int *phi)
> +{
> +	char * end;
> +	*plo = simple_strtol(input, &end, 0);
> +	if (end == input)
> +		return -1;
> +
> +	if (*end == '-') {

What about the case of input="12-"? Shouldn't there be an "&& *(end+1)"?

> +		end++;
> +		*phi = simple_strtol(end, NULL, 0);
> +	} else if (*end == '\0') {
> +		*phi = *plo;
> +	} else
> +		return -1;
> +
> +	return 0;
> +}

Other than that, looks good, so once my above concern is addressed

Acked-by: Detlev Zundel <dzu at denx.de>

Thanks!
  Detlev

-- 
Choosing which tool to use is a problem for most users. Therefore
when one tool came along that did everything Perl (Ugly) it took over.
                                    -- Rob Pike
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de


More information about the U-Boot mailing list