Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp3899850imd; Mon, 29 Oct 2018 14:15:21 -0700 (PDT) X-Google-Smtp-Source: AJdET5cpgaryBo/WwNu2JVIwH23F5agMv6ozVTN1Yti7uyP/beFJVzCyc3jRzyDNbKv+3VnmoWTw X-Received: by 2002:aa7:80cd:: with SMTP id a13-v6mr61480pfn.86.1540847721768; Mon, 29 Oct 2018 14:15:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540847721; cv=none; d=google.com; s=arc-20160816; b=oHVAV28bkfWLIQzNwgWucVHSC1LHrkZVXdZvAu4MZOmo/hVraxjXmbBOBIRT51zUjJ a+pUvWrC3w0hhVtiNMypJ2PJw7RKFq0KWz3JzmkgJjXvnH83qKnbws/ipy+f9ePc7kie c0/ngaJcDh7c1Uk10OPFfWh7r7yw4LMn9q9GdjrMZDuJYBc9lUEIdkRwO4JXU3SMFH4m udxnTJ2++5K8iqxZCk3YZrb0j1w9LBoWpARC+32c1MgIxNU23oDyaKRI4qGq1+2kUUDj Y5RZXt4GaedyeKRk3MTx2JGoib9MGrxfT2Mez0jE58FfUaDD5NDER4ZGoi9I5JQA3KQO Cbrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=yS+dpqRNPwbBO/EqkzDjTwfg/5i1vKm+AxyiGEsXhuM=; b=k0TmeJ0vfLA9SgciUr75qSceqcZ9WoqaNLat6adf/JoPAUS7PFaNpcQMA3+WXdh5Q+ PM3fhxXncI8NzI2aVBex4W2JOw0v7hOIXH7f6RZB3WKHYlb8xsjgLxJmIn2NA3CIgiWw OiDmUel/cne4j9ZUNV9lOgz0Oe3pCCf9p0xmcZzTXNrOZwbSCv7Ia7EdrAFMZKG8w/IX myo11j8/ifh3HOpbtWjevbXeXKHRJvupqLOjoqR4NaT8DWXf8DQ65IWo/0pbgzF5MwQ1 VBB/XnuRWULkW9YgGyyzcA0rm5BlatU+c9v0xWLZvFkeMZ5FX9dPLETQvzi47Ll/kcY+ MCwA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c11-v6si22636113pgj.409.2018.10.29.14.15.05; Mon, 29 Oct 2018 14:15:21 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727507AbeJ3GFF (ORCPT + 99 others); Tue, 30 Oct 2018 02:05:05 -0400 Received: from mga06.intel.com ([134.134.136.31]:36149 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726501AbeJ3GFF (ORCPT ); Tue, 30 Oct 2018 02:05:05 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Oct 2018 14:14:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,441,1534834800"; d="scan'208";a="275455989" Received: from maru.jf.intel.com ([10.54.51.77]) by fmsmga005.fm.intel.com with ESMTP; 29 Oct 2018 14:14:38 -0700 From: Jae Hyun Yoo To: Wolfram Sang , Brendan Higgins , Rob Herring , Joel Stanley , Benjamin Herrenschmidt , Mark Rutland , Andrew Jeffery , linux-i2c@vger.kernel.org, openbmc@lists.ozlabs.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org Cc: Jarkko Nikula , James Feist , Vernon Mauery , Jae Hyun Yoo Subject: [PATCH i2c-next v8 0/5] i2c: aspeed: Add bus idle waiting logic for multi-master use cases Date: Mon, 29 Oct 2018 14:14:09 -0700 Message-Id: <20181029211414.20771-1-jae.hyun.yoo@linux.intel.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In multi-master environment, this driver's master cannot know exactly when a peer master sends data to this driver's slave so a case can be happened that this master tries to send data through the master_xfer function but slave data from peer master is still being processed by this driver. To prevent state corruption in the case, this patch adds checking code if any slave operation is ongoing and it waits up to the bus timeout duration before starting a master_xfer operation. To support this change, it introduces changes on i2c-core-base to make that able to read the bus timeout and master transfer retries count values from device tree properties. Please review this patch set. Thanks, -Jae Changes since v7: - Simplified the bus idle waiting logic using jiffy based timer APIs. Changes since v6: - Changed the 'timeout-ms' property name to 'bus-timeout-ms'. Changes since v5: - Changed using of property reading API to device_property_read_u32. Changes since v4: - Moved the property reading code into i2c-base-core and changed the property name to 'timeout-ms'. Also, added '#retries' property reading code. - Changed bus busy checking logic to make that check slave_state instead of 'Transfer Mode State Machine' reg value. Changes since v3: - Changed the property name to 'timeout' and made it use the default setting in i2c-core when not specified. Changes since v2: - Changed the property name to 'aspeed,timeout' and made it to update the adapter's timeout configuration. Changes since v1: - Changed define names of timeout related. Jae Hyun Yoo (5): dt-bindings: i2c: Add 'bus-timeout-ms' and '#retries' properties as common optional i2c: core: Add support reading of 'bus-timeout-ms' and '#retries' properties dt-bindings: i2c: aspeed: Add 'bus-timeout-ms' property as an optional property i2c: aspeed: Remove hard-coded bus timeout value setting i2c: aspeed: Add bus idle waiting logic for multi-master use cases .../devicetree/bindings/i2c/i2c-aspeed.txt | 3 ++ Documentation/devicetree/bindings/i2c/i2c.txt | 6 +++ drivers/i2c/busses/i2c-aspeed.c | 53 +++++++++++++------ drivers/i2c/i2c-core-base.c | 12 ++++- 4 files changed, 56 insertions(+), 18 deletions(-) -- 2.19.1