ioremap and __raw_writel problems

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ioremap and __raw_writel problems

2,431 Views
kondaveetiarung
Contributor II

Hi,

i want to on a particular gpio function in linux with out using a gpio_set_value and gpio_request and gpio_direction_output function.

i write a sample example but it is showing wrong results.

Please tell me how to read and write to gpio pad registers in linux.

void *b;

b=ioremap(0x0209c000,1024);       ----?here gpio data sheet gpio base address
printk(KERN_INFO "***********DATA DIRECTION Register is %x\n****",b);
int value=ioread32(b);
printk(KERN_INFO "**********READ Value is %d\n*****",value);
iounmap(b);
}

how to use __raw_writel function to gpio registers in linux .

0 Kudos
6 Replies

1,536 Views
kondaveetiarung
Contributor II

HI,

Please give your Valuable Rely.

0 Kudos

1,536 Views
igorpadykov
NXP Employee
NXP Employee

Hi kondaveeti

for questions with __raw_readl function in various kernel versions

please post on kernel mail list, as this is general kernel questions.

Best regards
igor

1,536 Views
igorpadykov
NXP Employee
NXP Employee

Hi kondaveeti

usage may differ depending on kernel version, please consider

more convenient way using memtool (imx-test/test/memtool):
www.nxp.com/lgfiles/NMG/MAD/YOCTO/imx-test-5.7.tar.gz

Usage __raw_writel function in linux may be posted on kernel mail list.

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,536 Views
kondaveetiarung
Contributor II

Hi igor,

Thank you for your Valuable Reply.

In my Previous kernel versions iam using __raw_real and __raw_writel in 3.0 kernel versions.

I have to use in  my driver source code so memtool is not use in my driver source code.

Right now iam using Device Tree support in 3.10.17 kernel Version.

Please tell me how to use it in this kernel versions,

0 Kudos

1,536 Views
igorpadykov
NXP Employee
NXP Employee

Hi kondaveeti

for 3.10.17 one can look at __raw_writel in arch/arm/mach-imx/cpu.c :
http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/tree/arch/arm/mach-imx/cpu.c?h=imx_3.10....

~igor

0 Kudos

1,536 Views
kondaveetiarung
Contributor II

Hi igor,

Thank you for your Valuable Reply.

My doubt is if iam working in GPIO Pins.In Iinux 3.0 kernel versions if i want to read and write in gpio registers so i need to use kernel virtual address in linux defined in the 

arch/arm/plat-mxc/include/mach/mx6.h

#define PERIPBASE_VIRT                  0xF2000000

so i will use this virtual address plus gpio port base address plus offset(register address) i will use and i will read.

same if i want to read gpio pad status Registers how can i use __raw_readl function in device tree kernel 3.10.17 kernels.

0 Kudos