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.

AM335X- GPIO interrupt

Dear Sir,


I want to implement the reset button(S2_GPIO2_8 from BBB_SCH) interrupt in the BBB EVB, but it couldn't generate the interrupt when I pressed the S2 button, my code add into the drivers/watchdog/omap_wdt.c as bleow,

static irqreturn_t rst_button_handle_irq(int irq, void *dev)
{

    printk("=============rst_button_handle_irq\n");
    return IRQ_HANDLED;
}

static void reset_button_gpio_init(void)
{
    int gpio_reset_button_pin = 72;//gpio2_8
    int status = gpio_request(gpio_reset_button_pin,"rstButton\n");
    if (status < 0)
        pr_err("Failed to request gpio for rstButton");
    else
        printk("rstButton request success\n");

    gpio_direction_input(gpio_reset_button_pin);
 

    status = request_irq(gpio_to_irq(gpio_reset_button_pin), rst_button_handle_irq, 0, "rst_Button", NULL);
    if (status < 0)
        printk("rstButton irq failed\n");
    else
        printk("rstButton request_irq success\n");
}

static int omap_wdt_probe(struct platform_device *pdev)
{
    struct omap_wd_timer_platform_data *pdata = dev_get_platdata(&pdev->dev);
    struct watchdog_device *omap_wdt;
    struct resource *res, *mem;
    struct omap_wdt_dev *wdev;
    u32 rs;
    int ret;

    reset_button_gpio_init();

.

.}

Power on message:

[    1.275139] rstButton request success
[    1.284016] rstButton request_irq success
[    1.289229] omap_wdt: OMAP Watchdog Timer Rev 0x01: initial timeout 60 sec

The interrupt was created by cat /proc/interrupts

root@am335x-evm:~# cat /proc/interrupts
           CPU0
 28:       1693      INTC  12  edma
 30:          0      INTC  14  edma_error
 44:         54      INTC  28  mmc1
 56:          0      INTC  40  4a100000.ethernet
 57:         22      INTC  41  4a100000.ethernet
 58:          2      INTC  42  4a100000.ethernet
 59:          0      INTC  43  4a100000.ethernet
 80:       5296      INTC  64  mmc0
 84:       4888      INTC  68  gp_timer
 86:        730      INTC  70  44e0b000.i2c
 87:          0      INTC  71  4802a000.i2c
 88:        806      INTC  72  OMAP UART0
 91:          0      INTC  75  rtc0
 92:          0      INTC  76  rtc0
 94:          0      INTC  78  wkup_m3_txev
125:          0      INTC 109  53100000.sham
127:          0      INTC 111  48310000.rng
150:          0  44e07000.gpio   6  mmc0
216:          0  481ac000.gpio   8  rst_Button
Err:          0
root@am335x-evm:~#


Please give me a favor for the question, thanks.


B.R.

Joe