From 45009b64f1f107e1ab693b14cc35f88c5ab4dd47 Mon Sep 17 00:00:00 2001 From: thorpej Date: Mon, 17 Jan 2022 16:33:00 +0000 Subject: [PATCH] Re-factor and overhaul the "mcp23s17gpio" driver as "mcpgpio", and add support for 8-bit and I2C variants of the chip: - MCP23008 / MCP23S08: 8-bit (I2C / SPI) - MCP23017 / MCP23S17: 16-bit (I2C / SPI) - MCP23018 / MCP23S18: 16-bit (I2C / SPI), open-drain outputs The MCP23x17 and MCP23x18 are essentially identical, software-wise; we merely report different GPIO pin capabilities (no push-pull output for MCP23x18). Also, remove the tri-state capability that was previously advertised by the old version of this driver; these chips have no way to put the pin into a HI-Z mode. All 3 I2C versions are supported, but the SPI front-end still only supports the MCP23S17 for now (SPI autoconfiguration needs an overhaul). mcp23s17gpio(4) remains present as a link to the new mcpgpio(4) man page. XXX Still to-do: FDT integration, interrupt suppoort. (File missed in prior commit.) --- sys/conf/files | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/conf/files b/sys/conf/files index f3c84e30bbdc..665d99c32f27 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1,4 +1,4 @@ -# $NetBSD: files,v 1.1293 2022/01/03 17:19:41 jmcneill Exp $ +# $NetBSD: files,v 1.1294 2022/01/17 16:33:00 thorpej Exp $ # @(#)files.newconf 7.5 (Berkeley) 5/10/93 version 20171118 @@ -420,6 +420,10 @@ file dev/ic/nslm7x.c lm needs-flag device spdmem file dev/ic/spdmem.c spdmem +# Microchip MCP23x08 / MCP23x17 general purpose input/output +device mcpgpio: gpiobus +file dev/ic/mcp23xxxgpio.c mcpgpio + # SSD1306 or SH1106 OLED/PLED display (attaches via I2C or SPI) device ssdfb: wsemuldisplaydev file dev/ic/ssdfb.c ssdfb