public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] bdinfo: Fix bdinfo to show all MACs for Microblaze and ARM
@ 2011-08-31  9:38 Michal Simek
  2011-09-07 21:05 ` Wolfgang Denk
  2011-09-07 22:45 ` Marek Vasut
  0 siblings, 2 replies; 3+ messages in thread
From: Michal Simek @ 2011-08-31  9:38 UTC (permalink / raw)
  To: u-boot

- Show all ethernet MACs in the system.
- Show current ethernet device

Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 common/cmd_bdinfo.c |   32 ++++++++++++++++++++++++++++++--
 1 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
index 6051120..01441de 100644
--- a/common/cmd_bdinfo.c
+++ b/common/cmd_bdinfo.c
@@ -153,6 +153,11 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
+#if defined(CONFIG_CMD_NET)
+	struct eth_device *dev;
+	int i;
+#endif
+
 	bd_t *bd = gd->bd;
 	print_num("mem start      ",	(ulong)bd->bi_memstart);
 	print_lnum("mem size       ",	(u64)bd->bi_memsize);
@@ -164,7 +169,17 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	print_num("sram size      ",	(ulong)bd->bi_sramsize);
 #endif
 #if defined(CONFIG_CMD_NET)
-	print_eth(0);
+	i = 0;
+	while (1) {
+		dev = eth_get_dev_by_index(i);
+		if (dev) {
+			printf("eth%dname    = %s\n", i, dev->name);
+			print_eth(i);
+		} else
+			break;
+		i++;
+	}
+	printf("current eth = %s\n", eth_get_name());
 	printf("ip_addr     = %pI4\n", &bd->bi_ip_addr);
 #endif
 	printf("baudrate    = %ld bps\n", (ulong)bd->bi_baudrate);
@@ -330,6 +345,9 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	int i;
 	bd_t *bd = gd->bd;
+#if defined(CONFIG_CMD_NET)
+	struct eth_device *dev;
+#endif
 
 	print_num("arch_number",	bd->bi_arch_number);
 	print_num("boot_params",	(ulong)bd->bi_boot_params);
@@ -341,7 +359,17 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	}
 
 #if defined(CONFIG_CMD_NET)
-	print_eth(0);
+	i = 0;
+	while (1) {
+		dev = eth_get_dev_by_index(i)
+		if (dev) {
+			printf("eth%dname    = %s\n", i, dev->name);
+			print_eth(i);
+		} else
+			break;
+		i++;
+	}
+	printf("current eth = %s\n", eth_get_name());
 	printf("ip_addr     = %pI4\n", &bd->bi_ip_addr);
 #endif
 	printf("baudrate    = %d bps\n", bd->bi_baudrate);
-- 
1.5.5.6

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] bdinfo: Fix bdinfo to show all MACs for Microblaze and ARM
  2011-08-31  9:38 [U-Boot] [PATCH] bdinfo: Fix bdinfo to show all MACs for Microblaze and ARM Michal Simek
@ 2011-09-07 21:05 ` Wolfgang Denk
  2011-09-07 22:45 ` Marek Vasut
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfgang Denk @ 2011-09-07 21:05 UTC (permalink / raw)
  To: u-boot

Dear Michal Simek,

In message <1314783511-1480-1-git-send-email-monstr@monstr.eu> you wrote:
> - Show all ethernet MACs in the system.
> - Show current ethernet device
> 
> Signed-off-by: Michal Simek <monstr@monstr.eu>
> ---
>  common/cmd_bdinfo.c |   32 ++++++++++++++++++++++++++++++--
>  1 files changed, 30 insertions(+), 2 deletions(-)
> 
> diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
> index 6051120..01441de 100644
> --- a/common/cmd_bdinfo.c
> +++ b/common/cmd_bdinfo.c
> @@ -153,6 +153,11 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>  
>  int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>  {
> +#if defined(CONFIG_CMD_NET)
> +	struct eth_device *dev;
> +	int i;
> +#endif
> +
>  	bd_t *bd = gd->bd;
>  	print_num("mem start      ",	(ulong)bd->bi_memstart);
>  	print_lnum("mem size       ",	(u64)bd->bi_memsize);
> @@ -164,7 +169,17 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>  	print_num("sram size      ",	(ulong)bd->bi_sramsize);
>  #endif
>  #if defined(CONFIG_CMD_NET)
> -	print_eth(0);
> +	i = 0;
> +	while (1) {
> +		dev = eth_get_dev_by_index(i);
> +		if (dev) {
> +			printf("eth%dname    = %s\n", i, dev->name);
> +			print_eth(i);
> +		} else
> +			break;
> +		i++;
> +	}
> +	printf("current eth = %s\n", eth_get_name());
>  	printf("ip_addr     = %pI4\n", &bd->bi_ip_addr);
>  #endif
>  	printf("baudrate    = %ld bps\n", (ulong)bd->bi_baudrate);
> @@ -330,6 +345,9 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>  {
>  	int i;
>  	bd_t *bd = gd->bd;
> +#if defined(CONFIG_CMD_NET)
> +	struct eth_device *dev;
> +#endif
>  
>  	print_num("arch_number",	bd->bi_arch_number);
>  	print_num("boot_params",	(ulong)bd->bi_boot_params);
> @@ -341,7 +359,17 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>  	}
>  
>  #if defined(CONFIG_CMD_NET)
> -	print_eth(0);
> +	i = 0;
> +	while (1) {
> +		dev = eth_get_dev_by_index(i)
> +		if (dev) {
> +			printf("eth%dname    = %s\n", i, dev->name);
> +			print_eth(i);
> +		} else
> +			break;
> +		i++;
> +	}
> +	printf("current eth = %s\n", eth_get_name());

Instead of repeating this code we should turn it into a function.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"A complex system that works is invariably found to have evolved from
a simple system that worked."             - John Gall, _Systemantics_

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] bdinfo: Fix bdinfo to show all MACs for Microblaze and ARM
  2011-08-31  9:38 [U-Boot] [PATCH] bdinfo: Fix bdinfo to show all MACs for Microblaze and ARM Michal Simek
  2011-09-07 21:05 ` Wolfgang Denk
@ 2011-09-07 22:45 ` Marek Vasut
  1 sibling, 0 replies; 3+ messages in thread
From: Marek Vasut @ 2011-09-07 22:45 UTC (permalink / raw)
  To: u-boot

On Wednesday, August 31, 2011 11:38:31 AM Michal Simek wrote:
> - Show all ethernet MACs in the system.
> - Show current ethernet device
> 
> Signed-off-by: Michal Simek <monstr@monstr.eu>
> ---
>  common/cmd_bdinfo.c |   32 ++++++++++++++++++++++++++++++--
>  1 files changed, 30 insertions(+), 2 deletions(-)
> 
> diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
> index 6051120..01441de 100644
> --- a/common/cmd_bdinfo.c
> +++ b/common/cmd_bdinfo.c
> @@ -153,6 +153,11 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
> char * const argv[])
> 
>  int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>  {
> +#if defined(CONFIG_CMD_NET)
> +	struct eth_device *dev;
> +	int i;
> +#endif
> +
>  	bd_t *bd = gd->bd;
>  	print_num("mem start      ",	(ulong)bd->bi_memstart);
>  	print_lnum("mem size       ",	(u64)bd->bi_memsize);
> @@ -164,7 +169,17 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
> char * const argv[]) print_num("sram size      ",	(ulong)bd->bi_sramsize);
>  #endif
>  #if defined(CONFIG_CMD_NET)
> -	print_eth(0);
> +	i = 0;
> +	while (1) {
> +		dev = eth_get_dev_by_index(i);
> +		if (dev) {
> +			printf("eth%dname    = %s\n", i, dev->name);
> +			print_eth(i);
> +		} else
> +			break;
> +		i++;
> +	}

i = 0;
do {
	dev = eth_get_dev_by_index(i++);
} while (dev);
i--;

... or something

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-09-07 22:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-31  9:38 [U-Boot] [PATCH] bdinfo: Fix bdinfo to show all MACs for Microblaze and ARM Michal Simek
2011-09-07 21:05 ` Wolfgang Denk
2011-09-07 22:45 ` Marek Vasut

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox