RE : Error while accessing physical address
From: Garcia Jérémie <hidden>
Date: 2005-09-01 14:22:20
Tks for your answer Marcin. This is a good idea but unfortunately,=20 the result remains the same... When using "ioremap", do I need need to use inb/oub... family to=20 handle those remapped address?? -------- Message d'origine-------- De: Marcin Dawidowicz [mailto:marcin.dawidowicz@kontron.pl] Date: jeu. 01/09/2005 16:11 =C0: Garcia J=E9r=E9mie Objet : Re: Error while accessing physical address =20 Maybe you could try to change this:
regHdwAddress =3D (unsigned short *) ioremap((unsigned =
short)address,0x1); into this: regHdwAddress =3D (unsigned short *) ioremap((unsigned = short)address,sizeof=20 (unsigned short)); Cause you are accessing unsigned short register later.... and "unsigned = short"=20 I assume is 2 bytes long. Marcin On Thursday 01 of September 2005 15:44, you wrote:
Hi everybody. As a kernel newbie, I still encounter basic problems. I read a lot of things on the memory management, but obviously I didn't understand =
some
things. I have some kernel source code that only write data to our card =
registers:
void bhWriteCardRegister(unsigned short * address, unsigned short =
data)
{
unsigned short * regHdwAddress;
printk("Writing data: %x at address:%x\n",data,address);
/* Get the virtual address for the physical one */
regHdwAddress =3D (unsigned short *) ioremap((unsigned =short)address,0x1);
printk("ioremap returned : %x\n",regHdwAddress);
/* write hardware register data value */
*regHdwAddress =3D data;
iounmap((void *)regHdwAddress);
}
<<<<<<<<
In a module init I call this function:
#define CARD_PROCESSOR_CTRL_IN_SERVICE 0x8000
#define CARD_PROCESSOR_CTRL_REG_P 0x40000400
bhWriteCardRegister((unsigned short *)(CARD_PROCESSOR_CTRL_REG_P),
(unsigned short)CARD_PROCESSOR_CTRL_IN_SERVICE); <<<<<<<<
When I load this module on our powerPC 405EP based arch, the execution
gives that:
Writing data: 8000 at address:40000400
ioremap returned : c2090400
<<<<<<<<
The problem is that after this write operation, every shell cmd I try =give
a "segmentation fault". What I did wrong ?? Please help me cause I have to go on fast... (tks boss...) _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev