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.

How to config mux as gpio in omap3530

Other Parts Discussed in Thread: OMAP3530

chip is omap3530.work in linux.

I want to config pin work in gpio10.

I compile the driver file,as follows:

 

static void omap3530_gpio_int_cfg(void)
{
int result;
int reg;
int ret;
/*config gpio for mux in omap3530*/

ret = gpio_get_value(OMAP3530_INT_GPIO);
printk("gpio%d = %d\n", OMAP3530_INT_GPIO, ret);

omap_cfg_reg(OMAP3530_INT_GPIO);
//omap_mux_init_gpio(10, OMAP_PIN_INPUT_PULLUP);

//omap_mux_init_gpio(OMAP3530_INT_GPIO, OMAP_MUX_MODE4 | OMAP_PIN_INPUT);

/*request gpio as irq*/
//if(gpio_request(OMAP3530_INT_GPIO, "GPIO IRQ") < 0)
//printk(KERN_ERR "Failed to request GPIO10 for gpio10 irq\n");
printk("req=%d\n", gpio_request(OMAP3530_INT_GPIO, "GPIO IRQ"));

/*gpio direction config for input*/
gpio_direction_input(OMAP3530_INT_GPIO);
/*config irq to falling trigger*/
set_irq_type(OMAP_GPIO_IRQ(OMAP3530_INT_GPIO), IRQ_TYPE_EDGE_FALLING);

/*enable gpio irq*/
enable_irq(gpio_to_irq(OMAP3530_INT_GPIO));
printk("line = %d\n", __LINE__);

/*when init module, reuqest irq. Do not in open dev, becase /proc*/
result = request_irq(OMAP_GPIO_IRQ(OMAP3530_INT_GPIO),
card_detect_interrupt,
IRQF_DISABLED,
"card_detect",
NULL);
if(result)
{
printk(KERN_INFO "short: can't get assigned irq %i\n", OMAP_GPIO_IRQ(OMAP3530_INT_GPIO));
}
}

but it does not work:

How to do?

  • Zhang,

    You've to configure CONTROL_PADCONF_SYS_OFF_MODE[31:16] register @ 0x4800_2A18 to mode-4. I'm not sure whether the mux mode is added in your mux configs. But you can manually write to this register for mode-4

  • I do it ,but it does not work.

    code:

    static void omap3530_gpio_int_cfg(void)
    {
    int result;
    int reg;
    int ret;
    /*config gpio for mux in omap3530*/

    ret = gpio_get_value(OMAP3530_INT_GPIO);
    printk("gpio%d = %d\n", OMAP3530_INT_GPIO, ret);
    #if 1
    reg = readl(g_mux_vir_addr + OMAP3530_MUX_ADDR);
    printk("reg = %x\n", reg);
    reg = 0x011c0000;
    writel(reg, g_mux_vir_addr + OMAP3530_MUX_ADDR);
    printk("reg = %x\n", reg);
    #else
    omap_cfg_reg(OMAP3530_INT_GPIO);
    #endif
    /*request gpio as irq*/
    //if(gpio_request(OMAP3530_INT_GPIO, "GPIO IRQ") < 0)
    //printk(KERN_ERR "Failed to request GPIO10 for gpio10 irq\n");
    //printk("req=%d\n", gpio_request(OMAP3530_INT_GPIO, "GPIO IRQ"));

    /*gpio direction config for input*/
    //gpio_direction_input(OMAP3530_INT_GPIO);
    /*config irq to falling trigger*/
    set_irq_type(OMAP_GPIO_IRQ(OMAP3530_INT_GPIO), IRQ_TYPE_EDGE_FALLING);

    /*enable gpio irq*/
    //enable_irq(gpio_to_irq(OMAP3530_INT_GPIO));
    printk("line = %d\n", __LINE__);

    /*when init module, reuqest irq. Do not in open dev, becase /proc*/
    result = request_irq(OMAP_GPIO_IRQ(OMAP3530_INT_GPIO),
    card_detect_interrupt,
    IRQF_DISABLED,
    "card_detect",
    NULL);
    if(result)
    {
    printk(KERN_INFO "short: can't get assigned irq %i\n", OMAP_GPIO_IRQ(OMAP3530_INT_GPIO));
    }
    }

  • Zhang,

    Do you have devmem2 utility with you in your filesystem? You try passing the physical address and you can get the values in those registers. Can you dump the pinmux registers, and all GPIO registers. Then we can come to a conclusion.