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.

GPIO Support in DM8168

Hi,

I am using DM8168 processor. I am trying to toggle some GPIO pins in U-boot level. While accessing the GPIO base address 0x48032000, the system got stuck and its not proceeding further, If I set the base address as 0x48033000, I can able to boot but not making any sense it seems in my target.

I have taken these two base addresses from the Data Sheet. In that they have mentioned Peripheral Registers as 0x4803 2000 and Support Registers 0x4803 3000. So I am totally confused with these values. So, please let me know which address I suppose to be used in my target and also I want to know what is difference between Peripheral Registers and Support Registers

Thanks in advance.

Regards,

Salih

  • Hi Salih,

    Please refer to the following TI E2E posts like yours.

    http://e2e.ti.com/support/embedded/linux/f/354/t/152492
    http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/717/t/130602
  • Can you please tell me how you solved this issue. Even I am also facing the issue. While I am trying to GPIO0 with this base 0x4803200. The system Is stuck up and can't access it.

    How are you accessing the "0x48032000" (32 bit) address ?

    Because it is the address which has offset of "GPIO_REVISION" register { 0x48032000 = ( 0x48032000 + 0h) } that has provision to read only and write is not possible.

    You may get stuck if you try to write some thing.

    Try the following code snippet and update us.

    unsigned int value;
    
    value = __raw_readl(0x48032000);
    
    printk("GPIO_REVISION = %x\n",value);

  • Hi Titusrathinaraj Stalin,

    Thanks for your input. I have tried the same from which the links you provided in the above posts.

    Still I couldn't access the base address. I want to which one is correct clock enable register settings for GPIO.

    Below is the code:

    File: board/ti/evm.c

    Function: peripheral_enable()

            /* GPIO0 */
            __raw_writel(0x2, CM_ALWON_GPIO_0_CLKCTRL);
            while(__raw_readl(CM_ALWON_GPIO_0_CLKCTRL) != 0x2);

    Why the below setting is done in the source:

            __raw_writel((BIT(8)), CM_ALWON_GPIO_0_OPTFCLKEN_DBCLK);

    If I do the above setting, the GPIO module itself disabling as I checked in the data sheet.

    Which base address is the proper to access GPIO0 module. (0x48032000 or 0x48033000)

    Thanks in advance,

    Regards

    Salih

  • Have a try.

    __raw_writel(0x2, CM_ALWON_GPIO_0_CLKCTRL);
    To
    __raw_writel(0x102, CM_ALWON_GPIO_0_CLKCTRL);


    Why the below setting is done in the source:

    __raw_writel((BIT(8)), CM_ALWON_GPIO_0_OPTFCLKEN_DBCLK);


    You need to enable the bit "OPTFCLKEN_DBCLK" too.
    Thats why I want ask to you use "0x102" instead "0x2"

    Please refer to the DM8168 TRM page no 1884.

    http://www.ti.com/litv/pdf/sprugx8b

    The base address is 0x48032000 to access the GPIO register.
  • I am using DM8168 processor with my customized daughter board. The EZSDK version is 5_05_02_00 and U-boot version 2010.06-psp04.04.00.01

    I am accessing this register in the U-boot Level as Like below:

    U-boot > md 0x48032000

    48032000:

    I can't able to see any register dump messages and the system is stuck up.

    I have solved this issue by commenting the below line in the source

            /* GPIO0 */
            __raw_writel(0x2, CM_ALWON_GPIO_0_CLKCTRL);
            while(__raw_readl(CM_ALWON_GPIO_0_CLKCTRL) != 0x2);

     // __raw_writel((BIT(8)), CM_ALWON_GPIO_0_OPTFCLKEN_DBCLK);

    Since the issue not with value of 0x2 or 0x102.

    Thanks for your support.

    Regards,

    Salih

     

  • You meant that you had solved the problem by comment out the line ?
  • Yes exactly the same.
    Thanks for your support.

    Regards,
    Salih
  • Sounds good.
    Thanks for your update.
  • Hi,

    And now I am facing one more issue. I am trying to test the Ethernet in U-boot level. I couldn't read my PHY ID, since I have to do some GPIO toggling as per my customized hardware.

    So, I am trying to toggle that particular GPIO (GP0[8]). I can able to make that pin high and I couldn't make it low.

    What might be the reason for this issue.? I am using LSI_ET1011 phy device.

    GPIO0_BASE = 0x48032000;

    GPIO0_BASE + 0x194;

                    value = __raw_readl (GPIO0_BASE + 0x194);
                    value |= (1 << (0x8));
                    __raw_writel (value, GPIO0_BASE + 0x194);

                    value = __raw_readl (GPIO0_BASE + 0x194);
                    value &= ~(1 << (0x8));
                    __raw_writel (value, GPIO0_BASE + 0x194);
                    udelay(80000);

                    value = __raw_readl (GPIO0_BASE + 0x194);
                    value |= (1 << 0x8);
                    __raw_writel (value, GPIO0_BASE + 0x194);

    So, please suggest me any solution to solve this issue. Did I miss anything in this?

    Thanks in advance.

    Regards,

    Salih

  • Try the following code.

    You need to use "GPIO_CLEARDATAOUT" register to make it low on GPIO.
    Please refer to the DM8168 TRM guide chapter 8 (8.3.24)

    //Set the GPIO
    value = __raw_readl (GPIO0_BASE + 0x194);
    value |= (1 << (0x8));
    __raw_writel (value, GPIO0_BASE + 0x194);

    //Clear the GPIO
    value = __raw_readl (GPIO0_BASE + 0x190);
    value |= (1 << (0x8));
    __raw_writel (value, GPIO0_BASE + 0x190);
    udelay(80000);

    //Set the GPIO
    value = __raw_readl (GPIO0_BASE + 0x194);
    value |= (1 << 0x8);
    __raw_writel (value, GPIO0_BASE + 0x194);

    //Clear the GPIO
    value = __raw_readl (GPIO0_BASE + 0x190);
    value |= (1 << (0x8));
    __raw_writel (value, GPIO0_BASE + 0x190);
    udelay(80000);
  • Thank you very much Titus. Its toggling but my PHY ID is not at all detecting. Since I am using EMAC2 controller and I have made changes done in the source code. I mean the base addresses of EMAC and RAM has been changed as per data sheet.
    Still nothing is happening.

    Can you please help me out to fix this issue.

    Thanks in advance
  • Create a new post for your ethernet related query and concern person would address your problem.