r2687 - in trunk/kernel/source/kernel-source-2.6.11-2.6.11/debian: . patches patches/series

Sven Luther luther@costa.debian.org
Sun, 13 Mar 2005 16:10:48 +0100


Author: luther
Date: 2005-03-13 16:10:47 +0100 (Sun, 13 Mar 2005)
New Revision: 2687

Added:
   trunk/kernel/source/kernel-source-2.6.11-2.6.11/debian/patches/powerpc-pmac-agp-sleep.dpatch
Modified:
   trunk/kernel/source/kernel-source-2.6.11-2.6.11/debian/changelog
   trunk/kernel/source/kernel-source-2.6.11-2.6.11/debian/patches/series/2.6.11-1
Log:
Added pmac uninorth agp suspend/sleep patch, backported from linux tree.
Should fix pmac laptop sleep problems.


Modified: trunk/kernel/source/kernel-source-2.6.11-2.6.11/debian/changelog
===================================================================
--- trunk/kernel/source/kernel-source-2.6.11-2.6.11/debian/changelog	2005-03-13 13:30:03 UTC (rev 2686)
+++ trunk/kernel/source/kernel-source-2.6.11-2.6.11/debian/changelog	2005-03-13 15:10:47 UTC (rev 2687)
@@ -38,7 +38,7 @@
 
   * 2.6.11.3 Fix i2c messsage flags in video drivers. (Maximilian Attems)
 
-  * 2.6.11.3 ppc32: Compilation fixes Ebony, Luan and Ocotea. 
+  * 2.6.11.3 ppc32: Compilation fixes Ebony, Luan and Ocotea.
     CONFIG_SERIAL_TEXT_DEBUG=y (Maximilian Attems)
 
   * 2.6.11.3 drm missing memset can crash X server. (Maximilian Attems)
@@ -47,8 +47,11 @@
 
   * 2.6.11.3 saa7110 fix amd64 2.6.11 oops on modprobe. (Maximilian Attems)
 
- -- Sven Luther <luther@debian.org>  Mon,  7 Mar 2005 14:56:32 +0100
+  * [powerpc] Added uninorth-agp suspend support, should help with power/ibook
+    sleep support (Sven Luther)
 
+ -- Sven Luther <luther@debian.org>  Sun, 13 Mar 2005 16:08:44 +0100
+
 kernel-source-2.6.10 (2.6.10-6) unstable; urgency=low
 
   * Updated kernel-tree description from Martin F Krafft

Added: trunk/kernel/source/kernel-source-2.6.11-2.6.11/debian/patches/powerpc-pmac-agp-sleep.dpatch
===================================================================
--- trunk/kernel/source/kernel-source-2.6.11-2.6.11/debian/patches/powerpc-pmac-agp-sleep.dpatch	2005-03-13 13:30:03 UTC (rev 2686)
+++ trunk/kernel/source/kernel-source-2.6.11-2.6.11/debian/patches/powerpc-pmac-agp-sleep.dpatch	2005-03-13 15:10:47 UTC (rev 2687)
@@ -0,0 +1,156 @@
+#! /bin/sh -e
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Description: [PATCH] ppc32: uninorth-agp suspend support
+## DP: This patch adds suspend/resume support to the Apple UniNorth AGP bridge to
+## DP: make sure AGP is properly disabled when the machine goes to sleep.  Without
+## DP: this, the r300 based laptops will fail to wakeup from sleep when using the
+## DP: new experimental r300 DRI driver.  It should also improve reliablility in
+## DP: general with other chips.
+## DP: Unfortunately, uninorth-agp is just a "sibling" of the video chip on the
+## DP: PCI bus, and thus ends up beeing called either before the video chip
+## DP: suspend routine, or after, depending on the HW layout or other random
+## DP: things.
+## DP: To make sure the device side of AGP is always disabled first and that we
+## DP: never touch the device after having put it into D2 state (which can be
+## DP: deadly), I also need the separate patch to radeonfb and aty128fb which will
+## DP: make them disabled their own side if not already done by the bridge driver.
+## DP: Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+## DP: Signed-off-by: Paul Mackerras <paulus@samba.org>
+## DP: Signed-off-by: Andrew Morton <akpm@osdl.org>
+## DP: Signed-off-by: Linus Torvalds <torvalds@osdl.org>
+## DP: Patch author: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+## DP: Upstream status: backport
+## DP: URL: http://linux.bkbits.net:8080/linux-2.6/cset@42307fe1_IGeH1Vsciya0MYbowgWzg?nav=index.html|src/|src/drivers|src/drivers/char|src/drivers/char/agp|related/drivers/char/agp/uninorth-agp.c
+
+. $(dirname $0)/DPATCH
+
+@DPATCH@
+diff -Naru a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c
+--- a/drivers/char/agp/uninorth-agp.c	2005-03-13 07:00:18 -08:00
++++ b/drivers/char/agp/uninorth-agp.c	2005-03-13 07:00:18 -08:00
+@@ -6,6 +6,7 @@
+ #include <linux/init.h>
+ #include <linux/pagemap.h>
+ #include <linux/agp_backend.h>
++#include <linux/delay.h>
+ #include <asm/uninorth.h>
+ #include <asm/pci-bridge.h>
+ #include "agp.h"
+@@ -51,6 +52,11 @@
+ 
+ static void uninorth_cleanup(void)
+ {
++	u32 tmp;
++
++	pci_read_config_dword(agp_bridge->dev, UNI_N_CFG_GART_CTRL, &tmp);
++	if (!(tmp & UNI_N_CFG_GART_ENABLE))
++		return;
+ 	pci_write_config_dword(agp_bridge->dev, UNI_N_CFG_GART_CTRL,
+ 			UNI_N_CFG_GART_ENABLE | UNI_N_CFG_GART_INVAL);
+ 	pci_write_config_dword(agp_bridge->dev, UNI_N_CFG_GART_CTRL,
+@@ -155,6 +161,62 @@
+ 	uninorth_tlbflush(NULL);
+ }
+ 
++#ifdef CONFIG_PM
++static int agp_uninorth_suspend(struct pci_dev *pdev, pm_message_t state)
++{
++	u32 cmd;
++	u8 agp;
++	struct pci_dev *device = NULL;
++
++	if (state != PMSG_SUSPEND)
++		return 0;
++
++	/* turn off AGP on the video chip, if it was enabled */
++	for_each_pci_dev(device) {
++		/* Don't touch the bridge yet, device first */
++		if (device == pdev)
++			continue;
++		/* Only deal with devices on the same bus here, no Mac has a P2P
++		 * bridge on the AGP port, and mucking around the entire PCI
++		 * tree is source of problems on some machines because of a bug
++		 * in some versions of pci_find_capability() when hitting a dead
++		 * device
++		 */
++		if (device->bus != pdev->bus)
++			continue;
++		agp = pci_find_capability(device, PCI_CAP_ID_AGP);
++		if (!agp)
++			continue;
++		pci_read_config_dword(device, agp + PCI_AGP_COMMAND, &cmd);
++		if (!(cmd & PCI_AGP_COMMAND_AGP))
++			continue;
++		printk("uninorth-agp: disabling AGP on device %s\n",
++				pci_name(device));
++		cmd &= ~PCI_AGP_COMMAND_AGP;
++		pci_write_config_dword(device, agp + PCI_AGP_COMMAND, cmd);
++	}
++
++	/* turn off AGP on the bridge */
++	agp = pci_find_capability(pdev, PCI_CAP_ID_AGP);
++	pci_read_config_dword(pdev, agp + PCI_AGP_COMMAND, &cmd);
++	if (cmd & PCI_AGP_COMMAND_AGP) {
++		printk("uninorth-agp: disabling AGP on bridge %s\n",
++				pci_name(pdev));
++		cmd &= ~PCI_AGP_COMMAND_AGP;
++		pci_write_config_dword(pdev, agp + PCI_AGP_COMMAND, cmd);
++	}
++	/* turn off the GART */
++	uninorth_cleanup();
++
++	return 0;
++}
++
++static int agp_uninorth_resume(struct pci_dev *pdev)
++{
++	return 0;
++}
++#endif
++
+ static int uninorth_create_gatt_table(struct agp_bridge_data *bridge)
+ {
+ 	char *table;
+@@ -369,6 +431,10 @@
+ 	.id_table	= agp_uninorth_pci_table,
+ 	.probe		= agp_uninorth_probe,
+ 	.remove		= agp_uninorth_remove,
++#ifdef CONFIG_PM
++	.suspend	= agp_uninorth_suspend,
++	.resume		= agp_uninorth_resume,
++#endif
+ };
+ 
+ static int __init agp_uninorth_init(void)
+# This is a BitKeeper generated diff -Nru style patch.
+#
+# ChangeSet
+#   2005/03/10 09:12:01-08:00 benh@kernel.crashing.org 
+#   [PATCH] ppc32: uninorth-agp suspend support
+#   
+#   This patch adds suspend/resume support to the Apple UniNorth AGP bridge to
+#   make sure AGP is properly disabled when the machine goes to sleep.  Without
+#   this, the r300 based laptops will fail to wakeup from sleep when using the
+#   new experimental r300 DRI driver.  It should also improve reliablility in
+#   general with other chips.
+#   
+#   Unfortunately, uninorth-agp is just a "sibling" of the video chip on the
+#   PCI bus, and thus ends up beeing called either before the video chip
+#   suspend routine, or after, depending on the HW layout or other random
+#   things.
+#   
+#   To make sure the device side of AGP is always disabled first and that we
+#   never touch the device after having put it into D2 state (which can be
+#   deadly), I also need the separate patch to radeonfb and aty128fb which will
+#   make them disabled their own side if not already done by the bridge driver.
+#   
+#   Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+#   Signed-off-by: Paul Mackerras <paulus@samba.org>
+#   Signed-off-by: Andrew Morton <akpm@osdl.org>
+#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
+# 
+# drivers/char/agp/uninorth-agp.c
+#   2005/03/10 00:39:08-08:00 benh@kernel.crashing.org +66 -0
+#   ppc32: uninorth-agp suspend support
+# 

Modified: trunk/kernel/source/kernel-source-2.6.11-2.6.11/debian/patches/series/2.6.11-1
===================================================================
--- trunk/kernel/source/kernel-source-2.6.11-2.6.11/debian/patches/series/2.6.11-1	2005-03-13 13:30:03 UTC (rev 2686)
+++ trunk/kernel/source/kernel-source-2.6.11-2.6.11/debian/patches/series/2.6.11-1	2005-03-13 15:10:47 UTC (rev 2687)
@@ -64,3 +64,5 @@
 + drivers-char-drm_ioctl.dpatch
 + fs-cramfs-stat-fix.dpatch
 + drivers-video-saa7110-oops-fix.dpatch
++ powerpc-pmac-agp-sleep.dpatch
+