linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Sample driver
@ 2008-02-20  4:13 Silwer star
  2008-02-20 12:06 ` Josh Boyer
  0 siblings, 1 reply; 4+ messages in thread
From: Silwer star @ 2008-02-20  4:13 UTC (permalink / raw)
  To: linuxppc-embedded


Does anyone have sample drivers in Linux for the EBC interface for PPC405Ex?
I would be thankful if someone could put in a sample code here. 
-- 
View this message in context: http://www.nabble.com/Sample-driver-tp15582059p15582059.html
Sent from the linuxppc-embedded mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Sample driver
  2008-02-20  4:13 Silwer star
@ 2008-02-20 12:06 ` Josh Boyer
  2008-02-20 15:13   ` Jeff Mock
  0 siblings, 1 reply; 4+ messages in thread
From: Josh Boyer @ 2008-02-20 12:06 UTC (permalink / raw)
  To: Silwer star; +Cc: linuxppc-embedded

On Tue, 19 Feb 2008 20:13:24 -0800 (PST)
Silwer star <fariyaf@gmail.com> wrote:

> 
> Does anyone have sample drivers in Linux for the EBC interface for PPC405Ex?
> I would be thankful if someone could put in a sample code here. 

Linux typically doesn't touch the EBC itself.  That is normally set up
by firmware such as U-Boot and Linux uses it as-is.

josh

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Sample driver
  2008-02-20 12:06 ` Josh Boyer
@ 2008-02-20 15:13   ` Jeff Mock
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff Mock @ 2008-02-20 15:13 UTC (permalink / raw)
  To: Josh Boyer, linuxppc-embedded; +Cc: Silwer star

Josh Boyer wrote:
>> Does anyone have sample drivers in Linux for the EBC interface for PPC405Ex?
>> I would be thankful if someone could put in a sample code here. 
> 
> Linux typically doesn't touch the EBC itself.  That is normally set up
> by firmware such as U-Boot and Linux uses it as-is.
> 

True, but there's always a lot of ways to do it.  Here's an example that 
might help you get started configuring the EBC from Linux.  Here's a 
device driver directory from a recent 440GX project:
 
http://www.mock.com/wsvn/listing.php?repname=mock.pdev&path=%2Ftrunk%2Fsw%2Fdriver%2F#_trunk_sw_driver_

You might look at pdev-gxctl.c.  It is a simple module that sets up the 
EBC address space for two sets of address ranges with 16-bit data paths. 
  These are for simple register read/writes to control some FPGAs. 
Pdev-gxctl provides an mmap() interface to /dev/xxx so user code can 
easily access the FPGA registers mapped onto the EBC.  The difference 
for the 405Ex should be pretty small.

jeff

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Sample driver
       [not found] <8024567.229231203576334424.JavaMail.nabble@isper.nabble.com>
@ 2008-02-21  6:54 ` Jeff Mock
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff Mock @ 2008-02-21  6:54 UTC (permalink / raw)
  To: fariyaf; +Cc: linuxppc-embedded



fariyaf@gmail.com wrote:
> Hi,
> 
> Thanks so much for the driver. I have a few doubts.. .may be u cud
> help me out with it.... Basically, I am working on the PPC 405EX
> processor with a peripheral attached to the EBC. I've requested for
> I/O memory & mapped it using ioremap. The following are my doubts:
> 
> 1) How do I ensure that the memory range that I requested is
> non-cacheable. I've to work with non-cacheable memory.  I've
> requested for memory using request_mem_region( ).

In my example the memory range is set to non-cacheable, this needs to be 
done if you are talking to real hardware registers:

   "vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);"

static int
pdev_mmap(struct file *file, struct vm_area_struct *vma)
{
     int fpga_num = iminor(file->f_dentry->d_inode) - PDEV_SPCTL;
     phys_addr_t     paddr;

     paddr = fpga_num ? PDEV_SP1_REG : PDEV_SP0_REG;
#ifdef PDEV_DEBUG
     printk("pdev-gxctl: fpga %d reg mmap() at %016llx\n", fpga_num, paddr);
#endif
     vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
     if (remap_pfn_range(vma,
             vma->vm_start,
             paddr >> PAGE_SHIFT,
             vma->vm_end-vma->vm_start,
             vma->vm_page_prot))
         return -EAGAIN;
     return 0;
}

> 2) Between any consecutive writes or any consecutive reads to the EBC
> peripheral, if I introduce a delay of 500msec, the read/write is
> completing.  Does this have to do anything with caching? What could
> be the  reason for this?


I have no idea where the 500ms delay comes from, this is quite a long 
delay.  Maybe there is some problem with the EBC programming for your 
example.  The EBC is quite flexible and can be programmed in any number 
of insane ways that might cause trouble.

jeff

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-02-21  6:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <8024567.229231203576334424.JavaMail.nabble@isper.nabble.com>
2008-02-21  6:54 ` Sample driver Jeff Mock
2008-02-20  4:13 Silwer star
2008-02-20 12:06 ` Josh Boyer
2008-02-20 15:13   ` Jeff Mock

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).