Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Nov 2020 07:34:21 +0000 (UTC)
From:      Poul-Henning Kamp <phk@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r368052 - head/sys/dev/superio
Message-ID:  <202011260734.0AQ7YL7L040602@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: phk
Date: Thu Nov 26 07:34:20 2020
New Revision: 368052
URL: https://svnweb.freebsd.org/changeset/base/368052

Log:
  Add support for Fintek F81803 SuperIO chip
  
  Reviewed by:	avg

Modified:
  head/sys/dev/superio/superio.c
  head/sys/dev/superio/superio.h

Modified: head/sys/dev/superio/superio.c
==============================================================================
--- head/sys/dev/superio/superio.c	Thu Nov 26 07:31:30 2020	(r368051)
+++ head/sys/dev/superio/superio.c	Thu Nov 26 07:34:20 2020	(r368052)
@@ -233,9 +233,29 @@ static const struct sio_conf_methods nvt_conf_methods 
 	.vendor = SUPERIO_VENDOR_NUVOTON
 };
 
+static void
+fintek_conf_enter(struct resource* res, uint16_t port)
+{
+	bus_write_1(res, 0, 0x87);
+	bus_write_1(res, 0, 0x87);
+}
+
+static void
+fintek_conf_exit(struct resource* res, uint16_t port)
+{
+	bus_write_1(res, 0, 0xaa);
+}
+
+static const struct sio_conf_methods fintek_conf_methods = {
+	.enter = fintek_conf_enter,
+	.exit = fintek_conf_exit,
+	.vendor = SUPERIO_VENDOR_FINTEK
+};
+
 static const struct sio_conf_methods * const methods_table[] = {
 	&ite_conf_methods,
 	&nvt_conf_methods,
+	&fintek_conf_methods,
 	NULL
 };
 
@@ -261,6 +281,11 @@ const struct sio_device nct5104_devices[] = {
 	{ .type = SUPERIO_DEV_NONE },
 };
 
+const struct sio_device fintek_devices[] = {
+	{ .ldn = 7, .type = SUPERIO_DEV_WDT },
+	{ .type = SUPERIO_DEV_NONE },
+};
+
 static const struct {
 	superio_vendor_t	vendor;
 	uint16_t		devid;
@@ -410,6 +435,11 @@ static const struct {
 		.descr = "Nuvoton NCT6795",
 		.devices = nvt_devices,
 	},
+	{
+		.vendor = SUPERIO_VENDOR_FINTEK, .devid = 0x1210, .mask = 0xff,
+		.descr = "Fintek F81803",
+		.devices = fintek_devices,
+	},
 	{ 0, 0 }
 };
 
@@ -472,6 +502,10 @@ superio_detect(device_t dev, bool claim, struct siosc 
 			devid = sio_readw(res, 0x20);
 			revid = sio_read(res, 0x22);
 		} else if (methods_table[m]->vendor == SUPERIO_VENDOR_NUVOTON) {
+			devid = sio_read(res, 0x20);
+			revid = sio_read(res, 0x21);
+			devid = (devid << 8) | revid;
+		} else if (methods_table[m]->vendor == SUPERIO_VENDOR_FINTEK) {
 			devid = sio_read(res, 0x20);
 			revid = sio_read(res, 0x21);
 			devid = (devid << 8) | revid;

Modified: head/sys/dev/superio/superio.h
==============================================================================
--- head/sys/dev/superio/superio.h	Thu Nov 26 07:31:30 2020	(r368051)
+++ head/sys/dev/superio/superio.h	Thu Nov 26 07:34:20 2020	(r368052)
@@ -34,6 +34,7 @@ typedef enum superio_vendor {
 	SUPERIO_VENDOR_NONE,
 	SUPERIO_VENDOR_ITE,
 	SUPERIO_VENDOR_NUVOTON,
+	SUPERIO_VENDOR_FINTEK,
 	SUPERIO_VENDOR_MAX
 } superio_vendor_t;
 
@@ -58,7 +59,7 @@ device_t superio_find_dev(device_t superio, superio_de
     int ldn);
 
 enum superio_ivars {
-	SUPERIO_IVAR_LDN = 	10600,
+	SUPERIO_IVAR_LDN =	10600,
 	SUPERIO_IVAR_TYPE,
 	SUPERIO_IVAR_IOBASE,
 	SUPERIO_IVAR_IOBASE2,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202011260734.0AQ7YL7L040602>