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.

GPIO interrupt configuration on am3517 - Interrupt issue

Other Parts Discussed in Thread: AM3517

Hello

 I am trying to configure GPIO 106 as external interrupt PIN to use with ADP5588 keypad controller. I am running the Linux 2.6.37 on AM3517.

 It looks like the way I configured GPIO pin 106 as external interrupt is not correct, due to which registered IRG function is not getting invoked.

Could someone suggest what is wrong /missing in my configuration  function to enable GPIO Pin as external interrupt?

 

Here is the function which I wrote to configure GPIO pin

#define ADP_5588_KEYPAD_IRQ        106

/* I2C board info to initialize ADP client */

static struct i2c_board_info __initdata am3517evm_ADP5588_boardinfo[] =
{
    {
       I2C_BOARD_INFO("adp5588-keys", 0x34),
       .platform_data = &adp5588_kpad_data_info,
       .irq = OMAP_GPIO_IRQ(106),
     },
};

/* Function which configures GPIO 106 as interrupt */ 

static int ADP_5588_keypad_init_irq(void)
{
    int ret = 0;

   omap_mux_init_gpio(ADP_5588_KEYPAD_IRQ, OMAP_PIN_INPUT_PULLUP);

   ret = gpio_request(ADP_5588_KEYPAD_IRQ, "ADP-5588-keypad-irq");


   if (ret < 0)
  {
      printk(KERN_WARNING "ADP-5588-keypad failed to request GPIO#%d: %d\n", ADP_5588_KEYPAD_IRQ, ret);
      return ret;
  }

  if (gpio_direction_input(ADP_5588_KEYPAD_IRQ))
  {
      printk(KERN_WARNING "ADP-5588-GPIO#%d cannot be configured as " "input\n", ADP_5588_KEYPAD_IRQ);
     return -ENXIO;
  }

  if (gpio_set_debounce(ADP_5588_KEYPAD_IRQ, 0x05))
  {
      printk(KERN_WARNING "ADP-5588-GPIO#%d cannot set debouce " "input\n", ADP_5588_KEYPAD_IRQ);
      return -ENXIO;
  }


  printk(KERN_INFO "ADP_5588_keypad_init_irq - successful\n");

   return ret;

}

 

And also I added enable_irq_wake(client->irq); in my ADP5588 probe function.

  • Hi,

    Is the pinmux for this pin correctly done?
  • Thanks for your reply.

    Yes I enabled clock and configured PIN MUX using ioread32 and iowrite32 APIs. After this change booting stops and following error message appears on serial terminal. I am new to linux so I am not sure what is going wrong here

    [ 374.773376] net eth0: could not connect to phy ffffffff:00
    [ 375.780731] Sending DHCP requests ...... timed out!
    [ 464.926177] IP-Config: Retrying forever (NFS root)...
    [ 465.440704] net eth0: PHY already attached
    [ 465.445098] net eth0: could not connect to phy ffffffff:00
    [ 466.452606] Sending DHCP requests ......


    Here is the source code that I used to configure GPIO

    /* Base address of register map */
    pBase = ioremap(0x48000000, 0x1056000);

    /* Setup gpio_106 for input. */
    reg32 = ioread32(pBase + 0x21FC);
    reg32 &= DSS_PADCONF_DSS_D16_CLR;
    reg32 |= AM3X_PADCONF_GPIO_106_EN;
    iowrite32(reg32, pBase + 0x21FC);

    /* Enable functional clock for GPIO4. */
    reg32 = ioread32(pBase + 0x5000);
    reg32 |= AM3X_CM_ENABLE_GPIO4;
    iowrite32(reg32, pBase + 0x5000);

    /* Enable interface clock for GPIO4. */
    reg32 = ioread32(pBase + 0x5010);
    reg32 |= AM3X_CM_ENABLE_GPIO4;
    iowrite32(reg32, pBase + 0x5010);

    /* Configure gpio_106 as input. Set bit 10 of GPIO_OE to do so. */
    reg32 = ioread32(pBase + 0x1054000 + AM3X_GPIO_OE);
    reg32 |= KEY_GPIO_106;
    iowrite32(reg32, pBase + 0x1054000 + AM3X_GPIO_OE);

    /* Configure gpio_106 to generate interrupt */
    reg32 = ioread32(pBase + 0x1054000 + AM3X_GPIO_IRQENABLE1);
    reg32 |= KEY_GPIO_106;
    iowrite32(reg32, pBase + 0x1054000 + AM3X_GPIO_IRQENABLE1);

    /* Enable level low interrupt for gpio_106 */
    reg32 = ioread32(pBase + 0x1054000 + AM3X_GPIO_FALLINGDETECT);
    reg32 |= KEY_GPIO_106;
    iowrite32(reg32, pBase + 0x1054000 + AM3X_GPIO_FALLINGDETECT);

    /* Clear interrupt. */
    reg32 = KEY_GPIO_106;
    iowrite32(reg32, pBase + 0x1054000 + AM3X_GPIO_IRQSTATUS1);

    iounmap(pBase);
  • Dhanyakumar Hosamane1 said:
    /* Setup gpio_106 for input. */
    reg32 = ioread32(pBase + 0x21FC);
    reg32 &= DSS_PADCONF_DSS_D16_CLR;
    reg32 |= AM3X_PADCONF_GPIO_106_EN;
    iowrite32(reg32, pBase + 0x21FC);

    Are you sure 0x21FC is the correct offset? Isn't it 0x20FC?

  • Please disregard. GPIO_106 is at 0x21FC indeed.
  • However check your masks. It seems to me that you are masking bits 31-16 at 0x21FC, which are for MDIO_DATA.