Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

watchdog: f71808e_wdt: Add F81866 support

Adds watchdog enable support for Fintek F81866 Super-IO chip to
Fintek wdt driver (f71808e_wdt)

Tested and verified on iBASE MI802 Industrial PC

Datasheet references:
http://www.alldatasheet.com/datasheet-pdf/pdf/459085/FINTEK/F81866AD-I.html

Suggested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Ji-Ze Hong (Peter Hong) <hpeter+linux_kernel@gmail.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>

authored by

Ji-Ze Hong (Peter Hong) and committed by
Wim Van Sebroeck
14b24a88 b99c8774

+26 -2
+26 -2
drivers/watchdog/f71808e_wdt.c
··· 45 45 #define SIO_REG_DEVREV 0x22 /* Device revision */ 46 46 #define SIO_REG_MANID 0x23 /* Fintek ID (2 bytes) */ 47 47 #define SIO_REG_ROM_ADDR_SEL 0x27 /* ROM address select */ 48 + #define SIO_F81866_REG_PORT_SEL 0x27 /* F81866 Multi-Function Register */ 48 49 #define SIO_REG_MFUNCT1 0x29 /* Multi function select 1 */ 49 50 #define SIO_REG_MFUNCT2 0x2a /* Multi function select 2 */ 50 51 #define SIO_REG_MFUNCT3 0x2b /* Multi function select 3 */ 52 + #define SIO_F81866_REG_GPIO1 0x2c /* F81866 GPIO1 Enable Register */ 51 53 #define SIO_REG_ENABLE 0x30 /* Logical device enable */ 52 54 #define SIO_REG_ADDR 0x60 /* Logical device address (2 bytes) */ 53 55 ··· 62 60 #define SIO_F71882_ID 0x0541 /* Chipset ID */ 63 61 #define SIO_F71889_ID 0x0723 /* Chipset ID */ 64 62 #define SIO_F81865_ID 0x0704 /* Chipset ID */ 63 + #define SIO_F81866_ID 0x1010 /* Chipset ID */ 65 64 66 65 #define F71808FG_REG_WDO_CONF 0xf0 67 66 #define F71808FG_REG_WDT_CONF 0xf5 ··· 119 116 MODULE_PARM_DESC(start_withtimeout, "Start watchdog timer on module load with" 120 117 " given initial timeout. Zero (default) disables this feature."); 121 118 122 - enum chips { f71808fg, f71858fg, f71862fg, f71869, f71882fg, f71889fg, f81865 }; 119 + enum chips { f71808fg, f71858fg, f71862fg, f71869, f71882fg, f71889fg, f81865, 120 + f81866}; 123 121 124 122 static const char *f71808e_names[] = { 125 123 "f71808fg", ··· 130 126 "f71882fg", 131 127 "f71889fg", 132 128 "f81865", 129 + "f81866", 133 130 }; 134 131 135 132 /* Super-I/O Function prototypes */ ··· 375 370 superio_clear_bit(watchdog.sioaddr, SIO_REG_MFUNCT3, 5); 376 371 break; 377 372 373 + case f81866: 374 + /* Set pin 70 to WDTRST# */ 375 + superio_clear_bit(watchdog.sioaddr, SIO_F81866_REG_PORT_SEL, 376 + BIT(3) | BIT(0)); 377 + superio_set_bit(watchdog.sioaddr, SIO_F81866_REG_PORT_SEL, 378 + BIT(2)); 379 + /* 380 + * GPIO1 Control Register when 27h BIT3:2 = 01 & BIT0 = 0. 381 + * The PIN 70(GPIO15/WDTRST) is controlled by 2Ch: 382 + * BIT5: 0 -> WDTRST# 383 + * 1 -> GPIO15 384 + */ 385 + superio_clear_bit(watchdog.sioaddr, SIO_F81866_REG_GPIO1, 386 + BIT(5)); 387 + break; 388 + 378 389 default: 379 390 /* 380 391 * 'default' label to shut up the compiler and catch ··· 403 382 superio_select(watchdog.sioaddr, SIO_F71808FG_LD_WDT); 404 383 superio_set_bit(watchdog.sioaddr, SIO_REG_ENABLE, 0); 405 384 406 - if (watchdog.type == f81865) 385 + if (watchdog.type == f81865 || watchdog.type == f81866) 407 386 superio_set_bit(watchdog.sioaddr, F81865_REG_WDO_CONF, 408 387 F81865_FLAG_WDOUT_EN); 409 388 else ··· 808 787 goto exit; 809 788 case SIO_F81865_ID: 810 789 watchdog.type = f81865; 790 + break; 791 + case SIO_F81866_ID: 792 + watchdog.type = f81866; 811 793 break; 812 794 default: 813 795 pr_info("Unrecognized Fintek device: %04x\n",