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.

dm8168 gpio0_25 can not output 1

Hi,TI

When I use the ccs to debug the uboot,I found that the gpio0_25 can not output.On my board,the gpio0_25 connects the led0.but the led0 can not be light.

here is my code:

/* tl8168 som led0.gpio0_25 */
__raw_writew(0x2, CM_ALWON_GPIO_0_CLKCTRL);
while(__raw_readl(CM_ALWON_GPIO_0_CLKCTRL) != 0x2);

__raw_writew((PTU | EN | M1), PINCTRL200_ADDR);
reg_val = __raw_readl(TI816X_GPIO0_BASE + 0x134);
reg_val &= ~(unsigned int)BIT(25);
__raw_writew(reg_val, TI816X_GPIO0_BASE + 0x134);
__raw_writew(BIT(25), TI816X_GPIO0_BASE + 0x194);

the value of PINCTRL200_ADDR is 0x48140B1C, the value of  TI816X_GPIO0_BASE is 0x48032000.

atfer executing __raw_writew((PTU | EN | M1), PINCTRL200_ADDR); the value of the address 0x48140B1C not change.

__raw_writew(reg_val, TI816X_GPIO0_BASE + 0x134);the value of the address 0x48032134 not change.

Thank You!

vefone

  • Hi Vefone,

    vefone said:
    __raw_writew((PTU | EN | M1), PINCTRL200_ADDR);

    vefone said:
    the value of PINCTRL200_ADDR is 0x48140B1C

    vefone said:
    atfer executing __raw_writew((PTU | EN | M1), PINCTRL200_ADDR); the value of the address 0x48140B1C not change.

    In which u-boot file you are making these changes? What is the value you have in PINCTRL200 register?

    Regards,
    Pavel

  • Hi,Pavel

    I make these changes in the board/ti/ti8168/evm.c file.

    Here are the change:


    +#define PINCTRL193_ADDR 0x48140B00
    +#define PINCTRL200_ADDR 0x48140B1C
    +#define TI816X_GPIO0_BASE 0x48032000
    +#define TI816X_GPIO1_BASE 0x4804C000
    +
    /*******************************************************
    * Routine: misc_init_r
    ********************************************************/
    int misc_init_r (void)
    {
    + u32 reg_val = 0;
    #ifdef CONFIG_TI816X_ASCIIART
    int i = 0, j = 0;
    +
    + /* tl8168 som led1.gpio1_13 */
    + __raw_writew(0x2, CM_ALWON_GPIO_1_CLKCTRL);
    + while(__raw_readl(CM_ALWON_GPIO_1_CLKCTRL) != 0x2);
    +
    + __raw_writew((PTU | EN | M1), PINCTRL193_ADDR);
    + reg_val = __raw_readl(TI816X_GPIO1_BASE + 0x134);
    + reg_val &= ~(unsigned int)BIT(13);
    + __raw_writew(reg_val, TI816X_GPIO1_BASE + 0x134);
    + __raw_writew(BIT(13), TI816X_GPIO1_BASE + 0x194);
    +
    char ti816x[23][79] = {
    ":,;;:;:;;;;;;;;r;;:,;;:;:;;;;;;;;:,;;:;:;;;;;;;;:,;;:;:;;;;;;;;:;;;;;;;;:,;;:;
    ";,;:::;;;;r;;;rssiSiS552X5252525259GX2X9hX9X9XX2325S55252i5:,;;:;:;;;;;;;;:,;;
    @@ -957,6 +974,16 @@ int misc_init_r (void)
    printf("\n");
    }
    printf("\n");
    + #else
    + /* tl8168 som led0.gpio0_25 */
    + __raw_writew(0x2, CM_ALWON_GPIO_0_CLKCTRL);
    + while(__raw_readl(CM_ALWON_GPIO_0_CLKCTRL) != 0x2);
    +
    + __raw_writew((PTU | EN | M1), PINCTRL200_ADDR);
    + reg_val = __raw_readl(TI816X_GPIO0_BASE + 0x134);
    + reg_val &= ~(unsigned int)BIT(25);
    + __raw_writew(reg_val, TI816X_GPIO0_BASE + 0x134);
    + __raw_writew(BIT(25), TI816X_GPIO0_BASE + 0x194);
    #endif
    return 0;
    }

    I debug the MLO,when it run to misc_init_r(),I read the value of CM_ALWON_GPIO_0_CLKCTRL register,and it is 0x30100. The value of 16 bit - 17 bit is 0x3,which means that Module is disabled and cannot be accessed.After the "__raw_writew(0x2, CM_ALWON_GPIO_0_CLKCTRL);" execute,the value of CM_ALWON_GPIO_0_CLKCTRL register  is 0x2,enabling the GPIO0 module.Then I go one by one step.The value of GPIO_OE register(gpio0) is 0xffffffff,and the value of  GPIO_SETDATAOUT is 0x00000000.The value of GPIO_OE should  change to 0xfdffffff after "__raw_writew(reg_val, TI816X_GPIO0_BASE + 0x134);" execute,but it doesn't change.So does the GPIO_SETDATAOUT  register.

    The value of PINCTRL200 register is 0x00000019.

    BR,

    vefone

  • Hi,pavel
    What' s more.When I use the ccs memory brower to change the value of GPIO_OE and GPIO_SETDATAOUT ,the led light.
    BR,
    vefone
  • Vefone,

    vefone said:
    What' s more.When I use the ccs memory brower to change the value of GPIO_OE and GPIO_SETDATAOUT ,the led light.

    When the led light, what value you have in PINCTRL200 register? Is it still 0x00000019? I want to confirm that the value in PINCTRL200 is correct, then we can focus on the GPIO registers values.


    BR
    Pavel

  • vefone said:
    + reg_val = __raw_readl(TI816X_GPIO0_BASE + 0x134);
    + reg_val &= ~(unsigned int)BIT(25);
    + __raw_writew(reg_val, TI816X_GPIO0_BASE + 0x134);

    vefone said:
    The value of GPIO_OE register(gpio0) is 0xffffffff

    vefone said:
    The value of GPIO_OE should  change to 0xfdffffff after "__raw_writew(reg_val, TI816X_GPIO0_BASE + 0x134);" execute,but it doesn't change.

    Can you put printf statements to see what exactly you are reading and writing to GPIO_OE?

    reg_val = __raw_readl(TI816X_GPIO0_BASE + 0x134);
    + printf("before write GPIO_OE = %x\n", reg_val);
    reg_val &= ~(unsigned int)BIT(25);
    + printf("mask = %x\n", reg_val);
    __raw_writew(reg_val, TI816X_GPIO0_BASE + 0x134);
    +printf("after write GPIO_OE = %x\n", __raw_readl(TI816X_GPIO0_BASE + 0x134));

    Regards,
    Pavel

  • Hi,pavel
    Yes,when the led light,the value of PINCTRL200 still is 0x00000019.

    BR,
    vefone
  • Hi,pavel

    BR,

    vefone

  • Can you try with the below code?

    reg_val = __raw_readl(TI816X_GPIO0_BASE + 0x134);
    printf("before write GPIO_OE = %x\n", reg_val);
    reg_val &= ~(unsigned int)BIT(25);
    printf("mask = %x\n", reg_val);
    -__raw_writew(reg_val, TI816X_GPIO0_BASE + 0x134);
    +__raw_writel(reg_val, TI816X_GPIO0_BASE + 0x134);
    printf("after write GPIO_OE = %x\n", __raw_readl(TI816X_GPIO0_BASE + 0x134));


    I mean to replace __raw_writew() with __raw_writel(). See board/ti/ti8168/evm.c voltage_scale_init() function as a reference, there you will see how GPIO registers are setup.

    Regards,
    Pavel

  • Hi,
    Pavel

    It works fine.Thank you!

    BR,
    vefone