Subject: Re: removing get_immrbase()??

From: Arnd Bergmann <[email-masked]>
Date: Thu, 23 Apr 2009 15:53:55 +0200

On Wednesday 22 April 2009, Kumar Gala wrote:

First of all, thanks for bringing this up, I'd love to see get_immrbase() gone.

> arch/powerpc/sysdev/cpm1.c:     mpc8xx_immr = ioremap(get_immrbase(),  
> 0x4000);
>         not sure? ideas?

Nobody has commented on this, so I've taken a brief look at it.

I'd suggest moving the logic up one step at a time. im_cpm, im_siu_conf and
im_ioport could be defined locally in sysdev/cpm1.c rather than through
mpc8xx_immr, all you need for this is to export accessor functions from cpm1 for
iop_pcso and cp_cptr:

void cpm1_set_iop_pcso(u16 pcso)
{
	setbits16(cpm1_ioport.iop_pcso, pcso);
}
void cpm1_clear_iop_pcso(u16 pcso)
{
	clearbits16(cpm1_ioport.iop_pcso, pcso);
}
...

im_sit, im_sitk, im_clkrst and im_clkrstk should be defined locally in m8xx_setup.c,
which is the only place that they are used in. Fortunately, the are all contiguous
in the address sapce, so they can be moved into one new data structure with 
a single static pointer to it in m8xx_setup.c:

static struct {
	struct sys_int_timers sit;
	struct clk_and_reset clkrst;
	struct sitk sitk;
	struct cark clkrstk;
} *m8xx_setup_regs;

When this is done, 8xx_immap.h along with all the unused stuff therein can be removed.
In the last step, the device trees can be cleaned up so that you can of_iomap
the regions in those two files directly.

	Arnd <><