Skip to content

Commit 9545491

Browse files
TonyHan11dkalowsk
authored andcommitted
drivers: rtc: sam: update for supporting RTC of sama7g5 devices
The basic characteristics of "atmel,sam-rtc" is the same as the ones of sama7g5. Differences between the RTCs listed bellow: | atmel,sam-rtc | rtc in sama7g5 --------------------|---------------|---------------------- Persian calendar | Y | N UTC Mode support | N | Y Tamper Timestamping | N | Y Signed-off-by: Tony Han <[email protected]>
1 parent bb20f35 commit 9545491

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/rtc/rtc_sam.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,16 @@ struct rtc_sam_data {
5656

5757
static void rtc_sam_disable_wp(void)
5858
{
59+
#ifdef REG_RTC_WPMR
5960
REG_RTC_WPMR = RTC_SAM_WPMR_DISABLE;
61+
#endif
6062
}
6163

6264
static void rtc_sam_enable_wp(void)
6365
{
66+
#ifdef REG_RTC_WPMR
6467
REG_RTC_WPMR = RTC_SAM_WPMR_ENABLE;
68+
#endif
6569
}
6670

6771
static uint32_t rtc_sam_timr_from_tm(const struct rtc_time *timeptr)
@@ -642,7 +646,11 @@ static int rtc_sam_init(const struct device *dev)
642646
Rtc *regs = config->regs;
643647

644648
rtc_sam_disable_wp();
649+
#ifdef RTC_MR_PERSIAN
645650
regs->RTC_MR &= ~(RTC_MR_HRMOD | RTC_MR_PERSIAN);
651+
#else
652+
regs->RTC_MR &= ~RTC_MR_HRMOD;
653+
#endif
646654
regs->RTC_CR = 0;
647655
rtc_sam_enable_wp();
648656
regs->RTC_IDR = (RTC_IDR_ACKDIS

0 commit comments

Comments
 (0)