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.

tps65911x gpio bug

Other Parts Discussed in Thread: TPS65910

I was trying to use one of the gpios on the tps659113 on our custom board.  I noticed that the gpio functions use tps65910_clear_bits(), defined in linux drivers/mfd/tps65910.c.  It has the line:

data &= mask;

Surely it should be:

data &= (~mask);

????

Dan -

  • Hi Dan,

    It seems you are right (the mask should be inverted) but depends on the logic which is used. Could you specify which SDK you are using to look and analyze the source code.

    BR

    Tsvetolin Shulev

  • Tsvetolin,

    Thanks for the prompt reply.

    I am using ti-ezsdk_dm814x-evm_5_05_02_00.

    • tps65910_gpio_set() and tps65910_gpio_input() call tps65910_clear_bits()  (in drivers/mfd/tps65910-gpio.c)
    • tps65910_clear_bits()  has the uninverted mask  (in drivers/mfd/tps65910.c)

    For example, here is the gpio-set function:

    static void tps65910_gpio_set(struct gpio_chip *gc, unsigned offset,
            int value)
    {
       struct tps65910 *tps65910 = container_of(gc, struct tps65910, gpio);

       if (value)
          tps65910_set_bits(tps65910, TPS65910_GPIO0,
                GPIO0_GPIO_SET_MASK);
       else
          tps65910_clear_bits(tps65910, TPS65910_GPIO0,
                GPIO0_GPIO_SET_MASK);
    }

    The gpio-set function is specifying GPIO0_GPIO_SET_MASK to both tps65910_set_bits() and tps65910_clear_bits().  Therefore, it is telling clear_bits() which bits to clear, not which bits to keep.  Without adding the inversion, the gpio-set function has the effect of changing outputs to inputs, because the other-than-GPIO0_GPIO_SET_MASK bits get forced to zero, and the bit that you actually wanted to clear is left unchanged.  It seems like the worst possible outcome.

    Dan -

  • As I understand the problem is related to the DM814x and EZSDK. Therefore I will move the discussion to the proper form and will inform the owner.

    BR

    Tsvetolin Shulev

  • Apologies, I must have mis-hit when I first posted.  I definitely intended the post to go to the DM814x forum.  Though, since neither of these files have changed in Arago for two or three years, I suspect you have the same code.

    Anyway, thanks again.

    Dan -

  • Hi Dan,

    To me it seems that you are completely right. I will try to report that one. Thank you very much for sharing this.

    BR

    Vladimir