linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: linuxppc-dev@ozlabs.org
Subject: Re: mmap question on ppc440
Date: Tue, 6 Nov 2007 07:50:21 +0100	[thread overview]
Message-ID: <200711060750.21750.sr@denx.de> (raw)
In-Reply-To: <20071105151659.3ea601e4@weaponx>

On Monday 05 November 2007, Josh Boyer wrote:
> > I am attempting to access the CPLD on the AMCC Sequoia board from
> > user-land.  I open /dev/mem, and mmap it, then try to access the
> > resulting pointer.  That works fine when accessing physical addresses
> > that correspond to RAM, but as soon as I try to access the CPLD at
> > physical address 0xc0000000, I get an infinite machine check.
>
> That's because the CPLD is actually at physical address 0x1C0000000.
> Yay for 36-bit physical addresses.

Right. Are you using arch/ppc or arch/powerpc? If it's arch/ppc you could
give the following patch a try:

@@ -275,6 +275,14 @@
 {
        size_t size = vma->vm_end - vma->vm_start;

+#if defined(CONFIG_44x) && !defined(CONFIG_PPC_MERGE)
+       /*
+        * 2006-08-07: sr
+        * Needed on 44x-er systems for 36bit addresses (like pci on 440gx)
+        */
+       vma->vm_pgoff = (fixup_bigphys_addr(vma->vm_pgoff << PAGE_SHIFT, size) >> PAGE_SHIFT);
+#endif
+
        if (!valid_mmap_phys_addr_range(vma->vm_pgoff, size))
                return -EINVAL;


Best regards,
Stefan

  reply	other threads:[~2007-11-06  6:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-05 21:02 mmap question on ppc440 Steven A. Falco
2007-11-05 21:16 ` Josh Boyer
2007-11-06  6:50   ` Stefan Roese [this message]
2007-11-06 22:02     ` Benjamin Herrenschmidt
2007-11-06 22:59       ` Josh Boyer
2007-11-06 23:31         ` Benjamin Herrenschmidt

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=200711060750.21750.sr@denx.de \
    --to=sr@denx.de \
    --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;
as well as URLs for NNTP newsgroup(s).