]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - board/sandburst/common/sb_common.c
Merge branch 'master' of git://git.denx.de/u-boot-i2c
[karo-tx-uboot.git] / board / sandburst / common / sb_common.c
index 12334dfdd1755503c8940813295d2af007438b65..b579812ccf667aff7f223b979399727f350eba3f 100644 (file)
@@ -10,7 +10,6 @@
 #include <asm/io.h>
 #include <spd_sdram.h>
 #include <i2c.h>
-#include "ppc440gx_i2c.h"
 #include "sb_common.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -68,7 +67,7 @@ unsigned short sbcommon_get_serial_number(void)
 
        /* Get the board serial number from eeprom */
        /* Initialize I2C */
-       i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+       i2c_set_bus_num(0);
 
        /* Read 256 bytes in EEPROM */
        i2c_read (0x50, 0, 1, buff, 0x100);
@@ -94,85 +93,87 @@ void sbcommon_fans(void)
         * Attempt to turn on 2 of the fans...
         * Need to go through the bridge
         */
+       i2c_set_bus_num(1);
        puts ("FANS:  ");
 
        /* select fan4 through the bridge */
-       i2c_reg_write1(0x73, /* addr */
-                      0x00, /* reg */
-                      0x08); /* val = bus 4 */
+       i2c_reg_write(0x73, /* addr */
+                     0x00, /* reg */
+                     0x08); /* val = bus 4 */
 
        /* Turn on FAN 4 */
-       i2c_reg_write1(0x2e,
-                      1,
-                      0x80);
+       i2c_reg_write(0x2e,
+                     1,
+                     0x80);
 
-       i2c_reg_write1(0x2e,
-                      0,
-                      0x19);
+       i2c_reg_write(0x2e,
+                     0,
+                     0x19);
 
        /* Deselect bus 4 on the bridge */
-       i2c_reg_write1(0x73,
-                      0x00,
-                      0x00);
+       i2c_reg_write(0x73,
+                     0x00,
+                     0x00);
 
        /* select fan3 through the bridge */
-       i2c_reg_write1(0x73, /* addr */
-                      0x00, /* reg */
-                      0x04); /* val = bus 3 */
+       i2c_reg_write(0x73, /* addr */
+                     0x00, /* reg */
+                     0x04); /* val = bus 3 */
 
        /* Turn on FAN 3 */
-       i2c_reg_write1(0x2e,
-                      1,
-                      0x80);
+       i2c_reg_write(0x2e,
+                     1,
+                     0x80);
 
-       i2c_reg_write1(0x2e,
-                      0,
-                      0x19);
+       i2c_reg_write(0x2e,
+                     0,
+                     0x19);
 
        /* Deselect bus 3 on the bridge */
-       i2c_reg_write1(0x73,
-                      0x00,
-                      0x00);
+       i2c_reg_write(0x73,
+                     0x00,
+                     0x00);
 
        /* select fan2 through the bridge */
-       i2c_reg_write1(0x73, /* addr */
-                      0x00, /* reg */
-                      0x02); /* val = bus 4 */
+       i2c_reg_write(0x73, /* addr */
+                     0x00, /* reg */
+                     0x02); /* val = bus 4 */
 
        /* Turn on FAN 2 */
-       i2c_reg_write1(0x2e,
-                      1,
-                      0x80);
+       i2c_reg_write(0x2e,
+                     1,
+                     0x80);
 
-       i2c_reg_write1(0x2e,
-                      0,
-                      0x19);
+       i2c_reg_write(0x2e,
+                     0,
+                     0x19);
 
        /* Deselect bus 2 on the bridge */
-       i2c_reg_write1(0x73,
-                      0x00,
-                      0x00);
+       i2c_reg_write(0x73,
+                     0x00,
+                     0x00);
 
        /* select fan1 through the bridge */
-       i2c_reg_write1(0x73, /* addr */
-                      0x00, /* reg */
-                      0x01); /* val = bus 0 */
+       i2c_reg_write(0x73, /* addr */
+                     0x00, /* reg */
+                     0x01); /* val = bus 0 */
 
        /* Turn on FAN 1 */
-       i2c_reg_write1(0x2e,
-                      1,
-                      0x80);
+       i2c_reg_write(0x2e,
+                     1,
+                     0x80);
 
-       i2c_reg_write1(0x2e,
-                      0,
-                      0x19);
+       i2c_reg_write(0x2e,
+                     0,
+                     0x19);
 
        /* Deselect bus 1 on the bridge */
-       i2c_reg_write1(0x73,
-                      0x00,
-                      0x00);
+       i2c_reg_write(0x73,
+                     0x00,
+                     0x00);
 
        puts ("on\n");
+       i2c_set_bus_num(0);
 
        return;
 
@@ -303,7 +304,7 @@ void board_get_enetaddr(int macaddr_idx, uchar *enet)
        if (0 == macaddr_idx) {
 
                /* Initialize I2C */
-               i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+               i2c_set_bus_num(0);
 
                /* Read 256 bytes in EEPROM */
                i2c_read (0x50, 0, 1, buff, 0x100);