linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH]: [MPC5200] Fix lite5200b suspend/resume
@ 2008-06-17  8:33 Tim Yamin
  0 siblings, 0 replies; only message in thread
From: Tim Yamin @ 2008-06-17  8:33 UTC (permalink / raw)
  To: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 653 bytes --]

Hi,

Suspend/resume ("echo mem > /sys/power/state") does not work for me
with vanilla kernels -- the system does not suspend correctly and just
hangs. The attached patch fixes this so suspend/resume works:

1) of_iomap does not map the whole 0xC0000 of the MPC5200 for me, so
saving registers does not work. Maybe this is just a bug in my DTB? Or
is this an of_iomap bug?
2) PCI registers need to be saved and restored. Would it make sense to
move struct mpc52xx_pci out of mpc52xx_pci.c and into a header?

If somebody else with a lite5200B board could do some testing this
would be appreciated as would comments on the above two issues.

Thanks,

Tim

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 1100-mpc5200-lite5200b-fix-suspend.patch --]
[-- Type: text/x-patch; name=1100-mpc5200-lite5200b-fix-suspend.patch, Size: 2246 bytes --]

- Current memory remapping is wrong; the remapped area does not have
  the correct length (0x100 instead of 0xC000) and the system does
  not power down properly as a result... [of_ioremap bug?]

- Make sure the PCI registers are saved and restored, this fixes a
  kernel panic for me on resume.

Signed-off-by: Tim Yamin <plasm@roo.me.uk>

--- linux-2.6.26-rc6/arch/powerpc/platforms/52xx/lite5200_pm.c~	2008-04-17 03:49:44.000000000 +0100
+++ linux-2.6.26-rc6/arch/powerpc/platforms/52xx/lite5200_pm.c	2008-06-16 15:40:02.000000000 +0100
@@ -14,6 +14,7 @@
 static struct mpc52xx_xlb __iomem *xlb;
 static struct mpc52xx_gpio __iomem *gps;
 static struct mpc52xx_gpio_wkup __iomem *gpw;
+static void __iomem *pci;
 static void __iomem *sram;
 static const int sram_size = 0x4000;	/* 16 kBytes */
 static void __iomem *mbar;
@@ -42,6 +43,9 @@
 
 static int lite5200_pm_prepare(void)
 {
+	u64 regaddr64;
+	const u32 *regaddr_p;
+
 	struct device_node *np;
 	const struct of_device_id immr_ids[] = {
 		{ .compatible = "fsl,mpc5200-immr", },
@@ -60,8 +64,11 @@
 
 	/* map registers */
 	np = of_find_matching_node(NULL, immr_ids);
-	mbar = of_iomap(np, 0);
+	regaddr_p = of_get_address(np, 0, NULL, NULL);
+	regaddr64 = of_translate_address(np, regaddr_p);
 	of_node_put(np);
+
+	mbar = ioremap((u32) regaddr64, 0xC0000);
 	if (!mbar) {
 		printk(KERN_ERR "%s:%i Error mapping registers\n", __func__, __LINE__);
 		return -ENOSYS;
@@ -71,6 +78,7 @@
 	pic = mbar + 0x500;
 	gps = mbar + 0xb00;
 	gpw = mbar + 0xc00;
+	pci = mbar + 0xd00;
 	bes = mbar + 0x1200;
 	xlb = mbar + 0x1f00;
 	sram = mbar + 0x8000;
@@ -85,6 +93,7 @@
 static struct mpc52xx_xlb sxlb;
 static struct mpc52xx_gpio sgps;
 static struct mpc52xx_gpio_wkup sgpw;
+static char spci[0x200];
 
 static void lite5200_save_regs(void)
 {
@@ -94,6 +103,7 @@
 	_memcpy_fromio(&sxlb, xlb, sizeof(*xlb));
 	_memcpy_fromio(&sgps, gps, sizeof(*gps));
 	_memcpy_fromio(&sgpw, gpw, sizeof(*gpw));
+	_memcpy_fromio(spci, pci, 0x200);
 
 	_memcpy_fromio(saved_sram, sram, sram_size);
 }
@@ -103,6 +113,8 @@
 	int i;
 	_memcpy_toio(sram, saved_sram, sram_size);
 
+	/* PCI Configuration */
+	_memcpy_toio(pci, spci, 0x200);
 
 	/*
 	 * GPIOs. Interrupt Master Enable has higher address then other

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-06-17  8:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-17  8:33 [PATCH]: [MPC5200] Fix lite5200b suspend/resume Tim Yamin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).