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.

set GPIO22 as input in uboot, but it‘s no effective! why?

ipnc rdk3.8.0 8148

I set GPIO22 as input in uboot, but it‘s no effective! why?

my code :

1224     val = __raw_readl(0x48140A9C); 
1225     val |= 0x00000080;
1226     __raw_writel(val, 0x48140A9C); 
1227     //input              
1228     val = __raw_readl(0x48032134); 
1229     val |= ((0x1<<22));  
1230 //  val &= (~(0x1<<22));//output
1231     __raw_writel(val, 0x48032134); 

look forwards for you answer.

  • Hi ,
    Maybe the register is overwritten somewhere.
    So in which stage you check the gpio is functional or not? in uboot/kernel/or app running?
    Did you read back register in the uboot prompt?

    BR,
    Eason
  • Hi Yue,

    yue gu1 said:
    1224     val = __raw_readl(0x48140A9C); 
    1225     val |= 0x00000080;
    1226     __raw_writel(val, 0x48140A9C); 

    Do you have finally the value of 0x00060080 in PINCNTL168/0x48140A9C register? Make sure that some u-boot code does not overwrite this value. Load and start the u-boot and check with md command from the u-boot prompt.

    yue gu1 said:
    1228     val = __raw_readl(0x48032134); 
    1229     val |= ((0x1<<22));  
    1230 //  val &= (~(0x1<<22));//output
    1231     __raw_writel(val, 0x48032134); 

    The same valid here. Make sure that nothing overwrites this. Also we should have 0x1 by default/reset, no need to write it.

    yue gu1 said:
    but it‘s no effective! why?

    What do you mean by no effective? Do you enable the GPIO clock from the device PRCM? Do you read the GPIO_DATAIN register?

    Regards,
    Pavel

  • thanks a lot for your answer!

    1. Do you have finally the value of 0x00060080 in PINCNTL168/0x48140A9C register?
    I don't got the finally value of PINCNTL168.
    because when I use the " printf " , the com cann't output anything!
    my code: val = __raw_readl(0x48032134); printf( "----111------:%08x\n", val );

    how can I print in uboot? where can I got the final value of PINCNTL168?

    2. How can I enable the GPIO clock from the device PRCM ?

    3. Do you read the GPIO_DATAIN register? I don't read the register.
  • yue gu1 said:
    I don't got the finally value of PINCNTL168.
    because when I use the " printf " , the com cann't output anything!
    my code: val = __raw_readl(0x48032134); printf( "----111------:%08x\n", val );

    how can I print in uboot? where can I got the final value of PINCNTL168?

    Do not use printf, use the "md" command, example:

    TI8148_EVM#md 0x48140A9C 1
    48140a9c: 00020010    ....
    TI8148_EVM#

    As you can see I have the value of 0x00020010, while you should see 0x00060080 there.

    yue gu1 said:
    2. How can I enable the GPIO clock from the device PRCM ?

    Refer to the DM814x TRM, chapter PRCM

    yue gu1 said:
    3. Do you read the GPIO_DATAIN register? I don't read the register.

    Then how you test that it does not work (no effective)?

    Regards,
    Pavel

  • thanks again for you answer!

    I'll try it.