I'm new to Linux device driver writing. Can anyone offer any advice on the proper way to access memory mapped hardware registers?
I'm tinkering with stuff using MCF54455EVB. This has a 7-segment LED display. So, from u-boot I can display "12" on it just by doing:
-> mw.l 0x09000014 0x12
Now I'm trying to do the same thing from a Linux device driver. According to books/online sources this should work:
#define LED_REG_ADDRESS 0x09000014
void __iomem *reg;
request_mem_region(LED_REG_ADDRESS, 4, "LED");
reg = ioremap_nocache(LED_REG_ADDRESS, 4);
printk(KERN_INFO "LED phys = %x, virtual = %x\n",
LED_REG_ADDRESS,
(unsigned int)reg);
writel(0x00000012, reg);
I'm assuming that ioremap_nocache should program the MMU to give a translation from kernal allocated virtual address to the actual physical register addess with no cacheing. When it runs it prints the following, but the LED does not change.
LED phys = 9000014, virtual = e1002014
and /proc/iomem shows me that the address has been registered. Have tried all sorts of variations on the above code, but nothing works. Anybody have any ideas?