Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Add support for Nuvoton NCT5104D GPIO chips, as found on PC ...



details:   https://anonhg.NetBSD.org/src/rev/4732429185d1
branches:  trunk
changeset: 460504:4732429185d1
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Oct 25 17:39:56 2019 +0000

description:
Add support for Nuvoton NCT5104D GPIO chips, as found on PC Engines APU
systems. From Andrew Doran in PR kern/54648.

diffstat:

 distrib/sets/lists/man/mi   |    5 +-
 share/man/man4/Makefile     |    4 +-
 share/man/man4/isa.4        |    7 +-
 share/man/man4/nct.4        |   72 ++++
 sys/arch/amd64/conf/GENERIC |    7 +-
 sys/arch/i386/conf/GENERIC  |    7 +-
 sys/dev/DEVNAMES            |    3 +-
 sys/dev/isa/files.isa       |    7 +-
 sys/dev/isa/nct.c           |  660 ++++++++++++++++++++++++++++++++++++++++++++
 9 files changed, 761 insertions(+), 11 deletions(-)

diffs (truncated from 920 to 300 lines):

diff -r 6015943d9863 -r 4732429185d1 distrib/sets/lists/man/mi
--- a/distrib/sets/lists/man/mi Fri Oct 25 17:25:23 2019 +0000
+++ b/distrib/sets/lists/man/mi Fri Oct 25 17:39:56 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1657 2019/10/15 18:33:57 christos Exp $
+# $NetBSD: mi,v 1.1658 2019/10/25 17:39:56 martin Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -1493,6 +1493,7 @@
 ./usr/share/man/cat4/nadb.0                    man-sys-catman          .cat
 ./usr/share/man/cat4/nca.0                     man-sys-catman          .cat
 ./usr/share/man/cat4/ncr.0                     man-obsolete            obsolete
+./usr/share/man/cat4/nct.0                     man-sys-catman          .cat
 ./usr/share/man/cat4/ne.0                      man-sys-catman          .cat
 ./usr/share/man/cat4/nele.0                    man-sys-catman          .cat
 ./usr/share/man/cat4/neo.0                     man-sys-catman          .cat
@@ -4626,6 +4627,7 @@
 ./usr/share/man/html4/mvsata.html              man-sys-htmlman         html
 ./usr/share/man/html4/nadb.html                        man-sys-htmlman         html
 ./usr/share/man/html4/nca.html                 man-sys-htmlman         html
+./usr/share/man/html4/nct.html                 man-sys-htmlman         html
 ./usr/share/man/html4/ne.html                  man-sys-htmlman         html
 ./usr/share/man/html4/nele.html                        man-sys-htmlman         html
 ./usr/share/man/html4/neo.html                 man-sys-htmlman         html
@@ -7613,6 +7615,7 @@
 ./usr/share/man/man4/nadb.4                    man-sys-man             .man
 ./usr/share/man/man4/nca.4                     man-sys-man             .man
 ./usr/share/man/man4/ncr.4                     man-obsolete            obsolete
+./usr/share/man/man4/nct.4                     man-sys-man             .man
 ./usr/share/man/man4/ne.4                      man-sys-man             .man
 ./usr/share/man/man4/nele.4                    man-sys-man             .man
 ./usr/share/man/man4/neo.4                     man-sys-man             .man
diff -r 6015943d9863 -r 4732429185d1 share/man/man4/Makefile
--- a/share/man/man4/Makefile   Fri Oct 25 17:25:23 2019 +0000
+++ b/share/man/man4/Makefile   Fri Oct 25 17:39:56 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.684 2019/10/07 11:53:40 msaitoh Exp $
+#      $NetBSD: Makefile,v 1.685 2019/10/25 17:39:57 martin Exp $
 #      @(#)Makefile    8.1 (Berkeley) 6/18/93
 
 MAN=   aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
@@ -112,7 +112,7 @@
 # machine-independent ISA devices
 MAN+=  aha.4 ai.4 aic.4 ast.4 ate.4 boca.4 cs.4 cy.4 ec.4 ef.4 \
        eg.4 el.4 esp.4 ess.4 ex.4 fmv.4 gus.4 guspnp.4 ix.4 iy.4 \
-       le.4 lm.4 mcd.4 nca.4 rtfps.4 sb.4 sea.4 smsc.4 tcom.4 \
+       le.4 lm.4 mcd.4 nca.4 nct.4 rtfps.4 sb.4 sea.4 smsc.4 tcom.4 \
        wds.4 we.4 wss.4 wt.4
 
 # machine-independent PCMCIA devices
diff -r 6015943d9863 -r 4732429185d1 share/man/man4/isa.4
--- a/share/man/man4/isa.4      Fri Oct 25 17:25:23 2019 +0000
+++ b/share/man/man4/isa.4      Fri Oct 25 17:39:56 2019 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: isa.4,v 1.46 2017/07/03 21:30:58 wiz Exp $
+.\"    $NetBSD: isa.4,v 1.47 2019/10/25 17:39:57 martin Exp $
 .\"
 .\" Copyright (c) 1997 Jason R. Thorpe.  All rights reserved.
 .\" Copyright (c) 1997 Jonathan Stone
@@ -29,7 +29,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd June 10, 2013
+.Dd October 25, 2019
 .Dt ISA 4
 .Os
 .Sh NAME
@@ -253,6 +253,8 @@
 EGA graphics boards.
 .It lm
 National Semiconductor LM78, LM79 and compatible hardware monitors.
+.It nct
+Nuvoton NCT5104D SuperIO.
 .It pcdisplay
 PC display adapters.
 .It pcic
@@ -353,6 +355,7 @@
 .Xr mcd 4 ,
 .Xr mpu 4 ,
 .Xr nca 4 ,
+.Xr nct 4 ,
 .Xr ne 4 ,
 .Xr ntwoc 4 ,
 .Xr opl 4 ,
diff -r 6015943d9863 -r 4732429185d1 share/man/man4/nct.4
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/man/man4/nct.4      Fri Oct 25 17:39:56 2019 +0000
@@ -0,0 +1,72 @@
+.\"    $NetBSD: nct.4,v 1.1 2019/10/25 17:39:57 martin Exp $
+.\"
+.\" Copyright (c) 2019 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Andrew Doran.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd October 14, 2019
+.Dt NCT 4
+.Os
+.Sh NAME
+.Nm nct
+.Nd Nuvoton NCT5104D SuperIO driver
+.Sh SYNOPSIS
+.Cd "nct0 at isa? port ?"
+.Cd "nct0 at isa? port 0x2e"
+.Cd "nct0 at isa? port 0x4e"
+.Cd "gpio* at nct?"
+.Sh DESCRIPTION
+The
+.Nm
+driver supports the GPIO functions of the NCT5104D.
+The driver does not support the watchdog function of the chip.
+The chip's UARTs are driven by the
+.Xr com 4
+driver.
+.Pp
+The probe routine for this device is invasive.
+The chip will be probed for only if the device is configured into the kernel
+with a fixed port number (0x2e or 0x4e), or if running on a system that
+is known to have a NCT5104D, such as the PC Engines APU line of systems.
+.Pp
+GPIO pins on this chip are shared with the 3rd UART, 4th UART, a clock
+input line, and the watchdog timer.
+If any these functions have been enabled by the BIOS, the
+.Nm
+driver will not take control of the corresponding GPIO lines.
+At attach time, the driver logs which of the 17 GPIO lines are enabled.
+.Sh SEE ALSO
+.Xr gpio 4 ,
+.Xr gpioctl 8 ,
+.Xr isa 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Nx 9 .
+.Sh CAVEATS
+If the chip has not been configured in a complete and accurate manner by
+the BIOS, GPIO lines may be needlessly disabled.
diff -r 6015943d9863 -r 4732429185d1 sys/arch/amd64/conf/GENERIC
--- a/sys/arch/amd64/conf/GENERIC       Fri Oct 25 17:25:23 2019 +0000
+++ b/sys/arch/amd64/conf/GENERIC       Fri Oct 25 17:39:56 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.540 2019/10/25 17:25:23 martin Exp $
+# $NetBSD: GENERIC,v 1.541 2019/10/25 17:39:57 martin Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident         "GENERIC-$Revision: 1.540 $"
+#ident         "GENERIC-$Revision: 1.541 $"
 
 maxusers       64              # estimated number of users
 
@@ -593,6 +593,9 @@
 # Soekris 6501 GPIO/LED driver (provides gpiobus, needs gpio)
 #soekrisgpio0  at isa? port 0x680
 
+# Nuvoton NCT5104D SuperIO providing GPIO
+nct0           at isa? port ?
+
 # SCSI Controllers and Devices
 
 # PCI SCSI controllers
diff -r 6015943d9863 -r 4732429185d1 sys/arch/i386/conf/GENERIC
--- a/sys/arch/i386/conf/GENERIC        Fri Oct 25 17:25:23 2019 +0000
+++ b/sys/arch/i386/conf/GENERIC        Fri Oct 25 17:39:56 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1212 2019/10/08 18:50:44 maxv Exp $
+# $NetBSD: GENERIC,v 1.1213 2019/10/25 17:39:57 martin Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident         "GENERIC-$Revision: 1.1212 $"
+#ident         "GENERIC-$Revision: 1.1213 $"
 
 maxusers       64              # estimated number of users
 
@@ -737,6 +737,9 @@
 # Soekris 6501 GPIO/LED driver (provides gpiobus, needs gpio)
 #soekrisgpio0  at isa? port 0x680
 
+# Nuvoton NCT5104D SuperIO providing GPIO
+nct0           at isa? port ?
+
 # SCSI Controllers and Devices
 
 # PCI SCSI controllers
diff -r 6015943d9863 -r 4732429185d1 sys/dev/DEVNAMES
--- a/sys/dev/DEVNAMES  Fri Oct 25 17:25:23 2019 +0000
+++ b/sys/dev/DEVNAMES  Fri Oct 25 17:39:56 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: DEVNAMES,v 1.322 2019/10/07 11:53:40 msaitoh Exp $
+#      $NetBSD: DEVNAMES,v 1.323 2019/10/25 17:39:56 martin Exp $
 #
 # This file contains all used device names and defined attributes in
 # alphabetical order. New devices added to the system somewhere should first
@@ -924,6 +924,7 @@
 ncrsc                  mvme68k
 ncrscsi                        atari
 ncrscsi                        mac68k
+nct                    MI
 ne                     MI
 necpb                  arc
 nele                   MI
diff -r 6015943d9863 -r 4732429185d1 sys/dev/isa/files.isa
--- a/sys/dev/isa/files.isa     Fri Oct 25 17:25:23 2019 +0000
+++ b/sys/dev/isa/files.isa     Fri Oct 25 17:39:56 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.isa,v 1.173 2019/05/08 13:40:18 isaki Exp $
+#      $NetBSD: files.isa,v 1.174 2019/10/25 17:39:57 martin Exp $
 #
 # Config file and device description for machine-independent ISA code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -511,6 +511,11 @@
 attach soekrisgpio at isa
 file   dev/isa/soekrisgpio.c           soekrisgpio
 
+# NCT5104D GPIO
+device nct: gpiobus
+attach nct at isa
+file   dev/isa/nct.c                   nct
+
 #
 # ISA Plug 'n Play autoconfiguration glue.
 # THIS MUST COME AFTER ALL MI ISA DEVICES ARE DEFINED.  This is because
diff -r 6015943d9863 -r 4732429185d1 sys/dev/isa/nct.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/isa/nct.c Fri Oct 25 17:39:56 2019 +0000
@@ -0,0 +1,660 @@
+/*     $NetBSD: nct.c,v 1.1 2019/10/25 17:39:57 martin Exp $   */
+
+/*-
+ * Copyright (c) 2019 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Andrew Doran.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Nuvoton NCT5104D
+ *
+ * - GPIO: full support.
+ * - Watchdog: no support.  Watchdog uses GPIO pins.
+ * - UARTS: handled by com driver.  3rd & 4th UARTs use GPIO pins.
+ *
+ * If asked to probe with a wildcard address, we'll only do so if known to
+ * be running on a PC Engines APU board.  Probe is invasive.



Home | Main Index | Thread Index | Old Index