Skip to main content.

5.6.1. Accessing devices


avoid conflicts with other drivers:

struct resource *request_mem_region(unsigned long start, unsigned long len, char *name);
void release_mem_region(unsigned long start, unsigned long len);

this shows up in /proc/iomem:

-bash-3.2# cat /proc/iomem 
90000000-97ffffff : /plb/pciex@0a0000000
98000000-9fffffff : /plb/pciex@0c0000000
ef600200-ef600207 : serial
ef600300-ef600307 : serial
ef600400-ef600411 : ibm_iic
ef600500-ef600511 : ibm_iic
ef6c0000-ef6cffff : dwc_otg.0
  ef6c0000-ef6cffff : dwc_otg
f8000000-f8001fff : ndfc-nand.0
fc000000-ffffffff : fc000000.nor_flash

exclusive variants

request_mem_region_exclusive(start, n, name);

map physical address into kernel address space:

void *ioremap(unsigned long phys_addr, unsigned long size);
void iounmap(void *addr);

avoid compiler optimization problems:

void barrier();

avoid compiler and hardware reordering problems:


be portable and avoid above problems:

void io(write|read)(8|16|32)[be] functions

be versions for big endian registers!

5.6. Interfacing real hardware 1. Denx Training Topics 5.6.2. Interrupt Handling
Prev Home Next