From patchwork Fri Dec 27 11:51:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 853931 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (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 A9B0C1F2C27; Fri, 27 Dec 2024 11:52:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735300332; cv=none; b=o7wO6utz8FR01Kp3EGMnX0nx6PSCF0X5ITClWgCwviVrcVVhkdfU3Vj60X1TXRjMlzCUiGP9VFP5Sh5fe+EPhi2qCdimwGnMG8HJCwKjZykBtDq2f5VRHC2dX9gvAzqw7RaA/CxJgDGxdF6gVWCQZJx+PCreS5Zf9UNXysAsrL4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735300332; c=relaxed/simple; bh=r6NwWr0EMAA4jcLLbT4+7BFeJ73HJpxC3n+D0mkfyOI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bnanbedlGjQ9btjL8EVZ/UPPCeaV4Jt6pBUpRHBpGSs4CN+LsWHSOcsbKZOEGj7wPDYIlHVuRL7syoDNtN+aMf1MUk7PRitS05+sNyBoDv2zKnAu8pWs8nq8g1iqw6RK9Db+98hSN8dGqsj56sny1Flo36HrGZX5raqnrFEsInw= 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=Jf571Xf/; arc=none smtp.client-ip=209.85.214.174 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="Jf571Xf/" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-21669fd5c7cso87991985ad.3; Fri, 27 Dec 2024 03:52:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735300330; x=1735905130; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=15965UaUMUIQcX8R2+qIbEDBP9ZN9hIvP+Qalpqa8Qo=; b=Jf571Xf/d1uSny8gDHis+WmFd3HtvmWnE58e81ira+QZEG69cYFWAdAhdBHArxZsP3 fakYIV/b92lohVXKOsQv7wo/oP9jvB9YZmL0zgCKpIBXdeHtpOFj3cCEDe2Dbp4ZW+4M AP6+yvfjxwoemyy02o1eyfCwxgb0f/SriO5Cwrw16JXVY1m8XU2DYbX4IzgdNrkYbjbU 2yUqo4A9kcXwOOjaKhbtB+puVRmNqUH+3WXe87jJGPdzUpwR0qBVTj3PPsj4cfdbp8nx ou/CWFT4CCclAUsmxEPdBJHZ8pw7mahffDqszwbdo3tarcG5L3IFs6wao5ueFL+eGrZ5 KNtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735300330; x=1735905130; h=content-transfer-encoding:mime-version: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=15965UaUMUIQcX8R2+qIbEDBP9ZN9hIvP+Qalpqa8Qo=; b=CEKAV2yI9O7NT5SMzqdO2iJuJYy1ZwtSaHiRwvb6MUp00q8Xubzzo/2nZt4X/UNYL9 dW9GvWX9itircAKhaxu8VGwVUQ0YtsiaEQfkeHTpj0EpC5o4pUFIgOuhJjMC7lgJNo7K gtyTRmP5YIk0btM6+Dj3cWI1EX5Bj6Q0CtDLiYh9bKoQPxs4UXLIy+rCUqcBaAAyj7h1 0riGaZw8WueEfPdlWjQO7xPY5HUvwz2vG1XA47rI2FkJ03eDMrTN9a3T9gI+/6dmUf/Y C4/nOOz2UIvGkrsZ9E+16VMFXWHcmYZ+28qdTY48t6MbXooy2Pjv96VBXanONCZxujiI em7g== X-Forwarded-Encrypted: i=1; AJvYcCU/oQOmxdyGJacGEJ33/XaY0yvuVRVFSgkOaVAjjEqpsTQkuH3Oqq1GzPhCiObOJf+PPSEJn45TS4EddDmH@vger.kernel.org, AJvYcCVYK6miJ95/2TAUT4JAmLMje1UMhQ0i/OhLdWZcH3cjN1DIDoymNP0YVKKSNXt+P9+iUGNTJmob+kk=@vger.kernel.org X-Gm-Message-State: AOJu0YzUbKjpv85SknGuZe3KSKXTiPrwi4aoMNzFv+i4AR8bA1N+2vT7 PhNBGcb8RbIIQNBgiFE+XGs24KjdPyyf8YKDOyHaCrlDFmK4Jkh4 X-Gm-Gg: ASbGncv5Ya9LDJFvtGaD9PGgg2jfllBkjEhibBIpeyunOhFbb7C/ZMfKOnwI50CN+Cj 5COmfLGfTmzheVN/t1kUyGE8Tb5jUaoV+ky8EtFY0KWQa5QN4khU5kgLmYzZNeS6cpRsoJUhfat q0hwPdj2ujJO+zL2v9uwBDwWgI1KTo3Wf2JSr/2/l4n6MyhnoCan9aboAAu0rC3JAn/Pqbxj3sd gVv8g/1Cl8ObBZQEj9p1186+gYMXNryFC9gC0ZAdLda4sA2t8HVCKm3vlqoSJe1JvrDhIbh/XqS PyuItzQ= X-Google-Smtp-Source: AGHT+IHeDK1oFL3avB4RSV1GAEhoTKrJ9m3cdlJ7UqZ7wvUv5W10qtZta9ibPc2BnJQWnZoo3sjnpA== X-Received: by 2002:a05:6a00:858b:b0:72a:a7a4:9b21 with SMTP id d2e1a72fcca58-72abdd20f03mr39572625b3a.5.1735300329846; Fri, 27 Dec 2024 03:52:09 -0800 (PST) Received: from prasmi.. ([2401:4900:1c07:9010:ac08:3a91:844a:cc65]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad8dbcbbsm14363990b3a.97.2024.12.27.03.52.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2024 03:52:09 -0800 (PST) From: Prabhakar X-Google-Original-From: Prabhakar To: Chris Brandt , Andi Shyti , Geert Uytterhoeven , Wolfram Sang , Philipp Zabel Cc: linux-renesas-soc@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar , Claudiu Beznea Subject: [PATCH v3 2/8] i2c: riic: Use local `dev` pointer in `dev_err_probe()` Date: Fri, 27 Dec 2024 11:51:48 +0000 Message-ID: <20241227115154.56154-3-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241227115154.56154-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241227115154.56154-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Update the `riic_init_hw()` function to use the local `dev` pointer in calls to `dev_err_probe()`. Previously, `riic_init_hw()` used `riic->adapter.dev` in error reporting. Since this function is invoked during the probe phase, the I2C adapter is not yet initialized, leading to `(null) ...` being printed in error messages. This patch fixes the issue by consistently using the local `dev` pointer, which points to `riic->adapter.dev.parent`. Signed-off-by: Lad Prabhakar Reviewed-by: Geert Uytterhoeven Reviewed-by: Wolfram Sang Tested-by: Wolfram Sang Tested-by: Claudiu Beznea Reviewed-by: Claudiu Beznea --- v2->v3 - Moved replacing dev_err -> dev_err_probe into patch#1 - Dropped fixes tags - Updated commit message - Collected RB and tested tags v1->v2 - Collected RB tag from Geert --- drivers/i2c/busses/i2c-riic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.c index e1babd5077d4..01195ffd4c07 100644 --- a/drivers/i2c/busses/i2c-riic.c +++ b/drivers/i2c/busses/i2c-riic.c @@ -320,7 +320,7 @@ static int riic_init_hw(struct riic_dev *riic) : I2C_MAX_FAST_MODE_FREQ; if (t->bus_freq_hz > max_freq) - return dev_err_probe(&riic->adapter.dev, -EINVAL, + return dev_err_probe(dev, -EINVAL, "unsupported bus speed %uHz (%u max)\n", t->bus_freq_hz, max_freq); From patchwork Fri Dec 27 11:51:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 853930 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 BA2CD1F238A; Fri, 27 Dec 2024 11:52:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735300340; cv=none; b=VAWLhNfNR+1BBvWpwzjCp7aepHPejucorekMM67UbM8LssQV0faW4/J7Wa7e1W2t9p9aPM4u9KFu5K/zMgGCjJJOqTA1zMkke0UUVksppfQ3fhIldLcyYZ7BEW29VPxI4X0HVe92Ena6X/gjFBL8UF6Q6z7bgjuZtii87jJxm7k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735300340; c=relaxed/simple; bh=44Vs6/FM4VZrYo/0laOqRhsRYTez9Z5iEd8n1v/03Is=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OdrvSupHPnpcTdB0232IYXo2Y3+zu85X20S6LIEya3fOfVbxFOBRpQXYu3+4t87C+EyPra9kvEWbija3nXCXWSRw0DAcBmrTT/IG2XrcF2zICM+r/oGPNyHIHkWMOc0WtZyqY3zC6u7voQrs6eN4/0MhxxIwqr68Njzs10Fed5U= 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=VUMqhjTV; arc=none smtp.client-ip=209.85.214.169 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="VUMqhjTV" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-216634dd574so59061925ad.2; Fri, 27 Dec 2024 03:52:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735300338; x=1735905138; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tfAmnIKpqRHJaVZJ7etBHUJeCgioZCtC9Hj99Qd9EOQ=; b=VUMqhjTVenFGPz+1Mri1riPctbC+mQoAN3OADyDGte70mv7jPVivV7p02R712ZEmYP IVO1e544/snaELj49MBpCLnuD+7+uOgj6fXI2bpyzHHBZQfUz6cO0kLua46nGRfBqj1u WSHON2o0yRunDgGRQuLP6B9Qr19tGbw+A1wUBTPhmlNQV6MvGuxp4Y769Z27IJcCm64S 2sF4mst+u0dy/mUKhSGoaKmSAvQY4reCk41JowqjFFqlpwxsBffb0aj8Eo1we18vbliJ +0SuXzUMAMxddiEirLH9/H4M6cRTAS7WTEEUUUQO2v6HRW+y2PwfR3Y9AXBRpnNr5aWN vFtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735300338; x=1735905138; h=content-transfer-encoding:mime-version: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=tfAmnIKpqRHJaVZJ7etBHUJeCgioZCtC9Hj99Qd9EOQ=; b=X2wUadA27+V01ANHLZPiN8q5p6UxZnP5CRORQcUUHizygR+BVZ5NVQZidXFPWY56Jo 0FuyUIkst7Z/m4BmStsOlOEtF2DHgdnMltUEnrchios/3S6UbGEMjiz2uxPdP1XGTpO3 t5ZK1M+5QGPyANCh0BiSQb4JKvjqFakhK3fFF7flpUEviulOCGfnCKzW8X+W6RUsJAQH 9ZjZtmPTGe00cvKqDqAjSpsGokLwsEf6J0u+9BSg258jURbMb/hUX0ta8PsmvOSfq7qp lGMZi8DtQD1hYlUGnVIV2G/+bs1hUgiIENpPlxdp6962MbbUJu3QJ0NNwmtHOBWyi6ys kxSQ== X-Forwarded-Encrypted: i=1; AJvYcCV0P10oU1nSKmohlAwvGyWN/YYOFoB0HCG9gh1JvMMb3ziKkti/0aWo+ogTw12DfwjsYeZDbuuElBEGWcwb@vger.kernel.org, AJvYcCWHGSlWxBLNwPL6xceCSTGcRGAMflp4jNvbmH0/2bKzh2vixlJP1arrBMZzHjvnj1d4rOLtdkkBGBQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yyn2Fn0MkVa52+RPUQj4XUtUVbJ61kl/76X26iI92yTjuhx9V2x DqtJYh17RqnUKTX54Yj7/soHMCr++0X1V6KIHATuHQATVCYTlelQ X-Gm-Gg: ASbGnctMN2nIoRkS6PyZfmo8akfNBDdQOPSSsNeaM5zSlJBiYF3BNmEDKAlGflC05yN l+2ywbAG5jEe0py3AAFpH66AJCNJoUP1rTRM5nmNkienjgfjY6a9UJyqFIPI72g+1lxxabxUfv8 vLiVKjU3r39CIFIJ44hBZmvOYW0xRpVeNSyIzl/wBVXcILI82AzkE6/s80Xe6OQxeNsyypcbKyc lHk+m15Q93xVTNpQKYmVkXnVMH0/4mGKdWlSKmaE1mV+YC0BBFwCXIIX1SeUUGhAcgoglm9xUY+ mw6oZek= X-Google-Smtp-Source: AGHT+IGqzvw5ipqPXXi1vkrtY3GowQtnwgigMSDq5w2y1Vm5ZYnqM+rp2/eJ2CoTPhLElPzEM3xmng== X-Received: by 2002:a05:6a21:78a8:b0:1e1:f281:8cfd with SMTP id adf61e73a8af0-1e5e04643a3mr42481329637.15.1735300338068; Fri, 27 Dec 2024 03:52:18 -0800 (PST) Received: from prasmi.. ([2401:4900:1c07:9010:ac08:3a91:844a:cc65]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad8dbcbbsm14363990b3a.97.2024.12.27.03.52.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2024 03:52:17 -0800 (PST) From: Prabhakar X-Google-Original-From: Prabhakar To: Chris Brandt , Andi Shyti , Geert Uytterhoeven , Wolfram Sang , Philipp Zabel Cc: linux-renesas-soc@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar , Claudiu Beznea Subject: [PATCH v3 4/8] i2c: riic: Use GENMASK() macro for bitmask definitions Date: Fri, 27 Dec 2024 11:51:50 +0000 Message-ID: <20241227115154.56154-5-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241227115154.56154-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241227115154.56154-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Replace raw bitmask values with the `GENMASK()` macro in the `i2c-riic` driver to improve readability and maintain consistency. Signed-off-by: Lad Prabhakar Reviewed-by: Geert Uytterhoeven Reviewed-by: Wolfram Sang Tested-by: Wolfram Sang Tested-by: Claudiu Beznea Reviewed-by: Claudiu Beznea --- v2->v3 - Collected RB and tested tags v1->v2 - Collected RB tag from Geert --- drivers/i2c/busses/i2c-riic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.c index 954e066d61a8..ddae4b74a86b 100644 --- a/drivers/i2c/busses/i2c-riic.c +++ b/drivers/i2c/busses/i2c-riic.c @@ -55,7 +55,7 @@ #define ICCR2_RS BIT(2) #define ICCR2_ST BIT(1) -#define ICMR1_CKS_MASK 0x70 +#define ICMR1_CKS_MASK GENMASK(6, 4) #define ICMR1_BCWP BIT(3) #define ICMR1_CKS(_x) ((((_x) << 4) & ICMR1_CKS_MASK) | ICMR1_BCWP) @@ -73,7 +73,7 @@ #define ICSR2_NACKF BIT(4) -#define ICBR_RESERVED 0xe0 /* Should be 1 on writes */ +#define ICBR_RESERVED GENMASK(7, 5) /* Should be 1 on writes */ #define RIIC_INIT_MSG -1 From patchwork Fri Dec 27 11:51:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 853929 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (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 010721F3D27; Fri, 27 Dec 2024 11:52:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735300348; cv=none; b=QkCiiqXgVcsLdDLbgE8r5/Ulrpz/FT93a9SLzxrnzes0RtYvLXRouVs6vY9syfAdTI/F6s1RzPbudOQ1i89/w6rplr6TgFNSCvpz/UH+q6+LKmsbnn/3unUxwa20uUR1OK68/oBHLfcA62N/h0IAmxjv1ookENlOdihsdI5Uii4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735300348; c=relaxed/simple; bh=D/DsT1pJOp2v92eWJ6q2fpcaxKGx/oBC/neVfd9Jws4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sGIR0uvIrACitsLahYyrm+xO8mXsVVRs8TTXkPWPUDuMA66zv4YNs2Uug2GQF6Xnyzsrv2JevFjHFSqur8gapiPRsbM0tvhX7j7LjVjS7mT90R+P6QBf2RUfV311KT4jYHY+Qbyu4MCIT9+BVQ9AzyCQ2DXw00+XP7BeZ+wacQg= 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=ZjVNsgTk; arc=none smtp.client-ip=209.85.214.174 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="ZjVNsgTk" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-2161eb95317so89874805ad.1; Fri, 27 Dec 2024 03:52:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735300346; x=1735905146; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8MX7zL6e/eANjDZsXHEbEpyJVdlNQUXGXrD7nBKxrgM=; b=ZjVNsgTkmcGTzEnCYj5B8+yQjftcpoAsYs7FPOPPY74ilbcfdHCYfC0/dom6kZ7p9k bOVdKcITA2TrjTAB9LJrXa4Ny32pCx9O0Pj/nbt0iHJR6buApdErbLyGUA9zJsmcG07b hCkS2Yd1ManjUm9mtBXVcBkffec1iibD3co/426L9PBFrma4Aqd9v9OFJN8tayc4pLlP 3t3YqGpsMaial6l+JYNq49KXGcybby+TGjBg2Gcu5ju3mUA1otR3PZAuBKIorNn8vl4I elc6KFAYpMbx8i8GLZ+tp4jwzwvmCa/KclEZiPs+zX0zWT+oE0Sycdl2RpogxrDhUryp YKQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735300346; x=1735905146; h=content-transfer-encoding:mime-version: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=8MX7zL6e/eANjDZsXHEbEpyJVdlNQUXGXrD7nBKxrgM=; b=vxGHtYRiVP3V45D14X0Gqbh2I8nPbGRUc7Fumus9GAangF1lEJwx7kUgHDQ/rU/2Gr VrhELPZddnd4pTs1f0wiSGL2TRiONT+I5sACl2PtPApMtYorkGMWIE28FacPVDJCu8iF z3AFHbKK1kXSJco/86xcFtSXXup6WLNd1AWNj/Ju5p9kSAFBITRKe0sEP7czWSBblsC4 qNkdhdpxp/8S4J2mKemAYmJQF7ME282nylJtUDqPJZ0uBzACigH6Y5ZSFtDvtuTz3Pvj le7YCkLfzCiOD7dVl6+UOk9RxZl8r6l+GGWhuHas9oRwm+Ve0NOWHVvSgeNW+pYBbksU y1yQ== X-Forwarded-Encrypted: i=1; AJvYcCVgx4tjgyq6Oipc0fL5Yqe+h7B+E1pWVgPvfAhRZUtC1C5FUBeBfcTbt3f2nZPDBC/5ej2DEA3kXb/JMra+@vger.kernel.org, AJvYcCW1sl1z/1gIKFWKYvM3hthtpHflj0Gv7Mz7dGD+tXX/AeHSinSgBhbOw9xbcGCD0sWFS9eSOBV5YZ8=@vger.kernel.org X-Gm-Message-State: AOJu0YxwxUVzl+V89w5ziaiMf/h59ZeYFTcE6h83UPqIzTbDWXQECva9 69BhdW1Wcc1oWxp/S/IKgX4P2w7jPy7tXqmtnEWASvJ4GUQ/Pkdu X-Gm-Gg: ASbGncu2Mu4HlNlTVKntU6eZJcWLMWUec21h+4JMzZdiOQkorlXo1/gGhETjik51x9b jr6quU+HMHWcfyrmID8fCjDtFDEMm5LmlEDX/EH/JJedP+B2S929gXWcb6of+wc+ORqX8LmPyyp IUNW29ZfVa9rQijlcm5CE+UYfB4S6STasrr0A1y2tnqztEHO1LGlA/a3nd/6Xfy8IrVrINy4W8l pk88dIRw1g7u4zOfKR1iljV6w70x6nwgZHPSfYGNA1ApRFohq/a8BAWsWEt0BlEhphdAPkWHN/+ 8ReNVZ4= X-Google-Smtp-Source: AGHT+IHVYuJMQbzX2/MmsJlcNCQV6d6xSNOiE++9sMeb34z/sZ8avS7a8K8n+uzFcSL564OuhFGLeA== X-Received: by 2002:a05:6a21:1505:b0:1e0:9cc2:84b1 with SMTP id adf61e73a8af0-1e5e0800447mr44647770637.30.1735300346360; Fri, 27 Dec 2024 03:52:26 -0800 (PST) Received: from prasmi.. ([2401:4900:1c07:9010:ac08:3a91:844a:cc65]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad8dbcbbsm14363990b3a.97.2024.12.27.03.52.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2024 03:52:25 -0800 (PST) From: Prabhakar X-Google-Original-From: Prabhakar To: Chris Brandt , Andi Shyti , Geert Uytterhoeven , Wolfram Sang , Philipp Zabel Cc: linux-renesas-soc@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar , Claudiu Beznea Subject: [PATCH v3 6/8] i2c: riic: Mark riic_irqs array as const Date: Fri, 27 Dec 2024 11:51:52 +0000 Message-ID: <20241227115154.56154-7-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241227115154.56154-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241227115154.56154-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar The riic_irqs array describes the supported IRQs by the RIIC driver and does not change at runtime. Signed-off-by: Lad Prabhakar Reviewed-by: Geert Uytterhoeven Tested-by: Wolfram Sang Tested-by: Claudiu Beznea Reviewed-by: Claudiu Beznea --- v2->v3 - Collected RB and tested tags v1->v2 - Collected RB tag from Geert --- drivers/i2c/busses/i2c-riic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.c index edf2212e96ea..378887b133a5 100644 --- a/drivers/i2c/busses/i2c-riic.c +++ b/drivers/i2c/busses/i2c-riic.c @@ -414,7 +414,7 @@ static int riic_init_hw(struct riic_dev *riic) return 0; } -static struct riic_irq_desc riic_irqs[] = { +static const struct riic_irq_desc riic_irqs[] = { { .res_num = 0, .isr = riic_tend_isr, .name = "riic-tend" }, { .res_num = 1, .isr = riic_rdrf_isr, .name = "riic-rdrf" }, { .res_num = 2, .isr = riic_tdre_isr, .name = "riic-tdre" }, From patchwork Fri Dec 27 11:51:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 853928 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (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 B406B1F4279; Fri, 27 Dec 2024 11:52:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735300357; cv=none; b=Uthgi2A9vWWl+2w8VjmsurfJt3FKgaUVnfl6qsrXHvUOoi3F0dv+KMkVlGsOqoMKTYDTGx2IdI66AD/kBYoHm5ZAtnwFRC2oKzplyT003XXCPnF1ye+UZy+lOLnN+Qan88CvfurHkgPJ1iaodLUJqxPK0z9J9nhk0b1u74SmJrI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735300357; c=relaxed/simple; bh=og/4mZT4bNYEAKSmR/ylW3YHosMHCE9n6VPZsM7lb2w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=vE6BT3d10xNrOG1yUC2YKazFOsfF9Qzfi9g2AYR9/QT9Bp1AE30D+YfuR5/OzuttZvV3yQ3TcMIGh2wNqSCTebC83OrLcoKu36+j7f8bJpvUismaE1Wa4Z6I1b9RFEZQPi3KJKPk45JulI3ly6BH1WFE1n2y8A4r91Lcpj53jhc= 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=hIxsAGcZ; arc=none smtp.client-ip=209.85.214.180 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="hIxsAGcZ" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-2162c0f6a39so95380435ad.0; Fri, 27 Dec 2024 03:52:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735300355; x=1735905155; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SxrnLWAApnmijlLFIQl/ov451ANyf6P2dk6YwXU3Ne0=; b=hIxsAGcZprTJ9n0qGJ7I0qoR+Kxgx3yZG0YL+1EfLTlwFcR2jCXAZhnf0IbRCKcGYz i7N/PDYTdh4XqRB0DoIpQZf5V0arOZCYnDrZe1cqI9rXvmS0MREJVcifAmAzQDtPA31t +L3QLhenIEGWIxJHyj657feZv25PieYZYMq/kqKjrvPl/rITgRBvfKdqDrvvd6QdCBks mPdOBWvffWikXN/aWFbx1Dd2sWL+r6ZPLIvHny4qt+eGovzQ4kxll2Et4etBwq6jcido JrDh5vWzv/DpWJDcPS/3bdgZOJyOp6Tf3DP1OwwP3HCqN79EjurzNyaxjWevyhhizcCi Otsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735300355; x=1735905155; h=content-transfer-encoding:mime-version: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=SxrnLWAApnmijlLFIQl/ov451ANyf6P2dk6YwXU3Ne0=; b=Q4ZGl7b4OWu3/4n0nfHvuhLY08rCv1299Y0anGZbdpnbZkJDZ+ULkVVtp5+n1jeKwr L9oeveUdQRMwwxwySE0LaSqsXSdRUZiqUFd7QD0MBur9TVLpJOrswFdUz+pmEmJ/V/cD 0FaBVGg+PWhkIJdFfv025FXf/YeHqUn+1KlybG0lvbzEk2hZCKVn/bFgcqSy1gXqH1FQ RIdrFwes0jhOI1u/8NK7nDM9yNQA1vM2bipjips9zfS3gw1skc1aLIxGSInymOQGQSJ8 7VJ21220Bdzcic+VpQgYba8oymOj3yQ58Ic4H3mBrfBZUbxGBjpjsK23GHeSIK0RX65A 6Gsw== X-Forwarded-Encrypted: i=1; AJvYcCWmpjDmripYji9X/65K9fSs9on3sg2RxURu9803il9C0nR29xHNnsENC8Vmro7RUGcYvp1ztaP+XIIqDGiW@vger.kernel.org, AJvYcCWuUgyfi6iw7hW8f/2/gRxRMxE5lqESe9eSNGdusWO/3Fq5oIrsrCGub1lDwllmfiiOYNl0rXIsFLQ=@vger.kernel.org X-Gm-Message-State: AOJu0YycNfOK78dUn7wS6kVWPmGMkXxJxljJwfkqAp6e4GH5Ygiqmy34 va4UmEJFeRSSapEMF88tRHQqQtmEQd1abz3LqA22u0u1HUpUr63l X-Gm-Gg: ASbGncsrZAelDGAkSvlVHUqMJfg8vlLMtibW2QyEofcmVsiAO2o/5kSAPjK3ufXUV0H iwHrphrMjLD5Xy3xRkoKJT+IzUll6E8qDpBheNlPq99UC0hqUvFFG08rh8SQshhYeLRj0zHCG++ a19GFfQYzVG8BEDJr/ZS0I36WhMpRu5WzxPYBO5x5zlOi+GhTb121AMEGne1ppkJ4e/AEee6tbL 2+GLUCeKjmdMX6jlvblVgosggaoI205LudHp/gKe5gqtGjmBZdPfqMakF7uJHr1RPcvYlxKkUDa ozeDOoY= X-Google-Smtp-Source: AGHT+IHtSLgnEjDMksHOF6grV+q2mjiLXJSbkTz7D07bHxrB0gSSLrsfjF9hKxiqgbgqLdyJ+6xAsA== X-Received: by 2002:a05:6a21:648c:b0:1e2:2e4:6893 with SMTP id adf61e73a8af0-1e5e1e2979bmr43579802637.9.1735300354864; Fri, 27 Dec 2024 03:52:34 -0800 (PST) Received: from prasmi.. ([2401:4900:1c07:9010:ac08:3a91:844a:cc65]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad8dbcbbsm14363990b3a.97.2024.12.27.03.52.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2024 03:52:34 -0800 (PST) From: Prabhakar X-Google-Original-From: Prabhakar To: Chris Brandt , Andi Shyti , Geert Uytterhoeven , Wolfram Sang , Philipp Zabel Cc: linux-renesas-soc@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar , Claudiu Beznea Subject: [PATCH v3 8/8] i2c: riic: Add `riic_bus_barrier()` to check bus availability Date: Fri, 27 Dec 2024 11:51:54 +0000 Message-ID: <20241227115154.56154-9-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241227115154.56154-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241227115154.56154-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Introduce a new `riic_bus_barrier()` function to verify bus availability before initiating an I2C transfer. This function enhances the bus arbitration check by ensuring that the SDA and SCL lines are not held low, in addition to checking the BBSY flag using `readb_poll_timeout()`. Previously, only the BBSY flag was checked to determine bus availability. However, it is possible for the SDA line to remain low even when BBSY = 0. This new implementation performs an additional check on the SDA and SCL lines to avoid potential bus contention issues. Signed-off-by: Lad Prabhakar Reviewed-by: Geert Uytterhoeven Reviewed-by: Wolfram Sang Tested-by: Wolfram Sang Tested-by: Claudiu Beznea Reviewed-by: Claudiu Beznea --- v2->v3 - Collected RB and tested tags v1->v2 - Used single register read to check SDA/SCL lines --- drivers/i2c/busses/i2c-riic.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.c index a2d0cde5ac54..cf20e75da044 100644 --- a/drivers/i2c/busses/i2c-riic.c +++ b/drivers/i2c/busses/i2c-riic.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -50,6 +51,8 @@ #define ICCR1_ICE BIT(7) #define ICCR1_IICRST BIT(6) #define ICCR1_SOWP BIT(4) +#define ICCR1_SCLI BIT(1) +#define ICCR1_SDAI BIT(0) #define ICCR2_BBSY BIT(7) #define ICCR2_SP BIT(3) @@ -135,6 +138,27 @@ static inline void riic_clear_set_bit(struct riic_dev *riic, u8 clear, u8 set, u riic_writeb(riic, (riic_readb(riic, reg) & ~clear) | set, reg); } +static int riic_bus_barrier(struct riic_dev *riic) +{ + int ret; + u8 val; + + /* + * The SDA line can still be low even when BBSY = 0. Therefore, after checking + * the BBSY flag, also verify that the SDA and SCL lines are not being held low. + */ + ret = readb_poll_timeout(riic->base + riic->info->regs[RIIC_ICCR2], val, + !(val & ICCR2_BBSY), 10, riic->adapter.timeout); + if (ret) + return -EBUSY; + + if ((riic_readb(riic, RIIC_ICCR1) & (ICCR1_SDAI | ICCR1_SCLI)) != + (ICCR1_SDAI | ICCR1_SCLI)) + return -EBUSY; + + return 0; +} + static int riic_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) { struct riic_dev *riic = i2c_get_adapdata(adap); @@ -147,13 +171,11 @@ static int riic_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) if (ret) return ret; - if (riic_readb(riic, RIIC_ICCR2) & ICCR2_BBSY) { - riic->err = -EBUSY; + riic->err = riic_bus_barrier(riic); + if (riic->err) goto out; - } reinit_completion(&riic->msg_done); - riic->err = 0; riic_writeb(riic, 0, RIIC_ICSR2);