Subject: Multiple rtc devices for todr_attach (Re: RTC todr for mips/alchemy)
To: None <port-evbmips@NetBSD.org>
From: Shigeyuki Fukushima <shige@netbsd.org>
List: port-evbmips
Date: 03/29/2006 00:42:06
This is a multi-part message in MIME format.
--------------020309080201070503040809
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Thank you for your works (clock.c, aurtc.c, and so on)
Garrett D'Amore wrote:
> You should probably create a custom evbmips/omsal400 directory and stick
> your RTC driver there. You should probably model it after the aurrtc code.
>
> In your kernel config, you must *only* have one of aurrtc or your rtc.
> multiple devices trying to clockattach() will panic.
I have a plan for multiple rtc devices support.
I sent a patch in this e-mail.
Would you like to review this fix?
And, do you have something better idea?
--
Kind Regards,
--- shige
Shigeyuki Fukushima <shige@{FreeBSD,jp.FreeBSD,NetBSD}.org>
--------------020309080201070503040809
Content-Type: text/plain;
name="rtc.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="rtc.diff"
? sys/arch/evbmips/conf/INSTALL_OMSAL400
Index: sys/arch/evbmips/conf/OMSAL400
===================================================================
RCS file: /cvsroot/src/sys/arch/evbmips/conf/OMSAL400,v
retrieving revision 1.3
diff -u -r1.3 OMSAL400
--- sys/arch/evbmips/conf/OMSAL400 28 Mar 2006 15:12:01 -0000 1.3
+++ sys/arch/evbmips/conf/OMSAL400 28 Mar 2006 15:35:09 -0000
@@ -15,6 +15,7 @@
options ALCHEMY_AU1550
options ALCHEMY_OMSAL400
options PCI_NETBSD_CONFIGURE
+options TODRDEV="\"r2025rtc0\""
# Alchemy On-chip Programmable Serial Controllers
aupsc* at aubus? addr ?
Index: sys/arch/evbmips/evbmips/clock.c
===================================================================
RCS file: /cvsroot/src/sys/arch/evbmips/evbmips/clock.c,v
retrieving revision 1.8
diff -u -r1.8 clock.c
--- sys/arch/evbmips/evbmips/clock.c 28 Mar 2006 12:02:36 -0000 1.8
+++ sys/arch/evbmips/evbmips/clock.c 28 Mar 2006 15:35:09 -0000
@@ -126,9 +126,15 @@
void
todr_attach(todr_chip_handle_t todr)
{
+ struct device *sc = (struct device *)todr->cookie;
- if (todr_handle)
- panic("todr_attach: realtime-clock already configured");
+ if ((strcmp(sc->dv_xname, TODRDEV) != 0)
+ && (todr_handle != NULL)) {
+ aprint_normal(
+ "%s: other realtime-clock device already configured\n",
+ sc->dv_xname);
+ return;
+ }
todr_handle = todr;
}
--------------020309080201070503040809--