All of lore.kernel.org
 help / color / mirror / Atom feed
From: ayman@austin.rr.com
To: linuxppc-dev@lists.ozlabs.org
Subject: Problems mapping OCM memory from 460EX to user space
Date: Wed, 7 Jul 2010 14:48:46 -0500	[thread overview]
Message-ID: <20100707194846.GA724@crust.elkhashab.com> (raw)

I've got an issue with the new rev B 460EX processors that I am trying to isolate.
(Rev A worked fine).  In order to do that, I am trying to modify my driver to 
map the OCM (on chip memory) from the 460EX to user space so that the rest of the
application and codebase don't really know the difference.

My driver implements the mmap and this works fine when I point it to areas of 
memory that have been setup with kmalloc.  My sequence is basically kmalloc, 
adjust for page boundaries, and then remap_pfn_range.  For regular DRAM this 
works fine.

Now I want to modfiy it to use OCM.  I've modified the code to use ioremap so 
that the driver has access to the memory. This seems to work.  But the kernel 
gives a register dump when I call 

#define PLB_OCM_BASE_ADDR        0x400040000ull
...

static int mapper_mmap(struct file *fip, struct vm_area_struct *vma)
{
  int rc;
  
  /* 
   * make sure to allocate the proper number of pages when using
   * mmap.  We check it for correctness here.
   */
  
  unsigned long len = vma->vm_end - vma->vm_start;

  /* if user tries to map bigger space than we have, error */
 if (PAGE_COUNT * PAGE_SIZE < len) 
    return -EIO;

 rc = io_remap_pfn_range(vma, PLB_OCM_BASE_ADDR>>PAGE_SHIFT, vma->vm_start, len, vma->vm_page_prot);

#if 0
  /* map the physical area into one buffer */
  rc = remap_pfn_range(vma, vma->vm_start, 
		       virt_to_phys( (void*)km.pal)>>PAGE_SHIFT,
		       len,
		       vma->vm_page_prot);
#endif

  MDEBUG("Mapped %ld bytes at virt address 0x%lx to mapper file descriptor...\n", len, vma->vm_start);

  /* return an error to the caller if remap fails */
  return (rc < 0 ? rc : 0);

}

The "#if 0" code is the working code for using DRAM.  MDEBUG is just a printk.

I am fairly certain the physical address is correct, I've verified that the
TLB entries in u-boot look ok.  Any tips on how to make this work?

Thanks

             reply	other threads:[~2010-07-07 19:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-07 19:48 ayman [this message]
2010-07-11  4:14 ` Problems mapping OCM memory from 460EX to user space Ayman El-Khashab

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=20100707194846.GA724@crust.elkhashab.com \
    --to=ayman@austin.rr.com \
    --cc=linuxppc-dev@lists.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.