linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Mock <jeff@mock.com>
To: Dell Query <dell.query@yahoo.com>
Cc: linuxppc-embedded@ozlabs.org
Subject: Re: PPC440EPx GPIO control help
Date: Wed, 17 Oct 2007 20:22:37 -0700	[thread overview]
Message-ID: <4716D17D.1070206@mock.com> (raw)
In-Reply-To: <65478.31425.qm@web45611.mail.sp1.yahoo.com>


Oh no, it's not necessary to use /proc, pdev-lcd was my first device 
driver.  I wanted to try out all of the different features and it was 
fun to add a /proc interface.  It could just as easily have a read 
interface or an ioctl() or whatever.

I think LDD3 is fantastic, stick with it and go slowly.  Start out by 
writing little test drivers on your desktop machine where it's easy to 
debug.  LDD3 really got me over the hump of writing device drivers.

jeff



Dell Query wrote:
> Hi Jeff,
> 
> I read the device drivers part of the LDD3, it's really difficult as
> I
expected. Thanks for the sample codes. I'll develop my own driver basing
from your samples. Regarding reading the status of the LED, is it really
necessary to use proc?

> Regards,
> dell
> 
> Jeff Mock <jeff@mock.com> wrote: 
> David Hawkins wrote:
>>> I have a PPC440EPx Sequoia Evaluation board that runs on Linux 2.6.21. 
>>> What I would want to do is to control (write and read values to) its 
>>> GPIO. Perhaps similar to Turbo C's outputb(0x378,0x01) to write and 
>>> inportb(0x378) to read. I read the PPC440EPx manual but I find it 
>>> difficult to understand.
>>>
>>> Could anyone show me any tutorial or some sample codes?
>> I copied the code below from some test code I wrote for a TS7300
>> board (uses an ARM EP9302 processor). However, since its user-space
>> code it should work fine.
>>
> 
> I might be a little out of date, but I think you must write your own 
> driver to wiggle the GPIO pins on a 440 processor.  I just finished a 
> project using a 440GX with a 2.6.15 kernel (we froze the code about 8 
> months ago).
> 
> The 440 powerPC core is a 32-bit processor with 36-bit physical 
> addresses.  The physical address for the GPIO pins is someplace above 
> 4GB.  An mmap() of /dev/mem only lets you map the lower 4GB of the 
> address space, as a result you can't write a user space program on the 
> 440 to wiggle the GPIO pins.  (This was true with 2.6.15, I can't speak 
> for later kernels).
> 
> This tossed me into writing device drivers, which turned out to be not 
> nearly as scary as I imagined.  The Linux Device Drivers book is fabulous:
> 
>     http://lwn.net/Kernel/LDD3/
> 
> Here is a driver for the 440GX that controls an LED on one of the GPIO 
> pins you can use as an example.  The device /dev/pdev-led has a 
> read/write interface so you can do something like this:
> 
>     # echo "1" > /dev/pdev-led      # turn on LED
>     # echo "0" > /dev/pdev-led      # turn off LED
> 
> It also has a /proc interface so you can cat /proc/pdev-led to read the 
> status of the LED.  There are several other drivers there that probably 
> won't be interesting, but pdev-led.c is probably a good starting point:
>  
> http://www.mock.com/wsvn/listing.php?repname=mock.pdev&path=/trunk/sw/driver/
> 
> jeff
> 
> 
> 
> 
>  __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 

  reply	other threads:[~2007-10-18  3:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-17  3:29 PPC440EPx GPIO control help Dell Query
2007-10-17  4:15 ` David Hawkins
2007-10-17  6:21   ` Jeff Mock
2007-10-17 10:49     ` Josh Boyer
2007-10-17 12:17       ` Misbah khan
2007-10-17 20:26       ` Jeff Mock
2007-10-17 20:41         ` Josh Boyer
2007-10-17 16:19     ` David Hawkins
2007-10-18  2:05       ` Dell Query
2007-10-18  2:00     ` Dell Query
2007-10-18  3:22       ` Jeff Mock [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-10-17  3:14 Dell Query

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=4716D17D.1070206@mock.com \
    --to=jeff@mock.com \
    --cc=dell.query@yahoo.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).