From patchwork Thu Feb 29 18:10:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Th=C3=A9o_Lebrun?= X-Patchwork-Id: 208466 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp587222dyb; Thu, 29 Feb 2024 10:13:20 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXWV+94V4lLALVgjdgPKCbWL9I2cxEom8UeNPrrDc+Z6EdeyXD8xdVpe+damVH6Lacs02CgBIQHfEmYJQZ5cOKp6IOMSQ== X-Google-Smtp-Source: AGHT+IEnkht4ZiCHDNiF3DQT1+gs6y/2+Z7PcGk63KO0H3Y0Y0UJAzU6I/yibfvWkpUmXoSuwIhI X-Received: by 2002:a17:902:f54f:b0:1dc:c0c8:6bfa with SMTP id h15-20020a170902f54f00b001dcc0c86bfamr3118078plf.17.1709230400261; Thu, 29 Feb 2024 10:13:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709230400; cv=pass; d=google.com; s=arc-20160816; b=GnqIu0GEnXAITyNW7C1vbvDAzbf7O02DJqMF1M1LpgM1taX+N6jmd7UH23jU+VwfUo pcfpu5oUfQGZjahsn+bkkgEIMHcBG6hCeMf5Dll39TkuI2TeW4C/gedVyInnFI3kCg5q Fnjm4Xvdzpq5+Om8ueYPRqPcp0Ujt5Rs9SH5gWvVaP5C8d5epm3r8925umC9cQqTzRpX 3M5RBYU2kGIwpgsqixU05xd2+tslNBqkbvOC1W52DTkJwpRD5A+7kN/ILA3CS8LibY6v I4QR1p9Dty9eg5a7lBShycKjn+JCCuX/ADquYFPzJfVP/mXnBuwy1PRFgQZqNTa0G3De 2pgQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=2KjP0tKD670ot1mY6zPPbSUpgJRRflTSHBgbfRubJdc=; fh=5JSnMO1qLgeVtLVJilSQcFnAcZn2MWLSM3RnsAdOnEU=; b=rmUmJdGGpueC1kZcFd8YqEGXtfD1YMqArJ3eUS8B9UeGckU9SDNAdDgnbtaWstbtxd fysRKqFi/d5VvrgWg5444A2KejjeF4PZCpjbbPSIXR5n0mK0gktiQy1u5SlGjK3m47Jv QYXUzzpCLdkglxaZ9AWgEN1BIVJLrUw1siwuVCEYVAfcOyc7os66Nx29/T7vDxHkwdnh dw+kQA7wYieE8fQH6ssg0sUUWVPhIez6aUORBlSVxbndoDza7wgWhl3vaal+Cx+CwzSq nw+0k552aEV3JrnSzAHmdgPNgjqsK85uclr4rlQO+J2esxZnptQt6vj/8ENnz1v9YWVe Feuw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=OO3hwQ08; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-87249-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87249-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id z12-20020a170902cccc00b001dca5f9b4e4si1823683ple.100.2024.02.29.10.13.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 10:13:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-87249-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=OO3hwQ08; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-87249-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87249-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com 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 14FFA285E4F for ; Thu, 29 Feb 2024 18:13:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1CEB91428EA; Thu, 29 Feb 2024 18:11:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="OO3hwQ08" Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D3DBB7E10E; Thu, 29 Feb 2024 18:10:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709230262; cv=none; b=Mqty2sO5Z3/13+hVl/hpTzTCvyRNw7G4WpwvmBZaQdG8L6isdltFiVnPCW40xto7A79fIoushh3AGBbJgoSEMrt6rXKwNor4Xodl70IVvFN0PihyoKQ4Ieb1IG36QMt1nhfKl5/TI1UN7bYqQ5WQ/BIT4VI6l+88CujFX3YfJ7Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709230262; c=relaxed/simple; bh=h+SPw0GdFvm0QNkB7z2Z691z87obygwWxn7jzpzmhYE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=s6GYxf/+tIpMx8LtjkEHF1sPCGTd3x2l6iSJ7uzKQtBMuPREncibin5WBJEvz33D2lZRlMqKdC6nHkxii/Smdt+CUmZ9tdvoZTwn7rlI7uOh559ADBm76tSOA4QQuYFnQWYYcAWF8tfxcug8TN89MigNfAvZWz9nkngJcHPze0M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=OO3hwQ08; arc=none smtp.client-ip=217.70.183.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id C8B9D6000D; Thu, 29 Feb 2024 18:10:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709230258; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2KjP0tKD670ot1mY6zPPbSUpgJRRflTSHBgbfRubJdc=; b=OO3hwQ08HWAyapA/2XepbuagNM2zP1pxIlO8mrWqHd+LCRlzIUf0wbHfUQiX/H8vMQEJbM jiK4GuNALRnuV0HyyIj8DO298cKZV8OkaW+qpDWKncMDYFKX7sR6YxzcbOV3KDyBveLnRK OKpQ4huodC9QD68KyaUEAStQHGeJVkaThwKPZ8M6PQqNJOYTL4WEROfJ5wS7fr+npsb4i4 WHpe34vjgsngwacZrHY97OA8fz84MzK3GSdQY4PVImxhLpQSZ2KkKNjo9FnZB1SGCKsGJL kjQkFVkI2ya/cdaCZZEb70771Z8cTZznf1gL2fslCYnSxwzXduerUHyUZiPp2w== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Thu, 29 Feb 2024 19:10:56 +0100 Subject: [PATCH v2 08/11] i2c: nomadik: fetch i2c-transfer-timeout-us property from devicetree Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240229-mbly-i2c-v2-8-b32ed18c098c@bootlin.com> References: <20240229-mbly-i2c-v2-0-b32ed18c098c@bootlin.com> In-Reply-To: <20240229-mbly-i2c-v2-0-b32ed18c098c@bootlin.com> To: Linus Walleij , Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Thomas Bogendoerfer Cc: linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, Gregory Clement , Vladimir Kondratiev , Thomas Petazzoni , Tawfik Bayouk , =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.13.0 X-GND-Sasl: theo.lebrun@bootlin.com X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792257976186073696 X-GMAIL-MSGID: 1792257976186073696 Allow overriding the default timeout value (200ms) from devicetree, using the generic i2c-transfer-timeout-us property. The i2c_adapter->timeout field is an unaccurate jiffies amount; i2c-nomadik uses hrtimers for timeouts below one jiffy. Signed-off-by: Théo Lebrun Reviewed-by: Linus Walleij Reviewed-by: Wolfram Sang Reviewed-by: Andi Shyti --- drivers/i2c/busses/i2c-nomadik.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c index afd54999bbbb..2d3247979e45 100644 --- a/drivers/i2c/busses/i2c-nomadik.c +++ b/drivers/i2c/busses/i2c-nomadik.c @@ -964,6 +964,8 @@ static const struct i2c_algorithm nmk_i2c_algo = { static void nmk_i2c_of_probe(struct device_node *np, struct nmk_i2c_dev *priv) { + u32 timeout_usecs; + /* Default to 100 kHz if no frequency is given in the node */ if (of_property_read_u32(np, "clock-frequency", &priv->clk_freq)) priv->clk_freq = I2C_MAX_STANDARD_MODE_FREQ; @@ -975,7 +977,12 @@ static void nmk_i2c_of_probe(struct device_node *np, priv->sm = I2C_FREQ_MODE_FAST; priv->tft = 1; /* Tx FIFO threshold */ priv->rft = 8; /* Rx FIFO threshold */ - priv->timeout_usecs = 200 * USEC_PER_MSEC; /* Slave response timeout */ + + /* Slave response timeout */ + if (!of_property_read_u32(np, "i2c-transfer-timeout-us", &timeout_usecs)) + priv->timeout_usecs = timeout_usecs; + else + priv->timeout_usecs = 200 * USEC_PER_MSEC; } static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id)