From patchwork Sat Dec 21 15:19:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivaylo Ivanov X-Patchwork-Id: 13917871 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5DDA3E7718B for ; Sat, 21 Dec 2024 15:22:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=FYR35pN6B2ehQmZU1zbMbYa1s94KBf/W3qkLmq3E1Sk=; b=yntquaYBf5bUUdutKPiL3nrRps a0hetC+y2wlgIf3ZgbCeeMJLPVaieOEaBnvZqrwUclJFxbEwMH+oKcuHvYHan7oODI989ESOIU4V7 /Ml9cNx4grev2QHrqEYBjkhoNjie2lObDZmufq5t876uHE4k2pOnmXeXBbgYVs3yoAkKmKJ46dyD0 KXhWW7dovZY3R0q6ANGxHi81v1IZ0JaBv2K3DUlLtiqMR66d5BIioIcC4x9slhgViiOlDdL0J7QOw PHqx5T7hMRgT+0H1mIMHodIlzSuOXVeHLnI6UzXjtndDBDt+q3KIPO5xk2dxYQIx6sFv62Rn3Erbd r9WrboGA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tP1JG-000000077sR-3Kh4; Sat, 21 Dec 2024 15:22:30 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tP1Gx-000000077YK-18rQ for linux-arm-kernel@lists.infradead.org; Sat, 21 Dec 2024 15:20:08 +0000 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-43618283d48so21002975e9.1 for ; Sat, 21 Dec 2024 07:20:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734794405; x=1735399205; darn=lists.infradead.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=FYR35pN6B2ehQmZU1zbMbYa1s94KBf/W3qkLmq3E1Sk=; b=UPG++HUZffP6jNbpAb+2j4a3QS+yqCklW7j6YxVfBsfF6DKwofaLcVTrrQkyTgOHIC SQ2qGlpsbVFdPnjlEl01JHT35i3dBlUORvwZ9/Eb/kbWHbtN2CQkWZcOMmm7x3vLjmV3 j92IkGr6+7aJ7ttjd6lefLep4hB4qKTE6yT/r2ySFtqWQEdmzEb/MTVIEnnhp8sY+l/T xpZ0+c+nguPSx+NdgOWqymKFwphElhCBI3k0KGf7Jvkg6gpwsaalCSGPempY1VuGbep9 rBJNmDrd5qVSb4hIOFgVByK+8ikq/AUOhqRYTIhWSRZYYjfoPWlJmSi1g4sr89S58iJN Gi+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734794405; x=1735399205; 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=FYR35pN6B2ehQmZU1zbMbYa1s94KBf/W3qkLmq3E1Sk=; b=GxwdhwiusVJ4C9qcs9+3KyEzaW2MbNibubBvhYBI4fKilqF3+33Tt+XjdeE7OLDsc7 sL6w/NM5s6briNu6sPTHHg3sk8GX5LypCWZcknDY4nxXv2UThIakI8uMeyrnEEntJGFK 6qqJu4o/zBydjYPMT5p2UDJr1zja75grCSjP7rMDSVVWmbZ5vLYR6g/jd9/jXQwwDrov BRDdurgt8bq0//AUxgc85D8bD6JA0gIjk/Fe0HgSQJpHgnxWP2ps7TKMhw9yXpcoxh/h dl7syBgfg96OHEO2YHYW4rd2jamM4f8QcDwrBkKki/FnTdSLoXVnyFRogNvX0apvnUsn 1p1Q== X-Forwarded-Encrypted: i=1; AJvYcCUr8WHPPxPVxXNvVbriuoRwKvzKRiKtEclfP5EhiOfYen3doFnnybkFVxSHRryWOnI86dnZjCvIDywH23x5xcxO@lists.infradead.org X-Gm-Message-State: AOJu0YwtSP9WHtQf2rRQ74ggub32vtSaYUeUD3AtQQqrhkxUWEiisspQ 6j5DXq0n+E8x1Gykyv+Zc8Ab7uxjm7Ju1K5cmjX8f5BJFFakM7oP X-Gm-Gg: ASbGncsekvQDvLGY3IqAFmVVEh89FtNgwB7j49wVLcppp9rmQN0voDEqtYgBmx0GZT7 PCBdEN+VV8q5SY4xdeu4c8CR+jGWF57UbhmMNyGiP1TvIAkNJlRyeDDqtA2GwUs0lbbPp6KHnI9 f4pdFLEOmcsV8hA8F2A8QbODSZXmgSQI2bxDy3TpIFy3MqHd8Q+9EHImOINxlYB4v+a3D8b7HWK GdxSta00Fzh8WcYbq9oWNbH9th3zCRzzRPvYAF0linlyl0dbhZUVprzqQNrzBFbLvwOVimat2P8 q/6R/ZpAO90SEgcSPqWIJYtBKqzE/gvW X-Google-Smtp-Source: AGHT+IGQ1CK7WMo0t9Nu9b4sWeyce9VPk/h2HJZhnP+Bz9hfqh4ZvhyagojUZyJ5UUpegOnoi9OgsA== X-Received: by 2002:a05:600c:510f:b0:436:1b08:4c78 with SMTP id 5b1f17b1804b1-43668b7a284mr63092815e9.31.1734794405388; Sat, 21 Dec 2024 07:20:05 -0800 (PST) Received: from ivaylo-T580.. (91-139-201-119.stz.ddns.bulsat.com. [91.139.201.119]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c89e126sm6629046f8f.65.2024.12.21.07.20.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Dec 2024 07:20:04 -0800 (PST) From: Ivaylo Ivanov To: Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alim Akhtar Cc: linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] dt-bindings: i2c: exynos5: Add samsung,exynos8895-hsi2c compatible Date: Sat, 21 Dec 2024 17:19:36 +0200 Message-ID: <20241221151937.1659139-2-ivo.ivanov.ivanov1@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241221151937.1659139-1-ivo.ivanov.ivanov1@gmail.com> References: <20241221151937.1659139-1-ivo.ivanov.ivanov1@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241221_072007_329954_1B0CD460 X-CRM114-Status: UNSURE ( 8.23 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add samsung,exynos8895-hsi2c dedicated compatible for representing I2C of Exynos8895 SoC. I2C buses may be implemented both as a part of USIv1 and separately. Signed-off-by: Ivaylo Ivanov Reviewed-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/i2c/i2c-exynos5.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/i2c/i2c-exynos5.yaml b/Documentation/devicetree/bindings/i2c/i2c-exynos5.yaml index cc8bba553..70cc2ee9e 100644 --- a/Documentation/devicetree/bindings/i2c/i2c-exynos5.yaml +++ b/Documentation/devicetree/bindings/i2c/i2c-exynos5.yaml @@ -25,6 +25,7 @@ properties: - samsung,exynos5250-hsi2c # Exynos5250 and Exynos5420 - samsung,exynos5260-hsi2c # Exynos5260 - samsung,exynos7-hsi2c # Exynos7 + - samsung,exynos8895-hsi2c - samsung,exynosautov9-hsi2c - items: - enum: From patchwork Sat Dec 21 15:19:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivaylo Ivanov X-Patchwork-Id: 13917872 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3BFEEE7718B for ; Sat, 21 Dec 2024 15:23:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=tVxSWTXl5UIYBnL/G0S8NcTIdBJTYT5G0e8feEw+iHw=; b=zDUG+RAQ1wlpk/Dw7H+9t3AMdS 2m7WDp6vBbfR0Y7oGos1HaehIwXlTTUS7IyC9boZQ9PaKbH/6Oo8l+c8jr6htfl5DEoLGMcvvcAhJ yJVZWc+TyoC8wuYrSM1f6iGmhaT3DSBWN62IBtHsyFNrwkjIjIQqz/BPthwSeVGCwhBdqX1oR7vWu oht/YXWrzbE4oBh0+hMrIdCQEn1NzIaoEBCxcNpjxFb5Iu7SAAVGk8nOpva71+BBmf976OWgfHOwW BTEO8iZe/bnBCO2ueFqAWcmfHCkQcY/4NyzI++T/EuG1hwy7wFn1Jui4AatMC6uE6qGiqhJLrz9IT bnp9nnww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tP1KP-000000077zl-23Nj; Sat, 21 Dec 2024 15:23:41 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tP1Gy-000000077Yn-2FWO for linux-arm-kernel@lists.infradead.org; Sat, 21 Dec 2024 15:20:09 +0000 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4361f664af5so31732855e9.1 for ; Sat, 21 Dec 2024 07:20:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734794407; x=1735399207; darn=lists.infradead.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=tVxSWTXl5UIYBnL/G0S8NcTIdBJTYT5G0e8feEw+iHw=; b=bZQeV4T/R8JwNokDq4RJV1PQjwk6eYngWN8tiEBpGPgOoMCgvnHTfaEDGuujBx23UP ix4EAWp6xTosoOLWUElVLbOVICCaqS5gtgXzDPH4z5aJyWzCW/N2gdu2mevHOF9hiR+m +7DR9AxaETUjK6bHw1K7RZiIIyeQ5hnhnAmcYZThJP0j51/3SsGbWVOaaugY97+V7nC8 0WXpK146F+TL0rFf9d2rFZ64WNJWxREBjnLjryXrNlOEbZQthxrYfjeWTotmz+u2nIGu HgkAwUV9zrfYbLjcFm2tLALuIcWZT/A6S7wQhOv/P7XIpM/6ePuj0MIWHh3YW27Is/bY TWQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734794407; x=1735399207; 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=tVxSWTXl5UIYBnL/G0S8NcTIdBJTYT5G0e8feEw+iHw=; b=UbkHPjA6Wm2XGfjboTP2bmEpZz9yWhBNzCDcOdBTuoxjmiGFHpssP1nM5RYhjf0t1H uieMu5y7eFOl0r06GBEEv/57uuwwSGvBbAHJuxkQ/VlipLbDgL7Ihdhj0QPHvCoAmin1 t1h0tzSyOA/Q4seVw4B1+LelpIfkFaLAKW6uUvQWHDE2qnK3v+x3O/01eUexNVHQiOdB 3T2ZIz2GVHp5vZk/ifGEEWOFQbHAJhnVyksOqR9AUAMAnfEvQJq9HBhQR42QEhQQNAMs 5w7MRhTNrwlFQl8KIn6iVbwBYnVOUprJtJW1fhFSSOBRsOHLOhX/lCCWtwutL45NH+b0 5LKA== X-Forwarded-Encrypted: i=1; AJvYcCWc4M5ZrkupQRiFgIBwtF1NtE6CIsZD+SqTZLFSsCkUGOOjQSdqWddJaQ6QEfbP37bNL3P3hVd+LcUkd3HR16W4@lists.infradead.org X-Gm-Message-State: AOJu0YztjadZ4slJ/wQbX8zpVI00lSzoPm5mUgUIvYKqs13sQuIiGGfi Ucj4TOmZ0TquF/27ch17W3xjVTFJzbQw68VSMwdtN0wocE3wYrHn X-Gm-Gg: ASbGnctI7RZmTgC9lIpveC3uqLwbwjTyF1nP8kvulTBel4/HrnM7pWGU1qS2T+Z+ctw qnpla/sasqGFXH/sCWtFun26Jt21zGyIW9R6YxNBpY4VmDA6MTOPpT+/i9SJOqzphJ4xd5xZDsJ 4l4d5mXNSsbGK0aJlwoEZ6O3NrnYQCF7Rh73Hv/kLNG3ZhTA5yzUgLbme/0qdAXHLwiYQaIdyrW XsV7HNO8TPFwLzYPmP9CwP79wuGNwsfJ2uzCISuS+XQUp+B/PTGtaHsDCUdDwfV8A6gzuT75wsI /48aET4kDd3VTLUSO4/qqR/vOeh3lJ2b X-Google-Smtp-Source: AGHT+IEJc3gycBif+Ud/uhe0S2l+nbHHM3pQ0iNSMQUHkFYUO0h+l+iqpE18cSyQPOqhAA7Ey7zSUw== X-Received: by 2002:a05:6000:4024:b0:385:f349:fffb with SMTP id ffacd0b85a97d-38a223f5d8cmr5927073f8f.45.1734794406720; Sat, 21 Dec 2024 07:20:06 -0800 (PST) Received: from ivaylo-T580.. (91-139-201-119.stz.ddns.bulsat.com. [91.139.201.119]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c89e126sm6629046f8f.65.2024.12.21.07.20.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Dec 2024 07:20:06 -0800 (PST) From: Ivaylo Ivanov To: Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alim Akhtar Cc: linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] i2c: exynos5: Add support for Exynos8895 SoC Date: Sat, 21 Dec 2024 17:19:37 +0200 Message-ID: <20241221151937.1659139-3-ivo.ivanov.ivanov1@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241221151937.1659139-1-ivo.ivanov.ivanov1@gmail.com> References: <20241221151937.1659139-1-ivo.ivanov.ivanov1@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241221_072008_576759_042121A1 X-CRM114-Status: GOOD ( 14.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Exynos8895 functioning logic mostly follows I2C_TYPE_EXYNOS7, but timing and temp calculations are slightly changed according to the following logic: FPCLK / FI2C = (CLK_DIV + 1) * (TSCLK_L + TSCLK_H + 2) + 2 * ((FLT_CYCLE + 3) - (FLT_CYCLE + 3) % (CLK_DIV + 1)) temp := (FPCLK / FI2C) - (FLT_CYCLE + 3) * 2 Signed-off-by: Ivaylo Ivanov --- drivers/i2c/busses/i2c-exynos5.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-exynos5.c b/drivers/i2c/busses/i2c-exynos5.c index e33001508..8d8ee42ba 100644 --- a/drivers/i2c/busses/i2c-exynos5.c +++ b/drivers/i2c/busses/i2c-exynos5.c @@ -168,6 +168,7 @@ enum i2c_type_exynos { I2C_TYPE_EXYNOS5, I2C_TYPE_EXYNOS7, I2C_TYPE_EXYNOSAUTOV9, + I2C_TYPE_EXYNOS8895, }; struct exynos5_i2c { @@ -240,6 +241,11 @@ static const struct exynos_hsi2c_variant exynosautov9_hsi2c_data = { .hw = I2C_TYPE_EXYNOSAUTOV9, }; +static const struct exynos_hsi2c_variant exynos8895_hsi2c_data = { + .fifo_depth = 64, + .hw = I2C_TYPE_EXYNOS8895, +}; + static const struct of_device_id exynos5_i2c_match[] = { { .compatible = "samsung,exynos5-hsi2c", @@ -256,6 +262,9 @@ static const struct of_device_id exynos5_i2c_match[] = { }, { .compatible = "samsung,exynosautov9-hsi2c", .data = &exynosautov9_hsi2c_data + }, { + .compatible = "samsung,exynos8895-hsi2c", + .data = &exynos8895_hsi2c_data }, {}, }; MODULE_DEVICE_TABLE(of, exynos5_i2c_match); @@ -331,6 +340,14 @@ static int exynos5_i2c_set_timing(struct exynos5_i2c *i2c, bool hs_timings) * clk_cycle := TSCLK_L + TSCLK_H * temp := (CLK_DIV + 1) * (clk_cycle + 2) * + * In case of HSI2C controllers in Exynos8895 + * FPCLK / FI2C = + * (CLK_DIV + 1) * (TSCLK_L + TSCLK_H + 2) + + * 2 * ((FLT_CYCLE + 3) - (FLT_CYCLE + 3) % (CLK_DIV + 1)) + * + * clk_cycle := TSCLK_L + TSCLK_H + * temp := (FPCLK / FI2C) - (FLT_CYCLE + 3) * 2 + * * Constraints: 4 <= temp, 0 <= CLK_DIV < 256, 2 <= clk_cycle <= 510 * * To split SCL clock into low, high periods appropriately, one @@ -352,11 +369,19 @@ static int exynos5_i2c_set_timing(struct exynos5_i2c *i2c, bool hs_timings) * */ t_ftl_cycle = (readl(i2c->regs + HSI2C_CONF) >> 16) & 0x7; - temp = clkin / op_clk - 8 - t_ftl_cycle; + if (i2c->variant->hw == I2C_TYPE_EXYNOS8895) + temp = clkin / op_clk - (t_ftl_cycle + 3) * 2; + else + temp = clkin / op_clk - 8 - t_ftl_cycle; if (i2c->variant->hw != I2C_TYPE_EXYNOS7) temp -= t_ftl_cycle; div = temp / 512; - clk_cycle = temp / (div + 1) - 2; + + if (i2c->variant->hw == I2C_TYPE_EXYNOS8895) + clk_cycle = (temp + ((t_ftl_cycle + 3) % (div + 1)) * 2) / + (div + 1) - 2; + else + clk_cycle = temp / (div + 1) - 2; if (temp < 4 || div >= 256 || clk_cycle < 2) { dev_err(i2c->dev, "%s clock set-up failed\n", hs_timings ? "HS" : "FS"); @@ -491,6 +516,8 @@ static irqreturn_t exynos5_i2c_irq(int irqno, void *dev_id) switch (i2c->variant->hw) { case I2C_TYPE_EXYNOSAUTOV9: fallthrough; + case I2C_TYPE_EXYNOS8895: + fallthrough; case I2C_TYPE_EXYNOS7: if (int_status & HSI2C_INT_TRANS_DONE) { i2c->trans_done = 1;