From patchwork Thu Jan 26 04:02:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Crawford X-Patchwork-Id: 13116607 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BD31C61D97 for ; Thu, 26 Jan 2023 04:02:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229475AbjAZECz (ORCPT ); Wed, 25 Jan 2023 23:02:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229536AbjAZECx (ORCPT ); Wed, 25 Jan 2023 23:02:53 -0500 Received: from ipmail06.adl3.internode.on.net (ipmail06.adl3.internode.on.net [150.101.137.16]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EDDAE2D72 for ; Wed, 25 Jan 2023 20:02:46 -0800 (PST) IronPort-SDR: ZLrEiAKOvoujCwa9n0eD60zQVbzu//um34Y27tLnrt0O0q3bRa7t+Ze/dJtApdOqe6An39yVGw 6z85FN2Z+Uq88Z2k+4b3fDs3S8S5kN8qFj86Ch8PgIqjeCtzNNR6H5TCs+b8jDvGegBTEAvQwI 4qlU7J24O+8u64mhhpQyUKW2+3BDvQcFX3si9yQqgywZeJuBQJBEhR4uVpxPhQxge0AnCPwfAN 0vadoZZtqtZy02911P892uD03jF+SaKKAcnWAByhnG45yp/6XvxZcOkEIDKch4fF6jg8LIvbLq NZh7xCmLkLbzlKNimV+RQSKR X-SMTP-MATCH: 0 X-IPAS-Result: A2AsBgCK+tFjjPQc8jxaHQEBAQEJARIBBQUBSYFGgi2CYJVtnz4PAQ8BAUQEAQGFBgKFIyY4EwECBAEBAQEDAgMBAQEBAQED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yDPc2utkckz16Rh+8KeDTUgPbQKHjzZQLeUpPY4on bUhtcoR51DtgxYmKIzd3CpV63/KJWYJTKsgrJ1cDYr2zAsnjFhfOMSOBijz6ZCJStNNLkhzf GDO3fOZ2OoAyxqQaWc3GFjMwfFZ28YEtidK+1ledV6HrcWU1PY40SpY/SkzUgkInA5M1Ph+O zY3OkApd7+C+Sxk2JpKU2y2QFsTWkXcoBCrjgFZ0TeFEw+zSmXRLWZ7Jf6C/QYS9GcadyUCp OOUz2PsUDDLesDt33JsBhQ88qe8E4B8pl/YhcSqP8WZBJ1mMzDrtan/N2MHpizuDd41mECa9 /Jh+/x9aPOnOCMdy0Hh51J2CVjNpMi4GVF/ IronPort-HdrOrdr: A9a23:/u4soavFUJVdTxthpKv+DXUf7skDrNV00zEX/kB9WHVpm6yj/f xGUs576faSskdpZJlD8ersBEDkex/hHPFOkOos1NuZMzUO/VHYSL2KjrGSpQEIZReOlNK1vJ 0IG8ND4Z/LfD9HZK3BgDVQfexP/DEJnZrY/ds2t00dKD2Cc5sQkzuRFDzrb3GemzM2fqbQxf Knl7B6mwY= X-IronPort-Anti-Spam-Filtered: true Received: from 60-242-28-244.static.tpgi.com.au (HELO bits.crawford.emu.id.au) ([60.242.28.244]) by ipmail06.adl3.internode.on.net with ESMTP; 26 Jan 2023 14:32:43 +1030 Received: from agc.crawford.emu.id.au (agc.crawford.emu.id.au [IPv6:fdd2:7aad:d478:1:0:0:cb10:cc07]) (authenticated bits=0) by bits.crawford.emu.id.au (8.17.1/8.17.1) with ESMTPSA id 30Q42O5U1960730 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 26 Jan 2023 15:02:38 +1100 Authentication-Results: bits.crawford.emu.id.au; arc=none smtp.remote-ip=fdd2:7aad:d478:1::cb10:cc07 DKIM-Filter: OpenDKIM Filter v2.11.0 bits.crawford.emu.id.au 30Q42O5U1960730 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crawford.emu.id.au; s=s1; t=1674705759; bh=ZEPjMNMpNNGoT3JyHGJY8+fZzD0RHKUVp9nUZ1q8/Qw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DkFZWM4l3iEQL7BWqQGC5IrBhZY4+YAaojAqwqLtMS+M1EbL/+I/kozeIWjulp/Vl jQJMuyRvS1+yQyIotQa3sdsadOKGe/r4G/rZrL+divArYoyOD6HQK97fPV5H34FTY5 CRj9JtpVjctxC5C78Cji1JzD0FuQ0XVroqLz4qJZZPgbbapE6XmEP3TmMMfueqCPjN MSbPnlT2GoMEFhFbPM78rzMWFcyEKxRmLqtQGVXqIKFaAujkzXIw4GGDmyd+nN/CdF Ejk+7J0sUGrdAovMyv21LvIliLVO29w3HqjtIup3AOs10+PNsXEzcmC9NW7sYg01BB p1FP2Qpy/SjVg== From: Frank Crawford To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, Frank Crawford Subject: [PATCH v1 1/7] hwmon: (it87) Allow disabling exiting of configuration mode Date: Thu, 26 Jan 2023 15:02:17 +1100 Message-Id: <20230126040223.986189-2-frank@crawford.emu.id.au> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230126040223.986189-1-frank@crawford.emu.id.au> References: <20230126040223.986189-1-frank@crawford.emu.id.au> MIME-Version: 1.0 X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.4 (bits.crawford.emu.id.au [IPv6:fdd2:7aad:d478:1:0:0:cb10:cc01]); Thu, 26 Jan 2023 15:02:39 +1100 (AEDT) X-Virus-Scanned: clamav-milter 0.103.7 at bits.crawford.emu.id.au X-Virus-Status: Clean Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Disabling configuration mode on some chips can result in system hang-ups and access failures to the Super-IO chip at the second SIO address. Never exit configuration mode on these chips to avoid the problem. This patch should be applied in conjunction with a previous one to initialise the second chip for certain mother boards. Signed-off-by: Frank Crawford --- drivers/hwmon/it87.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index a8a6a0ffee82..7049e81f5af1 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c @@ -128,10 +128,12 @@ static inline int superio_enter(int ioreg) return 0; } -static inline void superio_exit(int ioreg) +static inline void superio_exit(int ioreg, bool doexit) { - outb(0x02, ioreg); - outb(0x02, ioreg + 1); + if (doexit) { + outb(0x02, ioreg); + outb(0x02, ioreg + 1); + } release_region(ioreg, 2); } @@ -497,6 +499,7 @@ static const struct it87_devices it87_devices[] = { struct it87_sio_data { int sioaddr; enum chips type; + u8 doexit; /* Values read from Super-I/O config space */ u8 revision; u8 vid_value; @@ -523,6 +526,8 @@ struct it87_data { u8 peci_mask; u8 old_peci_mask; + bool doexit; /* true if exit from sio config is ok */ + unsigned short addr; const char *name; struct mutex update_lock; @@ -2405,6 +2410,7 @@ static int __init it87_find(int sioaddr, unsigned short *address, int err; u16 chip_type; const struct it87_devices *config; + bool doexit = true; err = superio_enter(sioaddr); if (err) @@ -2501,6 +2507,8 @@ static int __init it87_find(int sioaddr, unsigned short *address, goto exit; } + sio_data->doexit = doexit; + err = 0; sio_data->sioaddr = sioaddr; sio_data->revision = superio_inb(sioaddr, DEVREV) & 0x0f; @@ -2827,7 +2835,7 @@ static int __init it87_find(int sioaddr, unsigned short *address, sio_data->skip_pwm |= dmi_data->skip_pwm; exit: - superio_exit(sioaddr); + superio_exit(sioaddr, doexit); return err; } @@ -3061,6 +3069,7 @@ static int it87_probe(struct platform_device *pdev) data->addr = res->start; data->sioaddr = sio_data->sioaddr; data->type = sio_data->type; + data->doexit = sio_data->doexit; data->features = it87_devices[sio_data->type].features; data->peci_mask = it87_devices[sio_data->type].peci_mask; data->old_peci_mask = it87_devices[sio_data->type].old_peci_mask; @@ -3213,7 +3222,7 @@ static void it87_resume_sio(struct platform_device *pdev) reg2c); } - superio_exit(data->sioaddr); + superio_exit(data->sioaddr, data->doexit); } static int it87_resume(struct device *dev)