From: "Travis B. Sawyer" <tsawyer@broadcom.com>
To: "Travis B. Sawyer" <tsawyer@broadcom.com>
Cc: linuxppc-embedded@ozlabs.org
Subject: Re: Problem mapping GPIO regs on ppc440gx
Date: Tue, 23 May 2006 09:50:05 -0400 [thread overview]
Message-ID: <4473130D.3080805@broadcom.com> (raw)
In-Reply-To: <44730484.4090208@broadcom.com>
Answering my own question here...
Travis B. Sawyer wrote:
>Greetings:
>
>We've been using a 2.4.30 kernel (with numerous patches) on a AMCC 440gx
>custom built board for quite some time now.
>
>We're building some new hardware that forces us to go to a 2.6 kernel.
>So, I've downloaded 2.6.16.16 from kernel.org and am porting everything
>forward from our 2.4.30 kernel.
>
>The problem lies in mapping the GPIO regs of the 440 to user space using
>/dev/mem:
>
> gpio_fd = open("/dev/mem", O_RDWR | O_SYNC);
>
> if (0 > gpio_fd) {
> perror("mbGpioGet(): Unable to open gpio");
> return(-1);
> }
>
> addr = (ppc440_gpio_regs_t *)mmap(0, getpagesize() * 2,
> PROT_READ | PROT_WRITE,
> MAP_SHARED, gpio_fd,
> (off_t)(0x40000000));
>
>
>
The above mmap call worked for 2.4.30, but for 2.6.16 I needed to change
the offset
to be a multiple of page size, so:
(off_t)(0x40000000/getpagesize());
-travis
prev parent reply other threads:[~2006-05-23 13:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-23 12:48 Problem mapping GPIO regs on ppc440gx Travis B. Sawyer
2006-05-23 13:50 ` Travis B. Sawyer [this message]
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=4473130D.3080805@broadcom.com \
--to=tsawyer@broadcom.com \
--cc=linuxppc-embedded@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;
as well as URLs for NNTP newsgroup(s).