1.1 --- a/pkg/devices/lib/rtc/src/x1600.cc Thu Nov 16 22:03:51 2023 +0100
1.2 +++ b/pkg/devices/lib/rtc/src/x1600.cc Thu Nov 16 23:58:13 2023 +0100
1.3 @@ -126,7 +126,8 @@
1.4
1.5 // Peripheral abstraction.
1.6
1.7 -Rtc_x1600_chip::Rtc_x1600_chip(l4_addr_t addr)
1.8 +Rtc_x1600_chip::Rtc_x1600_chip(l4_addr_t addr, Cpm_x1600_chip *cpm)
1.9 +: _cpm(cpm)
1.10 {
1.11 _regs = new Hw::Mmio_register_block<32>(addr);
1.12 }
1.13 @@ -264,6 +265,12 @@
1.14 void
1.15 Rtc_x1600_chip::power_down()
1.16 {
1.17 + /* Set CPU frequency to L2 cache frequency before powering down. This is
1.18 + apparently necessary according to the X1600 manual. */
1.19 +
1.20 + if (_cpm != NULL)
1.21 + _cpm->set_frequency(Clock_cpu, _cpm->get_frequency(Clock_l2cache));
1.22 +
1.23 write_enable();
1.24 _regs[Hibernate_control] = _regs[Hibernate_control] | Hibernate_power_down;
1.25 }
1.26 @@ -273,9 +280,9 @@
1.27 // C language interface functions.
1.28
1.29 void
1.30 -*x1600_rtc_init(l4_addr_t rtc_base)
1.31 +*x1600_rtc_init(l4_addr_t rtc_base, void *cpm)
1.32 {
1.33 - return (void *) new Rtc_x1600_chip(rtc_base);
1.34 + return (void *) new Rtc_x1600_chip(rtc_base, static_cast<Cpm_x1600_chip *>(cpm));
1.35 }
1.36
1.37 void x1600_rtc_disable(void *rtc)