Re: Memory mapping a UART

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le Fri, 7 Dec 2007 14:04:16 +0530,
"Rajat Jain" <Rajat.Jain@xxxxxxxxxxxx> a écrit :

> You need request_mem_region().

I'm not sure it's enough in Gavin's case.

>From what I understand, request_mem_region() simply allows to reserve a
memory region, to say « I'm using it », so that nobody else will use it.

However, it doesn't do anything with regard to mapping this physical
memory region in the virtual address space.

After a quick look at several drivers using request_mem_region(), I
have the impression that:

 * drivers handling peripherals that are driven through registers at a
   physical position already accessible through the kernel identity
   mapping only use request_mem_region()

   Ex: http://lxr.free-electrons.com/source/drivers/char/rtc.c#971

 * drivers handling peripherals that are driven through registers at a
   physical position not accessible through the kernel identify mapping
   use both request_mem_region() and ioremap().

   Ex: http://lxr.free-electrons.com/source/drivers/net/defxx.c#551

This is also confirmed by chapter 9 of Linux Device Drivers
(http://lwn.net/images/pdf/LDD3/ch09.pdf), which says:

«
Allocation of I/O memory is not the only required step before that
memory may be accessed. You must also ensure that this I/O memory has
been made accessible to the kernel. Getting at I/O memory is not just a
matter of dereferencing a pointer; on many systems, I/O memory is not
directly accessible in this way at all. So a mapping must be set up
first. This is the role of the ioremap function, introduced in the
section “vmalloc and Friends” in Chapter 1. The function is designed
specifically to assign virtual addresses to I/O memory regions.
»

Sincerly,

Thomas
-- 
Thomas Petazzoni, thomas.petazzoni@xxxxxxxx, http://thomas.enix.org
Jabber, thomas.petazzoni@xxxxxxxxx
Toulibre, http://www.toulibre.org - APRIL, http://www.april.org
Fingerprint : 0BE1 4CF3 CEA4 AC9D CC6E  1624 F653 CB30 98D3 F7A7

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux