This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Kernel module for configuration pin



Hi,

I generated the files mux.h and pinmux.h using Pin Mux Utility for am335x.

I use VAR-SOM-AM33.

I try write kernel module for configuration pin using generated header files.

In header mux.h i changed call function  writel(VALUE,AM335X_CTRL_BASE+OFFSET) to my function write_data(OFFSET,VALUE).

my write_data function :

static void write_data(u32 off,u32 val)
{
    iowrite32(val,virt_addr + off);
}

my init function :

#define AM335X_CTRL_BASE 0x44E10000

static u32* virt_addr;

static int __init mod_init(void)
{
    if(!request_mem_region(AM335X_CTRL_BASE,0x0B35,"conf pin")) printk(KERN_WARNING "%s: can not get region\n",MODNAME);
    
    virt_addr = (u32*)ioremap(AM335X_CTRL_BASE,0x0B35);
   
    if(!virt_addr) printk(KERN_WARNING "%s: can not get virtual address\n",MODNAME);

    MUX_EVM();

    return 0;
}

Module works when i call MUX_VAL once.However when i call all definitions  MUX_VAL system freezes.
Is it possible to write such module,and how?