Commit Graph

8 Commits

Author SHA1 Message Date
John Baldwin
84c5f982ef gpio: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-09 12:22:01 -07:00
Andriy Gapon
155514eacf nctgpio: improve performance (latency) of operation
This change consists of two parts.

First, nctgpio now supports hardware access via an I/O port window if
it's configured by firmware.  For instance, PC Engines firmware
v4.10.0.2 does that.  This is faster than going through the Super I/O
configuration registers.

Second, nctgpio now caches values of bits that it controls.  For
example, the driver does not need to access the hardware to determine if
a pin is an output or an input, or a state of an output.  Also, the
driver makes use of the fact that the hardware preserves an output state
of a pin accross a switch to the input mode and back.

With this change I am able to use the 1-Wire bus over nctgpio whereas
previously the driver introduced too much latency to be compliant with
the relatively strict protocol timings.

superio0: <Nuvoton NCT5104D/NCT6102D/NCT6106D (rev. B+)> at port 0x2e-0x2f on isa0
gpio1: <Nuvoton GPIO controller> at GPIO ldn 0x07 on superio0
pcib0: allocated type 4 (0x220-0x226) for rid 0 of gpio1
gpiobus1: <GPIO bus> on gpio1
owc0: <GPIO attached one-wire bus> at pin 4 on gpiobus1
ow0: <1 Wire Bus> on owc0
ow0: romid 28:b2:9e:45:92:10:02:34: no driver
ow_temp0: <Advanced One Wire Temperature> romid 28:b2:9e:45:92:10:02:34 on ow0

MFC after:	4 weeks
2019-10-22 14:20:35 +00:00
Andriy Gapon
e3df342a32 move nctgpio to superio(4) bus
This is where it logically belongs.
The change allows to drop a bunch of low lewel code.

Reviewed by:	gonzo
MFC after:	19 days
Differential Revision: https://reviews.freebsd.org/D21980
2019-10-16 14:42:49 +00:00
Andriy Gapon
0222625608 nctgpio: change default pin names to those used by the datasheet(s)
That is, instead of the current GPIO00 - GPIO15 the names will be GPIO00
- GPIO07, GPIO10 - GPIO17.  The first digit is a GPIO "bank" / group
number and the second one is a pin number within the bank.  Alternative
view is that the pin names are changed from decimal numbering scheme to
octal one (as there are 8 pins per bank).

Discussed with:	cem, gonzo
MFC after:	2 weeks
2019-07-01 15:43:48 +00:00
Oleksandr Tymoshenko
9d1208bbd2 nctgpio: add new device id for the GPIO chip in PCEngines APU3
PR:		224512
Submitted by:	mike@sentex.net
MFC after:	2 weeks
2018-01-02 20:58:05 +00:00
Conrad Meyer
523af57ea2 nctgpio(4): Don't index past the end of sc->pins array
This driver thinks that the NCT_MAX_PIN index is a valid index in a few places
(nct_attach() for-loop, as well as NCT_IS_VALID_PIN()).  Allocate room for
NCT_MAX_PIN as an index, that is, NCT_MAX_PIN + 1 elements.

Reported by:	Coverity
CIDs:		1353806, 1353807, 1353808, 1353809, 1353810
Sponsored by:	EMC / Isilon Storage Division
2016-04-20 01:17:18 +00:00
Pedro F. Giffuni
73a1170a8c sys/dev: use our nitems() macro when it is avaliable through param.h.
No functional change, only trivial cases are done in this sweep,
Drivers that can get further enhancements will be done independently.

Discussed in:	freebsd-current
2016-04-19 23:37:24 +00:00
Adrian Chadd
6b7b2d80ed Add support for the Nuvoton NCT5104D.
Make it compile only for i386/amd64 for now as it's been tested there.
It's quite possible it'll show up elsewhere and we can enable it
for other architectures later.

Tested:

* PC Engines APU1C4

Submitted by:	Daniel Wyatt <daniel@dewyatt.com>
Reviewed by:	adrian, loos
Differential Revision:	https://reviews.freebsd.org/D5389
2016-03-31 04:57:38 +00:00