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: GPIO output pin

Other Parts Discussed in Thread: DM385

Tool/software: Linux

Hi Sirs,

My environment is DM385 IPNC 3.5, kernel 2.6.37

We would like to configure the GPIO 2[30] to output pin.,following is our modification

=======================================================

In ti_tools/ipev_psp_arago/u-boot/board/ti/dm385_ipnc/mux.h

/* -204 */ BIT(0), BIT(0), BIT(0), BIT(2),
/* -208 */ BIT(2), BIT(7), BIT(2), BIT(2),

in board-dm385ipnc.c. we added the control function

gpio_is_valid(94);
gpio_request(94, "gpio_output");
gpio_direction_output(94, 1);
gpio_set_value(94, 1);
msleep(5000);
gpio_set_value(94, 0);
msleep(5000);

==============================================

But we checked this hardware pin when device was booting.------------>No any changed.

We changed the value in /sys/class/gpio/gpio94/value and checked this hardware pin ----->no any changed.

Please help if we lose some control.

Best regards,

Byron

  • Hi Byron,

    Please check if the below wiki page will help you to resolve:

    processors.wiki.ti.com/.../TI81XX_PSP_GPIO_Driver_User_Guide

    Regards,
    Pavel
  • Hi Pavel,

    Yes,we have referred this user guide.but this hardware pin still is not changed.Could you show us how do we debug this question.thanks.

    Best Regards,
    Byron
  • Byron,

    Looking in DM385 datasheet, I see GPIO numbering is not successive. We have 125 GPIO pins (0 to 124), GP0[0:28], GP1[0:31], GP2[0:31], and GP3[0:31]. Thus GP2[30] looks to be mapped at gpio91 (not gpio94). Please try with gpio91. If do not work, try also with gpio92, which is valid if we count also gp2[02].


    Run these commands for knowing what are the GPIO's already requested in the drivers.
    $mount -t debugfs debugfs /sys/kernel/debug
    $cat /sys/kernel/debug/gpio

    See also below e2e thread:

    e2e.ti.com/.../651317

    Regards,
    Pavel
  • Hi Pavel,

    1.Why the gpio pin number  is 91 not 94?Isn't it 2*32+30=94?

    2.I just added the function of  "omap_mux_init_signal("gpio2_30", TI814X_PIN_OUTPUT_PULL_UP)".This GPIO is seem to work.So do we need to initial the mux when we use the GPIO before?

    3.We would like to connect UART1  from UART2 via  GPMC_A[12] and GPMC_A[13]?Could we modify the initiation as below?

    static void dm38x_uart2_pin_mux(void)
    {
    //sprintf(mux_name, "uart2_rxd_mux2");
    //omap_mux_init_signal("uart2_rxd_mux2", TI814X_PULL_DIS | TI814X_INPUT_EN);
    omap_mux_init_signal("uart1_rxd_mux1", TI814X_PULL_DIS | TI814X_INPUT_EN);  //Modify


    //sprintf(mux_name, "uart2_txd_mux2");
    //omap_mux_init_signal("uart2_txd_mux2", TI814X_PULL_UP );
    omap_mux_init_signal("uart1_txd_mux1", TI814X_PULL_UP ); //Modify
    }

    Best regards,

    Byron

  • Byron Tien said:
    Why the gpio pin number  is 91 not 94?

    Because we have 29 pins for GPIO0, not 32.

    Byron Tien said:
    Isn't it 2*32+30=94?

    No. We have 29 pins for GPIO0, not 32.

    Byron Tien said:
    2.I just added the function of  "omap_mux_init_signal("gpio2_30", TI814X_PIN_OUTPUT_PULL_UP)".This GPIO is seem to work.So do we need to initial the mux when we use the GPIO before?

    Yes, you need to setup the proper pinmux for gp2[30]

    Byron Tien said:
    3.We would like to connect UART1  from UART2 via  GPMC_A[12] and GPMC_A[13]?Could we modify the initiation as below?

    I do not see how this is related to GP2[30] usage issue. Please clarify?

    Regards,
    Pavel

  • Hi Pavel,

    Sorry,GPMC_A[12] and GPMA_A[13] is another question.
    Originally we connect UART2 via UART2_TXD/I2C[3]_SDA and UART2_RXD/I2C[3]_SCL.
    Now we would like to change to UART1 via GPMC_A[12]/UART1_RXD and GPMC_A[13]/UART1_TXD
    If we modify the initiation function.Is it correct?

    static void dm38x_uart2_pin_mux(void)
    {
    //sprintf(mux_name, "uart2_rxd_mux2");
    //omap_mux_init_signal("uart2_rxd_mux2", TI814X_PULL_DIS | TI814X_INPUT_EN);
    omap_mux_init_signal("uart1_rxd_mux1", TI814X_PULL_DIS | TI814X_INPUT_EN); //Modify


    //sprintf(mux_name, "uart2_txd_mux2");
    //omap_mux_init_signal("uart2_txd_mux2", TI814X_PULL_UP );
    omap_mux_init_signal("uart1_txd_mux1", TI814X_PULL_UP ); //Modify
    }

    Best Regards,
    Byron
  • Byron Tien said:
    Sorry,GPMC_A[12] and GPMA_A[13] is another question.

    Sorry, but this is for another thread. Please keep this e2e thread for the issue in the subject (Linux: GPIO output pin) and open new e2e threads for new issues/questions.

    Regards,
    Pavel

  • Byron,

    I see your new question, and I see another engineer is handling that.

    Regarding GP2[30] issue, set pinmux configuration for GPIO pin usage, details of pinmux configuration are mentioned on PSP user guide. If the pinmux settings are not proper then expected functionality will not get.



    Have you finally fix your GPIO pin issue? If yes, please close/resolve/verify that this thread.

    Regards,
    Pavel

  • Hi Pavel,

    It's very strange.If used gpio91, I can not control it.but gpio94. it worked. It seem the 32 bits not 29 bits.

    Best Regards,

    Byron

  • Byron,

    Linux kernel might map GP2[30] to gpio94, as you are able to control it now. So the main issue was the pinmux of gpio94 which now is fixed.

    Regards,
    Pavel