]> git.sur5r.net Git - u-boot/blobdiff - drivers/hwmon/ds1621.c
Merge branch 'sf' of git://git.denx.de/u-boot-blackfin
[u-boot] / drivers / hwmon / ds1621.c
index 494818131f1a2090017a07722203aa743e2b6174..d15a082df518821fbaabd44cc62d6a6590489a5a 100644 (file)
  */
 
 #include <common.h>
-
-#ifdef CONFIG_DTT_DS1621
-#if !defined(CFG_EEPROM_PAGE_WRITE_ENABLE) || \
-       (CFG_EEPROM_PAGE_WRITE_BITS < 1)
-# error "CFG_EEPROM_PAGE_WRITE_ENABLE must be defined and CFG_EEPROM_PAGE_WRITE_BITS must be greater than 1 to use CONFIG_DTT_DS1621"
-#endif
 #include <i2c.h>
 #include <dtt.h>
 
  * Device code
  */
 #define DTT_I2C_DEV_CODE 0x48                  /* Dallas Semi's DS1621 */
+#define DTT_READ_TEMP          0xAA
+#define DTT_READ_COUNTER       0xA8
+#define DTT_READ_SLOPE         0xA9
+#define DTT_WRITE_START_CONV   0xEE
+#define DTT_WRITE_STOP_CONV    0x22
+#define DTT_TEMP_HIGH          0xA1
+#define DTT_TEMP_LOW           0xA2
+#define DTT_CONFIG             0xAC
 
 int dtt_read(int sensor, int reg)
 {
@@ -123,7 +125,7 @@ static int _dtt_init(int sensor)
     /*
      * Setup High Temp.
      */
-    val = ((CFG_DTT_MAX_TEMP * 2) << 7) & 0xff80;
+    val = ((CONFIG_SYS_DTT_MAX_TEMP * 2) << 7) & 0xff80;
     if (dtt_write(sensor, DTT_TEMP_HIGH, val) != 0)
        return 1;
     udelay(50000);                             /* Max 50ms */
@@ -131,7 +133,7 @@ static int _dtt_init(int sensor)
     /*
      * Setup Low Temp - hysteresis.
      */
-    val = (((CFG_DTT_MAX_TEMP - CFG_DTT_HYSTERESIS) * 2) << 7) & 0xff80;
+    val = (((CONFIG_SYS_DTT_MAX_TEMP - CONFIG_SYS_DTT_HYSTERESIS) * 2) << 7) & 0xff80;
     if (dtt_write(sensor, DTT_TEMP_LOW, val) != 0)
        return 1;
     udelay(50000);                             /* Max 50ms */
@@ -185,6 +187,3 @@ int dtt_get_temp(int sensor)
 
     return (dtt_read(sensor, DTT_READ_TEMP) / 256);
 } /* dtt_get_temp() */
-
-
-#endif /* CONFIG_DTT_DS1621 */