]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - board/keymile/common/ivm.c
Merge remote-tracking branch 'u-boot-samsung/master'
[karo-tx-uboot.git] / board / keymile / common / ivm.c
index 918a6ab6398ff23c9fa501cee0f18ea397c96378..b6b19ccb8ea1379b2e0fbed5b86df26e40aa1a1e 100644 (file)
@@ -2,31 +2,15 @@
  * (C) Copyright 2011
  * Holger Brunck, Keymile GmbH Hannover, holger.brunck@keymile.com
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
-#include <hush.h>
+#include <cli_hush.h>
 #include <i2c.h>
 #include "common.h"
 
-int ivm_calc_crc(unsigned char *buf, int len)
+static int ivm_calc_crc(unsigned char *buf, int len)
 {
        const unsigned short crc_tab[16] = {
                0x0000, 0xCC01, 0xD801, 0x1400,
@@ -136,7 +120,7 @@ static int ivm_findinventorystring(int type,
 
        /* Look for the requested number of CR. */
        while ((cr != nr) && (addr < INVENTORYDATASIZE)) {
-               if ((buf[addr] == '\r'))
+               if (buf[addr] == '\r')
                        cr++;
                addr++;
        }
@@ -252,7 +236,7 @@ static int ivm_analyze_block2(unsigned char *buf, int len)
        return 0;
 }
 
-int ivm_analyze_eeprom(unsigned char *buf, int len)
+static int ivm_analyze_eeprom(unsigned char *buf, int len)
 {
        unsigned short  val;
        unsigned char   valbuf[CONFIG_SYS_IVM_EEPROM_PAGE_LEN];
@@ -314,33 +298,14 @@ int ivm_analyze_eeprom(unsigned char *buf, int len)
 
 int ivm_read_eeprom(void)
 {
-#if defined(CONFIG_I2C_MUX)
-       I2C_MUX_DEVICE *dev = NULL;
-#endif
        uchar i2c_buffer[CONFIG_SYS_IVM_EEPROM_MAX_LEN];
-       char    *buf;
-       unsigned long dev_addr = CONFIG_SYS_IVM_EEPROM_ADR;
        int ret;
 
-#if defined(CONFIG_SYS_I2C)
-       buf = getenv("EEprom_ivm");
-       i2c_set_bus_num(buf ? (int)simple_strtol(buf, NULL, 10) : 0);
-#else
-#if defined(CONFIG_I2C_MUX)
-       /* First init the Bus, select the Bus */
-       buf = (unsigned char *) getenv("EEprom_ivm");
-       if (buf != NULL)
-               dev = i2c_mux_ident_muxstring(buf);
-       if (dev == NULL) {
-               printf("Error couldnt add Bus for IVM\n");
-               return -1;
-       }
-       i2c_set_bus_num(dev->busid);
-#endif
+       i2c_set_bus_num(CONFIG_KM_IVM_BUS);
        /* add deblocking here */
        i2c_make_abort();
 
-       ret = i2c_read(dev_addr, 0, 1, i2c_buffer,
+       ret = i2c_read(CONFIG_SYS_IVM_EEPROM_ADR, 0, 1, i2c_buffer,
                CONFIG_SYS_IVM_EEPROM_MAX_LEN);
        if (ret != 0) {
                printf("Error reading EEprom\n");