/* Called by macro WATCHDOG_RESET Get timebase clock frequency  */
unsigned long get_tbclk(void)
/* Called by macro WATCHDOG_RESET Get timebase clock frequency  */
unsigned long get_tbclk(void)
{
	volatile immap_t *immr = (volatile immap_t *) CONFIG_SYS_IMMR;
	ulong oscclk, factor;
	if (immr->im_clkrst.car_sccr & SCCR_TBS) {
		return (gd->cpu_clk / 16);
	}
	factor = (((CONFIG_SYS_PLPRCR) & PLPRCR_MF_MSK) >> PLPRCR_MF_SHIFT) + 1;
	oscclk = gd->cpu_clk / factor;
	if ((immr->im_clkrst.car_sccr & SCCR_RTSEL) == 0 || factor > 2) {
		return (oscclk / 4);
	}
	return (oscclk / 16);
}