How to Access a register and place data in it Linux

J.Selvabharathi
Hi,
Iam good in driver porting for wince Environment.

Now i need to Access a registerin linux for mini 2440.

I also saw the driver coding for Leds in linux.

I want to confirm that my assumptions are correct it.So please confirm it

My Requirement:

Just want to place data 0x01 in address 0xF012.

My Assumptions:

# define Reg_Address (0xF012)//Physical address

And change it into virtual address and place data in it.

is it right?.Can somebody help me on it please...

Juergen Beisert
void __iomem *vadr = ioremap(0xf000, 0x1000);
writeb(0x01, vadr + 0x12);

J.Selvabharathi
Hi Juergen Beisert,
Thanks for your help.
Is this the only way I can access a register?.

Juergen Beisert
What else do you are searching for? My two lines do what you outline in
your first question.

J.Selvabharathi
Hi Juergen,

Thanks for your reply i will let you know after trying your first answer.

Thank you very much.

selvabarathi
Hi Juergen,
I saw in some of the GPIO files they are using cdev for allocation.
Iam very confused by all those files on the net.
Can you tell me which is the good way to access a gpio.

Juergen Beisert
Do you want to access/change GPIOs in your kernel driver or in your
userland application?
in kernel: Use the GPIO-lib API the kernel provides
in userland: Use the sysfs way to access and change GPIOs

perry
Hi, I want to read GPIO value directly from register.

Below i explain what i have to do

In my application i want to send data on GPIO and also read from GPIO pins
for that i have develop one module . in that i am using ioctl and read for
send to receive from GPIO pins. Write data on GPIO pins using ioctl it's
work fine but when i am going to read value from GPIO pins using read
system call from userspace . but it's take time.But i want to read GPIO as
much as fast. for that i want to read GPIO pins directly from register.

I hope you can understand what i have to do.


Let me know solution...!!

xyz
Multiple posts on the same topic only creates "noise".

Just like this one!

perry
Hey xyz ,,
Can u give me post link ...!!!

xyz
http://www.friendlyarm.net/forum/topic/3611

????