Skip to content

Commit a268140

Browse files
committed
fix when using rt_smart CLK_EN_0 have no ioremap
1 parent f8ea6c6 commit a268140

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

bsp/cvitek/drivers/drv_rtc.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,21 @@ static int rtc_month_days(unsigned int month, unsigned int year)
9090

9191
static void hal_cvi_rtc_clk_set(int enable)
9292
{
93+
#ifdef RT_USING_SMART
94+
rt_ubase_t clk = (rt_ubase_t)DRV_IOREMAP((void *)CLK_EN_0,0x1000);
95+
#else
96+
rt_ubase_t clk = CLK_EN_0;
97+
#endif
9398
uint32_t clk_state;
9499

95-
clk_state = mmio_read_32((long unsigned int)CLK_EN_0);
100+
clk_state = mmio_read_32(clk);
96101

97102
if(enable)
98103
clk_state |= CLK_RTC_25M_BIT;
99104
else
100105
clk_state &= ~(CLK_RTC_25M_BIT);
101106

102-
mmio_write_32((long unsigned int)CLK_EN_0, clk_state);
107+
mmio_write_32(clk, clk_state);
103108
}
104109

105110
static void hal_cvi_rtc_enable_sec_counter(uintptr_t rtc_base)

0 commit comments

Comments
 (0)