aranym /dev/rtc
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Geert Uytterhoeven
maintainerGoing back into time...
Quoted 4 lines · Geert Uytterhoeven
4.
CONFIG_RTC_CLASS=y,CONFIG_RTC_DRV_CMOS=[my],/dev/rtcis dynamic While rtc-cmos can be enabled on Atari (it was derived fromrtc.c), it won't work yet,
as the necessaryrtc_cmosplatform device is not yet created on Atari.
I gave it a try, cfr. "[PATCH 1/2] [RFC] m68k/atari: Create rtc_cmos platform device" below.
Unfortunately it didn't work well, cfr. "[PATCH 2/2] [RFC] rtc: Disable RTC_DRV_CMOS on Atari" below, while rtc-generic works fine for the RTC part, and the separate nvram driver works for the NVRAM part.
So unless someone has a good reason for using rtc_cmos (and some patches to fix its issues), I'll go for [PATCH 2/2].
Thanks for your feedback!
Quoted 1 line
From
454783a49347468b5ddf5a01e00aa5b1b66d2480Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven <[email protected]>
Date: Mon, 2 Dec 2013 11:08:13 +0100
Subject: [PATCH 1/2] [RFC] m68k/atari: Create rtc_cmos platform device
Create an "rtc_cmos" platform device, so rtc-cmos can be used on Atari. Its IRQ is available on systems with a TT_MFP only.
This requires renaming RTC_PORT(), as rtc-cmos uses the presence of this macro to enable support for the second NVRAM bank, which Atari doesn't have ("Unable to handle kernel access at virtual address 00ff8965").
--- arch/m68k/atari/config.c | 26 ++++++++++++++++++++++++++ arch/m68k/include/asm/mc146818rtc.h | 10 +++++----- 2 files changed, 31 insertions(+), 5 deletions(-)
arch/m68k/atari/config.c +26 -0
@@ -660,6 +660,26 @@ static void atari_get_hardware_list(struct seq_file *m)ATARIHW_ANNOUNCE (DSP56K ,"DSP56001 processor" ); } +static struct resource rtc_resources[] = { + [0 ] = { + .start =TT_RTC_BAS , + .end =TT_RTC_BAS +2 *2 -1 , + .flags =IORESOURCE_IO , + }, + [1 ] = { + .start =IRQ_TT_MFP_RTC , + .end =IRQ_TT_MFP_RTC , + .flags =IORESOURCE_IRQ , + } +}; + +static struct platform_device rtc_device = { + .name ="rtc_cmos" , + .id =-1 , + .resource = rtc_resources, + .num_resources =1 /* Default to no IRQ */ +}; +/* * MSch: initial platform device support for Atari, * required for EtherNAT/EtherNEC/NetUSBee drivers
@@ -865,6 +885,12 @@ int __init atari_platform_init(void)if (!MACH_IS_ATARI )return -ENODEV ; +if (ATARIHW_PRESENT (TT_MFP )) { +/* Enable IRQ resource */ + rtc_device.num_resources =2 ; + } +platform_device_register (&rtc_device); +#ifdef CONFIG_ATARI_ETHERNAT {unsigned char *enatc_virt;
arch/m68k/include/asm/mc146818rtc.h +5 -5
@@ -10,16 +10,16 @@#include <asm/atarihw.h> -#define RTC_PORT (x) (TT_RTC_BAS + 2*(x)) +#define ATARI_RTC_PORT (x) (TT_RTC_BAS + 2*(x))#define RTC_ALWAYS_BCD 0#define CMOS_READ (addr) ({ \ -atari_outb_p((addr),RTC_PORT(0)); \ -atari_inb_p(RTC_PORT(1)); \ +atari_outb_p((addr), ATARI_RTC_PORT(0)); \ +atari_inb_p(ATARI_RTC_PORT(1)); \ })#define CMOS_WRITE (val, addr) ({ \ -atari_outb_p((addr),RTC_PORT(0)); \ -atari_outb_p((val),RTC_PORT(1)); \ +atari_outb_p((addr), ATARI_RTC_PORT(0)); \ +atari_outb_p((val), ATARI_RTC_PORT(1)); \ })#endif /* CONFIG_ATARI */
Signature · 1 line
1.7.9.5
Quoted 1 line
From
6c81cebe1f9bcf5fecae689235e86b42c9f8e28cMon Sep 17 00:00:00 2001
From: Geert Uytterhoeven <[email protected]>
Date: Mon, 2 Dec 2013 11:12:23 +0100
Subject: [PATCH 2/2] [RFC] rtc: Disable RTC_DRV_CMOS on Atari
On ARAnyM (emulating an Atari Falcon, which doesn't have an RTC IRQ), rtc-cmos doesn't work well:
- The date is of by 32 years (2045 instead of 2013):
rtc_cmos rtc_cmos: setting system clock to 2045-12-02 10:56:17 UTC (2395824977)
- The hwclock utility doesn't work:
hwclock: ioctl() to /dev/rtc to turn on update interrupts failed unexpectedly, errno=5: Input/output error.
rtc-generic works fine for the RTC part, and nvram works for the NVRAM part, though.
--- drivers/rtc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/Kconfig +1 -1
@@ -626,7 +626,7 @@ comment "Platform RTC drivers" config RTC_DRV_CMOS tristate "PC-style 'CMOS'" - depends on X86 || ARM || M32R || ATARI || PPC || MIPS || SPARC64 + depends on X86 || ARM || M32R || PPC || MIPS || SPARC64 default y if X86 help Say "yes" here to get direct support for the real time clock
Signature · 13 lines
1.7.9.5
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus TorvaldsGeert,
Quoted 11 lines · Geert Uytterhoeven
Going back into time...
Quoted 4 lines · Geert Uytterhoeven
4.
CONFIG_RTC_CLASS=y,CONFIG_RTC_DRV_CMOS=[my],/dev/rtcis dynamic While rtc-cmos can be enabled on Atari (it was derived fromrtc.c), it won't work yet,
as the necessaryrtc_cmosplatform device is not yet created on Atari.I gave it a try, cfr. "[PATCH 1/2] [RFC] m68k/atari: Create
rtc_cmosplatform device" below.
Quoted 6 lines
Unfortunately it didn't work well, cfr. "[PATCH 2/2] [RFC] rtc: Disable
RTC_DRV_CMOSon Atari" below, while rtc-generic works fine for the RTC part, and the separate nvram driver works for the NVRAM part.So unless someone has a good reason for using
rtc_cmos(and some patches to fix its issues), I'll go for [PATCH 2/2].
The generic CMOS driver will have the TT_MFP_RTC interrupt available only on a TT - maybe that's why it won't work on ARAnyM?
Nothing wrong with applying the second part of 1/2 (renaming the RTC_PORT macro to ATARI_RTC_PORT) anyway, though.
Cheers,
Michael
Quoted 146 lines
Thanks for your feedback!
From
454783a49347468b5ddf5a01e00aa5b1b66d2480Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven <[email protected]>
Date: Mon, 2 Dec 2013 11:08:13 +0100
Subject: [PATCH 1/2] [RFC] m68k/atari: Creatertc_cmosplatform deviceCreate an "
rtc_cmos" platform device, so rtc-cmos can be used on Atari. Its IRQ is available on systems with aTT_MFPonly.This requires renaming
RTC_PORT(), as rtc-cmos uses the presence of this macro to enable support for the second NVRAM bank, which Atari doesn't have ("Unable to handle kernel access at virtual address00ff8965").Signed-off-by Geert Uytterhoeven <[email protected]>--- arch/m68k/atari/config.c | 26 ++++++++++++++++++++++++++ arch/m68k/include/asm/mc146818rtc.h | 10 +++++----- 2 files changed, 31 insertions(+), 5 deletions(-)arch/m68k/atari/config.c +26
-0@@ -660,6 +660,26 @@ static void atari_get_hardware_list(struct seq_file *m)ATARIHW_ANNOUNCE (DSP56K ,"DSP56001 processor" ); } +static struct resource rtc_resources[] = { + [0 ] = { + .start =TT_RTC_BAS , + .end =TT_RTC_BAS +2 *2 -1 , + .flags =IORESOURCE_IO , + }, + [1 ] = { + .start =IRQ_TT_MFP_RTC , + .end =IRQ_TT_MFP_RTC , + .flags =IORESOURCE_IRQ , + } +}; + +static struct platform_device rtc_device = { + .name ="rtc_cmos" , + .id =-1 , + .resource = rtc_resources, + .num_resources =1 /* Default to no IRQ */ +}; +/* * MSch: initial platform device support for Atari, * required for EtherNAT/EtherNEC/NetUSBee drivers @@ -865,6 +885,12 @@ int __init atari_platform_init(void)if (!MACH_IS_ATARI )return -ENODEV ; +if (ATARIHW_PRESENT (TT_MFP )) { +/* Enable IRQ resource */ + rtc_device.num_resources =2 ; + } +platform_device_register (&rtc_device); +#ifdef CONFIG_ATARI_ETHERNAT {unsigned char *enatc_virt;arch/m68k/include/asm/mc146818rtc.h +5
-6@@ -10,16 +10,16 @@#include <asm/atarihw.h> -#define RTC_PORT (x) (TT_RTC_BAS + 2*(x)) +#define ATARI_RTC_PORT (x) (TT_RTC_BAS + 2*(x))#define RTC_ALWAYS_BCD 0#define CMOS_READ (addr) ({ \ -atari_outb_p((addr),RTC_PORT(0)); \ -atari_inb_p(RTC_PORT(1)); \ +atari_outb_p((addr), ATARI_RTC_PORT(0)); \ +atari_inb_p(ATARI_RTC_PORT(1)); \ })#define CMOS_WRITE (val, addr) ({ \ -atari_outb_p((addr),RTC_PORT(0)); \ -atari_outb_p((val),RTC_PORT(1)); \ +atari_outb_p((addr), ATARI_RTC_PORT(0)); \ +atari_outb_p((val), ATARI_RTC_PORT(1)); \ })#endif /* CONFIG_ATARI */ --1.7.9.5
From
6c81cebe1f9bcf5fecae689235e86b42c9f8e28cMon Sep 17 00:00:00 2001
From: Geert Uytterhoeven <[email protected]>
Date: Mon, 2 Dec 2013 11:12:23 +0100
Subject: [PATCH 2/2] [RFC] rtc: DisableRTC_DRV_CMOSon AtariOn ARAnyM (emulating an Atari Falcon, which doesn't have an RTC IRQ), rtc-cmos doesn't work well:
- The date is of by 32 years (2045 instead of 2013):rtc_cmos rtc_cmos: setting system clock to 2045-12-02 10:56:17 UTC (2395824977)- The hwclock utility doesn't work:
hwclock:
ioctl()to/dev/rtcto turn on update interrupts failed unexpectedly, errno=5: Input/output error.rtc-generic works fine for the RTC part, and nvram works for the NVRAM part, though.
Signed-off-by Geert Uytterhoeven <[email protected]>--- drivers/rtc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/rtc/Kconfig +1
-2@@ -626,7 +626,7 @@ comment "Platform RTC drivers" config RTC_DRV_CMOS tristate "PC-style 'CMOS'" - depends on X86 || ARM || M32R || ATARI || PPC || MIPS || SPARC64 + depends on X86 || ARM || M32R || PPC || MIPS || SPARC64 default y if X86 help Say "yes" here to get direct support for the real time clock --1.7.9.5
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Geert Uytterhoeven
maintainerQuoted 17 lines · Michael Schmitz
Quoted 15 lines · Geert Uytterhoeven
Going back into time...
Quoted 4 lines · Geert Uytterhoeven
4.
CONFIG_RTC_CLASS=y,CONFIG_RTC_DRV_CMOS=[my],/dev/rtcis dynamic While rtc-cmos can be enabled on Atari (it was derived fromrtc.c), it won't work yet,
as the necessaryrtc_cmosplatform device is not yet created on Atari.I gave it a try, cfr. "[PATCH 1/2] [RFC] m68k/atari: Create
rtc_cmosplatform device" below.Unfortunately it didn't work well, cfr. "[PATCH 2/2] [RFC] rtc: Disable
RTC_DRV_CMOSon Atari" below, while rtc-generic works fine for the RTC part, and the separate nvram driver works for the NVRAM part.
Quoted 5 lines
Quoted 2 lines
So unless someone has a good reason for using
rtc_cmos(and some patches to fix its issues), I'll go for [PATCH 2/2].The generic CMOS driver will have the
TT_MFP_RTCinterrupt available only on a TT - maybe that's why it won't work on ARAnyM?
Perhaps. Note that rtc-generic also doesn't have an interrupt, but it does work. Would be nice if someone could try rtc-cmos on a real TT, of course.
Quoted 2 lines
Nothing wrong with applying the second part of 1/2 (renaming the
RTC_PORTmacro toATARI_RTC_PORT) anyway, though.
Good point, thanks! Will do.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds