Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/5200: fix oops during going to standby

When going to standby mode mpc code maps the whole soc5200 node
to access warious MBAR registers. However as of_iomap uses 'reg'
property of device node, only small part of MBAR is getting mapped.
Thus pm code gets oops when trying to access high parts of MBAR.
As a way to overcome this, make mpc52xx_pm_prepare() explicitly
map whole MBAR (0xc0000).

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

authored by

Dmitry Baryshkov and committed by
Grant Likely
fb73538e a2c9a603

+10 -1
+10 -1
arch/powerpc/platforms/52xx/mpc52xx_pm.c
··· 64 64 { .type = "builtin", .compatible = "mpc5200", }, /* efika */ 65 65 {} 66 66 }; 67 + struct resource res; 67 68 68 69 /* map the whole register space */ 69 70 np = of_find_matching_node(NULL, immr_ids); 70 - mbar = of_iomap(np, 0); 71 + 72 + if (of_address_to_resource(np, 0, &res)) { 73 + pr_err("mpc52xx_pm_prepare(): could not get IMMR address\n"); 74 + of_node_put(np); 75 + return -ENOSYS; 76 + } 77 + 78 + mbar = ioremap(res.start, 0xc000); /* we should map whole region including SRAM */ 79 + 71 80 of_node_put(np); 72 81 if (!mbar) { 73 82 pr_err("mpc52xx_pm_prepare(): could not map registers\n");