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/AM3354: GPIO toggle in U-boot

Part Number: AM3354


Tool/software: Linux

Hello Sir,

I want to interface a external watchdog MAX6370 with my am335x evaluation board .For proper working of the system i will have to give a continuous pulse to wdi pin .can you give me any example how can I achieve it in UBOOT .

with regards ,

pranav

  • See these threads:
    e2e.ti.com/.../581673
    e2e.ti.com/.../689819

    By the way, there is a search tool on top of the forum page. Use it, most of the questions posted here are already answered somewhere else.
  • Hey Biser,

    I had been through the above documents earlier and i was able to toggle the specified gpio using the below function
    mux.c
    -------

    static struct module_pin_mux gpio2_7_pin_mux[] = {
    {OFFSET(usb0_drvvbus), (MODE(7) | PULLUDEN)}, /* GPIO0_7 */
    {-1},
    };
    void enable_board_pin_mux(void)
    {
    configure_module_pin_mux(gpio2_7_pin_mux);
    }

    board.c
    -----------------
    #define GPIO_OE 0x134 /* Output enable */
    #define GPIO_DATAIN 0x138 /* Input value */
    #define GPIO_DATAOUT 0x13C /* Write value */
    #define GPIO_CLEARDATAOUT 0x190 /* Set to 0 an output */
    #define GPIO_SETDATAOUT 0x194 /* Set to 1 an output */
    #define AM335X_CM_PER_GPIO2_CLKCTRL (0x44E00000+0xB0)
    #define AM335X_GPIO2_BASE 0x481AC000
    #define GPIO2(value,offset) __raw_writel(value,(AM335X_GPIO2_BASE+offset));


    toggle_gpio(void)
    {
    int i;

    __raw_writel(0x00000002,AM335X_CM_PER_GPIO2_CLKCTRL);

    GPIO2(0xFFFFFFFF & ~0x80,GPIO_OE);

    for (i=0;i<10;i++)

    {
    GPIO2(0x00000080,GPIO_SETDATAOUT);
    udelay(1000000);
    GPIO2(0x00000080,GPIO_CLEARDATAOUT);
    udelay(1000000);
    }
    }

    arch/arm/cpu/armv7/omap-common/hwinit-common.c
    -------------------------------------------------------------------------------------
    int board_early_init_f(void)
    {
    prcm_init();
    set_mux_conf_regs();
    toggle_gpio();
    #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_RTC_ONLY_SUPPORT)
    update_rtc_magic();
    #endif
    return 0;
    }


    but doing so holds the execution of uboot until the control is there in the loop ,I dont want the toggling to stop my booting process, I want that thing to be running as a background process.Is there any way to achieve that.

    with regards
    pranav
  • pranav prakash55 said:
    but doing so holds the execution of uboot until the control is there in the loop ,I dont want the toggling to stop my booting process, I want that thing to be running as a background process.Is there any way to achieve that.

    Pranav,

    There are no background processes/tasks in u-boot. There is no OS/kenel in u-boot. u-boot is linear bare metal programming.

    Regards,
    Pavel

  • Thanks pavel,
    I want to establish a continuous pulse on the wdi pin of my watchdog can you help me out how can i establish that in uboot and later i will continue the same with kernel but initially i am unable to make it in uboot only. Is it possible to configure that gpio as timer or pwm.

    with regards
    pranav
  • Pranav,

    No, it is NOT possible to configure AM335x GPIO module to generate continuous pulses on the output pin without SW intervention. For more details regarding GPIO module (what can be done with it), refer to the AM335x TRM, chapter 25

    Regards,
    Pavel