X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=cmd%2Fmdio.c;h=184868063abdab7a6a1cbd6d084ebeb20af81f67;hb=af0cf2178b043983a29f51e61e28feac4cf3b1d0;hp=fb13d050752a7f2abeb615101e76046257477fe5;hpb=2218c54bc13c8045903afc05d1364439a230da1f;p=oweals%2Fu-boot.git diff --git a/cmd/mdio.c b/cmd/mdio.c index fb13d05075..184868063a 100644 --- a/cmd/mdio.c +++ b/cmd/mdio.c @@ -1,8 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * (C) Copyright 2011 Freescale Semiconductor, Inc * Andy Fleming - * - * SPDX-License-Identifier: GPL-2.0+ */ /* @@ -14,7 +13,6 @@ #include #include - static char last_op[2]; static uint last_data; static uint last_addr_lo; @@ -27,12 +25,12 @@ static uint last_reg_hi; static int extract_range(char *input, int *plo, int *phi) { char *end; - *plo = simple_strtol(input, &end, 0); + *plo = simple_strtol(input, &end, 16); if (end == input) return -1; if ((*end == '-') && *(++end)) - *phi = simple_strtol(end, NULL, 0); + *phi = simple_strtol(end, NULL, 16); else if (*end == '\0') *phi = *plo; else @@ -79,7 +77,7 @@ static int mdio_read_ranges(struct phy_device *phydev, struct mii_dev *bus, printf("Reading from bus %s\n", bus->name); for (addr = addrlo; addr <= addrhi; addr++) { - printf("PHY at address %d:\n", addr); + printf("PHY at address %x:\n", addr); for (devad = devadlo; devad <= devadhi; devad++) { for (reg = reglo; reg <= reghi; reg++) { @@ -243,13 +241,13 @@ static int do_mdio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) case 'r': if (pos > 1) if (extract_reg_range(argv[pos--], &devadlo, &devadhi, - ®lo, ®hi)) + ®lo, ®hi)) return -1; default: if (pos > 1) - if (extract_phy_range(&(argv[2]), pos - 1, &bus, - &phydev, &addrlo, &addrhi)) + if (extract_phy_range(&argv[2], pos - 1, &bus, + &phydev, &addrlo, &addrhi)) return -1; break;