PowerPC iotable_init equivalent?

Kumar Gala galak at kernel.crashing.org
Sat Apr 18 07:32:29 EST 2009


On Apr 17, 2009, at 4:21 PM, Eddie Dawydiuk wrote:

> Hello,
>
> In the past I've worked with ARM architectures where I could setup  
> virtual / physical address mappings so I don't have to ioremap then  
> pass around pointers. Does PowerPC have an equivalent abstraction?  
> If not whats the recommended approach?
>
> That is, is there a better approach to the following...
>
> volatile static unsigned char *my_reg = NULL;
>
> static inline void read_func() {
>
> 	if (!my_reg)
>        	my_reg = (unsigned char *)
> 			ioremap(REG_PHYS_BASE, REG_SIZE);
> //do something with the reg
> }
>
>
> static inline void write_func() {
>
> 	if (!my_reg)
>        	my_reg = (unsigned char *)
> 			ioremap(REG_PHYS_BASE, REG_SIZE);
> //do something with the reg
> }

Yes have a struct that keeps track of the virt addr and do the mapping  
once at init time.  This is what most drivers do.

- k



More information about the Linuxppc-dev mailing list