]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
keymile boards: add CONFIG_PIGGY_MAC_ADRESS_OFFSET
authorHeiko Schocher <hs@denx.de>
Thu, 6 Jan 2011 09:25:26 +0000 (10:25 +0100)
committerWolfgang Denk <wd@denx.de>
Fri, 29 Apr 2011 22:45:17 +0000 (00:45 +0200)
Normaly the PIGGY_MAC_ADRESS can be read directly from the
IVM on keymile boards. On mgcoge3 it differs. Because there
are two piggy boards deployed the second MAC adress must be
calculated with the IVM mac adress and an offset. This patch
allows to set such a offset in the board config.

Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
cc: Valentin Longchamp <valentin.longchamp@keymile.com>
cc: Heiko Schocher <hs@denx.de>

board/keymile/common/common.c
board/keymile/common/common.h

index 6600e08711ea4252bb2306cbf4730b1444a0761f..8392a6413ea30aba8691313f2bb588dd47739e0e 100644 (file)
@@ -228,8 +228,21 @@ static int ivm_analyze_block2(unsigned char *buf, int len)
        /* IVM_MacAddress */
        sprintf((char *)valbuf, "%pM", buf);
        ivm_set_value("IVM_MacAddress", (char *)valbuf);
+       /* if an offset is defined, add it */
+#if defined(CONFIG_PIGGY_MAC_ADRESS_OFFSET)
+       if (CONFIG_PIGGY_MAC_ADRESS_OFFSET > 0) {
+               unsigned long val = (buf[4] << 16) + (buf[5] << 8) + buf[6];
+
+               val += CONFIG_PIGGY_MAC_ADRESS_OFFSET;
+               buf[4] = (val >> 16) & 0xff;
+               buf[5] = (val >> 8) & 0xff;
+               buf[6] = val & 0xff;
+               sprintf((char *)valbuf, "%pM", buf);
+       }
+#endif
        if (getenv("ethaddr") == NULL)
                setenv((char *)"ethaddr", (char *)valbuf);
+
        /* IVM_MacCount */
        count = (buf[10] << 24) +
                   (buf[11] << 16) +
index 8497ab63d1667a7551d882ad80664c88d548c762..e32de8d9fa484afdca851e986229b5cf1f5f5a36 100644 (file)
@@ -39,6 +39,10 @@ struct km_bec_fpga {
        unsigned char   pgy_eth;
 };
 
+#if !defined(CONFIG_PIGGY_MAC_ADRESS_OFFSET)
+#define CONFIG_PIGGY_MAC_ADRESS_OFFSET 0
+#endif
+
 int ethernet_present(void);
 int ivm_read_eeprom(void);