ulong bootcount_load(void) { struct davinci_rtc *reg = (struct davinci_rtc *)CONFIG_SYS_BOOTCOUNT_ADDR; if (raw_bootcount_load(®->scratch1) != BOOTCOUNT_MAGIC) return 0; else return raw_bootcount_load(®->scratch0); }
__weak ulong bootcount_load(void) { void *reg = (void *)CONFIG_SYS_BOOTCOUNT_ADDR; #if defined(CONFIG_SYS_BOOTCOUNT_SINGLEWORD) u32 tmp = raw_bootcount_load(reg); if ((tmp & 0xffff0000) != (BOOTCOUNT_MAGIC & 0xffff0000)) return 0; else return (tmp & 0x0000ffff); #else if (raw_bootcount_load(reg + 4) != BOOTCOUNT_MAGIC) return 0; else return raw_bootcount_load(reg); #endif /* defined(CONFIG_SYS_BOOTCOUNT_SINGLEWORD) */ }