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: 13917874 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 4354F1FA8CA; Sat, 21 Dec 2024 15:20:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734794408; cv=none; b=Z02e7dONFUaCmMf9Z672PWk5k/d+lRdY21+diPM8w5gN/o3lYZvmAVKuY2JsDMNeT2k7BPPFO4PzvgyfUl7JiilKZPVYQvym4RnGMGruACvd4IsPqJTOe4vaYbip7czbcouQmmIhxE5dOfqlbyWQtuGTqjYoWs384CqwY4gyJXk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734794408; c=relaxed/simple; bh=lz8soa2X52/Ceg+m0bgpHhYnux0n73yo4sFGO3Otuac=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cX+hV8NJjV18YwyPEFcQhm8V1EpHfnuwpLCDnwjsiPQfp7ODdbPSUksxYirZcUeVVWWTAgMNtcOCKgS0FVD7fGa8TrJDGiEA4t3qoExer56rGbvMGJEsHFfurMelYNCEDN7jrKCb0xWAvcUtJKzkSABsDXXmhxtKaBKlnwhJpxs= 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=QIjeHJ10; arc=none smtp.client-ip=209.85.128.47 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="QIjeHJ10" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-435f8f29f8aso20955175e9.2; 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=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=FYR35pN6B2ehQmZU1zbMbYa1s94KBf/W3qkLmq3E1Sk=; b=QIjeHJ10EaH9iEbU+mJbcPx05UDJhcxNLKJL52GsxSP+MSNEhzvYiLVsIGlYLsoMrK zYkb8sS33kUFORF+VFy56SsFfuLiiF/lCUV3uO9+7c4mfaAAJeEIUMEN9M0pOPS/9KFD 0uSJM14ho3IANY3ASl5WRhx/ZYxzVfNNNHJaripgKHmAwG+iniwnee62/wKjqetSgf7v e4RrK8ahgtKpahtDLbxUk0RG35JOEwiQSvJOyHn8/O2MvIe5/Dfw8xnhFkK2bLcGYIVk lfpNsEHeIk8fCjIH3ruNC5fKR9MdN+g1cU3vkMUPcCrX8JBzEuwn/PMlywhYvbOC+6lx tBEA== 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=qU8Hl+FCJu/+zh8UaPwARiTajeABq8m2nhIbBwXbmBYzyjA7+TrDpVlAn4Jk+vG+7W fhdG71h0Xt7E/YkuDjpijk6MorOey8wrKr7Ah8PPBDkLg3yBSy767k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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> Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 --- 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: 13917875 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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 8CB941FCCEB; Sat, 21 Dec 2024 15:20:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734794411; cv=none; b=fXMy1RUUQeNKjWml/ck4eBDFJCj1Q1/185UlLagg4JiWPR6tWI/wY9X1MEVXJyy2Rb24yzLfnRkpwSNI6oj14FP/zskEPX00lWlrxUytj+242p4PgpE/4aCjziaW2/3aP2mZuCGImpeRxgzn0eBuE1ACRzy9nyqSW8VVlIbSinU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734794411; c=relaxed/simple; bh=nbAtE5fCXm3zYwLKsyi5qBnZjW38aXP2Scmw3SWaD80=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GbqDdfyQ35bqiIV27Ndv0wMh8tB2cO3eVjicQLDUyf1sZ2Q4OHfBqnqkudkcpSlHf2PMTxySU6bAdElW32BUQ7IJjM7kaMiXxVeA0/qv/HG7QciCee/R83yk+XRivj/lOE4rjZRCH630xtCM+HA3YzDokRiEGOVl/FjAqcn8BEA= 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=Nb7XKhzN; arc=none smtp.client-ip=209.85.128.54 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="Nb7XKhzN" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4367239aa86so8284105e9.3; 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=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=tVxSWTXl5UIYBnL/G0S8NcTIdBJTYT5G0e8feEw+iHw=; b=Nb7XKhzNd7kPyQkXYOj4PiDeT1TTdWGxjDssMyvuDxZiUN0B2AnaqUZx6xhVAEJXb7 bqEK6djyx13oVlSArpsdtXjc8ZOb+qVohzHSrXxapT41yvsU6rZ28Q85VxMZ+02exgDo pCEcA11MLT87MA6wB14jK+315FvHWKic38Xig0B1QmXdC1G7I3DfA/MOGqYAwG8N2SHX Ish+s5dAmDJIRnnRjj+p2twxcVa3Qr5BFAejY6Iqijz6zIb+IuT2Itwc84BQB1EQYMDR 7hSzk0nX9wDwW5lfw2juLo3JjCcNsdjKz2OdBL0ukQWMcAGdZ9A5mGtvZYs+owQnbZea WfSg== 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=tVxSWTXl5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trWDckqCrUcMaKcFSn53V1zQ72G5PiCAQQUbDwgaSwt7xtYD9BQHPmgFChOZ oyI/u3hbX/z37nykjuXm11QNGiCGkrCJ 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> Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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;