Project

General

Profile

Basic Driver Virtual Addressing Question

Added by david kasper almost 14 years ago

I have written a simple "hello world" driver and I am trying to display the value of the OMAP REVID register from the init function. I assigned the physical address to a pointer; however a segmentation fault is generated when memory is accessed. Can anybody give me an example on how to do this? My original source is listed below.

Thanks,
David Kasper

#define REVID_ADDR 0x01C14000

static int __init hello_init(void) {
uint32 uValue; * * *
}

uValue = ((volatile uint32)REVID_ADDR);
printk("\nDEVID0 = 0x%lX", uValue);

Replies (1)

RE: Basic Driver Virtual Addressing Question - Added by Michael Williamson almost 14 years ago

You might want to check the fpga_ctrl.c file for an example, or check the online manual for Linux Device Drivers which is extremely helpful.

Short answer is that you need to map in IO regions (physical address space) to the kernel address space before you can use it. This is typically done using ioremap_nocache. And normally you want to tell the kernel about memory spaces you intend to use, so you might use request_mem_region() to do that.

If you want the JTAG id information, you might want to just dump out the /proc/cpuinfo file. That has the JTAG ID information in it, I think:

root@mitydsp # cat /proc/cpuinfo

-Mike

    (1-1/1)
    Go to top
    Add picture from clipboard (Maximum size: 1 GB)