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
- 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 <[EMAIL PROTECTED]>
--- 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
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev