From patchwork Wed Aug 7 10:02:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyrone Ting X-Patchwork-Id: 817779 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (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 77C531D1F51; Wed, 7 Aug 2024 10:03:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723025013; cv=none; b=FdYG8mnNC/LJCf9rL9inZ8wQAecY5tmN5gsPxUGX2x50Cr41tQRjrsFbrQnVrbrL2innYbfg881StfaCLQVRLqzRfoXkLFENnSXzbyhq79ckq8Jf16L/1/WLbFYVOOL5ZERzTHZlg4CAl+UEPlOtyx/vi/IPz3fS7CXg/fTnui4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723025013; c=relaxed/simple; bh=wBHnpnXQR2YnVe3Z3Xy1CQXht+Ilg8+LY704lrvFnm0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=aEoYZkjae6QzTl2Ucz0JrD+h2ASy67V5mQaKPyDxkQsCN7yJx+9meRTtt3SR2JDxQ0OvjJuqB9uxBqBa96xYK1vDXzYGbJXcC+QkMc53Z2EF1BWHzb/IUnP1+ra4PeNptrkcwxCY2w09/7pbDiHSViQ15mOVvACnh7blWnHYPn0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=GW/B0Qbp; arc=none smtp.client-ip=209.85.214.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GW/B0Qbp" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1fb3b7d0d56so10523025ad.1; Wed, 07 Aug 2024 03:03:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723025011; x=1723629811; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=CC5pNBBwbHzuFRI5vRop3kEGSaPPEJAGbytrwhnEs/A=; b=GW/B0QbpqN9WhgTewoKg62Z3PvaRlcvKfMguNHU+WMnISbsa189BVBfgZuDmTnwBMB wNJng5NF1JElrpZg9VlS+Z+tlVf7cAO/wbkYmG8IlIabxV4dMvfD/5i9+tDrqzV7XSfi iJd6EzelSKZ79CQki4NOjSn3J4SHPqMeg6QqzSp5dUvV1XZx/BD+yR0ODY57xfcdalzm s9iZAXcyl8cRIACkeInU/FXkesAPMDr01qs0mLXmEvecTNXbZ+POfZXuGk+ctKwGuYay MiT2zZiiDBASh6c5NXsavb7o5/w2N0FxoLOwIdb9bv8jwI5fgUI0AV+0C0CGLQUWd2ej WzDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723025011; x=1723629811; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CC5pNBBwbHzuFRI5vRop3kEGSaPPEJAGbytrwhnEs/A=; b=qVWtDUhS6SqKPJQ7NpCNIozNQJWsGAIVJ89ct8cbJO0AyK8D/Hiw2xHZ0IFITFVm8h 6nA/kEZ4nuPZQP/Ksu9m8Sv3sap7VGVhaw/Iz2z1dcaioJA8aFiKNhp8uBhYG8ogiwV1 cm6syJS+7CrtU4nY23LRj2MrUNMvoHtasIiNOReD9rDI1Ps6XKgE9bg5TbwFqRAzmnPw 2WJWQfrcV4sexA0KYXcTWKTSnaSNXYgnbkHiIBMczRAdAAcVLxeMrXJ+FR3kX/t16iZZ EaAP4G6sdebhxB1t67jjcEU9arghILk1eMt+ZEgG23dol/34FtQZA+Gcb3WysPVP6JuH 5UMQ== X-Forwarded-Encrypted: i=1; AJvYcCV77OkxPnGTmCjLPXlIHkBnxQ6+zCeSZZIRldONn74IHrYMGxaLh73xe47o7ZZlCOgkctgU9XrFKJQwkJ3Z/gJDhUaj2UXB84LxPi9z X-Gm-Message-State: AOJu0YwSIw/i/y3atHRuewxA6vOEom7etuTMfaGP04hiMbVY92qjEjwx Kh7NlOAUHnLihrSvFKypeCmS+TuEieosx0A0Q4+ESkEn7togtzc= X-Google-Smtp-Source: AGHT+IGaljIfOINvp35rTl5T4iijxPSBPWtVHz2ZOvAehR7Vkfor0vpEheNeOShza8gm7JoO5jsENQ== X-Received: by 2002:a17:902:ce10:b0:1fb:3b89:b11d with SMTP id d9443c01a7336-1ff57257f43mr185632175ad.4.1723025010560; Wed, 07 Aug 2024 03:03:30 -0700 (PDT) Received: from localhost (2001-b400-e352-b705-880f-4661-e7a1-4abb.emome-ip6.hinet.net. [2001:b400:e352:b705:880f:4661:e7a1:4abb]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ff59059f6dsm102022675ad.132.2024.08.07.03.03.29 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 07 Aug 2024 03:03:29 -0700 (PDT) From: warp5tw@gmail.com X-Google-Original-From: kfting@nuvoton.com To: tali.perry@nuvoton.com, Avi.Fishman@nuvoton.com, tomer.maimon@nuvoton.com, avifishman70@gmail.com, tmaimon77@gmail.com, tali.perry1@gmail.com, venture@google.com, yuenn@google.com, benjaminfair@google.com, andi.shyti@kernel.org, wsa+renesas@sang-engineering.com, rand.sec96@gmail.com, kwliu@nuvoton.com, jjliu0@nuvoton.com, kfting@nuvoton.com, warp5tw@gmail.com Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org Subject: [PATCH v1 1/7] i2c: npcm: correct the read/write operation procedure Date: Wed, 7 Aug 2024 18:02:38 +0800 Message-Id: <20240807100244.16872-2-kfting@nuvoton.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240807100244.16872-1-kfting@nuvoton.com> References: <20240807100244.16872-1-kfting@nuvoton.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Tyrone Ting Originally the driver uses the XMIT bit in SMBnST register to decide the upcoming i2c transaction. If XMIT bit is 1, then it will be an i2c write operation. If it's 0, then a read operation will be executed. After checking the datasheet, the XMIT bit is valid when the i2c module is acting in a slave role. Use the software status to control the i2c transaction flow instead when the i2c module is acting in a master role. Fixes: 48acf8292280 ("i2c: Remove redundant comparison in npcm_i2c_reg_slave") Signed-off-by: Tyrone Ting --- drivers/i2c/busses/i2c-npcm7xx.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c index 2fe68615942e..c8503acdaff8 100644 --- a/drivers/i2c/busses/i2c-npcm7xx.c +++ b/drivers/i2c/busses/i2c-npcm7xx.c @@ -1626,13 +1626,10 @@ static void npcm_i2c_irq_handle_sda(struct npcm_i2c *bus, u8 i2cst) npcm_i2c_wr_byte(bus, bus->dest_addr | BIT(0)); /* SDA interrupt, after start\restart */ } else { - if (NPCM_I2CST_XMIT & i2cst) { - bus->operation = I2C_WRITE_OPER; + if (bus->operation == I2C_WRITE_OPER) npcm_i2c_irq_master_handler_write(bus); - } else { - bus->operation = I2C_READ_OPER; + else if (bus->operation == I2C_READ_OPER) npcm_i2c_irq_master_handler_read(bus); - } } } From patchwork Wed Aug 7 10:02:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyrone Ting X-Patchwork-Id: 817778 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (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 BE6CA1D1738; Wed, 7 Aug 2024 10:03:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723025022; cv=none; b=XYeY0k5i3PJ7UhyWBR8d1uvGrb2GPWWxlA4iJLgqtdTkAUpfbvSlSw6tjd8xRWMkSvsmHoqYMzJYn7cznvxzij76AG7fBVLhqjw87dT9+6IqOw7L4GUvykDhiNrLquaxLpKGbhSeYLzIvF4ND/3gnwz7nVZI8MET8SNoaffQAB8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723025022; c=relaxed/simple; bh=pZxnysnWKRpNTQwY7+U2EXm4FHifuk92eXMm13+bTF4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=UCiXy6nny1kxi15iY9nml9L3gm17Q8ZYvG+mFlezrfyEQ2mmYgwcKOE8opgUxF5yhGfhptI5r/QLCcDAWYtPVX97Ay5fPrGkpFD7ZDBRXg0lRcM+1byBfV5wsCoeVFnvkwtzIIz1diTw4cxrXuWdSdy90wldDdDiqqnG6eH4P8c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kkJ/nDJM; arc=none smtp.client-ip=209.85.214.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kkJ/nDJM" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1fda7fa60a9so14116615ad.3; Wed, 07 Aug 2024 03:03:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723025020; x=1723629820; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=L6yyg1kIMG7SVeWDWABjZdm83++6QaBLVs76T+TLdz8=; b=kkJ/nDJM4tt+2sCbe7feM+h9s6AymkRXYZDKvtsa0rd7WjVb/Db9DAh2AvLbiEyHmP kNgnLiTgFJkXsHM3Mw8K+1gvPKhFikzDbg1vXtzpK0/UN8wv5d/bKxZ6cyenB08F1mUV ZRMxnUg9895d7gsptS6juRFOcli59ZrAPgJFBWBUApmJZqXj0LqG5whxXlndF205mq/C 29LS3B44DDopmOeRo3LAoqVDTXtz2KKbr+jMbi+LOm3gUFuSfbRcV10wxjxf9dvYDOv+ 97TnwLXUBBilMfgnp9bbfo6hvsV9dbQRdmIo2PZWLcMfrRx3Y93RrMu4pKTV5IZ1gNph tQ4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723025020; x=1723629820; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=L6yyg1kIMG7SVeWDWABjZdm83++6QaBLVs76T+TLdz8=; b=Ji6PesMdsF+yXC58x/X99aBuP/5CHyUuTPnZF5iCJlceYGaG+//dRUCgSJfo5+JOxp yeKTz1A0h3UnRdOg+rWUsHdtgyssrldn43JhGRxrsVOP05AhJmDXy0DU3vw2oZgqx9IM KOQs3Dbxv9LM+xtsa4lKUJWesMysMvCWEBUlj/4MM/r2EiBFEzVtEC5/RUHdmLttMtbr 7HZnfEaux8qW48wW8tqyNMvD7LdJu4pWFW+rrsN5C66lsAF3hKYev2QyLRSU9O4VW1eJ 472IGQj+nESaJLCaKBKvk83zoygs/KHLTzonyXsrnDs8RosN682sVEDR+MM9ruAoz5bo LS3A== X-Forwarded-Encrypted: i=1; AJvYcCUpZXHLULK8MarQ1j9/9qmwn7kGICo4IA6FAitPT+qJMb6vqbcYwr9Tgk9o8azufY0iLZJRNK5j93vfiklES9GtnelFsqgzjNGOVpXF X-Gm-Message-State: AOJu0YxioGXD+iYafLoaFtuQVwfxGouEEwPQOPbyPczEWTQkfNtuVffd kJFgA8O7R7u6o/0xpZH5QEgwI+sl1vsuo4a8pbzsffbkCcakMlY= X-Google-Smtp-Source: AGHT+IFE859a4z6aYQ+kKCDEwzwC899q7prVUXzLyaJijagUlplWhlLfQPtUbWQOx/7W4elpJ2Cpww== X-Received: by 2002:a17:902:dac1:b0:1fc:2ee3:d46f with SMTP id d9443c01a7336-1ff5725106amr236748365ad.11.1723025019906; Wed, 07 Aug 2024 03:03:39 -0700 (PDT) Received: from localhost (2001-b400-e352-b705-880f-4661-e7a1-4abb.emome-ip6.hinet.net. [2001:b400:e352:b705:880f:4661:e7a1:4abb]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ff591750fesm102297885ad.191.2024.08.07.03.03.38 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 07 Aug 2024 03:03:39 -0700 (PDT) From: warp5tw@gmail.com X-Google-Original-From: kfting@nuvoton.com To: tali.perry@nuvoton.com, Avi.Fishman@nuvoton.com, tomer.maimon@nuvoton.com, avifishman70@gmail.com, tmaimon77@gmail.com, tali.perry1@gmail.com, venture@google.com, yuenn@google.com, benjaminfair@google.com, andi.shyti@kernel.org, wsa+renesas@sang-engineering.com, rand.sec96@gmail.com, kwliu@nuvoton.com, jjliu0@nuvoton.com, kfting@nuvoton.com, warp5tw@gmail.com Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org Subject: [PATCH v1 3/7] i2c: npcm: Modify timeout evaluation mechanism Date: Wed, 7 Aug 2024 18:02:40 +0800 Message-Id: <20240807100244.16872-4-kfting@nuvoton.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240807100244.16872-1-kfting@nuvoton.com> References: <20240807100244.16872-1-kfting@nuvoton.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Tyrone Ting Increase the timeout and treat it as the total timeout, including retries. The total timeout is 2 seconds now. The i2c core layer will have chances to retry to call the i2c driver transfer function if the i2c driver reports that the bus is busy and returns EAGAIN. Fixes: 48acf8292280 ("i2c: Remove redundant comparison in npcm_i2c_reg_slave") Signed-off-by: Tyrone Ting --- drivers/i2c/busses/i2c-npcm7xx.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c index bd444ff83a8c..d115ac659900 100644 --- a/drivers/i2c/busses/i2c-npcm7xx.c +++ b/drivers/i2c/busses/i2c-npcm7xx.c @@ -2130,19 +2130,12 @@ static int npcm_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, } } - /* - * Adaptive TimeOut: estimated time in usec + 100% margin: - * 2: double the timeout for clock stretching case - * 9: bits per transaction (including the ack/nack) - */ - timeout_usec = (2 * 9 * USEC_PER_SEC / bus->bus_freq) * (2 + nread + nwrite); - timeout = max_t(unsigned long, bus->adap.timeout, usecs_to_jiffies(timeout_usec)); if (nwrite >= 32 * 1024 || nread >= 32 * 1024) { dev_err(bus->dev, "i2c%d buffer too big\n", bus->num); return -EINVAL; } - time_left = jiffies + timeout + 1; + time_left = jiffies + bus->adap.timeout / bus->adap.retries + 1; do { /* * we must clear slave address immediately when the bus is not @@ -2181,6 +2174,14 @@ static int npcm_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, if (npcm_i2c_master_start_xmit(bus, slave_addr, nwrite, nread, write_data, read_data, read_PEC, read_block)) { + /* + * Adaptive TimeOut: estimated time in usec + 100% margin: + * 2: double the timeout for clock stretching case + * 9: bits per transaction (including the ack/nack) + */ + timeout_usec = (2 * 9 * USEC_PER_SEC / bus->bus_freq) * (2 + nread + nwrite); + timeout = max_t(unsigned long, bus->adap.timeout / bus->adap.retries, + usecs_to_jiffies(timeout_usec)); time_left = wait_for_completion_timeout(&bus->cmd_complete, timeout); @@ -2306,7 +2307,7 @@ static int npcm_i2c_probe_bus(struct platform_device *pdev) adap = &bus->adap; adap->owner = THIS_MODULE; adap->retries = 3; - adap->timeout = msecs_to_jiffies(35); + adap->timeout = 2 * HZ; adap->algo = &npcm_i2c_algo; adap->quirks = &npcm_i2c_quirks; adap->algo_data = bus; From patchwork Wed Aug 7 10:02:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyrone Ting X-Patchwork-Id: 817777 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (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 08ED81D1750; Wed, 7 Aug 2024 10:03:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723025031; cv=none; b=Z7tNepK1dSrLKfHfuKNbt8E0UemyDpyznSqFZsmscYJCE0P2/jxnaFaZviuyhIQcyt/WjfYSK6TtSgny3DPbX98RKxB4c2Rv5HHVfL2uEXhzQKNZW++jvUCQAkPHXtEQZDSSrFr5CcIuQ/dP9nearrhKRcBTfISKjxoxKjbYctQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723025031; c=relaxed/simple; bh=S1IGGzEHrJfqBhf8C5t+KcthG0WEgCjfSb/8qWW8yCU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=ctZUoyEXPGuJOEc9A7DHlb407Om7l2fr62/SpteQ4aFWch1o3LGHo89PYFpM/g+Mbfgc2lWILQnIyyCM9krljPIpEpI6lOgpMISqaOhkTCIt8XNu30/oGEOrjDkg67AQqm8gO4P7RcVQTPt1LXr5DRfKz4TCaco3P1OBnnBTRmA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=R9luDvcx; arc=none smtp.client-ip=209.85.214.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="R9luDvcx" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1fd65aaac27so5156595ad.1; Wed, 07 Aug 2024 03:03:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723025029; x=1723629829; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=CcI+Jyhb9Q3IkK+/vK+3g+X4+pq3JUeN+lsGpBQ4Os8=; b=R9luDvcxCBzQmHg9cITFi4nGC4s3zpXEIBq4JbCjU4HLJL4/t1ZSdrV8c45u4sWeB+ 1rbxstfXa+c6JNxTD1dRO3Rc0lWM/BDy2gLWKJMMNGn/0gIynCH8CdxPtAVJrGnwsf88 SmHEG+5Qnm2pAoMB1Z6ClF4RC2vsLzV5pQ2yvfv0MrqKIpqeoMlUvsYtPvrq1ov4Sydk jWilCQimA/vAMnllJbDaN1+T5jTBMYfNtT0TW2W+3w2807dP0OyPnq4zfiE9tqwfpAs2 5oty5cxLFEIyl6xkUpMrLDwrR2WRE+lN+QuXqpcXYOnBbT0VPCFlt6grqIfRV3kOnN4n VY9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723025029; x=1723629829; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CcI+Jyhb9Q3IkK+/vK+3g+X4+pq3JUeN+lsGpBQ4Os8=; b=gyfmutfNWcGVmPamZP4mIj2MMTdJcq+MfU+jSZobNUBoVvgpN4iL+Bfc7gPfJd2mSr XgWwdOO40egLkr9yz2qMzP4FN3EqOz+cnlBrfOopqC7h3NyzK7Q8R1oDRmiwe3ozDV+C jR0MTdljO5QyTjpev5RsikK9vSH/OT+VagHZgnIAhHBYVHJ+1MGIF3PTHx+bI8NIDf6Z 9b/07n+19/PWAZTzgkxE7eky7MVRrgo5LrW+xKfbp8bEKavAH0eMt1T8nS69vbmgzzMX 7W3aEpZkv4kHaOYiSMCi2IUONRED2oJdyGPUrF0DhJykGvTHdcULkvFi7Gc6ZMTuX9F/ DA/A== X-Forwarded-Encrypted: i=1; AJvYcCVjsM0A9IPzdZXeqL7Vql4/6PVklQuIpC4U3BnPayXYcwIikXmxXRFmqiL/QBQbtH1DzSID0DXBudyfIMSJC9YlPB/kkKeuDsClOfFt X-Gm-Message-State: AOJu0Yx3/r1xEvrG2cDQkmTNqc7WDiywtChzNClTq7POK5BISyVeSgUk 4SiFerx7z2bvZu8TzR4Lts/xY2xVpvSkIIKVWXow6qfD4cki33A= X-Google-Smtp-Source: AGHT+IGwBLZOE7LcRRsdNndDg9PB4lB2xZzfrHQBg7GHeqM/R/h0JqOMG3zBCJOjXxbUAvn1c1Vjcw== X-Received: by 2002:a17:903:1c5:b0:1fd:96c7:24f5 with SMTP id d9443c01a7336-200853a437fmr27463705ad.5.1723025029152; Wed, 07 Aug 2024 03:03:49 -0700 (PDT) Received: from localhost (2001-b400-e352-b705-880f-4661-e7a1-4abb.emome-ip6.hinet.net. [2001:b400:e352:b705:880f:4661:e7a1:4abb]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ff5905b4ddsm102777315ad.173.2024.08.07.03.03.47 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 07 Aug 2024 03:03:48 -0700 (PDT) From: warp5tw@gmail.com X-Google-Original-From: kfting@nuvoton.com To: tali.perry@nuvoton.com, Avi.Fishman@nuvoton.com, tomer.maimon@nuvoton.com, avifishman70@gmail.com, tmaimon77@gmail.com, tali.perry1@gmail.com, venture@google.com, yuenn@google.com, benjaminfair@google.com, andi.shyti@kernel.org, wsa+renesas@sang-engineering.com, rand.sec96@gmail.com, kwliu@nuvoton.com, jjliu0@nuvoton.com, kfting@nuvoton.com, warp5tw@gmail.com Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org Subject: [PATCH v1 5/7] drivers: i2c: use i2c frequency table Date: Wed, 7 Aug 2024 18:02:42 +0800 Message-Id: <20240807100244.16872-6-kfting@nuvoton.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240807100244.16872-1-kfting@nuvoton.com> References: <20240807100244.16872-1-kfting@nuvoton.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Tyrone Ting Modify i2c frequency from table parameters for NPCM i2c modules. Supported frequencies are: 1. 100KHz 2. 400KHz 3. 1MHz Signed-off-by: Tyrone Ting --- drivers/i2c/busses/i2c-npcm7xx.c | 226 +++++++++++++++++++------------ 1 file changed, 143 insertions(+), 83 deletions(-) diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c index c6f72c0e3464..1537fb7baa8c 100644 --- a/drivers/i2c/busses/i2c-npcm7xx.c +++ b/drivers/i2c/busses/i2c-npcm7xx.c @@ -261,6 +261,121 @@ static const int npcm_i2caddr[I2C_NUM_OWN_ADDR] = { #define I2C_FREQ_MIN_HZ 10000 #define I2C_FREQ_MAX_HZ I2C_MAX_FAST_MODE_PLUS_FREQ +struct SMB_TIMING_T { + u32 core_clk; + u8 hldt; + u8 dbcnt; + u16 sclfrq; + u8 scllt; + u8 sclht; + bool fast_mode; +}; + +static struct SMB_TIMING_T SMB_TIMING_100KHZ[] = { + {.core_clk = 100000000, .hldt = 0x2A, .dbcnt = 0x4, .sclfrq = 0xFB, .scllt = 0x0, + .sclht = 0x0, .fast_mode = false }, + {.core_clk = 62500000, .hldt = 0x2A, .dbcnt = 0x1, .sclfrq = 0x9D, .scllt = 0x0, + .sclht = 0x0, .fast_mode = false }, + {.core_clk = 50000000, .hldt = 0x2A, .dbcnt = 0x1, .sclfrq = 0x7E, .scllt = 0x0, + .sclht = 0x0, .fast_mode = false }, + {.core_clk = 48000000, .hldt = 0x2A, .dbcnt = 0x1, .sclfrq = 0x79, .scllt = 0x0, + .sclht = 0x0, .fast_mode = false }, + {.core_clk = 40000000, .hldt = 0x2A, .dbcnt = 0x1, .sclfrq = 0x65, .scllt = 0x0, + .sclht = 0x0, .fast_mode = false }, + {.core_clk = 30000000, .hldt = 0x2A, .dbcnt = 0x1, .sclfrq = 0x4C, .scllt = 0x0, + .sclht = 0x0, .fast_mode = false }, + {.core_clk = 29000000, .hldt = 0x2A, .dbcnt = 0x1, .sclfrq = 0x49, .scllt = 0x0, + .sclht = 0x0, .fast_mode = false }, + {.core_clk = 26000000, .hldt = 0x2A, .dbcnt = 0x1, .sclfrq = 0x42, .scllt = 0x0, + .sclht = 0x0, .fast_mode = false }, + {.core_clk = 25000000, .hldt = 0x2A, .dbcnt = 0x1, .sclfrq = 0x3F, .scllt = 0x0, + .sclht = 0x0, .fast_mode = false }, + {.core_clk = 24000000, .hldt = 0x2A, .dbcnt = 0x1, .sclfrq = 0x3D, .scllt = 0x0, + .sclht = 0x0, .fast_mode = false }, + {.core_clk = 20000000, .hldt = 0x2A, .dbcnt = 0x1, .sclfrq = 0x33, .scllt = 0x0, + .sclht = 0x0, .fast_mode = false }, + {.core_clk = 16180000, .hldt = 0x2A, .dbcnt = 0x1, .sclfrq = 0x29, .scllt = 0x0, + .sclht = 0x0, .fast_mode = false }, + {.core_clk = 15000000, .hldt = 0x23, .dbcnt = 0x1, .sclfrq = 0x26, .scllt = 0x0, + .sclht = 0x0, .fast_mode = false }, + {.core_clk = 13000000, .hldt = 0x1D, .dbcnt = 0x1, .sclfrq = 0x21, .scllt = 0x0, + .sclht = 0x0, .fast_mode = false }, + {.core_clk = 12000000, .hldt = 0x1B, .dbcnt = 0x1, .sclfrq = 0x1F, .scllt = 0x0, + .sclht = 0x0, .fast_mode = false }, + {.core_clk = 10000000, .hldt = 0x18, .dbcnt = 0x1, .sclfrq = 0x1A, .scllt = 0x0, + .sclht = 0x0, .fast_mode = false }, + {.core_clk = 9000000, .hldt = 0x16, .dbcnt = 0x1, .sclfrq = 0x17, .scllt = 0x0, + .sclht = 0x0, .fast_mode = false }, + {.core_clk = 8090000, .hldt = 0x14, .dbcnt = 0x1, .sclfrq = 0x15, .scllt = 0x0, + .sclht = 0x0, .fast_mode = false }, + {.core_clk = 7500000, .hldt = 0x7, .dbcnt = 0x1, .sclfrq = 0x13, .scllt = 0x0, + .sclht = 0x0, .fast_mode = false }, + {.core_clk = 6500000, .hldt = 0xE, .dbcnt = 0x1, .sclfrq = 0x11, .scllt = 0x0, + .sclht = 0x0, .fast_mode = false }, + {.core_clk = 4000000, .hldt = 0x9, .dbcnt = 0x1, .sclfrq = 0xB, .scllt = 0x0, + .sclht = 0x0, .fast_mode = false } +}; + +static struct SMB_TIMING_T SMB_TIMING_400KHZ[] = { + {.core_clk = 100000000, .hldt = 0x2A, .dbcnt = 0x3, .sclfrq = 0x0, .scllt = 0x47, + .sclht = 0x35, .fast_mode = true }, + {.core_clk = 62500000, .hldt = 0x2A, .dbcnt = 0x2, .sclfrq = 0x0, .scllt = 0x2C, + .sclht = 0x22, .fast_mode = true }, + {.core_clk = 50000000, .hldt = 0x21, .dbcnt = 0x1, .sclfrq = 0x0, .scllt = 0x24, + .sclht = 0x1B, .fast_mode = true }, + {.core_clk = 48000000, .hldt = 0x1E, .dbcnt = 0x1, .sclfrq = 0x0, .scllt = 0x24, + .sclht = 0x19, .fast_mode = true }, + {.core_clk = 40000000, .hldt = 0x1B, .dbcnt = 0x1, .sclfrq = 0x0, .scllt = 0x1E, + .sclht = 0x14, .fast_mode = true }, + {.core_clk = 33000000, .hldt = 0x15, .dbcnt = 0x1, .sclfrq = 0x0, .scllt = 0x19, + .sclht = 0x11, .fast_mode = true }, + {.core_clk = 30000000, .hldt = 0x15, .dbcnt = 0x1, .sclfrq = 0x0, .scllt = 0x19, + .sclht = 0xD, .fast_mode = true }, + {.core_clk = 29000000, .hldt = 0x11, .dbcnt = 0x1, .sclfrq = 0x0, .scllt = 0x15, + .sclht = 0x10, .fast_mode = true }, + {.core_clk = 26000000, .hldt = 0x10, .dbcnt = 0x1, .sclfrq = 0x0, .scllt = 0x13, + .sclht = 0xE, .fast_mode = true }, + {.core_clk = 25000000, .hldt = 0xF, .dbcnt = 0x1, .sclfrq = 0x0, .scllt = 0x13, + .sclht = 0xD, .fast_mode = true }, + {.core_clk = 24000000, .hldt = 0xD, .dbcnt = 0x1, .sclfrq = 0x0, .scllt = 0x12, + .sclht = 0xD, .fast_mode = true }, + {.core_clk = 20000000, .hldt = 0xB, .dbcnt = 0x1, .sclfrq = 0x0, .scllt = 0xF, + .sclht = 0xA, .fast_mode = true }, + {.core_clk = 16180000, .hldt = 0xA, .dbcnt = 0x1, .sclfrq = 0x0, .scllt = 0xC, + .sclht = 0x9, .fast_mode = true }, + {.core_clk = 15000000, .hldt = 0x9, .dbcnt = 0x1, .sclfrq = 0x0, .scllt = 0xB, + .sclht = 0x8, .fast_mode = true }, + {.core_clk = 13000000, .hldt = 0x7, .dbcnt = 0x1, .sclfrq = 0x0, .scllt = 0xA, + .sclht = 0x7, .fast_mode = true }, + {.core_clk = 12000000, .hldt = 0x7, .dbcnt = 0x1, .sclfrq = 0x0, .scllt = 0xA, + .sclht = 0x6, .fast_mode = true }, + {.core_clk = 10000000, .hldt = 0x6, .dbcnt = 0x1, .sclfrq = 0x0, .scllt = 0x8, + .sclht = 0x5, .fast_mode = true }, +}; + +static struct SMB_TIMING_T SMB_TIMING_1000KHZ[] = { + {.core_clk = 100000000, .hldt = 0x15, .dbcnt = 0x4, .sclfrq = 0x0, .scllt = 0x1C, + .sclht = 0x15, .fast_mode = true }, + {.core_clk = 62500000, .hldt = 0xF, .dbcnt = 0x3, .sclfrq = 0x0, .scllt = 0x11, + .sclht = 0xE, .fast_mode = true }, + {.core_clk = 50000000, .hldt = 0xA, .dbcnt = 0x2, .sclfrq = 0x0, .scllt = 0xE, + .sclht = 0xB, .fast_mode = true }, + {.core_clk = 48000000, .hldt = 0x9, .dbcnt = 0x2, .sclfrq = 0x0, .scllt = 0xD, + .sclht = 0xB, .fast_mode = true }, + {.core_clk = 41000000, .hldt = 0x9, .dbcnt = 0x2, .sclfrq = 0x0, .scllt = 0xC, + .sclht = 0x9, .fast_mode = true }, + {.core_clk = 40000000, .hldt = 0x8, .dbcnt = 0x2, .sclfrq = 0x0, .scllt = 0xB, + .sclht = 0x9, .fast_mode = true }, + {.core_clk = 33000000, .hldt = 0x7, .dbcnt = 0x1, .sclfrq = 0x0, .scllt = 0xA, + .sclht = 0x7, .fast_mode = true }, + {.core_clk = 25000000, .hldt = 0x4, .dbcnt = 0x1, .sclfrq = 0x0, .scllt = 0x7, + .sclht = 0x6, .fast_mode = true }, + {.core_clk = 24000000, .hldt = 0x7, .dbcnt = 0x1, .sclfrq = 0x0, .scllt = 0x8, + .sclht = 0x5, .fast_mode = true }, + {.core_clk = 20000000, .hldt = 0x4, .dbcnt = 0x1, .sclfrq = 0x0, .scllt = 0x6, + .sclht = 0x4, .fast_mode = true }, +}; + struct npcm_i2c_data { u8 fifo_size; u32 segctl_init_val; @@ -1803,11 +1918,9 @@ static void npcm_i2c_recovery_init(struct i2c_adapter *_adap) */ static int npcm_i2c_init_clk(struct npcm_i2c *bus, u32 bus_freq_hz) { - u32 k1 = 0; - u32 k2 = 0; - u8 dbnct = 0; - u32 sclfrq = 0; - u8 hldt = 7; + struct SMB_TIMING_T *smb_timing; + u8 scl_table_cnt = 0, table_size = 0; + u8 fast_mode = 0; u32 src_clk_khz; u32 bus_freq_khz; @@ -1816,89 +1929,36 @@ static int npcm_i2c_init_clk(struct npcm_i2c *bus, u32 bus_freq_hz) bus_freq_khz = bus_freq_hz / 1000; bus->bus_freq = bus_freq_hz; - /* 100KHz and below: */ - if (bus_freq_hz <= I2C_MAX_STANDARD_MODE_FREQ) { - sclfrq = src_clk_khz / (bus_freq_khz * 4); - - if (sclfrq < SCLFRQ_MIN || sclfrq > SCLFRQ_MAX) - return -EDOM; - - if (src_clk_khz >= 40000) - hldt = 17; - else if (src_clk_khz >= 12500) - hldt = 15; - else - hldt = 7; - } - - /* 400KHz: */ - else if (bus_freq_hz <= I2C_MAX_FAST_MODE_FREQ) { - sclfrq = 0; + switch (bus_freq_hz) { + case I2C_MAX_STANDARD_MODE_FREQ: + smb_timing = SMB_TIMING_100KHZ; + table_size = ARRAY_SIZE(SMB_TIMING_100KHZ); + break; + case I2C_MAX_FAST_MODE_FREQ: + smb_timing = SMB_TIMING_400KHZ; + table_size = ARRAY_SIZE(SMB_TIMING_400KHZ); fast_mode = I2CCTL3_400K_MODE; - - if (src_clk_khz < 7500) - /* 400KHZ cannot be supported for core clock < 7.5MHz */ - return -EDOM; - - else if (src_clk_khz >= 50000) { - k1 = 80; - k2 = 48; - hldt = 12; - dbnct = 7; - } - - /* Master or Slave with frequency > 25MHz */ - else if (src_clk_khz > 25000) { - hldt = clk_coef(src_clk_khz, 300) + 7; - k1 = clk_coef(src_clk_khz, 1600); - k2 = clk_coef(src_clk_khz, 900); - } - } - - /* 1MHz: */ - else if (bus_freq_hz <= I2C_MAX_FAST_MODE_PLUS_FREQ) { - sclfrq = 0; + break; + case I2C_MAX_FAST_MODE_PLUS_FREQ: + smb_timing = SMB_TIMING_1000KHZ; + table_size = ARRAY_SIZE(SMB_TIMING_1000KHZ); fast_mode = I2CCTL3_400K_MODE; - - /* 1MHZ cannot be supported for core clock < 24 MHz */ - if (src_clk_khz < 24000) - return -EDOM; - - k1 = clk_coef(src_clk_khz, 620); - k2 = clk_coef(src_clk_khz, 380); - - /* Core clk > 40 MHz */ - if (src_clk_khz > 40000) { - /* - * Set HLDT: - * SDA hold time: (HLDT-7) * T(CLK) >= 120 - * HLDT = 120/T(CLK) + 7 = 120 * FREQ(CLK) + 7 - */ - hldt = clk_coef(src_clk_khz, 120) + 7; - } else { - hldt = 7; - dbnct = 2; - } - } - - /* Frequency larger than 1 MHz is not supported */ - else + break; + default: return -EINVAL; - - if (bus_freq_hz >= I2C_MAX_FAST_MODE_FREQ) { - k1 = round_up(k1, 2); - k2 = round_up(k2 + 1, 2); - if (k1 < SCLFRQ_MIN || k1 > SCLFRQ_MAX || - k2 < SCLFRQ_MIN || k2 > SCLFRQ_MAX) - return -EDOM; } + for (scl_table_cnt = 0 ; scl_table_cnt < table_size ; scl_table_cnt++) + if (bus->apb_clk >= smb_timing[scl_table_cnt].core_clk) + break; + /* write sclfrq value. bits [6:0] are in I2CCTL2 reg */ - iowrite8(FIELD_PREP(I2CCTL2_SCLFRQ6_0, sclfrq & 0x7F), + iowrite8(FIELD_PREP(I2CCTL2_SCLFRQ6_0, smb_timing[scl_table_cnt].sclfrq & 0x7F), bus->reg + NPCM_I2CCTL2); /* bits [8:7] are in I2CCTL3 reg */ - iowrite8(fast_mode | FIELD_PREP(I2CCTL3_SCLFRQ8_7, (sclfrq >> 7) & 0x3), + iowrite8(fast_mode | FIELD_PREP(I2CCTL3_SCLFRQ8_7, (smb_timing[scl_table_cnt].sclfrq >> 7) + & 0x3), bus->reg + NPCM_I2CCTL3); /* Select Bank 0 to access NPCM_I2CCTL4/NPCM_I2CCTL5 */ @@ -1910,13 +1970,13 @@ static int npcm_i2c_init_clk(struct npcm_i2c *bus, u32 bus_freq_hz) * k1 = 2 * SCLLT7-0 -> Low Time = k1 / 2 * k2 = 2 * SCLLT7-0 -> High Time = k2 / 2 */ - iowrite8(k1 / 2, bus->reg + NPCM_I2CSCLLT); - iowrite8(k2 / 2, bus->reg + NPCM_I2CSCLHT); + iowrite8(smb_timing[scl_table_cnt].scllt, bus->reg + NPCM_I2CSCLLT); + iowrite8(smb_timing[scl_table_cnt].sclht, bus->reg + NPCM_I2CSCLHT); - iowrite8(dbnct, bus->reg + NPCM_I2CCTL5); + iowrite8(smb_timing[scl_table_cnt].dbcnt, bus->reg + NPCM_I2CCTL5); } - iowrite8(hldt, bus->reg + NPCM_I2CCTL4); + iowrite8(smb_timing[scl_table_cnt].hldt, bus->reg + NPCM_I2CCTL4); /* Return to Bank 1, and stay there by default: */ npcm_i2c_select_bank(bus, I2C_BANK_1); From patchwork Wed Aug 7 10:02:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyrone Ting X-Patchwork-Id: 817776 Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (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 C3DD91D47B1; Wed, 7 Aug 2024 10:04:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723025045; cv=none; b=lhV/ANyWq50hfzS8YluqtIsE7EakgcJt7HlCysXEIKHIxH1gJxjoytd+3Ub2LB28PlQuxLn24juxKchioH73LQNEzrc4kCYJs03I6cxxBD3npp/t0SCX7NNmESrzI9vI5pevdCqUhHu/5Aorby1rfvY1R+ispDrz35rvpAanmAo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723025045; c=relaxed/simple; bh=sHXCEL6AQnmJEjDnggM+aJvNWrCPKKtV4Yz80r/JQbc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=WlOAr25hWmS+IKIoW4Klh3+qWwshaOGJVADAuJ0BB2L/JrgufJ/oZ9gOeTdy2QlYIRdXXaLcakKMAP8OL+MSNl6al3uiRdHQUx/2GeKL1ndew2vyPFZD3T6FSY3QHMJ9i+PAakHalnzhgQ+8buydBG6NOpHd/ynSzxtSkvZz2J0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=dDc6N/CG; arc=none smtp.client-ip=209.85.210.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dDc6N/CG" Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-710887a8083so1237704b3a.0; Wed, 07 Aug 2024 03:04:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723025043; x=1723629843; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=1JQZAPTxcfDOXPbIWl9UOyALCV+YMvtNIVhFTIQlcJQ=; b=dDc6N/CG/tOv490NwD3SqDLCcgLxHxAWkm428UJSWGg6oMfrk+dNASB6nCmIuXWZwG W+7muinaO7/9wBaYc/ohruNhO9wqGyuOkKWzNRwyteJ7OVUgsMgCuhgXNlvSAPqQdVj/ 5k6Kn1XNsPn9CMuuVYOVjCuKMQAiXFmbU3L3ETo0Aj/YSJL3pthUuRQ/uL6seF0upCpC 2lCtgon367FKHWhE0Qcy+X0YS1cJw6MpRsvqaKN+cfgMX349JdIsxLhuZ4oZoyaAX36T zQ3/6Wy3NujfLKnGfaDhYVowB46+sdkhGyi+WtmEgFUX2tDQJTDgT9KPH5fzSnUuURT+ Dsgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723025043; x=1723629843; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1JQZAPTxcfDOXPbIWl9UOyALCV+YMvtNIVhFTIQlcJQ=; b=sieVBwx4aJ00a9Swn/NWEu2BWoHftyHdQbn83DD/nlAO7UIh+vPqdm7JuaYBFHdUHq mpR9O3dvq4+IIxy+3HLO1xk/vJw0huSiEz3Xc1UOY+ztPU8wUx7HtBO5U09f7tzviloU Ps6o8qknyucnhKFBQKWgWzn/gmacb3N+OFZaE/RCnEERrY5Qve8suUSGmFj3lA4zi9Kq VP1hJ2QDOQ4jDljTtIIhfMIjLiSjAFy3bqCWgAZMLZuKWFQcqGo9Hsp//MlptnzjkpUF WgOi4K+s6lHda4juSvJ7XQWmiOimPLtKcaNTFrvzbmofj+keygRfPw1EK6d2oVouLZND UsOQ== X-Forwarded-Encrypted: i=1; AJvYcCVYeZQKUPZPg//s6Bs2ZTImGlPdWgpdHjQPSrGyM+NxSXS0x8WMDYQe/6HnUl6UENlvuOHgjNaR6rJcPMHfZ1+Uu3LwVVA5agYK/cfC X-Gm-Message-State: AOJu0YxY3LyblQoF3Wlsnmu2hvvKmP5Lv2gO7RyQ97KfS1rD2XqGy7gf lMFA+uYlOPkIyOBU/DUhH5jX6uMUjNFhAZShHdAQoPIT76nng8w= X-Google-Smtp-Source: AGHT+IHLo+ice5A1u5x85W8GsjViC9J2LkR5NJKcSzy4BETbX/PdHIGxniL82sI4lZtiaksXi+tBjg== X-Received: by 2002:a05:6a20:7346:b0:1c4:986a:de71 with SMTP id adf61e73a8af0-1c69960e1a1mr20396150637.35.1723025043040; Wed, 07 Aug 2024 03:04:03 -0700 (PDT) Received: from localhost (2001-b400-e352-b705-880f-4661-e7a1-4abb.emome-ip6.hinet.net. [2001:b400:e352:b705:880f:4661:e7a1:4abb]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7106ed15a42sm8111594b3a.182.2024.08.07.03.04.01 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 07 Aug 2024 03:04:02 -0700 (PDT) From: warp5tw@gmail.com X-Google-Original-From: kfting@nuvoton.com To: tali.perry@nuvoton.com, Avi.Fishman@nuvoton.com, tomer.maimon@nuvoton.com, avifishman70@gmail.com, tmaimon77@gmail.com, tali.perry1@gmail.com, venture@google.com, yuenn@google.com, benjaminfair@google.com, andi.shyti@kernel.org, wsa+renesas@sang-engineering.com, rand.sec96@gmail.com, kwliu@nuvoton.com, jjliu0@nuvoton.com, kfting@nuvoton.com, warp5tw@gmail.com Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org Subject: [PATCH v1 7/7] i2c: npcm: fix checkpatch Date: Wed, 7 Aug 2024 18:02:44 +0800 Message-Id: <20240807100244.16872-8-kfting@nuvoton.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240807100244.16872-1-kfting@nuvoton.com> References: <20240807100244.16872-1-kfting@nuvoton.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Tyrone Ting Fix checkpatch warning. Fixes: 48acf8292280 ("i2c: Remove redundant comparison in npcm_i2c_reg_slave") Signed-off-by: Tyrone Ting --- drivers/i2c/busses/i2c-npcm7xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c index 1af6a927b9c1..dbe652d628ee 100644 --- a/drivers/i2c/busses/i2c-npcm7xx.c +++ b/drivers/i2c/busses/i2c-npcm7xx.c @@ -1783,7 +1783,7 @@ static int npcm_i2c_int_master_handler(struct npcm_i2c *bus) /* reenable slave if it was enabled */ if (bus->slave) iowrite8((bus->slave->addr & 0x7F) | NPCM_I2CADDR_SAEN, - bus->reg + NPCM_I2CADDR1); + bus->reg + NPCM_I2CADDR1); #endif return 0; }