From patchwork Tue Jun 18 00:37:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 13701591 Received: from mail-oi1-f174.google.com (mail-oi1-f174.google.com [209.85.167.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 845EFFC19 for ; Tue, 18 Jun 2024 00:37:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718671067; cv=none; b=CHUBeqmlrbNkK17ULPf6A0t3VddzVoMg1pwQZqRvUGueq6DbhEhNLCyYa86vkhdBeJugRpWCtYB8AVqA9KagLz6G++C5yQQKfPnghdvw9WEL+ZqwYeK/Gt9JbAXAWZh3P8kWrpjkqVylW9oA1st8hmUiz610vcYQZp3FaQBjETg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718671067; c=relaxed/simple; bh=hrWFsIdGFQN3JlTpzd5Fob6eZVzy5bbOWq4iID+CKq0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=Otkq/yZA9Pusfq8G7XmaW2KxVsa/dbj+3JVUbORqMrg3hbILFXBDJdzkYJEj6A8TwHpJPgCFruXfWS93tgAeiRckgjXch1hFyBZYeMTkhBdGRKqoDWYZ1Ui66coWxfUhKqvScK9lVt2GVPT6rb/T/JCT+W0k+II7QSHwEHDY/nk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=JxZKM0e3; arc=none smtp.client-ip=209.85.167.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="JxZKM0e3" Received: by mail-oi1-f174.google.com with SMTP id 5614622812f47-3d21e00d9cfso2944538b6e.2 for ; Mon, 17 Jun 2024 17:37:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718671064; x=1719275864; 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=lKuj2kjzCNP1OTawGgcPwef07LFs/c3ARZmci/YZ/WU=; b=JxZKM0e3Kt9/GUATHWDMsqCQ8OeOtTl4MgDk6jMbizXf6eUbeXAitcPTD1Qy6stlP9 ZUdJ/BOJrT1NnMBWDsDSQB06EpU01EXYyMBBWHjYS4zIlM9NuE/Dve5r4XturdXIqTUq 3sx/oopLuoHI1PuJZ8JKYMYvoMuNSsj4mS4o8jsC5ltRHWooSx8oK6meYPsO3EI8BBW4 WPLtZke/yQ10Vg4CDppBJdZq7p5/gyG0bRVZfo0U5Qqltd/grRfaSPTuAEiEe8nsrT25 TUqsQWzMmGul+GZAQFlLWhMv1ZaxfF0+0io5KQgnqErzurkGEBAMNGj9pfC/IAikXHIT vQ5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718671064; x=1719275864; 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=lKuj2kjzCNP1OTawGgcPwef07LFs/c3ARZmci/YZ/WU=; b=L7ELiUmsHgtLJtJkQgmRmYOCxQuTvfvfF8uPAiSprJJP7stD9UOJONQlgQnXvCw/Hk ehp8pjeVMtK9zd9gU6inJEvZBlR0pk/mM6mhJB1yPk9aRDQ+zuhsZEUch2nX5J6LtAJJ ocrRENmhPYpnA84QJUmidJTlhMLt+2XuP1dGwd2EVMFAuQG9lZihzOaI37U6nUMrVMVx yukoLfL7oHk+4Mm4Thv+OfQb0dwk4JwGZwFwO42+L4Ixcd+gg+Z0nBx1WIDpw89hC8Rd ILB7+N7RC45yZpc9zgVRxyLEDyNpVGBVvWo/ylYnOb2HW+pQIp1+/CQq4w9vRMoLjV3E fUQg== X-Forwarded-Encrypted: i=1; AJvYcCWj7TqjRYXOeMD/61ebrS6Z/dTZUZ31D1pZrX2ycyoIpIh3KUC96ETOrrpiNxDLNZhKGvDzLCjEkZNc+BxA6q0vBzO7q7HkiRrPN3M/l6z2H4I= X-Gm-Message-State: AOJu0YydRvjRmJ5hMwy4PA7id5aL8/Gui9s6Mtne/dC4lpE9tmjYHjtT 3joFmb3D5wCSdJMutPpfWZu3JC3F0KsgIwEbU26f1bhe4PYYKgkfJRN6xGVV1Xg= X-Google-Smtp-Source: AGHT+IE3Prevs16wOHYwFYT8SyvwJLOz/BXQwuvHWQ2GdL0m4hXtQ3ed2xxIPKXNXVNQCC1FljUmiA== X-Received: by 2002:a05:6870:a406:b0:24c:b4da:725d with SMTP id 586e51a60fabf-25842a1d172mr12861310fac.33.1718671064465; Mon, 17 Jun 2024 17:37:44 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2567a94b7besm2896164fac.6.2024.06.17.17.37.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 17:37:44 -0700 (PDT) From: Sam Protsenko To: =?utf-8?q?=C5=81ukasz_Stelmach?= , Krzysztof Kozlowski , Rob Herring , Conor Dooley Cc: Olivia Mackall , Herbert Xu , Alim Akhtar , linux-samsung-soc@vger.kernel.org, linux-crypto@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/7] dt-bindings: rng: Rename exynos5250-trng to exynos-trng Date: Mon, 17 Jun 2024 19:37:37 -0500 Message-Id: <20240618003743.2975-2-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240618003743.2975-1-semen.protsenko@linaro.org> References: <20240618003743.2975-1-semen.protsenko@linaro.org> Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Exynos TRNG (True Random Number Generator) hardware block is found in various Exynos chips, not only in Exynos5250. Rename the binding doc to reflect that fact and make the naming more precise. Signed-off-by: Sam Protsenko --- .../{samsung,exynos5250-trng.yaml => samsung,exynos-trng.yaml} | 2 +- MAINTAINERS | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename Documentation/devicetree/bindings/rng/{samsung,exynos5250-trng.yaml => samsung,exynos-trng.yaml} (91%) diff --git a/Documentation/devicetree/bindings/rng/samsung,exynos5250-trng.yaml b/Documentation/devicetree/bindings/rng/samsung,exynos-trng.yaml similarity index 91% rename from Documentation/devicetree/bindings/rng/samsung,exynos5250-trng.yaml rename to Documentation/devicetree/bindings/rng/samsung,exynos-trng.yaml index 765d9f9edd6e..99c382d25c11 100644 --- a/Documentation/devicetree/bindings/rng/samsung,exynos5250-trng.yaml +++ b/Documentation/devicetree/bindings/rng/samsung,exynos-trng.yaml @@ -1,7 +1,7 @@ # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) %YAML 1.2 --- -$id: http://devicetree.org/schemas/rng/samsung,exynos5250-trng.yaml# +$id: http://devicetree.org/schemas/rng/samsung,exynos-trng.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# title: Samsung Exynos SoC True Random Number Generator diff --git a/MAINTAINERS b/MAINTAINERS index 4f09bdb5657e..511939a4c3f8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -19878,7 +19878,7 @@ SAMSUNG EXYNOS TRUE RANDOM NUMBER GENERATOR (TRNG) DRIVER M: Łukasz Stelmach L: linux-samsung-soc@vger.kernel.org S: Maintained -F: Documentation/devicetree/bindings/rng/samsung,exynos5250-trng.yaml +F: Documentation/devicetree/bindings/rng/samsung,exynos-trng.yaml F: drivers/char/hw_random/exynos-trng.c SAMSUNG FRAMEBUFFER DRIVER From patchwork Tue Jun 18 00:37:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 13701593 Received: from mail-oo1-f51.google.com (mail-oo1-f51.google.com [209.85.161.51]) (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 3220A134AB for ; Tue, 18 Jun 2024 00:37:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718671069; cv=none; b=Hkdu8KY9v0ECEaRbvw11+uko8k6z1Hl/PYa0xY/gkJz31Vudm4t9CYjQK7WaPs2nhcf4+4rz8+R6hQRJAloFQ/5JXAtfVVPOvP+7ZzGY1jQwWdqqXaQjCj3zu3M1YZncZv04PUoF///DRqo/iFkHSOZgh9lBUgmSiylBJK+Djls= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718671069; c=relaxed/simple; bh=FPECna8QubWZJWyI17d+5QqMeSrVSngVEd37TbVrJY4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WfQQiLeJUaeRqcrlxRI2RymzHdYDRMjfoyeuLXGbup5qUvhiZg4O5/uheZzGqdLxD8d7CWtu2gDvwLqOi31Zzf0hP5DtdWL+PL0CpfCFrd930CgipUrFv3eW8hJb8T4YWAB1x0H+mGRCyl4xNldJ2E2pp5pa9omC2EWfrUwPYmY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=bjmu609N; arc=none smtp.client-ip=209.85.161.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="bjmu609N" Received: by mail-oo1-f51.google.com with SMTP id 006d021491bc7-5b97a9a9b4bso2384224eaf.0 for ; Mon, 17 Jun 2024 17:37:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718671065; x=1719275865; 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=xQ++MWratnfX3umvtaDdV/3AZjItAbPo3zx0EZywnGo=; b=bjmu609NqRv2L4oqh1Xkunfp6nAsjqQpmjr/ey7aFBMEIrDCIJGs+jh9zEz+QHopjI +ZKbjYNR/dY3KI84v3A9SokmLRgxbmjOCJ66ECiwU5hrGQmz+Htp8gx+bsOMq4yQLRKM rsMgC0z13xT/5D7xBtWQQsKWUhp5V791J4ejNltPij8KY22NHoVVxQBr5q/+0CEPu7ho KIZDvQMvqKUQzOxakoH2x3D1djnHLQdzHP/1niUePtBCo2eGrbs3botTSCeUcHy4yLSD je78RJbCkBVjaM4etU9mNvsMjJgU/JyRLULZQqXnQOXMRgYP8t94Yw5y8kPOQ55XCAsL 4wzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718671065; x=1719275865; 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=xQ++MWratnfX3umvtaDdV/3AZjItAbPo3zx0EZywnGo=; b=AeEzzDWtz7RZTffb3RRDeyB5TmZoVk4S6IvkuY45NuQicljKPif7kCxGqSkWJTxTpn HSIu6PlvwdyUqzRVPldH/JToNo4R9tJulXuqBlFcniYh7fRdjPIJOm99KM5Gj75/Jz3/ pc4AodWVBbB5li9i9+3v5HwWTWP440ucnheuy++t4OJdepbEBxGVIDoC2obGMmOuJAjC qTzS4vrwfgYutwoWhs746i/O25J4Qzy5UMY9kmSt1fo+R80lNqyFPzjdR0RznXZ+eGXe R6YNTeOKgrncj/wBZGZ+LwkbW2CwIGz8ODYq/gCBEeNiIAURwYBhfcS/fwNbjQaovJrV 3Wjw== X-Forwarded-Encrypted: i=1; AJvYcCVw4lhNLB08DKc5uRQnq6UUwnZjDers20NWUonkfJrGElwEbhw0sduUoj9m2RtTm8H1qSAoKbS0Iuon4ub+GY4tjFKZRQVUFHELeD684aPNbxM= X-Gm-Message-State: AOJu0YyHBrVXVfMHnj7zj3cOqYZMWRwQwK4MkTFLWuEY78cnt75LdWIi 8B+Yq9mVMG/cAroWfGCzUpbjGsNyCqKQ8beiVCaBCtWOZHzX98ks1RzWtYytc/4= X-Google-Smtp-Source: AGHT+IFuFpjdFpuLvIdaYw3w/WCr1/gHlrImp8DoWkXpIxzm220GdkXoQwm/XTk+jxZ+CH+KzmX0Xg== X-Received: by 2002:a05:6820:161e:b0:5bb:2d23:8aeb with SMTP id 006d021491bc7-5bdadb68eb5mr13265376eaf.2.1718671065156; Mon, 17 Jun 2024 17:37:45 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd5e19e943sm1229935eaf.23.2024.06.17.17.37.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 17:37:44 -0700 (PDT) From: Sam Protsenko To: =?utf-8?q?=C5=81ukasz_Stelmach?= , Krzysztof Kozlowski , Rob Herring , Conor Dooley Cc: Olivia Mackall , Herbert Xu , Alim Akhtar , linux-samsung-soc@vger.kernel.org, linux-crypto@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/7] dt-bindings: rng: Add Exynos850 support to exynos-trng Date: Mon, 17 Jun 2024 19:37:38 -0500 Message-Id: <20240618003743.2975-3-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240618003743.2975-1-semen.protsenko@linaro.org> References: <20240618003743.2975-1-semen.protsenko@linaro.org> Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The TRNG block in Exynos850 is pretty much the same as in Exynos5250, but there are two clocks that has to be controlled to make it work: 1. Functional (operating) clock: called ACLK in Exynos850, the same as "secss" clock in Exynos5250 2. Interface (bus) clock: called PCLK in Exynos850. It has to be enabled in order to access TRNG registers Document Exynos850 compatible and the related clock changes, and provide a corresponding example for Exynos850 TRNG node with ACLK and PCLK clocks. Signed-off-by: Sam Protsenko --- .../bindings/rng/samsung,exynos-trng.yaml | 49 +++++++++++++++++-- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/rng/samsung,exynos-trng.yaml b/Documentation/devicetree/bindings/rng/samsung,exynos-trng.yaml index 99c382d25c11..e57310fa89c7 100644 --- a/Documentation/devicetree/bindings/rng/samsung,exynos-trng.yaml +++ b/Documentation/devicetree/bindings/rng/samsung,exynos-trng.yaml @@ -12,14 +12,17 @@ maintainers: properties: compatible: - const: samsung,exynos5250-trng + enum: + - samsung,exynos5250-trng + - samsung,exynos850-trng clocks: - maxItems: 1 + minItems: 1 + maxItems: 2 clock-names: - items: - - const: secss + minItems: 1 + maxItems: 2 reg: maxItems: 1 @@ -30,6 +33,35 @@ required: - clock-names - reg +allOf: + - if: + properties: + compatible: + contains: + const: samsung,exynos850-trng + + then: + properties: + clocks: + items: + - description: SSS (Security Sub System) operating clock + - description: SSS (Security Sub System) bus clock + + clock-names: + items: + - const: secss + - const: pclk + + else: + properties: + clocks: + items: + - description: SSS (Security Sub System) operating clock + + clock-names: + items: + - const: secss + additionalProperties: false examples: @@ -42,3 +74,12 @@ examples: clocks = <&clock CLK_SSS>; clock-names = "secss"; }; + - | + #include + + rng@12081400 { + compatible = "samsung,exynos850-trng"; + reg = <0x12081400 0x100>; + clocks = <&cmu_core CLK_GOUT_SSS_ACLK>, <&cmu_core CLK_GOUT_SSS_PCLK>; + clock-names = "secss", "pclk"; + }; From patchwork Tue Jun 18 00:37:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 13701592 Received: from mail-ot1-f53.google.com (mail-ot1-f53.google.com [209.85.210.53]) (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 B9BE64C7C for ; Tue, 18 Jun 2024 00:37:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718671068; cv=none; b=cL5IK9mZNrjDAEM0aj4nVIhBdRKvIuSQMNdnoQxKEBOsKj/smULLwtbdsZxv31ejNCA+u7kknrB8Qhs7mdvRnwYfTkCZmMw5CkuH1jz4kcrzQWRNTqr9DHAIJMLF375Zs2URgZnkatwOd6eq9oXoDTweN54c8cRqVG2bWiXNHUY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718671068; c=relaxed/simple; bh=147GziLrLX4hdx/jk6i77bJo/QV+4RX4Z3/r1jgnsUk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=UeHJcWyUmL5V0urTmeEDkZVKmy5KFo1vKrWAU/MsyiF/patRk+D0dR1VvnAxKKk895UOJKvljqLCwX27tNdJSiGM5wlVYcj+p+z4ehmIpCeSkkzRRjP760uJbsuEFHgn4Zzka1Gyxbg+zeLsLx0KiwsMcpr3UbQsFDTSgE3Hn1o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=FmvKCRLS; arc=none smtp.client-ip=209.85.210.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="FmvKCRLS" Received: by mail-ot1-f53.google.com with SMTP id 46e09a7af769-6f9611fc320so2195862a34.2 for ; Mon, 17 Jun 2024 17:37:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718671066; x=1719275866; 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=K0nRAEwRS+Kqa+xFeL/UdK1/42jrpGZZ3oW8XiNINwY=; b=FmvKCRLSpPZUuqMdd4YvMJHF6FQv6vOAqWRdWJuEOlwyuXukmk41d57if6bSs/Jl8K x7HXDY413PBCmrDUvfZO5haBLmK/AniB3cxcGoXvYj/yA8a8fR07VQsotiP3tS4C+t34 oOSuL1b1Q/5Q01qzwtAThgrF5PQcT3/7Fy5uoIIzEgQEycd4ai0KrZQ5OrFUsXHoiEU8 82AlZXQv7FzntktB/ZxEOArnsyyMr02hgECo4gBmlMwkjhGI4gXoxuEztT78uWIdc3uY ox9y0NrKpAXGjPOHs85Pcuy0DGd7fz9FCTsFuRnjziqINflGtyhLnAfVg53Qlo+jNAta ZGFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718671066; x=1719275866; 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=K0nRAEwRS+Kqa+xFeL/UdK1/42jrpGZZ3oW8XiNINwY=; b=Kz3kLEmJ2f9oxRHtRe+CJWqOj5AMoXZ9I0/Z2fQiHdn0d1covyTjxubrYWX2QKkJe+ hnEmwzhFnTfEY/FyTUZV+Gi7zmzt63NOHjiodRi9Dv9AdEpXtaFSHtJn3JzuMHrkHqNv waVHrPuJnXkXKe4n7GyEyX9U1zocZvA0egpwnxe220RAh2ANt9c/XFlZ0mqSNh1vOHDS wdU8E2nFFJWAk6noVmT8AevtdLcjVHpg3w12YJBDMef4ds/dwTXubcBdvig/XxKywdHF H+pUduvfpnnIZIiu2AeCtiC5eChc6SfFv+/XMTzyeIypDLKS/MhhS7Eu+oVnPp2DdNZp Wa1w== X-Forwarded-Encrypted: i=1; AJvYcCV7Swd1LcMSCQ9tgPQ4Lu16mRkk9H5qxafxdR8rDObbMCcloYKURmaKmUPiM5iEiBf0sFkjusB+c1asFVM0g8vk0Hj8F8IEBTbUh0xjQdbXeXk= X-Gm-Message-State: AOJu0YzsEjXZSx2eTAaX5fvBJ01HYBzD9xkLN8xDsZ/f/LLmCTBuCglR raFcTT27kZzKLNudqgel0FurrzTeoXqKxXHRKTlYOJlVm+7q+ojWLfwRw6Vco88= X-Google-Smtp-Source: AGHT+IGJdLC4WFJwxFevTuE9JllHcgHxe3B4leT9QNXKwBCjfTWKffWwR3974mIIt9gULbt3K2lVdg== X-Received: by 2002:a9d:66c7:0:b0:6f9:6f4b:f5ce with SMTP id 46e09a7af769-6fb93297d78mr12526107a34.8.1718671065819; Mon, 17 Jun 2024 17:37:45 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-6fb5b1eb6c8sm1738540a34.43.2024.06.17.17.37.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 17:37:45 -0700 (PDT) From: Sam Protsenko To: =?utf-8?q?=C5=81ukasz_Stelmach?= , Krzysztof Kozlowski , Rob Herring , Conor Dooley Cc: Olivia Mackall , Herbert Xu , Alim Akhtar , linux-samsung-soc@vger.kernel.org, linux-crypto@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/7] hwrng: exynos: Improve coding style Date: Mon, 17 Jun 2024 19:37:39 -0500 Message-Id: <20240618003743.2975-4-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240618003743.2975-1-semen.protsenko@linaro.org> References: <20240618003743.2975-1-semen.protsenko@linaro.org> Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Fix obvious style issues. Some of those were found with checkpatch, and some just contradict the kernel coding style guide. No functional change. Signed-off-by: Sam Protsenko Reviewed-by: Krzysztof Kozlowski --- drivers/char/hw_random/exynos-trng.c | 61 +++++++++++++--------------- 1 file changed, 29 insertions(+), 32 deletions(-) diff --git a/drivers/char/hw_random/exynos-trng.c b/drivers/char/hw_random/exynos-trng.c index 0ed5d22fe667..88a5088ed34d 100644 --- a/drivers/char/hw_random/exynos-trng.c +++ b/drivers/char/hw_random/exynos-trng.c @@ -23,45 +23,41 @@ #include #include -#define EXYNOS_TRNG_CLKDIV (0x0) - -#define EXYNOS_TRNG_CTRL (0x20) -#define EXYNOS_TRNG_CTRL_RNGEN BIT(31) - -#define EXYNOS_TRNG_POST_CTRL (0x30) -#define EXYNOS_TRNG_ONLINE_CTRL (0x40) -#define EXYNOS_TRNG_ONLINE_STAT (0x44) -#define EXYNOS_TRNG_ONLINE_MAXCHI2 (0x48) -#define EXYNOS_TRNG_FIFO_CTRL (0x50) -#define EXYNOS_TRNG_FIFO_0 (0x80) -#define EXYNOS_TRNG_FIFO_1 (0x84) -#define EXYNOS_TRNG_FIFO_2 (0x88) -#define EXYNOS_TRNG_FIFO_3 (0x8c) -#define EXYNOS_TRNG_FIFO_4 (0x90) -#define EXYNOS_TRNG_FIFO_5 (0x94) -#define EXYNOS_TRNG_FIFO_6 (0x98) -#define EXYNOS_TRNG_FIFO_7 (0x9c) -#define EXYNOS_TRNG_FIFO_LEN (8) -#define EXYNOS_TRNG_CLOCK_RATE (500000) - +#define EXYNOS_TRNG_CLKDIV 0x0 + +#define EXYNOS_TRNG_CTRL 0x20 +#define EXYNOS_TRNG_CTRL_RNGEN BIT(31) + +#define EXYNOS_TRNG_POST_CTRL 0x30 +#define EXYNOS_TRNG_ONLINE_CTRL 0x40 +#define EXYNOS_TRNG_ONLINE_STAT 0x44 +#define EXYNOS_TRNG_ONLINE_MAXCHI2 0x48 +#define EXYNOS_TRNG_FIFO_CTRL 0x50 +#define EXYNOS_TRNG_FIFO_0 0x80 +#define EXYNOS_TRNG_FIFO_1 0x84 +#define EXYNOS_TRNG_FIFO_2 0x88 +#define EXYNOS_TRNG_FIFO_3 0x8c +#define EXYNOS_TRNG_FIFO_4 0x90 +#define EXYNOS_TRNG_FIFO_5 0x94 +#define EXYNOS_TRNG_FIFO_6 0x98 +#define EXYNOS_TRNG_FIFO_7 0x9c +#define EXYNOS_TRNG_FIFO_LEN 8 +#define EXYNOS_TRNG_CLOCK_RATE 500000 struct exynos_trng_dev { - struct device *dev; - void __iomem *mem; - struct clk *clk; - struct hwrng rng; + struct device *dev; + void __iomem *mem; + struct clk *clk; + struct hwrng rng; }; static int exynos_trng_do_read(struct hwrng *rng, void *data, size_t max, bool wait) { - struct exynos_trng_dev *trng; + struct exynos_trng_dev *trng = (struct exynos_trng_dev *)rng->priv; int val; max = min_t(size_t, max, (EXYNOS_TRNG_FIFO_LEN * 4)); - - trng = (struct exynos_trng_dev *)rng->priv; - writel_relaxed(max * 8, trng->mem + EXYNOS_TRNG_FIFO_CTRL); val = readl_poll_timeout(trng->mem + EXYNOS_TRNG_FIFO_CTRL, val, val == 0, 200, 1000000); @@ -122,7 +118,7 @@ static int exynos_trng_probe(struct platform_device *pdev) trng->rng.init = exynos_trng_init; trng->rng.read = exynos_trng_do_read; - trng->rng.priv = (unsigned long) trng; + trng->rng.priv = (unsigned long)trng; platform_set_drvdata(pdev, trng); trng->dev = &pdev->dev; @@ -175,7 +171,7 @@ static int exynos_trng_probe(struct platform_device *pdev) static void exynos_trng_remove(struct platform_device *pdev) { - struct exynos_trng_dev *trng = platform_get_drvdata(pdev); + struct exynos_trng_dev *trng = platform_get_drvdata(pdev); clk_disable_unprepare(trng->clk); @@ -204,7 +200,7 @@ static int exynos_trng_resume(struct device *dev) } static DEFINE_SIMPLE_DEV_PM_OPS(exynos_trng_pm_ops, exynos_trng_suspend, - exynos_trng_resume); + exynos_trng_resume); static const struct of_device_id exynos_trng_dt_match[] = { { @@ -225,6 +221,7 @@ static struct platform_driver exynos_trng_driver = { }; module_platform_driver(exynos_trng_driver); + MODULE_AUTHOR("Łukasz Stelmach"); MODULE_DESCRIPTION("H/W TRNG driver for Exynos chips"); MODULE_LICENSE("GPL v2"); From patchwork Tue Jun 18 00:37:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 13701594 Received: from mail-oo1-f47.google.com (mail-oo1-f47.google.com [209.85.161.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 6CCB615E89 for ; Tue, 18 Jun 2024 00:37:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718671069; cv=none; b=U4zZh8W6A+eY6pAGBR4Yyxbcd/pYlZC+DXfHMzs/JHjR0NVyJFXnC+/bjDvf+scJzrhCIk6wPYTnPG7LXfXRTOHiAR8u/+beT7Ne/t2jcfQ8PRFEgr1t740UR+0Qv75qGoBp2K0oKAjbbkVYy1219O7e0SM8NSFfVZOnyPqunKs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718671069; c=relaxed/simple; bh=0XLUBor4Wy71S2SW7ou5JiqldczfvtidDdV09ttw2Rs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rXNfjp5ZU6gMkrWwjdM51fS9uxiKKUrz/kTrgFXf6gpN9jrSPUbJwe2tXsmEQQFnBnDCWvWRCABbbW32+Tf95LqBn661UfcOfoL+6GVk5s4iwT1EEHhk47+OYuZw+8Gd2C6Gu6WRoclb9jvrz927AlLA8Jg8yfBX8fLG0W/Enew= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=PUtLX58D; arc=none smtp.client-ip=209.85.161.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="PUtLX58D" Received: by mail-oo1-f47.google.com with SMTP id 006d021491bc7-5bafcb42d28so2725009eaf.0 for ; Mon, 17 Jun 2024 17:37:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718671066; x=1719275866; 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=UzEHeTFimKuQQxWwyrDcO+o5XCit+aZv+PnU9elFrsI=; b=PUtLX58DR5JgYvbCN1BHnB4DgXLXwGGYlNMeOGwGirio4667qdNIOIl2XkJdnkSYIf pwdgVyAmm5v4Zgubw9YM0UFkfKqa2ulzl0xMtZUwTTBRsOl8x2XzHHOIRGds6kanf32D w0AF0YmES4sqUq/Pvoz0eUnjwv/P3PyJh2JymMfeAZMv3ExNJSmu/5RLubFZ+gE0AIXx iqu/gyZjvIer1r74nyiiXUoDoHLSc2rsajJZ+pT4gyNmNI+1IBop0g5dAZ01GqPPwsj8 puWx4E5QqDprxCeH72wROcvdrOE4q7SvGcpRwJooDiUDsSCTmWxshzmhup2xXJXcvWkw fFpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718671066; x=1719275866; 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=UzEHeTFimKuQQxWwyrDcO+o5XCit+aZv+PnU9elFrsI=; b=oGBwBbpmGSuLoVW15w6s47nrCvJtK8g9suMDLFpO2w+IHck5pqIuwcji8PnvmGQ49b n6X8a10j4W/nR9Fn7O941UVfl/GKJWabJt2A8ac/VDxvBt9HGUsUXfchB5tjpx5I0a9D Q9k4k/ZtX/GsgzdSKXcY34nWoaEhJpL71F9VKRgU9S6fkkuCDMRtHA/WZxvinz1tOLeo pG2qNPzSDYVjbQ7dm0cUFq4ZYNdvKXOGIOuHLZMg+t/6BAMx5NK1eqa3rV9yh8gIYkIx TofZdCGl/9Ssch5lcFrIcSCKYhfmQVVn+r2LWurKkdtC1A+VYn5nwiFxxe+4CCVWd6Lt Yn4A== X-Forwarded-Encrypted: i=1; AJvYcCWfANx0C2S0e/6yf2UaqCF2KZgzHkieUdGsYmKdlLnieGWjhVeTs6qW9XQ2+38OhZAqllFgiSxiP0nliNSfiOMNCabNhAddOsFshV5t53NPuPQ= X-Gm-Message-State: AOJu0Yy8wsRPTZsjLVeItMo9C4FHjpV4W6PaGRjvqZPPdiIwhsWoKV5C agManhoFCbx+0EqVg62s+8Lbfjl+/GeXtJl0XwmaLswp8WnN0Kh1RlhbGxOUAxo= X-Google-Smtp-Source: AGHT+IGfQPJkGUEmf7bvL5EHIQMFh2lzC9gdoJFes+mvAbebBn2gmOigq0ygMHUP4CBQUyY/zDxPJA== X-Received: by 2002:a05:6820:80c:b0:5ba:f20c:361b with SMTP id 006d021491bc7-5bdadc84948mr13508706eaf.8.1718671066504; Mon, 17 Jun 2024 17:37:46 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd5f2a1801sm1216364eaf.37.2024.06.17.17.37.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 17:37:46 -0700 (PDT) From: Sam Protsenko To: =?utf-8?q?=C5=81ukasz_Stelmach?= , Krzysztof Kozlowski , Rob Herring , Conor Dooley Cc: Olivia Mackall , Herbert Xu , Alim Akhtar , linux-samsung-soc@vger.kernel.org, linux-crypto@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/7] hwrng: exynos: Implement bus clock control Date: Mon, 17 Jun 2024 19:37:40 -0500 Message-Id: <20240618003743.2975-5-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240618003743.2975-1-semen.protsenko@linaro.org> References: <20240618003743.2975-1-semen.protsenko@linaro.org> Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Some SoCs like Exynos850 might require the SSS bus clock (PCLK) to be enabled in order to access TRNG registers. Add and handle optional PCLK clock accordingly to make it possible. Signed-off-by: Sam Protsenko --- drivers/char/hw_random/exynos-trng.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/char/hw_random/exynos-trng.c b/drivers/char/hw_random/exynos-trng.c index 88a5088ed34d..4520a280134c 100644 --- a/drivers/char/hw_random/exynos-trng.c +++ b/drivers/char/hw_random/exynos-trng.c @@ -47,7 +47,8 @@ struct exynos_trng_dev { struct device *dev; void __iomem *mem; - struct clk *clk; + struct clk *clk; /* operating clock */ + struct clk *pclk; /* bus clock */ struct hwrng rng; }; @@ -141,10 +142,23 @@ static int exynos_trng_probe(struct platform_device *pdev) goto err_clock; } + trng->pclk = devm_clk_get_optional(&pdev->dev, "pclk"); + if (IS_ERR(trng->pclk)) { + ret = dev_err_probe(&pdev->dev, PTR_ERR(trng->pclk), + "cannot get pclk"); + goto err_clock; + } + + ret = clk_prepare_enable(trng->pclk); + if (ret) { + dev_err(&pdev->dev, "Could not enable the pclk.\n"); + goto err_clock; + } + ret = clk_prepare_enable(trng->clk); if (ret) { dev_err(&pdev->dev, "Could not enable the clk.\n"); - goto err_clock; + goto err_clock_enable; } ret = devm_hwrng_register(&pdev->dev, &trng->rng); @@ -160,6 +174,9 @@ static int exynos_trng_probe(struct platform_device *pdev) err_register: clk_disable_unprepare(trng->clk); +err_clock_enable: + clk_disable_unprepare(trng->pclk); + err_clock: pm_runtime_put_noidle(&pdev->dev); @@ -174,6 +191,7 @@ static void exynos_trng_remove(struct platform_device *pdev) struct exynos_trng_dev *trng = platform_get_drvdata(pdev); clk_disable_unprepare(trng->clk); + clk_disable_unprepare(trng->pclk); pm_runtime_put_sync(&pdev->dev); pm_runtime_disable(&pdev->dev); From patchwork Tue Jun 18 00:37:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 13701596 Received: from mail-ot1-f42.google.com (mail-ot1-f42.google.com [209.85.210.42]) (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 3367118C22 for ; Tue, 18 Jun 2024 00:37:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718671071; cv=none; b=jZ/0UnTsParXUVDAyF5eW9uaUFa2QtQaAbBZHj3Sta25V+P1fdts6XDHPONwOg158LIm/ebEKXgckXpugLYyZbHXGJTFkIcJ96imKvEo6pQ004TOjH5pLqQQktwJ7fnUMgzW8YwFel4ONoQdmYKt9mbQ5umEO4s192bxD1t8aaA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718671071; c=relaxed/simple; bh=wlWzDxin5qYXlpQazrMup6eynq5pG66YPpoBw8a9PUg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=U5vSBsubLTzKtWU51fQ6786OIvaY8KHRQtZof7QA41e+ZrScC+I8wTRREoCyQyFJDtemtJkq/Wzy44fSHQ22LQNGgss7/NMNhQTFb07RZ2cNrnUKV24UoAHkbIRaOt59kLNmjRIIWWZrqp5Rt2p1MiwK4TPXrgYb2e5+bmYtKeU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=WFA8rj14; arc=none smtp.client-ip=209.85.210.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="WFA8rj14" Received: by mail-ot1-f42.google.com with SMTP id 46e09a7af769-6f8d0a1e500so3684626a34.3 for ; Mon, 17 Jun 2024 17:37:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718671067; x=1719275867; 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=HF3yj9NB+f1P6unzjOcT62NKC0TjmglEhNnCfK/YhxY=; b=WFA8rj14LtNgzPrQAwBF4lct3zT3G8IsQy8ljY4m6W09oEsYNwX8dPxozjFE5ykh3/ UqulAJfowebDYLub9LzsvC9LEPRQVkGQW+V87q/SqBrUL70lI6HQhA5rD8Q3+4bljkr/ XlLPOcFTn7fXwTpgGWEW3Y6lYSCmPdVG7OI8vaWX5KNEf8rvkXMNtI4ogri01MhdQb3n vYKtkO5a2LwfZDIHq5ubTE4e6cJr9CQ684HosuaVd00+ZnHmGeDY1aOFbNV48PVInYYc t3HGinQmk3JRVEIUl0BToEqA1e5bxL/dY/NiJgv/AKgHrN6Aus4NEPfFyTiLQ+dJj26j rA+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718671067; x=1719275867; 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=HF3yj9NB+f1P6unzjOcT62NKC0TjmglEhNnCfK/YhxY=; b=kf0Er3YJtXAJYo9x/e+kUJeWs2vkI3LElYW2TaMnNAAhDQJA7iCCNpXG+6E84Tely5 WCqjoYJ1+99V1xaEgne5tJp3LNRmWbQYLgVl3ZKcc5lgi+SNwTgP0wh3JKy8ImZm9oRZ V2+/gTwxUoLTSJVhGqu0mwAwRIjj1KD9Cyp7nSALYMlsPbIcfhx40v8E9vYW1Mgce/Qc nQqKVy36neFj5riQ7M4HLqFYECnxrnOttrF7UDPyhGIhG257vwtDNvlmVMFkbQcw0b+J dy4gZOr6utOP5rpsRFkFtxhDL+uh7IXtEkEMRU3udgwViBirRutC0kZM+n372850j7rO ZGXA== X-Forwarded-Encrypted: i=1; AJvYcCXavIYQv/8Y3r3r9qDhl8tUZYWmto18kZOA06YQfl8lYsrpT9xZWJyuvCLMhYDEEFq/E3JZb4j4SD/IkpCWR4mxtxKJAm9m3m0R81qivYuk/L4= X-Gm-Message-State: AOJu0Yw81gnlGzERF11RSG5U5fmFEfW9GKFr3+L/ISdkNrQ5ZfHrbGyo Z+aZKwm9mPPFQXtxdtfKebANFbGKjNcEMyjl2wUhuxekwklbR5Xql4KDr+m//+E= X-Google-Smtp-Source: AGHT+IHKCaUtR8KPhYQJdoRvRQDarGdrRA43rA9XABMCQXk9wPvcC+mPa8iPETKzce2FCdEkupbjPA== X-Received: by 2002:a05:6830:1be2:b0:6f9:ce8e:5da1 with SMTP id 46e09a7af769-6fb9364aa32mr12434212a34.26.1718671067124; Mon, 17 Jun 2024 17:37:47 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-6fb5afab833sm1686856a34.10.2024.06.17.17.37.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 17:37:46 -0700 (PDT) From: Sam Protsenko To: =?utf-8?q?=C5=81ukasz_Stelmach?= , Krzysztof Kozlowski , Rob Herring , Conor Dooley Cc: Olivia Mackall , Herbert Xu , Alim Akhtar , linux-samsung-soc@vger.kernel.org, linux-crypto@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/7] hwrng: exynos: Add SMC based TRNG operation Date: Mon, 17 Jun 2024 19:37:41 -0500 Message-Id: <20240618003743.2975-6-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240618003743.2975-1-semen.protsenko@linaro.org> References: <20240618003743.2975-1-semen.protsenko@linaro.org> Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On some Exynos chips like Exynos850 the access to Security Sub System (SSS) registers is protected with TrustZone, and therefore only possible from EL3 monitor software. The Linux kernel is running in EL1, so the only way for the driver to obtain TRNG data is via SMC calls to EL3 monitor. Implement such SMC operation and use it when QUIRK_SMC is set in the corresponding chip driver data. Signed-off-by: Sam Protsenko Reviewed-by: Krzysztof Kozlowski --- drivers/char/hw_random/exynos-trng.c | 130 ++++++++++++++++++++++++--- 1 file changed, 120 insertions(+), 10 deletions(-) diff --git a/drivers/char/hw_random/exynos-trng.c b/drivers/char/hw_random/exynos-trng.c index 4520a280134c..98b7a8ebb909 100644 --- a/drivers/char/hw_random/exynos-trng.c +++ b/drivers/char/hw_random/exynos-trng.c @@ -10,6 +10,7 @@ * Krzysztof Kozłowski */ +#include #include #include #include @@ -22,6 +23,7 @@ #include #include #include +#include #define EXYNOS_TRNG_CLKDIV 0x0 @@ -44,16 +46,40 @@ #define EXYNOS_TRNG_FIFO_LEN 8 #define EXYNOS_TRNG_CLOCK_RATE 500000 +#define QUIRK_SMC BIT(0) + +#define EXYNOS_SMC_CALL_VAL(func_num) \ + ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \ + ARM_SMCCC_SMC_32, \ + ARM_SMCCC_OWNER_SIP, \ + func_num) + +/* SMC command for DTRNG access */ +#define SMC_CMD_RANDOM EXYNOS_SMC_CALL_VAL(0x1012) + +/* SMC_CMD_RANDOM: arguments */ +#define HWRNG_INIT 0x0 +#define HWRNG_EXIT 0x1 +#define HWRNG_GET_DATA 0x2 +#define HWRNG_RESUME 0x3 + +/* SMC_CMD_RANDOM: return values */ +#define HWRNG_RET_OK 0x0 +#define HWRNG_RET_RETRY_ERROR 0x2 + +#define HWRNG_MAX_TRIES 100 + struct exynos_trng_dev { struct device *dev; void __iomem *mem; struct clk *clk; /* operating clock */ struct clk *pclk; /* bus clock */ struct hwrng rng; + unsigned long quirks; }; -static int exynos_trng_do_read(struct hwrng *rng, void *data, size_t max, - bool wait) +static int exynos_trng_do_read_reg(struct hwrng *rng, void *data, size_t max, + bool wait) { struct exynos_trng_dev *trng = (struct exynos_trng_dev *)rng->priv; int val; @@ -70,7 +96,40 @@ static int exynos_trng_do_read(struct hwrng *rng, void *data, size_t max, return max; } -static int exynos_trng_init(struct hwrng *rng) +static int exynos_trng_do_read_smc(struct hwrng *rng, void *data, size_t max, + bool wait) +{ + struct arm_smccc_res res; + u32 *buf = data; + unsigned int copied = 0; + int tries = 0; + + while (copied < max) { + arm_smccc_smc(SMC_CMD_RANDOM, HWRNG_GET_DATA, 0, 0, 0, 0, 0, 0, + &res); + switch (res.a0) { + case HWRNG_RET_OK: + *buf++ = res.a2; + *buf++ = res.a3; + copied += 8; + tries = 0; + break; + case HWRNG_RET_RETRY_ERROR: + if (!wait) + return copied; + if (++tries >= HWRNG_MAX_TRIES) + return copied; + cond_resched(); + break; + default: + return -EIO; + } + } + + return copied; +} + +static int exynos_trng_init_reg(struct hwrng *rng) { struct exynos_trng_dev *trng = (struct exynos_trng_dev *)rng->priv; unsigned long sss_rate; @@ -103,6 +162,17 @@ static int exynos_trng_init(struct hwrng *rng) return 0; } +static int exynos_trng_init_smc(struct hwrng *rng) +{ + struct arm_smccc_res res; + + arm_smccc_smc(SMC_CMD_RANDOM, HWRNG_INIT, 0, 0, 0, 0, 0, 0, &res); + if (res.a0 != HWRNG_RET_OK) + return -EIO; + + return 0; +} + static int exynos_trng_probe(struct platform_device *pdev) { struct exynos_trng_dev *trng; @@ -112,21 +182,29 @@ static int exynos_trng_probe(struct platform_device *pdev) if (!trng) return ret; + platform_set_drvdata(pdev, trng); + trng->dev = &pdev->dev; + + trng->quirks = (unsigned long)device_get_match_data(&pdev->dev); + trng->rng.name = devm_kstrdup(&pdev->dev, dev_name(&pdev->dev), GFP_KERNEL); if (!trng->rng.name) return ret; - trng->rng.init = exynos_trng_init; - trng->rng.read = exynos_trng_do_read; trng->rng.priv = (unsigned long)trng; - platform_set_drvdata(pdev, trng); - trng->dev = &pdev->dev; + if (trng->quirks & QUIRK_SMC) { + trng->rng.init = exynos_trng_init_smc; + trng->rng.read = exynos_trng_do_read_smc; + } else { + trng->rng.init = exynos_trng_init_reg; + trng->rng.read = exynos_trng_do_read_reg; - trng->mem = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(trng->mem)) - return PTR_ERR(trng->mem); + trng->mem = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(trng->mem)) + return PTR_ERR(trng->mem); + } pm_runtime_enable(&pdev->dev); ret = pm_runtime_resume_and_get(&pdev->dev); @@ -190,6 +268,13 @@ static void exynos_trng_remove(struct platform_device *pdev) { struct exynos_trng_dev *trng = platform_get_drvdata(pdev); + if (trng->quirks & QUIRK_SMC) { + struct arm_smccc_res res; + + arm_smccc_smc(SMC_CMD_RANDOM, HWRNG_EXIT, 0, 0, 0, 0, 0, 0, + &res); + } + clk_disable_unprepare(trng->clk); clk_disable_unprepare(trng->pclk); @@ -199,6 +284,16 @@ static void exynos_trng_remove(struct platform_device *pdev) static int exynos_trng_suspend(struct device *dev) { + struct exynos_trng_dev *trng = dev_get_drvdata(dev); + struct arm_smccc_res res; + + if (trng->quirks & QUIRK_SMC) { + arm_smccc_smc(SMC_CMD_RANDOM, HWRNG_EXIT, 0, 0, 0, 0, 0, 0, + &res); + if (res.a0 != HWRNG_RET_OK) + return -EIO; + } + pm_runtime_put_sync(dev); return 0; @@ -206,6 +301,7 @@ static int exynos_trng_suspend(struct device *dev) static int exynos_trng_resume(struct device *dev) { + struct exynos_trng_dev *trng = dev_get_drvdata(dev); int ret; ret = pm_runtime_resume_and_get(dev); @@ -214,6 +310,20 @@ static int exynos_trng_resume(struct device *dev) return ret; } + if (trng->quirks & QUIRK_SMC) { + struct arm_smccc_res res; + + arm_smccc_smc(SMC_CMD_RANDOM, HWRNG_RESUME, 0, 0, 0, 0, 0, 0, + &res); + if (res.a0 != HWRNG_RET_OK) + return -EIO; + + arm_smccc_smc(SMC_CMD_RANDOM, HWRNG_INIT, 0, 0, 0, 0, 0, 0, + &res); + if (res.a0 != HWRNG_RET_OK) + return -EIO; + } + return 0; } From patchwork Tue Jun 18 00:37:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 13701595 Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) (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 CB7C54C8F for ; Tue, 18 Jun 2024 00:37:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718671071; cv=none; b=bnyE9zBTOwIUCOSO1HXkIqPUMJIBY/3qAaGAycFjwfSxOJNP4UInL7JUMDvu67ka20rSiEFoH7Y/GwGWNAxJXxecKyqY25IO2V0Zf6fQ2gA3c4YDoaGb828V6bqqOyTbPKYiBZN2+xju33oj4w8a64878umP2Ni0wbkb098maPA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718671071; c=relaxed/simple; bh=Hvedb86I9a8BBqTvsputX1R5bqo1eQlMeauBsu3wu2E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZEroa2Yeoebo0oyxmBjFz7lAT0LE0vl0DKANUPNfoH9qgsola2g2G33qqey3/M8yjqWXILtujCtqFYSEcGTkj+0VMk5mBLf5XVMnciC4bUX0VKi+r6fesQUKM1LY4iFeZYR6H3UXML7zSGho7N8Ue/OF9c534wmXB1TwAEvX2j8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=LmFsQD2I; arc=none smtp.client-ip=209.85.210.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="LmFsQD2I" Received: by mail-ot1-f52.google.com with SMTP id 46e09a7af769-6f361af4cb6so1486089a34.3 for ; Mon, 17 Jun 2024 17:37:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718671068; x=1719275868; 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=cJM+FjwIt8Vsqi9DQbiY4E0tjpC6f+V3n620JM6N4W4=; b=LmFsQD2Invf78Dc5T6F0FvvEXN7h/hoebIyiDd0WL59W0TiXbLQRXF3cOs5OwYKbGI XrpeUxQYJU13IsSJujiRYQd9bhKCdXk1TA72yCSpyGU/t8jxkMlvHfRWhEuD3PXi+KnQ BjOHtqe5zpc7dFwqgRqHGfUKwmJZ6daxw5nJ2A5PmvdaV4mJskUMkMuenfBIQxBFqbZN tY20xeqQZQAKaKHqgTavTPRthhOSm3OoTaKjv8jCb6sxdhBUObajg1ImquwmIkLeyLbW PUddStxaoeDk6VuC1b3AOxoFhNYRz3TM7MbjLjqzoZuKIjtYoVawTruHp1GQTnnfg9TP 7PlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718671068; x=1719275868; 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=cJM+FjwIt8Vsqi9DQbiY4E0tjpC6f+V3n620JM6N4W4=; b=c3WIzfzOTNJQ0btcLPmdy3T5gxNVWvp5ybnzs7fnato1zq5XST8s1z3Z/IJG320Oze ONM291FGJEsW9r+7Xu6fYknVlrDLJeZMzddTERaEPNYF3O+iuUPUCIk+18ZdD7OmBma1 G/htTuIYC0TLEyew+/IQQsI7/ySiLuS18JqTC68leB7ElaA+PwsTOYbYT40vQeY5bz4G VwoiQ8l/qxj7xwn866BXt1RF+ce5QX5x6CrxJkhlxupDZtm2ENimqomXdWO8mARKrIVJ 6lXW0L8yjK7A1h9exZpHJ3vKUQZk3znB3nP+Lhz0MUzuTdTW52uF20fQCWQZXQ+AI5hE K78A== X-Forwarded-Encrypted: i=1; AJvYcCWnAsOs113b8wDqsu42w/GaRbTswTwqzazWOM16Z1BWw2whCdwUqoSXLiK//x+/yrr+hOLu43/ERyf/U9sf8SWOi97hNiuIZDFStm6MT1jq4eg= X-Gm-Message-State: AOJu0Yx/hfvPtpTE4P+mNbTMQJ2tm12zzGErIbL6lx0L5VSYnwI+nawM C7/T/TroYQpp3F9BOENOkxmWlgth7TRVU25ElnCkR3BLB3qfhNmrvMSzjN33VOo= X-Google-Smtp-Source: AGHT+IHmWqNe1qFCpia0kcsa+KwsVizvSzvqatZv/DcZrfeCuQFKkxSB7UvgdM255Z2koLHPoO/haQ== X-Received: by 2002:a9d:758c:0:b0:6f9:6786:485d with SMTP id 46e09a7af769-6fb93b1ef3cmr12795074a34.37.1718671067847; Mon, 17 Jun 2024 17:37:47 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd5e0874b7sm1324092eaf.14.2024.06.17.17.37.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 17:37:47 -0700 (PDT) From: Sam Protsenko To: =?utf-8?q?=C5=81ukasz_Stelmach?= , Krzysztof Kozlowski , Rob Herring , Conor Dooley Cc: Olivia Mackall , Herbert Xu , Alim Akhtar , linux-samsung-soc@vger.kernel.org, linux-crypto@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 6/7] hwrng: exynos: Enable Exynos850 support Date: Mon, 17 Jun 2024 19:37:42 -0500 Message-Id: <20240618003743.2975-7-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240618003743.2975-1-semen.protsenko@linaro.org> References: <20240618003743.2975-1-semen.protsenko@linaro.org> Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add Exynos850 compatible and its driver data. It's only possible to access TRNG block via SMC calls in Exynos850, so specify that fact using QUIRK_SMC in the driver data. Signed-off-by: Sam Protsenko --- drivers/char/hw_random/exynos-trng.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/char/hw_random/exynos-trng.c b/drivers/char/hw_random/exynos-trng.c index 98b7a8ebb909..3368a08df9ce 100644 --- a/drivers/char/hw_random/exynos-trng.c +++ b/drivers/char/hw_random/exynos-trng.c @@ -333,6 +333,9 @@ static DEFINE_SIMPLE_DEV_PM_OPS(exynos_trng_pm_ops, exynos_trng_suspend, static const struct of_device_id exynos_trng_dt_match[] = { { .compatible = "samsung,exynos5250-trng", + }, { + .compatible = "samsung,exynos850-trng", + .data = (void *)QUIRK_SMC, }, { }, }; From patchwork Tue Jun 18 00:37:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 13701597 Received: from mail-oo1-f54.google.com (mail-oo1-f54.google.com [209.85.161.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 AF94B134AB for ; Tue, 18 Jun 2024 00:37:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718671073; cv=none; b=jAN7PEGZ+EyMTvxcC9n1Fn1Bw8X7ENyh7PQZEDN6PaT0ijmejqt60Zm7ycz7u+UHtmvVBUuMMR4glSmnowfwYQPNG1GIo6RGupT/LwDLDBKRYtv/vON4623xfhjGiFPi2B+ZbizpscHcwFe/OYL48rEKUdknnMJ9AdTrZNy/pJs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718671073; c=relaxed/simple; bh=idQsCXTRSpteqMQ/ApU8QqN2v+CejLFr+G+P9eZMvmA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RNWABTZcPyIoVee2MgLMnMLBY3opAMlallUr3tWiy4l3CufxGop+tot2FidhEa53AJD8d/Uhqph+kPkqlzEIC3i+7cwMBy+L3GLS+dxeXbLyMmz6NLbxlsD8Zy4KtMmIrHsQlWGqWw4610F91i9gI8kJLytnYW0dkAv8aD2Nj4w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Rq2edSdo; arc=none smtp.client-ip=209.85.161.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Rq2edSdo" Received: by mail-oo1-f54.google.com with SMTP id 006d021491bc7-5b9a35a0901so1664863eaf.0 for ; Mon, 17 Jun 2024 17:37:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718671069; x=1719275869; 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=q/EO8T5rRTkiZ8LbuFbhP2DGGAGyuLlPjhaKm+CoFdc=; b=Rq2edSdoPiP/PVPV51jRdJNi/JGzv7NjujvKFSAc+VlJ+kg6PifKAO8X2a9+FyTjhi 4x6OQFQ5qCmlFBdwTeR9ItFl/tLIW+liY7bmPnCtja4v9HyPwVukt3tUPInsORSB+OAV 44rBSezwB+ijG2u7TWIMczkBlCJb+ecQ+T9bcgP7PG5btvUsOYqjqmQ1UH8japLMmIRL CA1hSYfdiqfUd6HYLBTOsCfhhQHy3XScL0YXmbMtiqjtHp33Yg56dLLVj8WIRTrrQHNi 65Kj/dOkycuJp62P4sAaJIBrYwzb9ucdrSN2PIVCs+Rwz7/ejZqZ8OeFkMHwgwbIPoqQ sj7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718671069; x=1719275869; 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=q/EO8T5rRTkiZ8LbuFbhP2DGGAGyuLlPjhaKm+CoFdc=; b=mhXmcpA76W5cM6FX/TvkOW7d6gjOe1hcO+dQOHlhufLSs3xdNbFfs48f7ZZ/qJydPZ rt/8UH+Rj45XI2zzxzbp/RdqJYdlvq5yfw0tAcXinskaXJ9cxXpMTIBo5CjSd2viSVOz 8ouioXLigpONzwr3WaLv3uxaty2m+54hwFDoHyBJBJQdLjDm6gF+BPtiDSyIDW2w0ruW Ff2GUmNi+QZ16+ocvWQBK+IWez/p6j+kqZw9X3TZh5SlFRfBDz+cmOwZn9Be5HbRlsrO 6CdO9ROVdU/48+V+LIWI+B2T2MK4D5Y7RB/8xBcjX0R4nKjdhzV3Zd95bKNvFlE0e8bk mhEQ== X-Forwarded-Encrypted: i=1; AJvYcCXt1DfuJrp5C0ambhPV+9eY36yP76c0XYYBFXq10s5AJNKBBnGLEKCkZo4awXGVBTGEahNGUsM7vpRneuTXl6wGT0fRyIXZDhN1jaljVsU9TKU= X-Gm-Message-State: AOJu0YygS5gUFItP0CTUkloXIUwwDv+5E6KOAT1dpiFfIF3L5k8eoOOn wK4FxtyNAuxZv4yx4lsi169QaJvP7KOUC8jJO0pHaB16BURBVpjLgJe7BEHwKkg= X-Google-Smtp-Source: AGHT+IEcoB3JmFJ9IpjpkDLM0gXNp4DcLepn0oB2jv35HwAPRgPQt+5YDdLNa1XcS8JrDiT3nZnRlg== X-Received: by 2002:a4a:7651:0:b0:5bd:c2b0:f599 with SMTP id 006d021491bc7-5bdc2b0f7d3mr5945744eaf.9.1718671068698; Mon, 17 Jun 2024 17:37:48 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd5e19a4e7sm1320770eaf.20.2024.06.17.17.37.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 17:37:48 -0700 (PDT) From: Sam Protsenko To: =?utf-8?q?=C5=81ukasz_Stelmach?= , Krzysztof Kozlowski , Rob Herring , Conor Dooley Cc: Olivia Mackall , Herbert Xu , Alim Akhtar , linux-samsung-soc@vger.kernel.org, linux-crypto@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 7/7] arm64: dts: exynos850: Enable TRNG Date: Mon, 17 Jun 2024 19:37:43 -0500 Message-Id: <20240618003743.2975-8-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240618003743.2975-1-semen.protsenko@linaro.org> References: <20240618003743.2975-1-semen.protsenko@linaro.org> Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add True Random Number Generator (TRNG) node to Exynos850 SoC dtsi. Signed-off-by: Sam Protsenko --- arch/arm64/boot/dts/exynos/exynos850.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/boot/dts/exynos/exynos850.dtsi b/arch/arm64/boot/dts/exynos/exynos850.dtsi index 0706c8534ceb..f1c8b4613cbc 100644 --- a/arch/arm64/boot/dts/exynos/exynos850.dtsi +++ b/arch/arm64/boot/dts/exynos/exynos850.dtsi @@ -416,6 +416,14 @@ pinctrl_core: pinctrl@12070000 { interrupts = ; }; + trng: rng@12081400 { + compatible = "samsung,exynos850-trng"; + reg = <0x12081400 0x100>; + clocks = <&cmu_core CLK_GOUT_SSS_ACLK>, + <&cmu_core CLK_GOUT_SSS_PCLK>; + clock-names = "secss", "pclk"; + }; + pinctrl_hsi: pinctrl@13430000 { compatible = "samsung,exynos850-pinctrl"; reg = <0x13430000 0x1000>;