Skip to contentSkip to conversation

powerpc: Fix clock spreading setting on some powermacs

PATCH In review Benjamin Herrenschmidt 3 participants 3 messages Dec 12, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc: Fix clock spreading setting on some powermacs

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.

---

This is 2.6.15 material.

arch/powerpc/platforms/powermac/feature.c +16 -5
Index: linux-work/arch/powerpc/platforms/powermac/feature.c
===================================================================
@@ -1650,11 +1650,19 @@
 	 */
 
 	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 @@
 			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);
arch/ppc/platforms/pmac_feature.c +15 -5
Index: linux-work/arch/ppc/platforms/pmac_feature.c
===================================================================
@@ -1606,11 +1606,19 @@
 	 */
 
 	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 @@
 			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);
#1 lore raw
Quoted 4 lines · Benjamin Herrenschmidt

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.

I have a bunch of powerpc fixes for 2.6.15, some of which are in Paul's tree. I presently have:

powerpc-fix-a-huge-page-bug.patch powerpc-remove-debug-code-in-hash-path.patch fix-windfarm-model-id-table.patch powerpc-set-cache-info-defaults.patch powerpc-fix-slb-flushing-path-in-hugepage.patch powerpc-add-missing-icache-flushes-for-hugepages.patch ppc32-set-smp_tb_synchronized-on-up-with-smp-kernel.patch

Linus is back online now. Paul, do you intend to send a batch to Linus? If so, please do so asap so I can merge up anything that's left over.

#2 lore raw
Quoted 2 lines · Andrew Morton

Linus is back online now. Paul, do you intend to send a batch to Linus? If so, please do so asap so I can merge up anything that's left over.

Yes, I have all of those patches in my powerpc-merge tree and I'll send him a "please pull" message once it's mirrored to kernel.org.

Paul.