Re: [PATCH v3 02/10] powerpc: Consolidate mpic_alloc() OF address translation
From: Kumar Gala <hidden>
Date: 2011-12-05 19:22:55
On Dec 5, 2011, at 12:41 PM, Moffett, Kyle D wrote:
On Dec 03, 2011, at 10:53, Kumar Gala wrote:quoted
On Dec 2, 2011, at 10:27 AM, Kyle Moffett wrote:quoted
Instead of using the open-coded "reg" property lookup and address translation in mpic_alloc(), directly call of_address_to_resource(). This includes various workarounds for special cases which the naive of_address_translate() does not. =20 Afterwards it is possible to remove the copiously copy-pasted calls =
to
quoted
quoted
of_address_translate() from the 85xx/86xx/powermac platforms. =20 Signed-off-by: Kyle Moffett <redacted> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <redacted> Cc: Grant Likely <redacted> Cc: Kumar Gala <redacted> --- arch/powerpc/platforms/85xx/corenet_ds.c | 9 +---- arch/powerpc/platforms/85xx/ksi8560.c | 9 +---- arch/powerpc/platforms/85xx/mpc8536_ds.c | 9 +---- arch/powerpc/platforms/85xx/mpc85xx_ads.c | 9 +---- arch/powerpc/platforms/85xx/mpc85xx_cds.c | 9 +---- arch/powerpc/platforms/85xx/mpc85xx_ds.c | 11 +---- arch/powerpc/platforms/85xx/mpc85xx_mds.c | 9 +---- arch/powerpc/platforms/85xx/mpc85xx_rdb.c | 11 +---- arch/powerpc/platforms/85xx/p1010rdb.c | 9 +---- arch/powerpc/platforms/85xx/p1022_ds.c | 9 +---- arch/powerpc/platforms/85xx/p1023_rds.c | 9 +---- arch/powerpc/platforms/85xx/sbc8548.c | 9 +---- arch/powerpc/platforms/85xx/sbc8560.c | 9 +---- arch/powerpc/platforms/85xx/socrates.c | 9 +---- arch/powerpc/platforms/85xx/stx_gp3.c | 9 +---- arch/powerpc/platforms/85xx/tqm85xx.c | 9 +---- arch/powerpc/platforms/85xx/xes_mpc85xx.c | 9 +---- arch/powerpc/platforms/86xx/pic.c | 4 +- arch/powerpc/platforms/powermac/pic.c | 8 +--- arch/powerpc/sysdev/mpic.c | 61 =
++++++++++++++++-------------
quoted
quoted
20 files changed, 55 insertions(+), 175 deletions(-)=20 What about cleaning up: =20 arch/powerpc/platforms/chrp/setup.c: chrp_mpic =3D mpic_alloc(np, =
opaddr, MPIC_PRIMARY,
quoted
arch/powerpc/platforms/embedded6xx/holly.c: mpic =3D =
mpic_alloc(tsi_pic, mpic_paddr,
quoted
arch/powerpc/platforms/embedded6xx/linkstation.c: mpic =3D =
mpic_alloc(dnp, paddr, MPIC_PRIMARY | MPIC
quoted
arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c: mpic =3D =
mpic_alloc(tsi_pic, mpic_paddr,
quoted
arch/powerpc/platforms/embedded6xx/storcenter.c: mpic =3D =
mpic_alloc(dnp, paddr, MPIC_PRIMARY | MPIC
quoted
arch/powerpc/platforms/maple/setup.c: mpic =3D =
mpic_alloc(mpic_node, openpic_addr, flags,
quoted
arch/powerpc/platforms/pasemi/setup.c: mpic =3D =
mpic_alloc(mpic_node, openpic_addr,
quoted
arch/powerpc/platforms/pseries/setup.c: mpic =3D =
mpic_alloc(pSeries_mpic_node, openpic_addr,
quoted
=20 Seems like we should be able to remove the 'phys_addr' argument =
altogether.
=20 Well, ideally the MPIC code would just be a OF platform_driver with a bit of supplementary platform_data to deal with device-tree flaws. Unfortunately it's quite a long way from that. =20 Some platforms seem to prefer to use a "platform-open-pic" property on the root node instead of setting up the "reg" node of the open-pic itself. =20 Furthermore, the ISU configuration seems to be board-specific. =
pSeries
seems to have all of the ISUs configured as additional cells in the "platform-open-pic" property, but almost all of the rest are just hard-coded offsets from the PIC address in the board-support code. =20 If it was possible to fix the device-trees on the systems with =
hardcoded
offsets then we could put the ISU addresses into the =
"platform-open-pic"
property and test that in mpic_alloc(). =20 Otherwise there's still going to be a fair amount of hardcoding for specific boards. =20 Regardless, I think this patch series is a good first cut and cleaning up some of the more egregious code duplication there. =20 Cheers, Kyle Moffett
Agreed its a good first pass cleanup but it doesn't seem like we're that = far off from remove the 'phys_addr' being passed in. - k=