Hi All,
I'm writing a device driver for an ARM based board (Cirrus EP9302). One of the functions of the driver is to be able to write values to the address 0x23800000. How do you actually write to a physical address from within the kernel?
Hi All,
I'm writing a device driver for an ARM based board (Cirrus EP9302). One of the functions of the driver is to be able to write values to the address 0x23800000. How do you actually write to a physical address from within the kernel?
Did you check how the other device drivers do it? (BTW: The kernel is full of examples).
jbe
l
H!,
Just type cast the address to a variable and use it. Any thing that is directly mapped to the processors address space can be accssed like that. Also try __raw_read Api, should be available on ARM.
ull
unsigned long *ptr =3D 0xphysicaladdr
*ptr =3D yourdata.
This would be wrong on other architectures (I am unfamiliar with ARM but I believe most of them have an MMU and therefore it is wrong there too). Normally you would need a phys_to_virt() to convert the physical address to the virtual address used in the kernel process.
ie
unsigned long *ptr = phys_to_virt( 0xphysicaladdr );
*ptr = yourdata;See
Cheers, John McCallum Edinburgh
Uzytkownik "John McCallum" napisal w wiadomosci news:gci1ej$k03$1$ snipped-for-privacy@news.demon.co.uk...
to
Please dont't forget about: volatile. Lot of time I spent, when I was trying to understad WHY :)
volatile unsigned long *ptr = phys_to_virt( 0xphysicaladdr );
*ptr = yourdata;Grzegorz Kania Czerwionka, Poland
is
t I
sing
phys_to_virt() only works with directly mapped physical address. I don't think using phys_to_virt() is the best idea, anyway. Usually you do this in several steps in a device driver:
Thanks, Marco Wang
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.