From patchwork Thu Feb 1 04:46:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aahil Awatramani X-Patchwork-Id: 1893781 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20230601 header.b=MtSY0Pj/; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=139.178.88.99; helo=sv.mirrors.kernel.org; envelope-from=linux-i2c+bounces-1567-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TQRG92qpLz23gx for ; Thu, 1 Feb 2024 15:47:13 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id D61CF286240 for ; Thu, 1 Feb 2024 04:47:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 273F83CF5D; Thu, 1 Feb 2024 04:46:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="MtSY0Pj/" X-Original-To: linux-i2c@vger.kernel.org Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E8773CF59 for ; Thu, 1 Feb 2024 04:46:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706762807; cv=none; b=l/9yhFIgCN6THb8VQs2Jdg3mrX7KjzddJmAc+1Gw0dmcMahnu2AEX2NHya2jR4sK7hH0q+0d1XWC4fuiof/29nXRY48U17gN+BGWeRCZJWLonUIeroeKBk0biK2O6r58kpgRpVaL/+gfUBiOtxX5EAPtLlS3G27cKPUrsKmfkQc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706762807; c=relaxed/simple; bh=4VGGGcaYk35HxXgdSmdu935kGFSoAd32AIvMtmVqZPQ=; h=Date:Mime-Version:Message-ID:Subject:From:To:Content-Type; b=MGZADbCS1bW7K5jBbwQ46siHlfCcA0NAOFofRWBm0MoFKmg6yDv6UDsxT25eRUvg+YmyFK7H7prrFuvsJz5zVNcVBAbsvcPwX+V3/qpYlmqSqh5Ikufd2lx9yc65MOZLv87ZhWkV9sxjcleF5+Im+TNRL6vUGy9g1nW9BgWGipE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aahila.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=MtSY0Pj/; arc=none smtp.client-ip=209.85.215.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aahila.bounces.google.com Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-5d8bff2b792so594805a12.1 for ; Wed, 31 Jan 2024 20:46:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706762805; x=1707367605; darn=vger.kernel.org; h=to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=uYSo7dLHiN39LMct+TvOkaek+OHlhRLiZBJ+JHrrHE0=; b=MtSY0Pj/cyrsCH8V6NyW1kLO7ySRKjHc0+PYyqlrfa3mmN4mkUPx8Gsn9OutO007t+ Rmxg1nesn9bkf5/O2Zn8/gWqYKmqel1mWZvD/Xn5iNeHtAz2bD5TicAYAXBXMKpYrnyg z1IEcHUH5hvlCv0c/W7en6F8ktGwJAjpqaNZQMbhz7cxDLI1L58+boETjp76buNcqoNN dwd2+0y1ya7F6UQHncWBpY0P4csOZmCHzRlGWdD9Anno/YCi8rNzM9AjvShzVIFZH5dz 4LVlljbCzZPQj2zC5ypFH4FqjKkmW+x7G2vEj9OPllsxAHkQTbdqX2bNNf4L7BMUEk7q aIJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706762805; x=1707367605; h=to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=uYSo7dLHiN39LMct+TvOkaek+OHlhRLiZBJ+JHrrHE0=; b=PXAD20+KlLkKao3jHPKzyT9Ql0+DZKXjm/XeHRPH4ZMBI9Cvv6JR2hxqLJwFEFJcky 0l3rP1xEozQSCaZ6872h4FFs5txtAJRaPbZop0Z71k0J5q7rNyeSPZ05mrpI21B8n79d fq9Fp71q/yUGB26uiobrQoGOc1/VCGmqqHpTRipLhHPIySjyCAqUrCSWAGb8J2yhdHLQ 1m7zjtycOE3kojwd36lef2IG+cfuhtXhLcUD27AIEfDdNkQ9f+cRy6wQEbHHxszl8dJN uBoqMmggwNQyk38T4HY26aD6fK5G6iNrNQ5YdnncmQOuiWI1r4YoSPP64nVgy7ul64Ll hrGQ== X-Gm-Message-State: AOJu0Yz+XFl1JgKK5/Y6G0ZBohu7NChYxwgxuD746KFSa32E1NTrDC5W B+R8vmGia0WZ6M37mW2PpOb68Q3kLEXAv+eSLi2Sb6SrdGm+/COkfcPzieITnd22vW/Vr4YwT2O Htw== X-Google-Smtp-Source: AGHT+IH1mpGNqqs+VrlIIPUSdBXJXXj54xNBJG7viPKa5/ZRAaOUdYVX8hyYK8Eb2TKfEfxpyqG2TrgIDQI= X-Received: from aahila.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2f3]) (user=aahila job=sendgmr) by 2002:a65:6115:0:b0:5d4:e18a:1e5 with SMTP id z21-20020a656115000000b005d4e18a01e5mr88518pgu.5.1706762805440; Wed, 31 Jan 2024 20:46:45 -0800 (PST) Date: Thu, 1 Feb 2024 04:46:22 +0000 Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog Message-ID: <20240201044623.374389-1-aahila@google.com> Subject: [PATCH 1/2] dt-bindings: i2c: designware: allow fine tuning tuning waveform from device tree From: Aahil Awatramani To: Aahil Awatramani , David Dillow , Wolfram Sang , Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jarkko Nikula , Andy Shevchenko , Mika Westerberg , Jan Dabros , linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org The Synopsys i2c driver allows a user to override the parameters controlling the waveform using ACPI; this is useful for fine tuning when needed to make spec compliance. Extend this support to the device tree to allow non-ACPI platforms the same capabilities. Signed-off-by: Aahil Awatramani --- Documentation/devicetree/bindings/i2c/i2c.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Documentation/devicetree/bindings/i2c/i2c.txt b/Documentation/devicetree/bindings/i2c/i2c.txt index fc3dd7ec0445..3c33c36571f9 100644 --- a/Documentation/devicetree/bindings/i2c/i2c.txt +++ b/Documentation/devicetree/bindings/i2c/i2c.txt @@ -45,6 +45,24 @@ wants to support one of the below features, it should adapt these bindings. Number of nanoseconds the SCL signal takes to rise; t(r) in the I2C specification. +- i2c-scl-ss-hcnt + HCNT value for standard speed mode in I2C Controller. + +- i2c-scl-ss-lcnt + LCNT value for standard speed mode in I2C Controller. + +- i2c-scl-fs-hcnt + HCNT value for fast speed mode in I2C Controller. + +- i2c-scl-fs-lcnt + LCNT value for fast speed mode in I2C Controller. + +- i2c-scl-hs-hcnt + HCNT value for high speed mode in I2C Controller. + +- i2c-scl-hs-lcnt + LCNT value for high speed mode in I2C Controller. + - i2c-sda-falling-time-ns Number of nanoseconds the SDA signal takes to fall; t(f) in the I2C specification. From patchwork Thu Feb 1 04:46:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aahil Awatramani X-Patchwork-Id: 1893783 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20230601 header.b=N8kvZ/ir; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; envelope-from=linux-i2c+bounces-1568-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [IPv6:2604:1380:45d1:ec00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TQRGT0MVwz23g7 for ; Thu, 1 Feb 2024 15:47:29 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 221621C24CA0 for ; Thu, 1 Feb 2024 04:47:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0069C3D3A7; Thu, 1 Feb 2024 04:46:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="N8kvZ/ir" X-Original-To: linux-i2c@vger.kernel.org Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1144A3CF6D for ; Thu, 1 Feb 2024 04:46:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706762811; cv=none; b=ilgRxnoyisxr/sMhgbWf7ElB3jSqytCpTsGaQSTnaueWHActVhGjKpPVsrgdEFaNETb/6gLzRkoKKAXGefhM41ZUV3msSPA9vOQMeKziuOUaNIU80kcaTOuNwp8sad5BcRDRlGPbEZYt2VD20NnBsaPOXQLE+Y9BJX7aG7jn6BY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706762811; c=relaxed/simple; bh=Twt8VpGAnLnDknK+2mkdxRc9XEHSq6p2WMav1kEzpAw=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=tkQbSBPv4JgLO/NnhIWq5bwR0Uau3IZb9l5QGQuy+qZkbeOHYyZ8UZMCr4wh1WHJ1u+Sx7fq10iAZSTL792Fo7DEH6XGz5N3zXR87I6T4Lr33MEa44/xdRNFz261l//MEqM8yVeQJEigGzEX/c64AUqwPHT3Axtr0+33TadcwW8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aahila.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=N8kvZ/ir; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aahila.bounces.google.com Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-5efe82b835fso10890997b3.0 for ; Wed, 31 Jan 2024 20:46:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706762809; x=1707367609; darn=vger.kernel.org; h=to:from:subject:message-id:references:mime-version:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=8c691bs4raW5tl1fD8/M9N6DqO7UPyEHeitm4Vwh450=; b=N8kvZ/irzYvcuRYBw0Ut78xk7XwlNAtgF9N5BGOaTXIjxMZre/TZb/nyjnvb504t0P aeBELdHdqmSd10ai3mPQ2E/YoACMofobbkxoQQCHFUuV15LHlzqHhjh/ihB0HQwCS/fG D5aMjpE8EA7c5zpsepMW/nT+KS54+YoaVRXDNHNYi2FWBHCFyf0Swu01tYZmXdZBp87y D09pf+yqRVhcyO2jX6YvRC+nPLaV2mCBxvt00qs+n1DhwI2uW+HqSksFHL8dDEHHo3tD iiO/nRI4VkplJJ69tUGaeoC/Y9aXf9+ksQR4DakdR0IF7sYxE4Pg8/76SrMedq1zROyJ zdSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706762809; x=1707367609; h=to:from:subject:message-id:references:mime-version:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8c691bs4raW5tl1fD8/M9N6DqO7UPyEHeitm4Vwh450=; b=pQVclR7F1kpWyQp9WcBDQ2Vj9GdsJWStOBU7Y6iQghbHqClFliHwjC4TobBqv76+lF GLB8rujr2+jNLjogTIeIkGNjwyajsU3TC56OyvhbEh3kutfiZV4aKRuWCjqXHNdhnNL7 4zPT58DxAinb1Al4fEXIGTPKeb0kJYQAVC7Sk1m/lJIZagl8yql5flCva26I+F9FIA8R Z4alWkPRFaOVFoQKrWM3mH/zfJLRss3QDmG//NgYjdtxONbC26ufOjoRQeBb5qYfXUHf 79/ZVYFwjvYfk5wNx+IXl4mDPUY1Os51LUfiiLsDvfftgHkP7lLDBcKboCIpdgE6Bxaj xYUA== X-Gm-Message-State: AOJu0YzK+RMTUXesXYzMri2hAkg+DfX34a6+bgtO5/Ppe6KGUv4jVmqZ JMGRQF4+evJUyjvajS9wSLAptruYpwG0JyoRQ1sRYYMXrZ1y8lZp52/uhcEmpNrXJkcG7J2ycqx uCA== X-Google-Smtp-Source: AGHT+IGCqkf4S6bQM1K/unGBkakUD903fQKJFzDx/PsI7m/ghEanV+fd8QwhKiXNvUcW/cWgJucE/HbyIpE= X-Received: from aahila.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2f3]) (user=aahila job=sendgmr) by 2002:a05:690c:f85:b0:5ff:9eb1:29a6 with SMTP id df5-20020a05690c0f8500b005ff9eb129a6mr796091ywb.2.1706762809133; Wed, 31 Jan 2024 20:46:49 -0800 (PST) Date: Thu, 1 Feb 2024 04:46:23 +0000 In-Reply-To: <20240201044623.374389-1-aahila@google.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240201044623.374389-1-aahila@google.com> X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog Message-ID: <20240201044623.374389-2-aahila@google.com> Subject: [PATCH 2/2] i2c: designware: allow fine tuning tuning waveform from device tree From: Aahil Awatramani To: Aahil Awatramani , David Dillow , Wolfram Sang , Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jarkko Nikula , Andy Shevchenko , Mika Westerberg , Jan Dabros , linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org The Synopsys i2c driver allows a user to override the parameters controlling the waveform using ACPI; this is useful for fine tuning when needed to make spec compliance. Extend this support to the device tree to allow non-ACPI platforms the same capabilities. Signed-off-by: Aahil Awatramani --- drivers/i2c/busses/i2c-designware-platdrv.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index 855b698e99c0..09c464874fdb 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -132,6 +132,17 @@ static int mscc_twi_set_sda_hold_time(struct dw_i2c_dev *dev) return 0; } +static void i2c_parse_cnt(struct device *dev, char *prop_name, u16 *cnt) +{ + u32 tmp_cnt; + int ret; + + ret = device_property_read_u32(dev, prop_name, &tmp_cnt); + if (ret) + return; + *cnt = tmp_cnt; +} + static int dw_i2c_of_configure(struct platform_device *pdev) { struct dw_i2c_dev *dev = platform_get_drvdata(pdev); @@ -146,6 +157,15 @@ static int dw_i2c_of_configure(struct platform_device *pdev) break; } + i2c_parse_cnt(&pdev->dev, "i2c-scl-ss-hcnt", &dev->ss_hcnt); + i2c_parse_cnt(&pdev->dev, "i2c-scl-ss-lcnt", &dev->ss_lcnt); + i2c_parse_cnt(&pdev->dev, "i2c-scl-fs-hcnt", &dev->fs_hcnt); + i2c_parse_cnt(&pdev->dev, "i2c-scl-fs-lcnt", &dev->fs_lcnt); + i2c_parse_cnt(&pdev->dev, "i2c-scl-fp-hcnt", &dev->fp_hcnt); + i2c_parse_cnt(&pdev->dev, "i2c-scl-fp-lcnt", &dev->fp_lcnt); + i2c_parse_cnt(&pdev->dev, "i2c-scl-hs-hcnt", &dev->hs_hcnt); + i2c_parse_cnt(&pdev->dev, "i2c-scl-hs-lcnt", &dev->hs_lcnt); + return 0; }