Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions drivers/rtc/rtc_sam.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,16 @@ struct rtc_sam_data {

static void rtc_sam_disable_wp(void)
{
#ifdef REG_RTC_WPMR
REG_RTC_WPMR = RTC_SAM_WPMR_DISABLE;
#endif
}

static void rtc_sam_enable_wp(void)
{
#ifdef REG_RTC_WPMR
REG_RTC_WPMR = RTC_SAM_WPMR_ENABLE;
#endif
}

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

rtc_sam_disable_wp();
#ifdef RTC_MR_PERSIAN
regs->RTC_MR &= ~(RTC_MR_HRMOD | RTC_MR_PERSIAN);
#else
regs->RTC_MR &= ~RTC_MR_HRMOD;
#endif
regs->RTC_CR = 0;
rtc_sam_enable_wp();
regs->RTC_IDR = (RTC_IDR_ACKDIS
Expand Down
8 changes: 8 additions & 0 deletions dts/arm/microchip/sam/sama7g5.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@
#interrupt-cells = <4>;
};

rtc: rtc@e001d0a8 {
compatible = "atmel,sam-rtc";
reg = <0xe001d0a8 0x30>;
interrupt-parent = <&gic>;
interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL IRQ_DEFAULT_PRIORITY>;
clocks = <&clk32k 1>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this fixed or user should select it ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The RTC clock is from the slow clock. Details in datasheet
image

};

sram: memory@100000 {
compatible = "mmio-sram";
reg = <0x00100000 DT_SIZE_K(128)>;
Expand Down
3 changes: 3 additions & 0 deletions tests/drivers/rtc/rtc_api/boards/sama7g54_ek.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CONFIG_RTC_ALARM=y
CONFIG_RTC_UPDATE=y
CONFIG_RTC_CALIBRATION=y
11 changes: 11 additions & 0 deletions tests/drivers/rtc/rtc_api/boards/sama7g54_ek.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* Copyright (C) 2025 Microchip Technology Inc. and its subsidiaries
*
* SPDX-License-Identifier: Apache-2.0
*/

/ {
aliases {
rtc = &rtc;
};
};
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ manifest:
groups:
- hal
- name: hal_microchip
revision: 4b74f4081342423badcf758278bbc0582ca8735d
revision: 32a79d481c056b2204a5701d5a5799f9e5130dd7
path: modules/hal/microchip
groups:
- hal
Expand Down