X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=board%2Fkeymile%2Fcommon%2Fcommon.c;h=9adfefaf6aac9c89cfec7e86429da150aabace33;hb=a9417ce74a8b79b1a3ab879d05f4f54138422c6e;hp=4883fe588b80c23a23ed1c01199e00b5a0c8adc8;hpb=f1fef1d8a141e0b4e4520d66e162c06ff047bd16;p=u-boot diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c index 4883fe588b..9adfefaf6a 100644 --- a/board/keymile/common/common.c +++ b/board/keymile/common/common.c @@ -22,10 +22,11 @@ */ #include -#if defined(CONFIG_MGCOGE) || defined(CONFIG_MGCOGE2NE) +#if defined(CONFIG_KM82XX) #include #endif #include +#include #include #include #include @@ -398,10 +399,10 @@ int ivm_read_eeprom(void) #define DELAY_ABORT_SEQ 62 /* @200kHz 9 clocks = 44us, 62us is ok */ #define DELAY_HALF_PERIOD (500 / (CONFIG_SYS_I2C_SPEED / 1000)) -#if defined(CONFIG_MGCOGE) || defined(CONFIG_MGCOGE2NE) +#if defined(CONFIG_KM_82XX) #define SDA_MASK 0x00010000 #define SCL_MASK 0x00020000 -static void set_pin(int state, unsigned long mask) +void set_pin(int state, unsigned long mask) { ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, 3); @@ -677,11 +678,41 @@ int ethernet_present(void) int board_eth_init(bd_t *bis) { -#ifdef CONFIG_KEYMILE_HDLC_ENET - (void)keymile_hdlc_enet_initialize(bis); -#endif if (ethernet_present()) return cpu_eth_init(bis); return -1; } + +/* + * do_setboardid command + * read out the board id and the hw key from the intventory EEPROM and set + * this values as environment variables. + */ +static int do_setboardid(cmd_tbl_t *cmdtp, int flag, int argc, + char *const argv[]) +{ + unsigned char buf[32]; + char *p; + + p = get_local_var("IVM_BoardId"); + if (p == NULL) { + printf("can't get the IVM_Boardid\n"); + return 1; + } + sprintf((char *)buf, "%s", p); + setenv("boardid", (char *)buf); + + p = get_local_var("IVM_HWKey"); + if (p == NULL) { + printf("can't get the IVM_HWKey\n"); + return 1; + } + sprintf((char *)buf, "%s", p); + setenv("hwkey", (char *)buf); + + return 0; +} + +U_BOOT_CMD(km_setboardid, 1, 0, do_setboardid, "setboardid", "read out bid and " + "hwkey from IVM and set in environment");