Apparently I'm not the only one who forgets which way the outb and
[coreboot.git] / src / devices / smbus_ops.c
index e721bfbfb39e9e09b8b789d9de956f9133d17a21..acf0b1f39d19e7d84f70bd1133a54031ca62f80c 100644 (file)
@@ -1,3 +1,24 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2004 Tyan
+ * (Written by Yinghai Lu <yhlu@tyan.com> for Tyan)
+ * Copyright (C) 2004 Li-Ta Lo <ollie@lanl.gov>
+ *
+ * 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; version 2 of the License.
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ */
+
 #include <console/console.h>
 #include <stdint.h>
 #include <device/device.h>
 struct bus *get_pbus_smbus(device_t dev)
 {
        struct bus *pbus = dev->bus;
-       while(pbus && pbus->dev && !ops_smbus_bus(pbus)) {
+       while (pbus && pbus->dev && !ops_smbus_bus(pbus)) {
                pbus = pbus->dev->bus;
        }
        if (!pbus || !pbus->dev || !pbus->dev->ops || !pbus->dev->ops->ops_smbus_bus) {
                printk_alert("%s Cannot find smbus bus operations", dev_path(dev));
                die("");
-               for(;;);
        }
        return pbus;
 }
 
-       /*multi level i2c MUX??? may need to find the first i2c device and then set link down to current dev
-                 1 store get_pbus_smbus list link
-                 2 reverse the link and call set link */
+/*multi level i2c MUX??? may need to find the first i2c device and then set link
+ * down to current dev
+  1 store get_pbus_smbus list link
+  2 reverse the link and call set link */
 
 int smbus_set_link(device_t dev)
 {
@@ -33,10 +54,10 @@ int smbus_set_link(device_t dev)
                 pbus = pbus->dev->bus;
         }
 //     printk_info("smbus_set_link: ");
-       for(i=pbus_num-1; i>=0; i--) {
+       for (i=pbus_num-1; i>=0; i--) {
 //             printk_info(" %s[%d] -> ", dev_path(pbus_a[i]->dev), pbus_a[i]->link);
-               if(ops_smbus_bus(get_pbus_smbus(pbus_a[i]->dev))) {
-                       if(pbus_a[i]->dev->ops && pbus_a[i]->dev->ops->set_link)
+               if (ops_smbus_bus(get_pbus_smbus(pbus_a[i]->dev))) {
+                       if (pbus_a[i]->dev->ops && pbus_a[i]->dev->ops->set_link)
                                pbus_a[i]->dev->ops->set_link(pbus_a[i]->dev, pbus_a[i]->link);
                }
        }