Subject: Re: MPC5200b kernel module memory mapping

From: sudheer <[email-masked]>
Date: Thu, 21 Sep 2006 14:17:37 +0530

Hi Stevenson Kaiser,

Steven Kaiser wrote:
> #define MPC5xxx_MM_IPBI		(MPC5xxx_MBAR + 0x0054)
>
> void *ioaddr = NULL;
>
>
> 	// map our physical address into kernal virtual address space
> 	// do I need this call?
> 	ioaddr = ioremap(MALab_MM_START,MALab_MM_SIZE);
>
>   
Try typecasting.        ioaddr = (u16 *)ioremap (start, size );

Regards
Sudheer

> return 0;
> }
>
> Later (in a ioctrl routine), I will try and write something to the first
> location in my address range.  I tried these three ways:
>
> 	*(volatile u16 *)MALab_MM_START = 0x5555;
> 	outw(0x5555,MALab_MM_START);
> 	outw(0x5555,ioaddr);
>
> Any and all of the these calls crash the kernel so horrendously I have to
> reboot.  Sometimes I have to delete and mknod a new /dev entry.
>
> I have tried the io memory map technique instead of the above io port map
> technique, using request_mem_region(), with the same crashing results upon
> any writew() call or direct variants.  I tried things without the ioremap()
> call--  I get a segmentation fault in these cases.
>
> The request_region() or request_mem_region() seems to work ok.  I can cat
> /proc/iomem or /proc/ioports and see my range in there.  I am pretty sure I
> am setting up the LocalBus chip select registers ok.
>
> Yet obviously I am doing something profoundly stupid.  Is my error obvious?
> Can someone enlighten me in my darkness?
>
> Steven Kaiser
> Chemistry Electronics Facility
> University of California, Irvine
> 2347 Natural Sciences 2
> Irvine, CA  92697-2025
> (949)824-7520
>
>
> _______________________________________________
> Linuxppc-embedded mailing list
> [email-masked]
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
>
>