hrcon: Add fan controllers
[oweals/u-boot.git] / board / gdsys / mpc8308 / hrcon.c
index 3cc03cbdade987bf9249cc0088d02367b28d4f16..880b6387de29c9139d1792fc93754dd578678179 100644 (file)
@@ -26,6 +26,7 @@
 #include "../common/osd.h"
 #include "../common/mclink.h"
 #include "../common/phy.h"
+#include "../common/fanctrl.h"
 
 #include <pca953x.h>
 #include <pca9698.h>
@@ -52,6 +53,11 @@ enum {
 unsigned int mclink_fpgacount;
 struct ihs_fpga *fpga_ptr[] = CONFIG_SYS_FPGA_PTR;
 
+struct {
+       u8 bus;
+       u8 addr;
+} hrcon_fans[] = CONFIG_HRCON_FANS;
+
 int fpga_set_reg(u32 fpga, u16 *reg, off_t regoff, u16 data)
 {
        int res;
@@ -199,6 +205,11 @@ int last_stage_init(void)
                }
        }
 
+       for (k = 0; k < ARRAY_SIZE(hrcon_fans); ++k) {
+               i2c_set_bus_num(hrcon_fans[k].bus);
+               init_fan_controller(hrcon_fans[k].addr);
+       }
+
        return 0;
 }