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.

AM64x: Using RTC with low level interrupt

On our custom AM64x hardware we have a RTC with the RTC INT pin connected to EXTINT, IOPAD(0x0278).

Now it looks like we can not use the RV3028 RTC interrupt because the GPIO controller nor the GIC EXTINT source (SPI range GLUELOGIC_GLUE_EXT_INTN_OUT_0) is able to detect a level low interrupt type.

// gpio-davinci.c
static int gpio_irq_type(struct irq_data *d, unsigned trigger)
{
        if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING))
                return -EINVAL;

// rtc-rv3028.c
ret = devm_request_threaded_irq(&client->dev, client->irq,
                                NULL, rv3028_handle_irq,
                                IRQF_TRIGGER_LOW | IRQF_ONESHOT,
                                "rv3028", rv3028);


The AM64x GPIO controller does not support level interrupts, but only falling/rising. And if I try to use the GICs EXTINT source, it also says no support for low level interrupt.

So I assume we will be not able to use this RTC int signal in our design.

The IRQF_TRIGGER_LOW type seems to be common for RTCs. Is there something we can do?

  • Hello Wadim Egorov

    Thank you for the query.

    I am looking at the belowdocument to undersad the use case. Do you have some pointers?

    https://www.microcrystal.com/fileadmin/Media/Products/RTC/App.Manual/RV-3028-C7_App-Manual.pdf

    Below is the inputs i received internally. Can you please explain the usecase

    It is not clear why they need a level interrupt.  I assume the RTC is trying to get the processors attention when its output toggle from high to low.  This high to low transition would trigger an falling edge interrupt and the software can service the RTC request.  So why would they want a low level interrupt that constantly generates interrupts as long as the signal is low?  This could have a very negative effect on processor performance as the OS gets stuck serving the RTC for the whole time the signal is low.

    Regards,

    Sreenivasa

     

  • Hi Sreenivasa,

    Our use case is just triggering an interrupt on EXTINT, when the RTC has a interrupt event. We have a pull up on EXTINT, so I think when the RTC pulls the pin low we should be able to use a falling edge type trigger. I think the RTC just uses the naming IRQF_TRIGGER_LOW so it looks like it only takes a low level interrupt. But we will test it as a falling interrupt and get back to you. 

    Thanks, Sam

  • Hello Wadim Egorov

    Thank you for the inputs. Please refer below additional suggestions 

    Can you consider using the falling edge trigger function on one of the GPIO pins to initiate the ISR and have the ISR service the one that initiated the interrupt and clear it once done, but check the logic state of the GPIO pin before completing the ISR.  If still low they need to check the other sources and address them also.  If high, no other sources are pending.  So they can end the ISR and return to the pervious task.

    Regards,

    Sreenivasa,

  • Making the RTC driver use a falling edge irq type seems to make the interrupt work.
    Thank you.

  • Hello Wadim Egorov

    Good to hear and thank you for the inputs.

    Regards,

    Sreenivasa