Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1440438imm; Thu, 4 Oct 2018 13:44:42 -0700 (PDT) X-Google-Smtp-Source: ACcGV62ZL7KEYvIHYgtUJMtsVm8IYJjlfk9m0yWqfDRhrE/2cA8cFpyQeC9ao2hLMkF2Eq6lcF0a X-Received: by 2002:a17:902:9893:: with SMTP id s19-v6mr8273120plp.130.1538685882378; Thu, 04 Oct 2018 13:44:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538685882; cv=none; d=google.com; s=arc-20160816; b=F6TZ9ZwsTSQxg18yZEPc27kt93XFZZxYi5sZy/AjDvYTOGRpVsqxW+YqGhrbrWrt0r Uu3IlIh0eWNOqMW3VRtXw0d4wvyHrF9A0JAusnL2DR7n2TKLXZg/vcxn6dI/s0vHiCzf K1U6jHbA1Xvn5ctNY/u8wUSX7xSjJ0C9sF0Qokwsrz9RUZDSuu+k8/FXDpYaf0pOnA3c LVOHnHxG/IISz9ET9eWMc0mowWVnM0GIw7hcMLWtv4BEm9D6xRZWlIG/j6b7Vwfihknj wwwfjBMl1Xy9BBKuNRnWEA7r1sb+dMEpMm0J/0IbUJ/RAC/3E1xrWPT3ga3t4zd7/TFv TKEw== 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=bzIJkDRFUfPolQQlhH30GNNGPStCdMqbf3r1iL3HoCY=; b=AQoWts2YmjDBsyKQ93QZbJPgM7BsIdlolgV7/+eVg4orSFt/NwtjZuzyxKaqQabR0C zUb0G5tYD0n6atpVzN4B9zAB4dIoytPjJ6dCymy8OWlCBcO8ttQEcIUe3gePT04xuvCS HWhcotJA+y9ZMYpEs+L85a7RZJBgJVMOUU9sHl/SXo1b0PN2aKYSOoFEYN5G7onMEUE5 ZohBcoNKwKPlNBdPnU9m0lXUr8VumiY1yMNT/HG6A/Me+CVGgN5exNQopx9Mxea9iVoW uU4Cgh8B0Ma9qklpI7u1PbRpFFW/E/LVTQj3Gk4Gf4phTt2X6Sqgob1MBGjL6vAj9PKo vaoA== 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 a11-v6si5732396plp.225.2018.10.04.13.44.27; Thu, 04 Oct 2018 13:44:42 -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 S1728072AbeJEDil (ORCPT + 99 others); Thu, 4 Oct 2018 23:38:41 -0400 Received: from mga02.intel.com ([134.134.136.20]:49781 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727642AbeJEDik (ORCPT ); Thu, 4 Oct 2018 23:38:40 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Oct 2018 13:43:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,341,1534834800"; d="scan'208";a="92294995" Received: from maru.jf.intel.com ([10.54.51.77]) by fmsmga002.fm.intel.com with ESMTP; 04 Oct 2018 13:43:24 -0700 From: Jae Hyun Yoo To: Brendan Higgins , Wolfram Sang , Benjamin Herrenschmidt , Joel Stanley , Rob Herring , 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 v6 0/5] i2c: aspeed: Add bus idle waiting logic for multi-master use cases Date: Thu, 4 Oct 2018 13:43:17 -0700 Message-Id: <20181004204322.20665-1-jae.hyun.yoo@linux.intel.com> X-Mailer: git-send-email 2.19.0 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 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 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 'timeout-ms' and '#retries' properties as common optional i2c: Add support reading of 'timeout-ms' and '#retries' properties dt-bindings: i2c: aspeed: Add '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 | 54 +++++++++++++------ drivers/i2c/i2c-core-base.c | 10 +++- 4 files changed, 55 insertions(+), 18 deletions(-) -- 2.19.0