uboot/arch/arm/cpu/armv7/highbank/bootcount.c
<<
>>
Prefs
   1/*
   2 * Copyright 2011 Calxeda, Inc.
   3 *
   4 * This program is free software; you can redistribute it and/or modify it
   5 * under the terms of the GNU General Public License as published by the Free
   6 * Software Foundation; either version 2 of the License, or (at your option)
   7 * any later version.
   8 *
   9 * This program is distributed in the hope it will be useful, but WITHOUT
  10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  12 * more details.
  13 *
  14 * You should have received a copy of the GNU General Public License along with
  15 * this program.  If not, see <http://www.gnu.org/licenses/>.
  16 */
  17
  18#include <common.h>
  19#include <asm/io.h>
  20
  21#ifdef CONFIG_BOOTCOUNT_LIMIT
  22void bootcount_store(ulong a)
  23{
  24        writel((BOOTCOUNT_MAGIC & 0xffff0000) | a, CONFIG_SYS_BOOTCOUNT_ADDR);
  25}
  26
  27ulong bootcount_load(void)
  28{
  29        u32 tmp = readl(CONFIG_SYS_BOOTCOUNT_ADDR);
  30
  31        if ((tmp & 0xffff0000) != (BOOTCOUNT_MAGIC & 0xffff0000))
  32                return 0;
  33        else
  34                return tmp & 0x0000ffff;
  35}
  36#endif
  37