diff --git a/drivers/rtc/rtc-snvs.c b/drivers/rtc/rtc-snvs.c index 9af591d5223c..5e7ff39d9552 100644 --- a/drivers/rtc/rtc-snvs.c +++ b/drivers/rtc/rtc-snvs.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2012 Freescale Semiconductor, Inc. + * Copyright (C) 2011-2016 Freescale Semiconductor, Inc. * * The code contained herein is licensed under the GNU General Public * License. You may obtain a copy of the GNU General Public License @@ -64,7 +64,12 @@ static u32 rtc_read_lp_counter(struct snvs_rtc_data *data) read2 <<= 32; regmap_read(data->regmap, data->offset + SNVS_LPSRTCLR, &val); read2 |= val; - } while (read1 != read2); + /* + * when CPU/BUS are running at low speed, there is chance that + * we never get same value during two consecutive read, so here + * we only compare the second value. + */ + } while ((read1 >> CNTR_TO_SECS_SH) != (read2 >> CNTR_TO_SECS_SH)); /* Convert 47-bit counter to 32-bit raw second count */ return (u32) (read1 >> CNTR_TO_SECS_SH);