[U-Boot] [PATCH 2/2] smc911x_eeprom: new example app for managing newer SMC parts
Magnus Lilja
lilja.magnus at gmail.com
Mon Jan 5 16:23:56 CET 2009
Hi
I forgot to include some comments on the code, sorry about the noise.
2008/12/22 Mike Frysinger <vapier at gentoo.org>:
> A forward port of the last version to work with the newer smc911x driver.
> I only have a board with a LAN9218 part on it, so that is the only one
> I've tested. But there isn't anything in this that would make it terribly
> chip specific afaik.
>
> Signed-off-by: Mike Frysinger <vapier at gentoo.org>
> CC: Sascha Hauer <s.hauer at pengutronix.de>
> CC: Guennadi Liakhovetski <lg at denx.de>
> CC: Magnus Lilja <lilja.magnus at gmail.com>
> CC: Ben Warren <biggerbadderben at gmail.com>
> ---
> examples/.gitignore | 1 +
> examples/Makefile | 7 +-
> examples/smc911x_eeprom.c | 381 +++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 386 insertions(+), 3 deletions(-)
> diff --git a/examples/smc911x_eeprom.c b/examples/smc911x_eeprom.c
> new file mode 100644
> index 0000000..3dac4d3
> --- /dev/null
> +++ b/examples/smc911x_eeprom.c
<...>
> +static void print_macaddr(void)
> +{
> + puts("Current MAC Address in MAC: ");
> + ulong addrl = smc911x_get_mac_csr(ADDRL);
> + ulong addrh = smc911x_get_mac_csr(ADDRH);
> + printf("%02x:%02x:%02x:%02x:%02x:%02x\n",
> + (u8)(addrl), (u8)(addrl >> 8), (u8)(addrl >> 16),
> + (u8)(addrl >> 24), (u8)(addrh), (u8)(addrh >> 8));
> +
> + puts("Current MAC Address in EEPROM: ");
> + int i;
> + for (i = 1; i < 6; ++i)
> + printf("%02x:", read_eeprom_reg(i));
> + printf("%02x\n", read_eeprom_reg(i));
> +}
The above function declares new variables in the middle of the code.
Is this OK w.r.t. the coding standard? I haven't seen such code in
U-boot (or Linux) before.
/Magnus
More information about the U-Boot
mailing list