NetBSD Problem Report #51676

From brad@anduin.eldar.org  Thu Dec  1 00:11:10 2016
Return-Path: <brad@anduin.eldar.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 430D97A28D
	for <gnats-bugs@gnats.NetBSD.org>; Thu,  1 Dec 2016 00:11:10 +0000 (UTC)
Message-Id: <201612010011.uB10B3Vp014072@anduin.eldar.org>
Date: Wed, 30 Nov 2016 19:11:03 -0500 (EST)
From: brad@anduin.eldar.org
Reply-To: brad@anduin.eldar.org
To: gnats-bugs@NetBSD.org
Subject: Enhancement - interrupt support for RPI gpio, kevents for gpio.c, PPS driver for gpio, and more
X-Send-Pr-Version: 3.95

>Number:         51676
>Category:       kern
>Synopsis:       Enhancement - interrupt support for RPI gpio, kevents for gpio.c, PPS driver for gpio, and more
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    thorpej
>State:          analyzed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 01 00:15:00 +0000 2016
>Closed-Date:    
>Last-Modified:  Fri Jan 18 15:10:01 +0000 2019
>Originator:     Brad Spencer
>Release:        NetBSD 7.99.42
>Organization:
Personal project
>Environment:
System: NetBSD erebor 7.99.42 NetBSD 7.99.42 (EREBOR) #0: Tue Nov 29 09:05:19 EST 2016  brad@braddev.brad.local:/usr/src/sys/arch/evbarm/compile/EREBOR evbarm
Architecture: earmv6hf
Machine: evbarm
>Description:

I had a desire to build one of these:

http://www.satsignal.eu/ntp/Raspberry-Pi-NTP.html

...but did not want to run Linux and NetBSD lacked any interrupts on
the RPI's gpio pins and did not have a PPS driver for GPIO.  This is
an enhancement PR that is the result of working on this:

o Adds support for interrupts to arch/arm/broadcom/bcm2835_gpio.c

o Adds a "demo" driver for GPIO interrupts called gpioirq. 

o Adds simple kevents to dev/gpio/gpio.c that trigger on a number of
conditions, including an interrupt.

o Adds a demo userland program that demonstrates the use of kevents on
GPIO pins.  This can be used with the gpioirq or gpiopps driver to
actually see something happen.

o Adds a PPS driver called gpiopps that seems to make ntpd happy with
the type 20 and type 22 reference driver.  The type 28 driver can also
be used when gpsd is running, but I could not get the type 46 driver
to work and gpsd did not like the PPS device even with the type 28
driver.  I am not entirely sure gpsd from pkgsrc compiles in PPS
support on NetBSD.

>How-To-Repeat:

The tar.bz2 below includes a script that patches a source tree.
Unpack the tar file and do something like the following.  The script
will want the top of a checked out src tree:

./install_gpio_enhancement /development/usr/src

There are 20 diffs that are applied to the src tree and three new
directories.  Poorly worded man pages have been provided for gpioirq
and gpiopps and diffs against gpio.4 are included.

Simple usage:

modload gpioirq
modload gpiopps

gpioctl gpio0 attach gpioirq 4 0x01 0x01
gpioctl gpio0 attach gpiopps 26 0x01

Forgot...  to include diffs for MAKEDEV for gpiopps:

erebor: {15} ls -l /dev/gpiopps0
crw-rw-r--  1 root  _gpio  342, 0 Nov 29 17:02 /dev/gpiopps0

Maybe someone other than me will find this useful.


>Fix:

begin 644 GPIO_ENHANCEMENT.tar.bz2
M0EIH.3%!629361Z,R1L`283_W_YT%$!_________[O____]````0H`0`$0`"
M04(`*&!"WG??/0:#?1AHVS`&^][0]7-[O7K7+Z:\S?=W0%UE*`#MNC<[&PWS
MKVN$7O>X>/KC[/61.?>RN\`-`.4T[GLCW;UP.@/0"NK:@[FZ`#73>;*[!3UT
M]-=!UVLZH<WK<T<%;;SWSOOLGJNM-7V]P'72]-]CZZ"JJM-::%T8$E`IY+84
M@GH6LLT%TT^[O>3:J]!JO6CO)P2FD30F@T`!,(T$Q,$:%/::F:)@J?J>D]1#
M/*CRFGJ,;4@-!IH)0$!!!`C(T:&DTU,IY-$/2>0F@T&F@>H-`#30``&$H:FB
M2@/4/4:``:'I#(`S4:````&@`````DTDA(":`U-4_3U&C30$U&)Z:FF3R@]-
M33"!D9&$]0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13M.061*HAB:!`<B\+;*7HOIB@[R!!
M)(0A!/[)'^\%)$D%.CU;G/Q7.#TVDC[?D*U`JD2P01T7Z&0P,@#L+\^^TUS4
9VP-3),,QA\X/`(&0`/_Q=R13A0D!Z,R1L*U`
`
end

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: kern-bug-people->mbalmer
Responsible-Changed-By: dholland@NetBSD.org
Responsible-Changed-When: Fri, 02 Dec 2016 17:02:20 +0000
Responsible-Changed-Why:
gpio dude
(if you can at least review the changes that would be helpful; if not
set it back)


Responsible-Changed-From-To: mbalmer->thorpej
Responsible-Changed-By: thorpej@NetBSD.org
Responsible-Changed-When: Mon, 30 Apr 2018 17:20:50 +0000
Responsible-Changed-Why:
No action for over 1 year, and I have a need for this, so I'll pick it up.


From: Brad Spencer <brad@anduin.eldar.org>
To: gnats-bugs@NetBSD.org
Cc: thorpej@NetBSD.org, mbalmer@NetBSD.org, netbsd-bugs@netbsd.org,
        gnats-admin@netbsd.org
Subject: Re: kern/51676 (Enhancement - interrupt support for RPI gpio, kevents for gpio.c, PPS driver for gpio, and more)
Date: Tue, 01 May 2018 08:11:28 -0400

 thorpej@NetBSD.org writes:

 > Synopsis: Enhancement - interrupt support for RPI gpio, kevents for gpio.c, PPS driver for gpio, and more
 >
 > Responsible-Changed-From-To: mbalmer->thorpej
 > Responsible-Changed-By: thorpej@NetBSD.org
 > Responsible-Changed-When: Mon, 30 Apr 2018 17:20:50 +0000
 > Responsible-Changed-Why:
 > No action for over 1 year, and I have a need for this, so I'll pick it up.


 Hello...

 I was the one who put in this PR..  You may want to visit my web site:

 http://anduin.eldar.org/stratum-1

 and download MUCH improved patches for some of what was in the PR.


 I have not had time to update anything to support the FDTization that
 occurred with the RPI, so all patches are very much pre-FDT.  Sorry...

 I was also mostly unclear if the RPI will support interrupts coming to
 more than one CPU core.  Right now, the patches pretty much have CPU0
 handle the interrupts.  This won't be a problem for PPS, but may very
 well be a problem if there is a high number of interrupts occurring on a
 pin, such as what can happen here:

 http://anduin.eldar.org/true-rng

 for one of the true rng generators I built.



 I would love to see GPIO interrupts official for the RPI as well....



 -- 
 Brad Spencer - brad@anduin.eldar.org - KC8VKS - http://anduin.eldar.org

From: Jason Thorpe <thorpej@me.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/51676 (Enhancement - interrupt support for RPI gpio,
 kevents for gpio.c, PPS driver for gpio, and more)
Date: Tue, 01 May 2018 09:31:24 -0700

 > On May 1, 2018, at 5:15 AM, Brad Spencer <brad@anduin.eldar.org> =
 wrote:
 > Hello...
 >=20
 > I was the one who put in this PR..  You may want to visit my web site:

 Hey Brad =E2=80=94 thanks for following up.  Cool stuff!  The project =
 I=E2=80=99m using this for is a Nixie tube display clock.

 >=20
 > http://anduin.eldar.org/stratum-1
 >=20
 > and download MUCH improved patches for some of what was in the PR.

 Great, noted.

 >=20
 >=20
 > I have not had time to update anything to support the FDTization that
 > occurred with the RPI, so all patches are very much pre-FDT.  Sorry...
 >=20
 > I was also mostly unclear if the RPI will support interrupts coming to
 > more than one CPU core.  Right now, the patches pretty much have CPU0
 > handle the interrupts.  This won't be a problem for PPS, but may very
 > well be a problem if there is a high number of interrupts occurring on =
 a
 > pin, such as what can happen here:

 I=E2=80=99ll have a look in the documentation.  I am doing my Nixie =
 project on a Pi B+, but I also have a Pi 3 for general hackery (and =
 eventually a cocktail table game system with important titles like Ms =
 Pac Man and Galaga), so if I can figure out how to steer interrupts to =
 other CPUs, I=E2=80=99ll work on it on that platform.

 >=20
 > http://anduin.eldar.org/true-rng
 >=20
 > for one of the true rng generators I built.

 This is excellent!

 >=20
 > I would love to see GPIO interrupts official for the RPI as well=E2=80=A6=
 .

 Yah, I=E2=80=99ll definitely be integrating that part.  In particular, =
 the thing I=E2=80=99m most interested in is the interrupt support, which =
 I will then enhance =E2=80=9Cgpiokeys=E2=80=9D with (I=E2=80=99d prefer =
 to generate the UI events for the buttons on the clock housing [snooze, =
 etc] without resorting using an AVR to generate USB events), and I =
 really loathe polling :-)

 Anyway, I=E2=80=99ll be working on it in the coming weeks (and I have a =
 couple of cross-country flights coming up, so that=E2=80=99ll give me =
 some extra time).

 Thanks for doing this work!

 >=20
 >=20
 >=20
 > --=20
 > Brad Spencer - brad@anduin.eldar.org - KC8VKS - =
 http://anduin.eldar.org
 >=20

 -- thorpej

From: Brad Spencer <brad@anduin.eldar.org>
To: gnats-bugs@NetBSD.org
Cc: thorpej@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: kern/51676 (Enhancement - interrupt support for RPI gpio,
 kevents for gpio.c, PPS driver for gpio, and more)
Date: Tue, 01 May 2018 13:42:35 -0400

 Jason Thorpe <thorpej@me.com> writes:

 >  > On May 1, 2018, at 5:15 AM, Brad Spencer <brad@anduin.eldar.org> =
 >  wrote:
 >  > Hello...
 >  >=20
 >  > I was the one who put in this PR..  You may want to visit my web site:
 >  
 >  Hey Brad thanks for following up.  Cool stuff!  The project
 >  I am using this for is a Nixie tube display clock.

 Oh, ya, those are fun.  Post some pictures when you get it working.

 [snip]

 >  > I have not had time to update anything to support the FDTization that
 >  > occurred with the RPI, so all patches are very much pre-FDT.  Sorry...
 >  >=20
 >  > I was also mostly unclear if the RPI will support interrupts coming to
 >  > more than one CPU core.  Right now, the patches pretty much have CPU0
 >  > handle the interrupts.  This won't be a problem for PPS, but may very
 >  > well be a problem if there is a high number of interrupts occurring on =
 >  a
 >  > pin, such as what can happen here:
 >  
 >  I'll have a look in the documentation.  I am doing my Nixie
 >  project on a Pi B+, but I also have a Pi 3 for general hackery (and
 >  eventually a cocktail table game system with important titles like Ms
 >  Pac Man and Galaga), so if I can figure out how to steer interrupts to
 >  other CPUs, I'll work on it on that platform.

 This was an area of the docs that confused me some, and I just wasn't
 sure what I was looking at.

 >  >=20
 >  > http://anduin.eldar.org/true-rng
 >  >=20
 >  > for one of the true rng generators I built.
 >  
 >  This is excellent!

 Thanks... ya, the true rngs were fun to build.  The diode generator
 creates around 250,000 interrupts a second, and I found it impossible to
 process every interrupt with only one CPU handling the hard interrupt,
 so having more then one CPU involved is likely to help in that case.
 The gpiorng driver on that page tries to be as MP as possible, but it
 can't help the fact that only CPU0 get the hard interrupt.

 >  >=20
 >  > I would love to see GPIO interrupts official for the RPI as well=E2=80=A6=
 >  .
 >  
 >  Yah, I'll definitely be integrating that part.  In particular,
 >  the thing I'm most interested in is the interrupt support, which
 >  I will then enhance gpiokeys with (I'd prefer
 >  to generate the UI events for the buttons on the clock housing [snooze,
 >  etc] without resorting using an AVR to generate USB events), and I
 >  really loathe polling :-)

 Depending on what is desired some of the rest of the patches might be of
 interest.  The patches to gpio.c added kevent support for gpio stuff in
 general, including interrupts.  You can then use the included gpioirq
 driver as a simple trigger, which is all it really is anyway, and get
 interrupt events into user land.  There is some example C code included
 that show how to use GPIO kevents.

 >  Anyway, I'll be working on it in the coming weeks (and I have a
 >  couple of cross-country flights coming up, so that will give me
 >  some extra time).

 [snip]

 I will be watching out for this..  thanks for picking it up.

 >  -- thorpej




 -- 
 Brad Spencer - brad@anduin.eldar.org - KC8VKS - http://anduin.eldar.org

From: "Jason R Thorpe" <thorpej@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51676 CVS commit: src
Date: Sat, 19 May 2018 13:59:07 +0000

 Module Name:	src
 Committed By:	thorpej
 Date:		Sat May 19 13:59:07 UTC 2018

 Modified Files:
 	src/share/man/man4: gpio.4
 	src/sys/dev/gpio: gpio.c gpiovar.h
 	src/sys/sys: gpio.h
 	src/usr.sbin/gpioctl: gpioctl.c

 Log Message:
 Overhaul of GPIO interrupt support (that wasn't even used by anything).
 - Remove the old, not-expressive-enough interrupt flags, and replace them
   with a new set of interrupt-specific flags that can express a wide
   variety of interrupt configurations (pos, neg, and double-edge, high
   and low level).
 - Remove old, unused gpio_pin_ctl_intr() and gpio_pin_irqen(), and
   replace them with gpio_intr_establish(), gpio_intr_disestablish(),
   and gpio_intr_str().  Corresponding fields in the gpio_chipset_tag
   are also added for back-end controllers, which now handle the actual
   dispatch of GPIO interrupts in order to properly support level-triggered
   interrupts as well as interoperate properly with FDT-registered
   interrupts.

 Piggy-back on the 8.99.18 version bump.

 Inspired by initial work from Brad Spencer.
 PR kern/51676


 To generate a diff of this commit:
 cvs rdiff -u -r1.32 -r1.33 src/share/man/man4/gpio.4
 cvs rdiff -u -r1.60 -r1.61 src/sys/dev/gpio/gpio.c
 cvs rdiff -u -r1.17 -r1.18 src/sys/dev/gpio/gpiovar.h
 cvs rdiff -u -r1.15 -r1.16 src/sys/sys/gpio.h
 cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/gpioctl/gpioctl.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Jason R Thorpe" <thorpej@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51676 CVS commit: src/sys/arch/arm/broadcom
Date: Sat, 19 May 2018 14:02:10 +0000

 Module Name:	src
 Committed By:	thorpej
 Date:		Sat May 19 14:02:10 UTC 2018

 Modified Files:
 	src/sys/arch/arm/broadcom: bcm2835_gpio.c

 Log Message:
 Add support for interrupts on GPIO pins.  We support both FDT-driven
 interrupt registration as well as the new GPIO interrupt interface.

 Based on initial work by Brad Spencer.
 PR kern/51676


 To generate a diff of this commit:
 cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/broadcom/bcm2835_gpio.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Jason R Thorpe" <thorpej@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51676 CVS commit: src
Date: Sat, 19 May 2018 14:15:40 +0000

 Module Name:	src
 Committed By:	thorpej
 Date:		Sat May 19 14:15:40 UTC 2018

 Modified Files:
 	src/distrib/sets/lists/man: mi
 	src/distrib/sets/lists/modules: mi
 	src/share/man/man4: Makefile
 	src/sys/dev/gpio: files.gpio
 	src/sys/modules: Makefile
 Added Files:
 	src/share/man/man4: gpioirq.4
 	src/sys/dev/gpio: gpioirq.c
 	src/sys/modules/gpioirq: Makefile gpioirq.ioconf

 Log Message:
 Add an example "gpioirq" driver that demonstrates interrupts on GPIO
 pins.  Will be enhanced in the future to support sending events to
 user space on edge-triggered interrupt events.

 Based on initial work by Brad Spencer.
 PR kern/51676


 To generate a diff of this commit:
 cvs rdiff -u -r1.1586 -r1.1587 src/distrib/sets/lists/man/mi
 cvs rdiff -u -r1.114 -r1.115 src/distrib/sets/lists/modules/mi
 cvs rdiff -u -r1.652 -r1.653 src/share/man/man4/Makefile
 cvs rdiff -u -r0 -r1.1 src/share/man/man4/gpioirq.4
 cvs rdiff -u -r1.14 -r1.15 src/sys/dev/gpio/files.gpio
 cvs rdiff -u -r0 -r1.1 src/sys/dev/gpio/gpioirq.c
 cvs rdiff -u -r1.202 -r1.203 src/sys/modules/Makefile
 cvs rdiff -u -r0 -r1.1 src/sys/modules/gpioirq/Makefile \
     src/sys/modules/gpioirq/gpioirq.ioconf

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Jason R Thorpe" <thorpej@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51676 CVS commit: src
Date: Sun, 20 May 2018 14:08:33 +0000

 Module Name:	src
 Committed By:	thorpej
 Date:		Sun May 20 14:08:33 UTC 2018

 Modified Files:
 	src/distrib/sets/lists/man: mi
 	src/distrib/sets/lists/modules: mi
 	src/etc: MAKEDEV.tmpl
 	src/share/man/man4: Makefile
 	src/share/man/man8: MAKEDEV.8
 	src/sys/conf: majors
 	src/sys/dev/gpio: files.gpio
 	src/sys/modules: Makefile
 Added Files:
 	src/sys/dev/gpio: gpiopps.c

 Log Message:
 Add a 1PPS-over-GPIO driver, originally by Brad Spencer, with changes by
 me to adapt to the new GPIO interrupt interface and support a wider variety
 of GPIO pin configuations.

 PR kern/51676


 To generate a diff of this commit:
 cvs rdiff -u -r1.1587 -r1.1588 src/distrib/sets/lists/man/mi
 cvs rdiff -u -r1.115 -r1.116 src/distrib/sets/lists/modules/mi
 cvs rdiff -u -r1.189 -r1.190 src/etc/MAKEDEV.tmpl
 cvs rdiff -u -r1.653 -r1.654 src/share/man/man4/Makefile
 cvs rdiff -u -r1.47 -r1.48 src/share/man/man8/MAKEDEV.8
 cvs rdiff -u -r1.78 -r1.79 src/sys/conf/majors
 cvs rdiff -u -r1.15 -r1.16 src/sys/dev/gpio/files.gpio
 cvs rdiff -u -r0 -r1.1 src/sys/dev/gpio/gpiopps.c
 cvs rdiff -u -r1.203 -r1.204 src/sys/modules/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Jason R Thorpe" <thorpej@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51676 CVS commit: src
Date: Sun, 20 May 2018 15:15:41 +0000

 Module Name:	src
 Committed By:	thorpej
 Date:		Sun May 20 15:15:41 UTC 2018

 Added Files:
 	src/share/man/man4: gpiopps.4
 	src/sys/modules/gpiopps: Makefile gpiopps.ioconf

 Log Message:
 Add a 1PPS-over-GPIO driver, originally by Brad Spencer, with changes by
 me to adapt to the new GPIO interrupt interface and support a wider variety
 of GPIO pin configuations.

 PR kern/51676

 (Oops, forgot to "cvs add" these items previously.)


 To generate a diff of this commit:
 cvs rdiff -u -r0 -r1.1 src/share/man/man4/gpiopps.4
 cvs rdiff -u -r0 -r1.1 src/sys/modules/gpiopps/Makefile \
     src/sys/modules/gpiopps/gpiopps.ioconf

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Fri, 18 Jan 2019 03:11:47 +0000
State-Changed-Why:
Is this all committed?


From: Jason Thorpe <thorpej@me.com>
To: "gnats-bugs@netbsd.org" <gnats-bugs@NetBSD.org>
Cc: Jason Thorpe <thorpej@NetBSD.org>,
 netbsd-bugs@netbsd.org,
 gnats-admin@netbsd.org,
 "dholland@netbsd.org" <dholland@NetBSD.org>,
 brad@anduin.eldar.org
Subject: Re: kern/51676 (Enhancement - interrupt support for RPI gpio, kevents
 for gpio.c, PPS driver for gpio, and more)
Date: Thu, 17 Jan 2019 19:32:14 -0800

 > On Jan 17, 2019, at 7:11 PM, dholland@netbsd.org <dholland@NetBSD.org> =
 wrote:

 > State-Changed-From-To: open->feedback
 > State-Changed-By: dholland@NetBSD.org
 > State-Changed-When: Fri, 18 Jan 2019 03:11:47 +0000
 > State-Changed-Why:
 > Is this all committed?

 The kevent stuff for gpio is not.  I think it's worth a re-think of how =
 that should be done, and not done as-in the PR.  Oh, and I think the =
 /dev entry for "dsrtc" change is still missing.  But Brad can easily =
 check that in himself now :-)

 -- thorpej

State-Changed-From-To: feedback->analyzed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Fri, 18 Jan 2019 07:48:14 +0000
State-Changed-Why:
I think we should probably have kevents for gpio, so let's leave this open as
a reminder to do it.


From: Brad Spencer <brad@anduin.eldar.org>
To: Jason Thorpe <thorpej@me.com>
Cc: gnats-bugs@NetBSD.org, thorpej@NetBSD.org, netbsd-bugs@netbsd.org,
        gnats-admin@netbsd.org, dholland@NetBSD.org
Subject: Re: kern/51676 (Enhancement - interrupt support for RPI gpio, kevents
 for gpio.c, PPS driver for gpio, and more)
Date: Fri, 18 Jan 2019 10:08:57 -0500

 Jason Thorpe <thorpej@me.com> writes:

 >> On Jan 17, 2019, at 7:11 PM, dholland@netbsd.org <dholland@NetBSD.org> wrote:
 >
 >> State-Changed-From-To: open->feedback
 >> State-Changed-By: dholland@NetBSD.org
 >> State-Changed-When: Fri, 18 Jan 2019 03:11:47 +0000
 >> State-Changed-Why:
 >> Is this all committed?
 >
 > The kevent stuff for gpio is not.  I think it's worth a re-think of how that should be done, and not done as-in the PR.  Oh, and I think the /dev entry for "dsrtc" change is still missing.  But Brad can easily check that in himself now :-)
 >
 > -- thorpej


 The main and important parts of the PR were committed, so I am fine it
 with it closing.  Having kevents with gpio is a nice to have, but
 probably not a critical need to have sort of thing.  The /dev entry for
 dsrtc is just odd, as the code supports it, just nothing was ever
 committed to the majors file and MAKEDEV to have the /dev node created.
 Reading and writing the NVRAM works fine and can be a handy thing to
 have.



 -- 
 Brad Spencer - brad@anduin.eldar.org - KC8VKS - http://anduin.eldar.org


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.