From: Florent Kermarrec Date: Mon, 18 May 2020 20:16:20 +0000 (+0200) Subject: software/bios/commands: rename cmd_mdio to cmd_liteeth. X-Git-Tag: 24jan2021_ls180~328^2~7 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=573a881529d2d6a4edfcd864de74ddc6602c5f5a;p=litex.git software/bios/commands: rename cmd_mdio to cmd_liteeth. --- diff --git a/litex/soc/software/bios/Makefile b/litex/soc/software/bios/Makefile index 8d4090b7..fe809fe8 100755 --- a/litex/soc/software/bios/Makefile +++ b/litex/soc/software/bios/Makefile @@ -20,7 +20,7 @@ OBJECTS = isr.o \ cmd_bios.o \ cmd_boot.o \ cmd_dram.o \ - cmd_mdio.o \ + cmd_liteeth.o \ cmd_mem.o \ cmd_sdcard.o \ cmd_spi_flash.o \ diff --git a/litex/soc/software/bios/commands/cmd_liteeth.c b/litex/soc/software/bios/commands/cmd_liteeth.c new file mode 100644 index 00000000..86e8fc8a --- /dev/null +++ b/litex/soc/software/bios/commands/cmd_liteeth.c @@ -0,0 +1,134 @@ +// SPDX-License-Identifier: BSD-Source-Code + +#include +#include + +#include + +#include "mdio.h" + +#include "../command.h" +#include "../helpers.h" + +/** + * Command "mdiow" + * + * Write MDIO register + * + */ +#ifdef CSR_ETHPHY_MDIO_W_ADDR +static void mdiow(int nb_params, char **params) +{ + char *c; + unsigned int phyadr2; + unsigned int reg2; + unsigned int val2; + + if (nb_params < 3) { + printf("mdiow "); + return; + } + + phyadr2 = strtoul(params[0], &c, 0); + if (*c != 0) { + printf("Incorrect phyadr"); + return; + } + + reg2 = strtoul(params[1], &c, 0); + if (*c != 0) { + printf("Incorrect reg"); + return; + } + + val2 = strtoul(params[2], &c, 0); + if (*c != 0) { + printf("Incorrect val"); + return; + } + + mdio_write(phyadr2, reg2, val2); +} + +define_command(mdiow, mdiow, "Write MDIO register", MDIO_CMDS); +#endif + +/** + * Command "mdior" + * + * Read MDIO register + * + */ +#ifdef CSR_ETHPHY_MDIO_W_ADDR +static void mdior(int nb_params, char **params) +{ + char *c; + unsigned int phyadr2; + unsigned int reg2; + unsigned int val; + + if (nb_params < 2) { + printf("mdior "); + return; + } + + phyadr2 = strtoul(params[0], &c, 0); + if (*c != 0) { + printf("Incorrect phyadr"); + return; + } + + reg2 = strtoul(params[1], &c, 0); + if (*c != 0) { + printf("Incorrect reg"); + return; + } + + val = mdio_read(phyadr2, reg2); + printf("Reg %d: 0x%04x", reg2, val); +} + +define_command(mdior, mdior, "Read MDIO register", MDIO_CMDS); +#endif + +/** + * Command "mdiod" + * + * Dump MDIO registers + * + */ +#ifdef CSR_ETHPHY_MDIO_W_ADDR +static void mdiod(int nb_params, char **params) +{ + char *c; + unsigned int phyadr; + unsigned int count; + unsigned int val; + int i; + + if (nb_params < 2) { + printf("mdiod "); + return; + } + + phyadr = strtoul(params[0], &c, 0); + if (*c != 0) { + printf("Incorrect phyadr"); + return; + } + + count = strtoul(params[1], &c, 0); + if (*c != 0) { + printf("Incorrect count"); + return; + } + + printf("MDIO dump @0x%x:\n", phyadr); + for (i = 0; i < count; i++) { + val = mdio_read(phyadr, i); + printf("reg %d: 0x%04x", i, val); + } +} + +define_command(mdiod, mdiod, "Dump MDIO registers", MDIO_CMDS); +#endif diff --git a/litex/soc/software/bios/commands/cmd_mdio.c b/litex/soc/software/bios/commands/cmd_mdio.c deleted file mode 100644 index 86e8fc8a..00000000 --- a/litex/soc/software/bios/commands/cmd_mdio.c +++ /dev/null @@ -1,134 +0,0 @@ -// SPDX-License-Identifier: BSD-Source-Code - -#include -#include - -#include - -#include "mdio.h" - -#include "../command.h" -#include "../helpers.h" - -/** - * Command "mdiow" - * - * Write MDIO register - * - */ -#ifdef CSR_ETHPHY_MDIO_W_ADDR -static void mdiow(int nb_params, char **params) -{ - char *c; - unsigned int phyadr2; - unsigned int reg2; - unsigned int val2; - - if (nb_params < 3) { - printf("mdiow "); - return; - } - - phyadr2 = strtoul(params[0], &c, 0); - if (*c != 0) { - printf("Incorrect phyadr"); - return; - } - - reg2 = strtoul(params[1], &c, 0); - if (*c != 0) { - printf("Incorrect reg"); - return; - } - - val2 = strtoul(params[2], &c, 0); - if (*c != 0) { - printf("Incorrect val"); - return; - } - - mdio_write(phyadr2, reg2, val2); -} - -define_command(mdiow, mdiow, "Write MDIO register", MDIO_CMDS); -#endif - -/** - * Command "mdior" - * - * Read MDIO register - * - */ -#ifdef CSR_ETHPHY_MDIO_W_ADDR -static void mdior(int nb_params, char **params) -{ - char *c; - unsigned int phyadr2; - unsigned int reg2; - unsigned int val; - - if (nb_params < 2) { - printf("mdior "); - return; - } - - phyadr2 = strtoul(params[0], &c, 0); - if (*c != 0) { - printf("Incorrect phyadr"); - return; - } - - reg2 = strtoul(params[1], &c, 0); - if (*c != 0) { - printf("Incorrect reg"); - return; - } - - val = mdio_read(phyadr2, reg2); - printf("Reg %d: 0x%04x", reg2, val); -} - -define_command(mdior, mdior, "Read MDIO register", MDIO_CMDS); -#endif - -/** - * Command "mdiod" - * - * Dump MDIO registers - * - */ -#ifdef CSR_ETHPHY_MDIO_W_ADDR -static void mdiod(int nb_params, char **params) -{ - char *c; - unsigned int phyadr; - unsigned int count; - unsigned int val; - int i; - - if (nb_params < 2) { - printf("mdiod "); - return; - } - - phyadr = strtoul(params[0], &c, 0); - if (*c != 0) { - printf("Incorrect phyadr"); - return; - } - - count = strtoul(params[1], &c, 0); - if (*c != 0) { - printf("Incorrect count"); - return; - } - - printf("MDIO dump @0x%x:\n", phyadr); - for (i = 0; i < count; i++) { - val = mdio_read(phyadr, i); - printf("reg %d: 0x%04x", i, val); - } -} - -define_command(mdiod, mdiod, "Dump MDIO registers", MDIO_CMDS); -#endif