Subject: Re: Multiple rtc devices for todr_attach (Re: RTC todr for mips/alchemy)
To: Shigeyuki Fukushima <shige@netbsd.org>
From: Garrett D'Amore <garrett_damore@tadpole.com>
List: port-evbmips
Date: 03/28/2006 08:46:39
Shigeyuki Fukushima wrote:
> 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?
>
This extra logic is silly. Just *don't* configure the aurtc on boards
that have it.
-- Garrett
>
> ------------------------------------------------------------------------
>
> ? 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;
> }
>
>
--
Garrett D'Amore, Principal Software Engineer
Tadpole Computer / Computing Technologies Division,
General Dynamics C4 Systems
http://www.tadpolecomputer.com/
Phone: 951 325-2134 Fax: 951 325-2191