Received: by 10.223.185.116 with SMTP id b49csp1466258wrg; Wed, 21 Feb 2018 20:01:19 -0800 (PST) X-Google-Smtp-Source: AH8x227I9DpVpxZII7qFVG4axk0OKdCTfIx1GhQIyjmnzz8EN1JP9t2Fwlp3WHLdk+ik97CjoKDX X-Received: by 10.98.211.1 with SMTP id q1mr5517429pfg.199.1519272079760; Wed, 21 Feb 2018 20:01:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519272079; cv=none; d=google.com; s=arc-20160816; b=eS55Rrrd+ZN4eMmwyt6fHg7V1nNc3XauKv7AYTF6V/cSjicHuXR6ZM4jUpb809S8YD so7VMS6hS8++R9Nl1ELgFdzge/FBGrkcBKyFWAH5QlC/woSWqcuatrPzO4wd60TOaikU tgJQ1/FA31d+Jixq1vqj4JCni3a3EQtMmVbB1da1EYx3VNjlLKO2HdH2YjoFWayc1sug EN9yT+XccIWT1pLD714FrbeuGS48D4OKx4gOnEVoQNaIxl/2dKWiUlat5p0e2/RFgHVT /KHvAyGaGws9EckqjGLrTS7m4cXt1grcFwIf7DlEQFkqYzUwUa/POz7+puMkujhcXfZ8 /hDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:arc-authentication-results; bh=HoZ9w0Vz001FrQnyIpVoayP62jNmykCJvunamLBpkTg=; b=ib0f5SQsWT2LMs9CXLI+TRXK0j9SDts9S6e1McbJ6oNIHLRBihnww2nvze0gvcXkUr QADSLFHa988SQSxGLlgRqZU2+eGM72MEM5wfIBzxrdsqEWdwyRscRl2yHP6Ni9Q1fTbn yi2DcDMvGhceKK1qHV0R4VXJJssEkSKMHyv8Pcz/o0WIr3ghCLK/VK2haucWIFlxI6e8 obYkbT13qs2FHv4aLWOE6TZp1j+ST10SWb58GDMe0nq+yiYb/1XBRqUDPh5+6FJvchHt Bh83AWYA0NduxB6YASzMlM7taTX7cGwH4AGbrNQNXlt9N90hQatvBi8WVrqbAcIqTQdT k9ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@opengear.com header.s=selector1 header.b=yXE5sC5V; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=opengear.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e3-v6si4207119plb.100.2018.02.21.20.01.03; Wed, 21 Feb 2018 20:01:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@opengear.com header.s=selector1 header.b=yXE5sC5V; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=opengear.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752135AbeBVEAU (ORCPT + 99 others); Wed, 21 Feb 2018 23:00:20 -0500 Received: from mail-by2nam03on0071.outbound.protection.outlook.com ([104.47.42.71]:41439 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751978AbeBVEAR (ORCPT ); Wed, 21 Feb 2018 23:00:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=opengear.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=HoZ9w0Vz001FrQnyIpVoayP62jNmykCJvunamLBpkTg=; b=yXE5sC5V8ToYXKrnDElZvGXp5LCb209eA+PdvA+DyxnREL10A7pHuvn1trMWi/Nzy25Yc2o/KBMefBHIPc6cgMQ7ATW1sVL49mZer6/utx/nkwqpx1RJUDsqKCOrzAQKU2QrruFSriEtFdJmbWepIBdFAALqigSkoIsgUeCYazY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=andrew.cooks@opengear.com; Received: from [192.168.254.67] (59.167.150.161) by DM5PR15MB1211.namprd15.prod.outlook.com (10.173.209.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.527.15; Thu, 22 Feb 2018 04:00:12 +0000 Subject: Re: [PATCH 2/2] i2c: piix4: Use usleep_range() To: Guenter Roeck , Wolfram Sang Cc: Jean Delvare , =?UTF-8?B?Wm9sdMOhbiBCw7ZzesO2cm3DqW55?= =?UTF-8?Q?i?= , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org References: <1514652658-6228-1-git-send-email-linux@roeck-us.net> <1514652658-6228-2-git-send-email-linux@roeck-us.net> From: Andrew Cooks Message-ID: <6af53537-f160-8ea5-2491-98f8a7966975@opengear.com> Date: Thu, 22 Feb 2018 13:59:49 +1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1514652658-6228-2-git-send-email-linux@roeck-us.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [59.167.150.161] X-ClientProxiedBy: MEXPR01CA0142.ausprd01.prod.outlook.com (10.171.15.27) To DM5PR15MB1211.namprd15.prod.outlook.com (10.173.209.17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 43d88a91-058a-495d-6301-08d579a8c815 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4604075)(2017052603307)(7153060)(7193020);SRVR:DM5PR15MB1211; X-Microsoft-Exchange-Diagnostics: 1;DM5PR15MB1211;3:TL7QWqVG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NtfyyyLkb3l+mO9XH8Fkw9BghqzpDWssJPkWQwDJmMvz+fyHOZbMD83BKYTN+MPJencXdzsuvEVFmqPCa6yiJk0QKqC5hcGDs/N1Zx7ps10T7cPYvpFJgZHzeYSwiw8slZimpja2OWiQB9+Ya2dH4t1ciuo93/sw1q6puP2KoOvdK9bp4ddgSUabemm79d+BXLKDdhJe5280H3rjxHulsCQVOiUzMI5ydIayTM5s44zr0ZOnf3chjeP06V+SymG9I1aoG553ExgHo4FyH4g== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001074)(6040501)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93001095)(3231101)(944501161)(6041288)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR15MB1211;BCL:0;PCL:0;RULEID:;SRVR:DM5PR15MB1211; X-Forefront-PRVS: 059185FE08 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6049001)(39840400004)(366004)(39380400002)(346002)(376002)(396003)(189003)(199004)(305945005)(25786009)(53936002)(97736004)(478600001)(47776003)(65806001)(66066001)(65956001)(50466002)(5660300001)(106356001)(64126003)(65826007)(77096007)(7736002)(6666003)(6246003)(76176011)(229853002)(90366009)(26005)(2950100002)(6486002)(117156002)(36756003)(4326008)(52116002)(386003)(105586002)(58126008)(2486003)(52146003)(23676004)(68736007)(2906002)(86362001)(16526019)(551934003)(8936002)(81166006)(81156014)(54906003)(110136005)(8676002)(16576012)(316002)(3846002)(31696002)(53546011)(230700001)(31686004)(6116002);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR15MB1211;H:[192.168.254.67];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Received-SPF: None (protection.outlook.com: opengear.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics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Xuw3eBTNBTvpNLuJYT16iSLOaWTDfHZDrdNY54WulrwQY SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: opengear.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2018 04:00:12.4698 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 43d88a91-058a-495d-6301-08d579a8c815 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a6251c26-d21f-4164-a225-1f4eaebf5f9a X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR15MB1211 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 31/12/17 02:50, Guenter Roeck wrote: > The piix4 i2c driver is extremely slow. Replacing msleep() > with usleep_range() increases its speed substantially. > > Signed-off-by: Guenter Roeck > --- > drivers/i2c/busses/i2c-piix4.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c > index 78dd5951d6e7..52a8b1c5c110 100644 > --- a/drivers/i2c/busses/i2c-piix4.c > +++ b/drivers/i2c/busses/i2c-piix4.c > @@ -467,13 +467,13 @@ static int piix4_transaction(struct i2c_adapter *piix4_adapter) > > /* We will always wait for a fraction of a second! (See PIIX4 docs errata) */ > if (srvrworks_csb5_delay) /* Extra delay for SERVERWORKS_CSB5 */ > - msleep(2); > + usleep_range(2000, 2000); > else > - msleep(1); > + usleep_range(500, 1000); > > while ((++timeout < MAX_TIMEOUT) && > ((temp = inb_p(SMBHSTSTS)) & 0x01)) > - msleep(1); > + usleep_range(200, 500); > > /* If the SMBus is still busy, we give up */ > if (timeout == MAX_TIMEOUT) { > Thanks for this patch. FWIW, this also makes a noticeable difference on AMD Family 16h Model 30h, used in embedded designs and also commonly available as AMD GX-412TC SoC in the PC Engines APU2. Among the tests I did were reading from the SoC temperature sensor in a loop: while [ true ] ; do i2cget -y 0 0x4C 0x01 ; done and scanning for peripherals in a loop: while [ true ] ; do i2cdetect -y 0 ; done These tests may be artificial and trivial, but the speedup matters to us because we have more than one bus master and the embedded controller needs to poll multiple sensors. Tested-by: Andrew Cooks