aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2005-12-11 21:13:24 -0500
committerPaul Mackerras <paulus@samba.org>2005-12-11 22:16:09 -0500
commitb39f9485e6cfe1bf21b18b60fd8c631a72a1304d (patch)
tree250c26d0c8251c5a5228a44a4192efb47e8715a4
parent23ed6cb9a237902cce6018a24d1993c346abddb4 (diff)
[PATCH] 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. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r--arch/powerpc/platforms/powermac/feature.c21
-rw-r--r--arch/ppc/platforms/pmac_feature.c20
2 files changed, 31 insertions, 10 deletions
diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c
index 0d7fa00fcb00..f6e22da2a5da 100644
--- a/arch/powerpc/platforms/powermac/feature.c
+++ b/arch/powerpc/platforms/powermac/feature.c
@@ -1650,11 +1650,19 @@ void pmac_tweak_clock_spreading(int enable)
1650 */ 1650 */
1651 1651
1652 if (macio->type == macio_intrepid) { 1652 if (macio->type == macio_intrepid) {
1653 if (enable) 1653 struct device_node *clock =
1654 UN_OUT(UNI_N_CLOCK_SPREADING, 2); 1654 of_find_node_by_path("/uni-n@f8000000/hw-clock");
1655 else 1655 if (clock && get_property(clock, "platform-do-clockspreading",
1656 UN_OUT(UNI_N_CLOCK_SPREADING, 0); 1656 NULL)) {
1657 mdelay(40); 1657 printk(KERN_INFO "%sabling clock spreading on Intrepid"
1658 " ASIC\n", enable ? "En" : "Dis");
1659 if (enable)
1660 UN_OUT(UNI_N_CLOCK_SPREADING, 2);
1661 else
1662 UN_OUT(UNI_N_CLOCK_SPREADING, 0);
1663 mdelay(40);
1664 }
1665 of_node_put(clock);
1658 } 1666 }
1659 1667
1660 while (machine_is_compatible("PowerBook5,2") || 1668 while (machine_is_compatible("PowerBook5,2") ||
@@ -1724,6 +1732,9 @@ void pmac_tweak_clock_spreading(int enable)
1724 pmac_low_i2c_close(ui2c); 1732 pmac_low_i2c_close(ui2c);
1725 break; 1733 break;
1726 } 1734 }
1735 printk(KERN_INFO "%sabling clock spreading on i2c clock chip\n",
1736 enable ? "En" : "Dis");
1737
1727 pmac_low_i2c_setmode(ui2c, pmac_low_i2c_mode_stdsub); 1738 pmac_low_i2c_setmode(ui2c, pmac_low_i2c_mode_stdsub);
1728 rc = pmac_low_i2c_xfer(ui2c, 0xd2 | pmac_low_i2c_write, 0x80, buffer, 9); 1739 rc = pmac_low_i2c_xfer(ui2c, 0xd2 | pmac_low_i2c_write, 0x80, buffer, 9);
1729 DBG("write result: %d,", rc); 1740 DBG("write result: %d,", rc);
diff --git a/arch/ppc/platforms/pmac_feature.c b/arch/ppc/platforms/pmac_feature.c
index 1e69b0593162..6b7b3a150631 100644
--- a/arch/ppc/platforms/pmac_feature.c
+++ b/arch/ppc/platforms/pmac_feature.c
@@ -1606,11 +1606,19 @@ void pmac_tweak_clock_spreading(int enable)
1606 */ 1606 */
1607 1607
1608 if (macio->type == macio_intrepid) { 1608 if (macio->type == macio_intrepid) {
1609 if (enable) 1609 struct device_node *clock =
1610 UN_OUT(UNI_N_CLOCK_SPREADING, 2); 1610 of_find_node_by_path("/uni-n@f8000000/hw-clock");
1611 else 1611 if (clock && get_property(clock, "platform-do-clockspreading",
1612 UN_OUT(UNI_N_CLOCK_SPREADING, 0); 1612 NULL)) {
1613 mdelay(40); 1613 printk(KERN_INFO "%sabling clock spreading on Intrepid"
1614 " ASIC\n", enable ? "En" : "Dis");
1615 if (enable)
1616 UN_OUT(UNI_N_CLOCK_SPREADING, 2);
1617 else
1618 UN_OUT(UNI_N_CLOCK_SPREADING, 0);
1619 mdelay(40);
1620 }
1621 of_node_put(clock);
1614 } 1622 }
1615 1623
1616 while (machine_is_compatible("PowerBook5,2") || 1624 while (machine_is_compatible("PowerBook5,2") ||
@@ -1680,6 +1688,8 @@ void pmac_tweak_clock_spreading(int enable)
1680 pmac_low_i2c_close(ui2c); 1688 pmac_low_i2c_close(ui2c);
1681 break; 1689 break;
1682 } 1690 }
1691 printk(KERN_INFO "%sabling clock spreading on i2c clock chip\n",
1692 enable ? "En" : "Dis");
1683 pmac_low_i2c_setmode(ui2c, pmac_low_i2c_mode_stdsub); 1693 pmac_low_i2c_setmode(ui2c, pmac_low_i2c_mode_stdsub);
1684 rc = pmac_low_i2c_xfer(ui2c, 0xd2 | pmac_low_i2c_write, 0x80, buffer, 9); 1694 rc = pmac_low_i2c_xfer(ui2c, 0xd2 | pmac_low_i2c_write, 0x80, buffer, 9);
1685 DBG("write result: %d,", rc); 1695 DBG("write result: %d,", rc);