Patchwork superiotool support for Fintek F81216

login
register
about
Submitter Stefan Reinauer
Date 2010-06-01 11:42:39
Message ID <4C04F22F.7090807@coresystems.de>
Download mbox | patch
Permalink /patch/1436/
State Accepted, archived
Headers show

Comments

Stefan Reinauer - 2010-06-01 11:42:39
See patch...

./superiotool -d
superiotool r5549
Found Fintek F81216A/AG (vid=0x3419, id=0x1602) at 0x4e
Register dump:
idx 25 27
val 00 10
def 00 NA
LDN 0x00 (UART1)
idx 30 60 61 70 f0 f1 f4 f5
val 00 00 00 00 00 44 00 00
def NA NA NA NA 00 40 00 00
LDN 0x01 (UART2)
idx 30 60 61 70 f0 f4 f5
val 00 00 00 00 00 00 00
def NA NA NA NA 00 00 00
LDN 0x02 (UART3)
idx 30 60 61 70 f0 f4 f5
val 00 00 00 00 00 00 00
def NA NA NA NA 00 00 00
LDN 0x03 (UART4)
idx 30 60 61 70 f0 f4 f5
val 00 00 00 00 00 00 00
def NA NA NA NA 00 00 00
LDN 0x08 (WDT)
idx 30 60 61 70 f0 f1
val 00 00 00 00 00 00
def 00 NA NA NA NA NA
Peter Stuge - 2010-06-01 17:43:33
Stefan Reinauer wrote:
> Add support for Fintek F81216D/DG/AD
> 
> Signed-off-by: Stefan Reinauer <stepan@coresystems.de>

Acked-by: Peter Stuge <peter@stuge.se>

Patch

Index: fintek.c
===================================================================
--- fintek.c	(revision 5601)
+++ fintek.c	(working copy)
@@ -153,6 +153,46 @@ 
 		{EOT}}},
 	{0x0581, "F8000", {	/* Fintek/ASUS F8000 */
 		{EOT}}},
+	{0x0802, "F81216D/DG", {
+		{NOLDN, NULL,
+			{0x25,0x2f,EOT},
+			{0x00,RSVD,EOT}},
+		{0x0, "UART1",
+			{0x30,0x60,0x61,0x70,0xf0,0xf1,EOT},
+			{NANA,NANA,NANA,NANA,0x00,0x40,EOT}},
+		{0x1, "UART2",
+			{0x30,0x60,0x61,0x70,0xf0,EOT},
+			{NANA,NANA,NANA,NANA,0x00,EOT}},
+		{0x2, "UART3",
+			{0x30,0x60,0x61,0x70,0xf0,EOT},
+			{NANA,NANA,NANA,NANA,0x00,EOT}},
+		{0x3, "UART4",
+			{0x30,0x60,0x61,0x70,0xf0,EOT},
+			{NANA,NANA,NANA,NANA,0x00,EOT}},
+		{0x8, "WDT",
+			{0x30,0x60,0x61,0x70,0xf0,0xf1,EOT},
+			{0x00,NANA,NANA,NANA,NANA,NANA,EOT}},
+		{EOT}}},
+	{0x1602, "F81216AD", {
+		{NOLDN, NULL,
+			{0x25,0x27,EOT},
+			{0x00,NANA,EOT}},
+		{0x0, "UART1",
+			{0x30,0x60,0x61,0x70,0xf0,0xf1,0xf4,0xf5,EOT},
+			{NANA,NANA,NANA,NANA,0x00,0x40,0x00,0x00,EOT}},
+		{0x1, "UART2",
+			{0x30,0x60,0x61,0x70,0xf0,0xf4,0xf5,EOT},
+			{NANA,NANA,NANA,NANA,0x00,0x00,0x00,EOT}},
+		{0x2, "UART3",
+			{0x30,0x60,0x61,0x70,0xf0,0xf4,0xf5,EOT},
+			{NANA,NANA,NANA,NANA,0x00,0x00,0x00,EOT}},
+		{0x3, "UART4",
+			{0x30,0x60,0x61,0x70,0xf0,0xf4,0xf5,EOT},
+			{NANA,NANA,NANA,NANA,0x00,0x00,0x00,EOT}},
+		{0x8, "WDT",
+			{0x30,0x60,0x61,0x70,0xf0,0xf1,EOT},
+			{0x00,NANA,NANA,NANA,NANA,NANA,EOT}},
+		{EOT}}},
 	{EOT}
 };
 
@@ -186,6 +226,37 @@ 
 	exit_conf_mode_winbond_fintek_ite_8787(port);
 }
 
+
+void probe_idregs_fintek_alternative(uint16_t port)
+{
+	uint16_t vid, did;
+
+	probing_for("Fintek", "", port);
+
+	enter_conf_mode_fintek_7777(port);
+
+	did = regval(port, DEVICE_ID_BYTE1_REG);
+	did |= (regval(port, DEVICE_ID_BYTE2_REG) << 8);
+
+	vid = regval(port, VENDOR_ID_BYTE1_REG);
+	vid |= (regval(port, VENDOR_ID_BYTE2_REG) << 8);
+
+	if (vid != FINTEK_VENDOR_ID || superio_unknown(reg_table, did)) {
+		if (verbose)
+			printf(NOTFOUND "vid=0x%04x, id=0x%04x\n", vid, did);
+		exit_conf_mode_fintek_7777(port);
+		return;
+	}
+
+	printf("Found Fintek %s (vid=0x%04x, id=0x%04x) at 0x%x\n",
+	       get_superio_name(reg_table, did), vid, did, port);
+	chip_found = 1;
+
+	dump_superio("Fintek", reg_table, port, did, LDN_SEL);
+
+	exit_conf_mode_fintek_7777(port);
+}
+
 void print_fintek_chips(void)
 {
 	print_vendor_chips("Fintek", reg_table);
Index: superiotool.c
===================================================================
--- superiotool.c	(revision 5601)
+++ superiotool.c	(working copy)
@@ -58,11 +58,23 @@ 
 	regwrite(port, 0x02, 0x02);	/* ITE */
 }
 
+void enter_conf_mode_fintek_7777(uint16_t port)
+{
+	OUTB(0x77, port);
+	OUTB(0x77, port);
+}
+
+void exit_conf_mode_fintek_7777(uint16_t port)
+{
+	OUTB(0xaa, port);		/* Fintek */
+}
+
 int superio_unknown(const struct superio_registers reg_table[], uint16_t id)
 {
 	return !strncmp(get_superio_name(reg_table, id), "<unknown>", 9);
 }
 
+
 const char *get_superio_name(const struct superio_registers reg_table[],
 			     uint16_t id)
 {
Index: superiotool.h
===================================================================
--- superiotool.h	(revision 5601)
+++ superiotool.h	(working copy)
@@ -117,6 +117,8 @@ 
 void regwrite(uint16_t port, uint8_t reg, uint8_t val);
 void enter_conf_mode_winbond_fintek_ite_8787(uint16_t port);
 void exit_conf_mode_winbond_fintek_ite_8787(uint16_t port);
+void enter_conf_mode_fintek_7777(uint16_t port);
+void exit_conf_mode_fintek_7777(uint16_t port);
 int superio_unknown(const struct superio_registers reg_table[], uint16_t id);
 const char *get_superio_name(const struct superio_registers reg_table[],
 			     uint16_t id);
@@ -133,6 +135,7 @@ 
 
 /* fintek.c */
 void probe_idregs_fintek(uint16_t port);
+void probe_idregs_fintek_alternative(uint16_t port);
 void print_fintek_chips(void);
 
 /* ite.c */
@@ -164,6 +167,7 @@ 
 } superio_ports_table[] = {
 	{probe_idregs_ali,	{0x3f0, 0x370, EOT}},
 	{probe_idregs_fintek,	{0x2e, 0x4e, EOT}},
+	{probe_idregs_fintek_alternative,	{0x2e, 0x4e, EOT}},
 	/* Only use 0x370 for ITE, but 0x3f0 or 0x3bd would also be valid. */
 	{probe_idregs_ite,	{0x2e, 0x4e, 0x370, EOT}},
 	{probe_idregs_nsc,	{0x2e, 0x4e, 0x15c, EOT}},