EmbeddedRelated.com
Forums

How to map physical address of CS8900A under linux driver?

Started by Aimingoo May 23, 2006
Hello, All.
As we all know that the standard linux kernel does not allow us to access
physical address of devices, so the physical address must be converted to
virtual address before any IO operation. In my disign, the cs8900a is
configured for IO mode, its bus physical address is 0x1001_0000, and its
default IO base address is 0x300, ARM9(Cirrus Logic EP9302) processor,
linux kernel 2.4.21.
Now, problem is, how can I get the virtual address of the cs8900a under
my
device driver?

The code below can't work correctly.

  ...
  static unsigned int virt_base;

  if(check_mem_region(0x10010300, 0x10)){
    printk(KERN_INFO "CS8900A: memory already in use\n");
  } else 
    request_mem_region(0x10010300, 0x10, "CS8900A");
  }
  virt_base = (unsigned int)ioremap(0x10010300, 0x10); // 16 bytes

  // get signature
  writew(0x0000, virt_base+0x0a);
  mdelay(100);
  printk(KERN_INFO "CS8900A : 0x%lx\n", readw(virt_base+0x0c));
  ...

I appreciate anyone who help this.