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.

Linux/TPS659037: TPS659037 watchdog support in device tree / linux

Part Number: TPS659037
Other Parts Discussed in Thread: AM5748,

Tool/software: Linux

Hi

we use http://www.ti.com/product/TPS659037 with AM5748 and would like to use the watch dog component on this PMIC.

In device tree of our reference IDK we find subtrees for several PMIC extra functions like rtc but no subnode for the watchdog:

tps659038: tps659038@58 {

compatible = "ti,tps659038";

reg = <0x58>;

interrupts-extended = <&gpio6 16 IRQ_TYPE_LEVEL_HIGH

       &dra7_pmx_core 0x418>;

#interrupt-cells = <2>;

interrupt-controller;

ti,system-power-controller;

ti,palmas-override-powerhold;

 

tps659038_pmic {

compatible = "ti,tps659038-pmic";

…..

tps659038_rtc: tps659038_rtc {

compatible = "ti,palmas-rtc";

interrupt-parent = <&tps659038>;

interrupts = <8 IRQ_TYPE_EDGE_FALLING>;

wakeup-source;

};

 

tps659038_pwr_button: tps659038_pwr_button {

compatible = "ti,palmas-pwrbutton";

interrupt-parent = <&tps659038>;

interrupts = <1 IRQ_TYPE_EDGE_FALLING>;

wakeup-source;

ti,palmas-long-press-seconds = <12>;

};

 

tps659038_gpio: tps659038_gpio {

compatible = "ti,palmas-gpio";

gpio-controller;

#gpio-cells = <2>;

};

 

extcon_usb2: tps659038_usb {

compatible = "ti,palmas-usb-vid";

ti,enable-vbus-detection;

ti,enable-id-detection;

/* ID & VBUS GPIOs provided in board dts */

};

Couls you advice

- how to enable the watchdog, how to set the watchdog mode/time/lock

- if we need to write an interrupt handler ourselves which resets the watchdog or if this is done by the driver

Thanks, Chris

  • Hi, Chris,
    Watchdog is disabled by default. SW can enable watchdog and lock (write protect) watchdog register (WATCHDOG).
    The watchdog timer has two modes of operation, periodic mode and interrupt mode.
    In periodic mode, an interrupt is generated with a regular period N that is defined by the WATCHDOG.TIMER setting. This interrupt is generated at the beginning of the period (when the watchdog internal counter equals 1). The IC initiates a shutdown at the end of the period (when the internal counter has reached N) only if the interrupt has not been cleared within the defined time frame (0 to N). In this mode, when the interrupt is cleared, the internal counter is not reset. The counter continues to count until it reaches the maximum value (defined by the TIMER setting) and automatically rolls over to 0 in order to start a new counting period. Regardless of when the interrupt is cleared within a given period (N), the next interrupt is generated only when the ongoing period completes (reaches N). The internal watchdog counter is initialized and kept at 0 as long as the RESET_OUT pin is low. The counter begins counting as soon as the RESET_OUT pin is released.
    In interrupt mode, any interrupt source resets the watchdog counter and begins the counting. If the sources of the interrupts are not cleared (INT line released) before the end of the predefined period N (set by WATCHDOG.TIMER setting) then the device initiates a shutdown. If the sources of the interrupts are cleared within the predefined period, then the watchdog counter is discarded (DC) and no shutdown sequence is initiated.
    Please also refer to "Watch Dog Timer Register" in Section 3.7.5 of register map which is linked below; there are details about the registers and bits definition:
    www.ti.com/.../sliu015b.pdf.
  • Hi Phil,

    thank. This I knew. This works if we want to use control watchdog directly by I2C.

    The question was more if there is any support for this watchdog in the PMIC device tree node as it is the case with the remaining PMIC functionality like RTC, etc.

    When controling the watchdog directly by I2C I'm afraid of resource conflicts:

    1) The PMIC device tree node is a subnode of the I2C1 bus node. So the driver will write to PMIC node address possibly at the same time when we will directly by I2C.

    2) In the PMIC device tree node the PMIC interrupt is defined hence there will be handler for this interrupt already. How could we then attach our routing which clears the watchdog bit.

    Best regards, Chris

  • Hi Christian,

    The processor team developed the drivers for the TPS659037, but I did find this from a search online:

    lore.kernel.org/.../

    If you have questions, I'd recommended making a new post to the AM57xx forums, but we can try to help as well.

  • Hi,

    I'll make a new post to the AM57xx forums. The lore.kernel.org/.../ code does not seem to be part of the current Kernel..

    Regards, Chris