LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 12-09-2010, 02:28 AM   #1
Milosman
LQ Newbie
 
Registered: Dec 2010
Posts: 3

Rep: Reputation: 0
Problem using SA-1100 GPIO registers


Hi there,

I'm having some serious trouble using my GPIO pin registers on my intel SA-1100 device, from kernel space ofc..
I want to map the physical addresses to some usable ones using ioremap and then use write32 and read32 to write and read them. Should be simple.. But is this the easiest way?
For reference, the devmanual of the SA-1100 can be found here: HERE

Here is the code I have:

#define GPIO_BASE 0x90040000
#define GPIO_LENGTH 0xFFF

static void *io_base, *GPLR, *GPDR, *GPSR, *GPCR;

void InitGPIO(void)
{
io_base = ioremap(GPIO_BASE, GPIO_LENGTH);
GPLR = io_base;
GPDR = io_base + 0x04;
GPSR = io_base + 0x08;
GPCR = io_base + 0x0C;

printk("io ports remapped %p\n ", GPLR);
}


Now I should be able to read the pins using:

ioread32(GPLR);


But this is returning the incorrect values.. (not dependent on what i write) Somehow I have the feeling that I didn't map the correct address. The address returned by ioremap is ca000000 but that shouldn't say anything right? What am I not seeing? Or am I not using the right methods?

Any help is greatly appreciated.
 
Old 12-13-2010, 02:25 PM   #2
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,850

Rep: Reputation: 161Reputation: 161
Using ioremap to access GPIO in kernel space is fine. The issue is GPIO_BASE define. Is it correct physical address?
 
Old 12-13-2010, 07:50 PM   #3
archieval
Member
 
Registered: Apr 2007
Location: Philippines
Distribution: Kubuntu, Ubuntu, CentOS
Posts: 289

Rep: Reputation: 41
Perhaps the value of GPIO_BASE is already mapped or some mapped address space already covers it? Have you tried reading directly on the GPIO_BASE address?
 
Old 12-14-2010, 01:41 AM   #4
Milosman
LQ Newbie
 
Registered: Dec 2010
Posts: 3

Original Poster
Rep: Reputation: 0
Yes, since GPIO_BASE = GPLR. But the matter has just been solved using register shortcuts i found in hardware.h ... so much effort for nothing.

But thanks for the advice!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I2C problem (registers not writable) lqu Linux - Embedded & Single-board computer 0 11-08-2010 11:45 AM
Using GPIO (from kernel GPIO support) in MY application DannyGilbert Linux - Kernel 2 03-16-2009 07:52 AM
Display problem on Dell Inspiron 1100 k.r.hiremath Linux - Laptop and Netbook 1 06-27-2006 07:04 PM
Problem with reading/writing GPIO on video card with bttv compatible chip boky Linux - Hardware 0 10-13-2005 05:08 AM
Inspiron 1100 HD Squeak problem in Fedora Darkskies Fedora 2 03-10-2004 08:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 06:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration