Esempio n. 1
0
int checkboard(void)
{
    char const *const s = getenv("serial#");
    u8 const rev = in_8((u8 *) CONFIG_SYS_CPLD_BASE + 0);

    printf("Board: Korat, Rev. %X", rev);
    if (s)
        printf(", serial# %s", s);

    printf(".\n       Ethernet PHY 0: ");
    if (gpio_read_out_bit(CONFIG_SYS_GPIO_PHY0_FIBER_SEL))
        printf("fiber");
    else
        printf("copper");

    printf(", PHY 1: ");
    if (gpio_read_out_bit(CONFIG_SYS_GPIO_PHY1_FIBER_SEL))
        printf("fiber");
    else
        printf("copper");

    printf(".\n");
#if defined(CONFIG_KORAT_PERMANENT)
    printf("       Executing permanent copy of U-Boot.\n");
#endif
    return 0;
}
Esempio n. 2
0
void hw_watchdog_reset(void)
{
	int val;
#if defined(CONFIG_WD_MAX_RATE)
	unsigned long long ct = get_ticks();

	/*
	 * Don't allow watch-dog triggering more frequently than
	 * the predefined value CONFIG_WD_MAX_RATE [ticks].
	 */
	if (ct >= gd->arch.wdt_last) {
		if ((ct - gd->arch.wdt_last) < CONFIG_WD_MAX_RATE)
			return;
	} else {
		/* Time base counter had been reset */
		if (((unsigned long long)(-1) - gd->arch.wdt_last + ct) <
		    CONFIG_WD_MAX_RATE)
			return;
	}
	gd->arch.wdt_last = get_ticks();
#endif

	/*
	 * Toggle watchdog output
	 */
	val = gpio_read_out_bit(CONFIG_SYS_GPIO_WATCHDOG) == 0 ? 1 : 0;
	gpio_write_bit(CONFIG_SYS_GPIO_WATCHDOG, val);
}