LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Garcia Jérémie" <GARCIAJ@3il.fr>
To: <linuxppc-dev@ozlabs.org>
Subject: Error while accessing physical address
Date: Thu, 1 Sep 2005 15:44:23 +0200	[thread overview]
Message-ID: <D4FDDD1349B5AC46B68FC26AD8AF42D6226B55@exnet.3il.fr> (raw)

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);
 =20
  /* write hardware register data value */=20
  *regHdwAddress =3D data;
 =20
  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...)

                 reply	other threads:[~2005-09-01 13:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D4FDDD1349B5AC46B68FC26AD8AF42D6226B55@exnet.3il.fr \
    --to=garciaj@3il.fr \
    --cc=linuxppc-dev@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox