[PATCH] powerpc: Fix clock spreading setting on some powermacs
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Mon, 12 Dec 2005 02:13:24 +0000 (13:13 +1100)
committerPaul Mackerras <paulus@samba.org>
Mon, 12 Dec 2005 03:16:09 +0000 (14:16 +1100)
The code that sets the clock spreading feature of the Intrepid ASIC
must not be run on some machine models or those won't boot. This
fixes it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/platforms/powermac/feature.c
arch/ppc/platforms/pmac_feature.c

index 0d7fa00fcb00cd8d608b5045557a6f6f5128bb72..f6e22da2a5daa8dd27a2bcade5b12ff19599b60f 100644 (file)
@@ -1650,11 +1650,19 @@ void pmac_tweak_clock_spreading(int enable)
         */
 
        if (macio->type == macio_intrepid) {
-               if (enable)
-                       UN_OUT(UNI_N_CLOCK_SPREADING, 2);
-               else
-                       UN_OUT(UNI_N_CLOCK_SPREADING, 0);
-               mdelay(40);
+               struct device_node *clock =
+                       of_find_node_by_path("/uni-n@f8000000/hw-clock");
+               if (clock && get_property(clock, "platform-do-clockspreading",
+                                         NULL)) {
+                       printk(KERN_INFO "%sabling clock spreading on Intrepid"
+                              " ASIC\n", enable ? "En" : "Dis");
+                       if (enable)
+                               UN_OUT(UNI_N_CLOCK_SPREADING, 2);
+                       else
+                               UN_OUT(UNI_N_CLOCK_SPREADING, 0);
+                       mdelay(40);
+               }
+               of_node_put(clock);
        }
 
        while (machine_is_compatible("PowerBook5,2") ||
@@ -1724,6 +1732,9 @@ void pmac_tweak_clock_spreading(int enable)
                        pmac_low_i2c_close(ui2c);
                        break;
                }
+               printk(KERN_INFO "%sabling clock spreading on i2c clock chip\n",
+                      enable ? "En" : "Dis");
+
                pmac_low_i2c_setmode(ui2c, pmac_low_i2c_mode_stdsub);
                rc = pmac_low_i2c_xfer(ui2c, 0xd2 | pmac_low_i2c_write, 0x80, buffer, 9);
                DBG("write result: %d,", rc);
index 1e69b05931620a2f1420adea43a27cac67644f6b..6b7b3a150631485cbf7ce43fe763f2ab8f55748a 100644 (file)
@@ -1606,11 +1606,19 @@ void pmac_tweak_clock_spreading(int enable)
         */
 
        if (macio->type == macio_intrepid) {
-               if (enable)
-                       UN_OUT(UNI_N_CLOCK_SPREADING, 2);
-               else
-                       UN_OUT(UNI_N_CLOCK_SPREADING, 0);
-               mdelay(40);
+               struct device_node *clock =
+                       of_find_node_by_path("/uni-n@f8000000/hw-clock");
+               if (clock && get_property(clock, "platform-do-clockspreading",
+                                         NULL)) {
+                       printk(KERN_INFO "%sabling clock spreading on Intrepid"
+                              " ASIC\n", enable ? "En" : "Dis");
+                       if (enable)
+                               UN_OUT(UNI_N_CLOCK_SPREADING, 2);
+                       else
+                               UN_OUT(UNI_N_CLOCK_SPREADING, 0);
+                       mdelay(40);
+               }
+               of_node_put(clock);
        }
 
        while (machine_is_compatible("PowerBook5,2") ||
@@ -1680,6 +1688,8 @@ void pmac_tweak_clock_spreading(int enable)
                        pmac_low_i2c_close(ui2c);
                        break;
                }
+               printk(KERN_INFO "%sabling clock spreading on i2c clock chip\n",
+                      enable ? "En" : "Dis");
                pmac_low_i2c_setmode(ui2c, pmac_low_i2c_mode_stdsub);
                rc = pmac_low_i2c_xfer(ui2c, 0xd2 | pmac_low_i2c_write, 0x80, buffer, 9);
                DBG("write result: %d,", rc);