Tuesday, August 3, 2010

Static IO Remapping during kernel bootup

Even though it is possible to map all IO modules, it becomes redundant to map all modules to VM.
See the mail discussion from RMK regarding this!

So, we do boot time IO mapping only for the modules that becomes absolutely necessary.

In our case, this happens to be the INTC and the GPT1.

In order to do this mapping, we first define the following structure in our core.c file:

static struct map_desc puppy_io_desc[] __initdata = {

    {
                .virtual        = PUPPY_L4_BASE_VIRT,
                .pfn            = __phys_to_pfn(PUPPY_L4_BASE),
                .length         = L4_CORE_SIZE,
                .type           = MT_DEVICE
        },
};



Note that we can define any VA for our peripherals, as long as they exist above VMALLOC_END, which again, is defined by us in vmalloc.h file
Check this discussion.

We chose:

#define PUPPY_L4_BASE_VIRT    0xFC000000
#define L4_CORE_SIZE                  0x00FFFFFF

While IO_ADDRESS in hardware.h file is defined as:

#define IO_ADDRESS(x) (((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + 0xf0000000)

With this configuration, we are now able to program INTC, though GPT1 is still not getting configured correctly. I see that GPT1 is by default free-running even before it is programmed and programming it seems to be ignored. May also need to cross check INTC programming as well.

All in all, it is now possible to progress further as I can ensure correct register locations are being accessed with the above settings....phew, finally!

No comments:

Post a Comment