Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp942442imm; Fri, 5 Oct 2018 14:46:02 -0700 (PDT) X-Google-Smtp-Source: ACcGV6223zULvB42GW37iYe71AqPFQg5Vfc8qOMIjp50SWfcWk5DPKgSSepW1S5Srh52Pr3/QoC8 X-Received: by 2002:a17:902:a58a:: with SMTP id az10-v6mr13307527plb.204.1538775962318; Fri, 05 Oct 2018 14:46:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538775962; cv=none; d=google.com; s=arc-20160816; b=xdz3+Evbx/TyFDi5w9fme/vmKYW0vuzjnKBfnuIIMflxsEsVTYI5M3o3MzgZPl7hQd //CrN4BtEUK9sLi/Is+oUsYVuqRdbHBzynuCY/OWFKQTYrtHXXJNn2xXq7eJJ6jtM6t0 XwZ6iL/MQ2Ze2enJX9Jnmlx5C60rMS+ki2XU9sKw60KF6+VYY0JJlfdY0xmxrNTPWPB5 fIVXOApVBdNPmIexZdmJ45xcf4i+xXg0NMMFMoZc0OxWL2kDkF9f1OcjbnsbFKKA3myT D2uEn3254/Ye34UpYqpH5pTFazMUdvN2bbLY18XpjiVHH9KGA2psxjKfarSF+pzk2+yd O9eg== 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=jZnI5SQbVXe6HmHVoFiROKfYA7S2oviraJYclYS9i34=; b=kcExz/BaoLsmn59XB3rdS106jqCkHfdbYJLeLpdQ98Aud7mEeYQ116OqjSel3eLMSa qrFLWZoZSCqij+55/36WTk7YNLISdYYM1oawDSVMWqiAjEVH1OG4bqAnao6NZRVWkPtr 4Fp2s6+6kS18KoLcnP2CGPqhd+42UJJuKBHTzZDIaG0psyfaLyxkJI2bobKvU8bgodMg QdPLiaNrP/RtuVFkgXnSchHSntN6Z2vaUnDrUJhi4a6QWlyT8O5WYu8PLdh6ChO/lZt+ iRLa/hXOMnItsnq+gLBy7ZnfFeoOany8zkbOdeCiJd3rHdq5899p4lz4RgZx+pN9A9O4 L1AA== 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 q22-v6si9711656pgc.393.2018.10.05.14.45.46; Fri, 05 Oct 2018 14:46:02 -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 S1729197AbeJFEqE (ORCPT + 99 others); Sat, 6 Oct 2018 00:46:04 -0400 Received: from mga03.intel.com ([134.134.136.65]:29594 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729104AbeJFEp6 (ORCPT ); Sat, 6 Oct 2018 00:45:58 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Oct 2018 14:45:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,346,1534834800"; d="scan'208";a="75773026" Received: from maru.jf.intel.com ([10.54.51.77]) by fmsmga007.fm.intel.com with ESMTP; 05 Oct 2018 14:45:09 -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 v7 0/5] i2c: aspeed: Add bus idle waiting logic for multi-master use cases Date: Fri, 5 Oct 2018 14:45:02 -0700 Message-Id: <20181005214507.26315-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 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 | 54 +++++++++++++------ drivers/i2c/i2c-core-base.c | 12 ++++- 4 files changed, 57 insertions(+), 18 deletions(-) -- 2.19.0