From patchwork Wed Nov 22 12:56:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viacheslav X-Patchwork-Id: 13464846 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 B68BCC61D9B for ; Wed, 22 Nov 2023 12:57:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9hj/OPFwdgugoUaoHZcgUV1z/n+ypphzuU7dAmM0Sj8=; b=CwMkY7rqeV1slT jAeizsXekqE1IaUzK26EGAKm2fKX3UBdtdGE1YEo9vppJ8uFQmCsp16V7OlWnZH0oKKjkmpm6vNSR dzaWKV16vMkL5+fBT1dHrL6y2ACUBbqQaI+pqJ71Xrsb1gcTLak+vBhPjhuFWCx2BTrSzOw/ovSe5 dfbGMHvwPCD6BRTXATy3zdMHrTXVVtf00XbSoVTJGHwo/vFMPMJASRgEhFwE3N5O8hVlxsweNAw5/ cYeL29ugEGhzxdVXqIZm5HzemEMRjOwpwbai1/ulxV69xuKGoB5T49L87J51ib10uQ3K4cETUwZdr YJXBCnwHhsj8uA55jkKA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5mmz-001swp-1d; Wed, 22 Nov 2023 12:57:09 +0000 Received: from mx.msync.work ([62.182.159.68]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5mmr-001sqQ-0k; Wed, 22 Nov 2023 12:57:05 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id BFAD0540A1; Wed, 22 Nov 2023 12:56:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lexina.in; s=dkim; t=1700657813; h=from:subject:date:message-id:to:mime-version: content-transfer-encoding:in-reply-to:references; bh=wZJcknLSQE6kdQ1bjcwbk6f5DDGjp+KGewdb43Z6bVU=; b=emeAcex7MTdNQYItOcD8oAXdXllmUPtwiSxVek/oU9dagw+hjG40EtoNTlqEiT7PBGGv5p Tw4A+4EwhwpzNK1NR/cVAvuAupb1zlpevsD16mCUDfSv9ZVHyGUO18dFsA5DCQg1LAPI4I NPRHb+VTA2Ny2NYi5koOIEOIkBIhdd1O/5t5Cc1riemheMwILWzeZiyZlCWf/5/RpWg/kF WYQXLYhgeDqDKV5g09aPS0h1kkKUmqUWbJDEPU3fOwKwU7rNU8R5d+Mx+IUZXFgyfhILUA 2fuzAv46AropR7GHODaAOFlMsO9A/Bxinw1qPAO2ZJsrTWqVcNIfZgM1xmM2nw== From: Viacheslav Bocharov To: Neil Armstrong , Jerome Brunet , Kevin Hilman , Martin Blumenstingl , linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 1/5] soc: amlogic: meson-gx-socinfo: move common code to header file Date: Wed, 22 Nov 2023 15:56:39 +0300 Message-Id: <20231122125643.1717160-2-adeep@lexina.in> In-Reply-To: <20231122125643.1717160-1-adeep@lexina.in> References: <20231122125643.1717160-1-adeep@lexina.in> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5915; h=from:subject; bh=5lDOXBX94eQyb3bj1qrCKOVZy2f8VFuTwJBZrTGTfS8=; b=owGbwMvMwCHmnhFhrJcZuJTxtFoSQ2rstyNT4n5meL12Twx8OXWtnueVUnEp3foo/U9SB7vuSBuU Rhh1lLIwiHEwyIopsoR1BE3d57H64sQFRgdg5rAygQxh4OIUgIn8DGZk+LejpoBpQ8nKiNOrzVZUpu b879gglvdhlYes3MZpbh65LYwM5w9JLb2bZGIlyvTLPu7tPHfFMEWpIMmF4Vx6TelTxNPZAQ== X-Developer-Key: i=adeep@lexina.in; a=openpgp; fpr=E2FA1A767ACB0716E02E3E7AEE36B110025A8DFA X-Last-TLS-Session-Version: TLSv1.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231122_045701_990415_460CF44D X-CRM114-Status: GOOD ( 12.92 ) 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 Move common constants and inline functions from meson-gx-socinfo driver to header file Signed-off-by: Viacheslav Bocharov --- .../soc/amlogic/meson-gx-socinfo-internal.h | 99 +++++++++++++++++++ drivers/soc/amlogic/meson-gx-socinfo.c | 80 +-------------- 2 files changed, 100 insertions(+), 79 deletions(-) create mode 100644 drivers/soc/amlogic/meson-gx-socinfo-internal.h diff --git a/drivers/soc/amlogic/meson-gx-socinfo-internal.h b/drivers/soc/amlogic/meson-gx-socinfo-internal.h new file mode 100644 index 000000000000..884cf8fb580f --- /dev/null +++ b/drivers/soc/amlogic/meson-gx-socinfo-internal.h @@ -0,0 +1,99 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2017 BayLibre, SAS + * Copyright (C) 2023 JetHome + * + * Author: Neil Armstrong + * Author: Viacheslav Bocharov + */ + +#ifndef _MESON_GX_SOCINFO_INTERNAL_H_ +#define _MESON_GX_SOCINFO_INTERNAL_H_ + +#include + +#define AO_SEC_SD_CFG8 0xe0 +#define AO_SEC_SOCINFO_OFFSET AO_SEC_SD_CFG8 + +#define SOCINFO_MAJOR GENMASK(31, 24) +#define SOCINFO_PACK GENMASK(23, 16) +#define SOCINFO_MINOR GENMASK(15, 8) +#define SOCINFO_MISC GENMASK(7, 0) + +static const struct meson_gx_soc_id { + const char *name; + unsigned int id; +} soc_ids[] = { + { "GXBB", 0x1f }, + { "GXTVBB", 0x20 }, + { "GXL", 0x21 }, + { "GXM", 0x22 }, + { "TXL", 0x23 }, + { "TXLX", 0x24 }, + { "AXG", 0x25 }, + { "GXLX", 0x26 }, + { "TXHD", 0x27 }, + { "G12A", 0x28 }, + { "G12B", 0x29 }, + { "SM1", 0x2b }, + { "A1", 0x2c }, +}; + + +static const struct meson_gx_package_id { + const char *name; + unsigned int major_id; + unsigned int pack_id; + unsigned int pack_mask; +} soc_packages[] = { + { "S905", 0x1f, 0, 0x20 }, /* pack_id != 0x20 */ + { "S905H", 0x1f, 0x3, 0xf }, /* pack_id & 0xf == 0x3 */ + { "S905M", 0x1f, 0x20, 0xf0 }, /* pack_id == 0x20 */ + { "S905D", 0x21, 0, 0xf0 }, + { "S905X", 0x21, 0x80, 0xf0 }, + { "S905W", 0x21, 0xa0, 0xf0 }, + { "S905L", 0x21, 0xc0, 0xf0 }, + { "S905M2", 0x21, 0xe0, 0xf0 }, + { "S805X", 0x21, 0x30, 0xf0 }, + { "S805Y", 0x21, 0xb0, 0xf0 }, + { "S912", 0x22, 0, 0x0 }, /* Only S912 is known for GXM */ + { "962X", 0x24, 0x10, 0xf0 }, + { "962E", 0x24, 0x20, 0xf0 }, + { "A113X", 0x25, 0x37, 0xff }, + { "A113X", 0x25, 0x43, 0xff }, + { "A113D", 0x25, 0x22, 0xff }, + { "S905D2", 0x28, 0x10, 0xf0 }, + { "S905Y2", 0x28, 0x30, 0xf0 }, + { "S905X2", 0x28, 0x40, 0xf0 }, + { "A311D", 0x29, 0x10, 0xf0 }, + { "S922X", 0x29, 0x40, 0xf0 }, + { "S905D3", 0x2b, 0x4, 0xf5 }, + { "S905X3", 0x2b, 0x5, 0xf5 }, + { "S905X3", 0x2b, 0x10, 0x3f }, + { "S905D3", 0x2b, 0x30, 0x3f }, + { "A113L", 0x2c, 0x0, 0xf8 }, +}; + + +static inline unsigned int socinfo_to_major(u32 socinfo) +{ + return FIELD_GET(SOCINFO_MAJOR, socinfo); +} + +static inline unsigned int socinfo_to_minor(u32 socinfo) +{ + return FIELD_GET(SOCINFO_MINOR, socinfo); +} + +static inline unsigned int socinfo_to_pack(u32 socinfo) +{ + return FIELD_GET(SOCINFO_PACK, socinfo); +} + +static inline unsigned int socinfo_to_misc(u32 socinfo) +{ + return FIELD_GET(SOCINFO_MISC, socinfo); +} + +#endif /* _MESON_GX_SOCINFO_INTERNAL_H_ */ + diff --git a/drivers/soc/amlogic/meson-gx-socinfo.c b/drivers/soc/amlogic/meson-gx-socinfo.c index 6abb730344ab..9d7921c0fb91 100644 --- a/drivers/soc/amlogic/meson-gx-socinfo.c +++ b/drivers/soc/amlogic/meson-gx-socinfo.c @@ -16,85 +16,7 @@ #include #include -#define AO_SEC_SD_CFG8 0xe0 -#define AO_SEC_SOCINFO_OFFSET AO_SEC_SD_CFG8 - -#define SOCINFO_MAJOR GENMASK(31, 24) -#define SOCINFO_PACK GENMASK(23, 16) -#define SOCINFO_MINOR GENMASK(15, 8) -#define SOCINFO_MISC GENMASK(7, 0) - -static const struct meson_gx_soc_id { - const char *name; - unsigned int id; -} soc_ids[] = { - { "GXBB", 0x1f }, - { "GXTVBB", 0x20 }, - { "GXL", 0x21 }, - { "GXM", 0x22 }, - { "TXL", 0x23 }, - { "TXLX", 0x24 }, - { "AXG", 0x25 }, - { "GXLX", 0x26 }, - { "TXHD", 0x27 }, - { "G12A", 0x28 }, - { "G12B", 0x29 }, - { "SM1", 0x2b }, - { "A1", 0x2c }, -}; - -static const struct meson_gx_package_id { - const char *name; - unsigned int major_id; - unsigned int pack_id; - unsigned int pack_mask; -} soc_packages[] = { - { "S905", 0x1f, 0, 0x20 }, /* pack_id != 0x20 */ - { "S905H", 0x1f, 0x3, 0xf }, /* pack_id & 0xf == 0x3 */ - { "S905M", 0x1f, 0x20, 0xf0 }, /* pack_id == 0x20 */ - { "S905D", 0x21, 0, 0xf0 }, - { "S905X", 0x21, 0x80, 0xf0 }, - { "S905W", 0x21, 0xa0, 0xf0 }, - { "S905L", 0x21, 0xc0, 0xf0 }, - { "S905M2", 0x21, 0xe0, 0xf0 }, - { "S805X", 0x21, 0x30, 0xf0 }, - { "S805Y", 0x21, 0xb0, 0xf0 }, - { "S912", 0x22, 0, 0x0 }, /* Only S912 is known for GXM */ - { "962X", 0x24, 0x10, 0xf0 }, - { "962E", 0x24, 0x20, 0xf0 }, - { "A113X", 0x25, 0x37, 0xff }, - { "A113D", 0x25, 0x22, 0xff }, - { "S905D2", 0x28, 0x10, 0xf0 }, - { "S905Y2", 0x28, 0x30, 0xf0 }, - { "S905X2", 0x28, 0x40, 0xf0 }, - { "A311D", 0x29, 0x10, 0xf0 }, - { "S922X", 0x29, 0x40, 0xf0 }, - { "S905D3", 0x2b, 0x4, 0xf5 }, - { "S905X3", 0x2b, 0x5, 0xf5 }, - { "S905X3", 0x2b, 0x10, 0x3f }, - { "S905D3", 0x2b, 0x30, 0x3f }, - { "A113L", 0x2c, 0x0, 0xf8 }, -}; - -static inline unsigned int socinfo_to_major(u32 socinfo) -{ - return FIELD_GET(SOCINFO_MAJOR, socinfo); -} - -static inline unsigned int socinfo_to_minor(u32 socinfo) -{ - return FIELD_GET(SOCINFO_MINOR, socinfo); -} - -static inline unsigned int socinfo_to_pack(u32 socinfo) -{ - return FIELD_GET(SOCINFO_PACK, socinfo); -} - -static inline unsigned int socinfo_to_misc(u32 socinfo) -{ - return FIELD_GET(SOCINFO_MISC, socinfo); -} +#include "meson-gx-socinfo-internal.h" static const char *socinfo_to_package_id(u32 socinfo) { From patchwork Wed Nov 22 12:56:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viacheslav X-Patchwork-Id: 13464847 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 7A353C61D9B for ; Wed, 22 Nov 2023 12:57:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=k67p8cHzIjny1srJe+V3YgMnWrEcVvMmicFdJQinlkE=; b=nO+5VOPbWg5mjS mSGk0f6JxbJ/zwX4S7oA9fB4H4Y5MXoXp6Snv/0SkyP7v08jwX3048lMiZSwMUbp25N3gWOv5OmlC uQtX0M9VdHE2E6hl3zVYFYP53jcK5jRUHTLtTKXkJtwUyo0Tw8ERjDXSWI5ZyhtxBpZQy/zVU+Yro hsJ8GRrrOmqXXvIUo/VBb2mXi/r4YaUojqi237zfVzkJwf9pQj+LSQXyeeiewRJ8cmuMCi+ugVBk/ gDBAFuQEGvexj9p63wtx0AHNVQaBT1cAEoYQ7eEj80K9xiw0yz5/TGsgZrgFylv1TE0+E21h2GZA2 pOuD79WB8f1zKgOgLwHg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5mn8-001t4W-0D; Wed, 22 Nov 2023 12:57:18 +0000 Received: from mx.msync.work ([62.182.159.68]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5mmr-001sqT-16; Wed, 22 Nov 2023 12:57:05 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 79DD953ED8; Wed, 22 Nov 2023 12:56:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lexina.in; s=dkim; t=1700657814; h=from:subject:date:message-id:to:mime-version: content-transfer-encoding:in-reply-to:references; bh=TCt0JoZg+p6aWcClOSdNWHnx4AX17W2tb5XYFeiobmA=; b=mA/UeoFeBoCs2qSwF7nxxjkUFaDJmKEQOU5Wa3EZR57SwbPJTyghxGJyrkaqLlt8artEKp XetuKqfHJtF0FUusVm5MxTpbBorJ6XO4yi80Y7kkKVSgxqCsAFgHMeKkXHY7kl/1JKXOAT 3wPLJioi0l8r9tRD4y3K8w8M4TFym6Vpy7w3Hmsy366qrWz8KB1AxlhOZFmK/4LqYMOG8I hxfRLPKqZyrMcGbFncrldnP0BQZFg9HX+CpDFkKMWYDG6sHM29vpnyPSAOTDVjvR1pDeb/ 2kQxQdwn3GkaAdg0SZ3BjvPke9JVwMBaXzMDv741W7XbCIzRVhVnV5A6g2RVPQ== From: Viacheslav Bocharov To: Neil Armstrong , Jerome Brunet , Kevin Hilman , Martin Blumenstingl , linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 2/5] soc: amlogic: meson-gx-socinfo: move common code to exported function Date: Wed, 22 Nov 2023 15:56:40 +0300 Message-Id: <20231122125643.1717160-3-adeep@lexina.in> In-Reply-To: <20231122125643.1717160-1-adeep@lexina.in> References: <20231122125643.1717160-1-adeep@lexina.in> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2574; h=from:subject; bh=BnHHuUquDeW8vfYvoIWuzuZnrP1gP/Gae/DQ47jDLU8=; b=owGbwMvMwCHmnhFhrJcZuJTxtFoSQ2rstyP3FWz+1wqt///MM3F/QLJsm3D3Tg8PsXbvuoya5uoP 2tYdpSwMYhwMsmKKLGEdQVP3eay+OHGB0QGYOaxMIEMYuDgFYCInExkZjjtfuFXcoBVz8Iw/O9fm2t J7qisu61w0ZbuSXG3wg/9AAMN/j4jY8vh1NuZZeuEcnzYK/Vc+u6NVsUyGn//ftKlmJyQ5AQ== X-Developer-Key: i=adeep@lexina.in; a=openpgp; fpr=E2FA1A767ACB0716E02E3E7AEE36B110025A8DFA X-Last-TLS-Session-Version: TLSv1.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231122_045701_997279_671297EC X-CRM114-Status: UNSURE ( 9.84 ) 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 Move common code fill soc_device_attribute to common function for later use Signed-off-by: Viacheslav Bocharov --- .../soc/amlogic/meson-gx-socinfo-internal.h | 3 +++ drivers/soc/amlogic/meson-gx-socinfo.c | 26 ++++++++++++------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/drivers/soc/amlogic/meson-gx-socinfo-internal.h b/drivers/soc/amlogic/meson-gx-socinfo-internal.h index 884cf8fb580f..5a742cc16fc8 100644 --- a/drivers/soc/amlogic/meson-gx-socinfo-internal.h +++ b/drivers/soc/amlogic/meson-gx-socinfo-internal.h @@ -95,5 +95,8 @@ static inline unsigned int socinfo_to_misc(u32 socinfo) return FIELD_GET(SOCINFO_MISC, socinfo); } +int meson_gx_socinfo_prepare_soc_driver_attr(struct soc_device_attribute *soc_dev_attr, + unsigned int socattr); + #endif /* _MESON_GX_SOCINFO_INTERNAL_H_ */ diff --git a/drivers/soc/amlogic/meson-gx-socinfo.c b/drivers/soc/amlogic/meson-gx-socinfo.c index 9d7921c0fb91..8cf69dd238ee 100644 --- a/drivers/soc/amlogic/meson-gx-socinfo.c +++ b/drivers/soc/amlogic/meson-gx-socinfo.c @@ -47,6 +47,22 @@ static const char *socinfo_to_soc_id(u32 socinfo) return "Unknown"; } +int meson_gx_socinfo_prepare_soc_driver_attr(struct soc_device_attribute *soc_dev_attr, + unsigned int socattr) +{ + soc_dev_attr->family = "Amlogic Meson"; + soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%x:%x - %x:%x", + socinfo_to_major(socattr), + socinfo_to_minor(socattr), + socinfo_to_pack(socattr), + socinfo_to_misc(socattr)); + soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "%s (%s)", + socinfo_to_soc_id(socattr), + socinfo_to_package_id(socattr)); + return 0; +} +EXPORT_SYMBOL(meson_gx_socinfo_prepare_soc_driver_attr); + static int __init meson_gx_socinfo_init(void) { struct soc_device_attribute *soc_dev_attr; @@ -95,15 +111,7 @@ static int __init meson_gx_socinfo_init(void) if (!soc_dev_attr) return -ENODEV; - soc_dev_attr->family = "Amlogic Meson"; - soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%x:%x - %x:%x", - socinfo_to_major(socinfo), - socinfo_to_minor(socinfo), - socinfo_to_pack(socinfo), - socinfo_to_misc(socinfo)); - soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "%s (%s)", - socinfo_to_soc_id(socinfo), - socinfo_to_package_id(socinfo)); + meson_gx_socinfo_prepare_soc_driver_attr(soc_dev_attr, socinfo); soc_dev = soc_device_register(soc_dev_attr); if (IS_ERR(soc_dev)) { From patchwork Wed Nov 22 12:56:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viacheslav X-Patchwork-Id: 13464843 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 C947DC61D97 for ; Wed, 22 Nov 2023 12:57:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Z+rs1OsOAPjTCDlaxj0ULKypFN/o/fmVMFBBVFC+JAQ=; b=jA1do0fOchvDGG 9oioRJ6T4l9uTq5DrNDUAIWFiCnsFwxCzk1Jgfxu0C3VB+OLtqnucK7hY+Op9CLhvau8Cfj1GJv1e B3SW2V1kYlo44+rGSgkZ+wlj4HUBx9SJSZL6FrbXx7Hq4TpRr2DyxxrMixwumMLtp7r4WG84UdBoD qIOX4clHIJwJsY3Of4RdPfmzHVwvVXSk878XJ0qHulozA/R6pXlFaGVtspqQG4QNWPAXTA6hoy8hp r/5/hf1R64lCFbSt2EK79A1IVqcLaXuNWsjeSh8kJFgaqglcdTCbY9Y9G9BVdm8uD9rnlNILlclR3 5Kai5TZ2HLJKT3UYAzsw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5mmx-001svi-28; Wed, 22 Nov 2023 12:57:07 +0000 Received: from mx.msync.work ([62.182.159.68]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5mmr-001sqd-13; Wed, 22 Nov 2023 12:57:04 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id BBCED540A2; Wed, 22 Nov 2023 12:56:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lexina.in; s=dkim; t=1700657814; h=from:subject:date:message-id:to:mime-version: content-transfer-encoding:in-reply-to:references; bh=1JJrVlQT4dSyAepCsKEppt0JhDAnONuiLebT73/zFmQ=; b=MyaO1ciELUoOTnkA8k5bOa8bMRT2ead7XfG4T1E1/saUsTaq9YZZ5POKgj8j/2kH+2yK5b Yt4F4OdXM0mtM/vpM9Ah9rXVH8A79i4xkMSEeeJ5ltnobxOh/IopZ4eEqDEEVVvjGcT29u McfldYm/gBr2SkJKqT33OyapEP2vdX49Yu1jzgO9lprJ8n8cH5S3QjRISFts71ah/aLaem ynCHhwbAj0wVR7makmAnhlviUDes0UwIiVKX/7ox9cDrUEc5wi/tEHuMC1kmkcWk6EYlbn XbBquQ5X5cVbxtaLtzW1sxqMWhHDJJ7zj8djrGFb755RagPQrgoldenLRpj2WQ== From: Viacheslav Bocharov To: Neil Armstrong , Jerome Brunet , Kevin Hilman , Martin Blumenstingl , linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 3/5] firmware: meson_sm: move common definitions to header file Date: Wed, 22 Nov 2023 15:56:41 +0300 Message-Id: <20231122125643.1717160-4-adeep@lexina.in> In-Reply-To: <20231122125643.1717160-1-adeep@lexina.in> References: <20231122125643.1717160-1-adeep@lexina.in> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1284; h=from:subject; bh=qgIgUERrKdBRmt/t8R9MoRn4sT6vtjugdlg8U0yx7ss=; b=owGbwMvMwCHmnhFhrJcZuJTxtFoSQ2rst6N93hV/DR5LPs8LXCH2/fyz36Iv3ldfLpt+SnmDqfNG XbbUjlIWBjEOBlkxRZawjqCp+zxWX5y4wOgAzBxWJpAhDFycAjARETOGv3Jn1KbnZSwoTRbMmhoS8a O3ZVJ970a71oRvJ0K3vctTXcvIcLTzWXu8t1fTt7VmW0tLsiZ9U/OptTUWN+dalL03ukWKDwA= X-Developer-Key: i=adeep@lexina.in; a=openpgp; fpr=E2FA1A767ACB0716E02E3E7AEE36B110025A8DFA X-Last-TLS-Session-Version: TLSv1.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231122_045701_976037_163606CB X-CRM114-Status: UNSURE ( 7.89 ) 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 Move SM_CHIPID_* constants from firmware meson sm driver to header file. Signed-off-by: Viacheslav Bocharov --- drivers/firmware/meson/meson_sm.c | 4 ---- include/linux/firmware/meson/meson_sm.h | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/firmware/meson/meson_sm.c b/drivers/firmware/meson/meson_sm.c index 402851ed4ac0..96e50811336f 100644 --- a/drivers/firmware/meson/meson_sm.c +++ b/drivers/firmware/meson/meson_sm.c @@ -240,10 +240,6 @@ struct meson_sm_firmware *meson_sm_get(struct device_node *sm_node) } EXPORT_SYMBOL_GPL(meson_sm_get); -#define SM_CHIP_ID_LENGTH 119 -#define SM_CHIP_ID_OFFSET 4 -#define SM_CHIP_ID_SIZE 12 - static ssize_t serial_show(struct device *dev, struct device_attribute *attr, char *buf) { diff --git a/include/linux/firmware/meson/meson_sm.h b/include/linux/firmware/meson/meson_sm.h index 8eaf8922ab02..f62acd2bf52a 100644 --- a/include/linux/firmware/meson/meson_sm.h +++ b/include/linux/firmware/meson/meson_sm.h @@ -7,6 +7,10 @@ #ifndef _MESON_SM_FW_H_ #define _MESON_SM_FW_H_ +#define SM_CHIP_ID_LENGTH 119 +#define SM_CHIP_ID_OFFSET 4 +#define SM_CHIP_ID_SIZE 12 + enum { SM_EFUSE_READ, SM_EFUSE_WRITE, From patchwork Wed Nov 22 12:56:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viacheslav X-Patchwork-Id: 13464844 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 EDA6BC61D9B for ; Wed, 22 Nov 2023 12:57:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=N4TOfrBoyIyG6uW5kOIEJqcRdRkPgIvf7Quk5//oQag=; b=F+teeYl5R2Jp/9 jrRPwcFsLWyWOX6VbcDpcdO1hJAQDb4dj7prpgU/b1bAMARj6chBxLUZy57ocNgzDOxmDX1c0R+ef N1FbV1hO4o9T7LQ7yx+JDKl56VwaqIDB+Oir9w1oUdb4uO8geVvEMChzHRFaDtUnP9bMLamwRS4Jp ARYDm21yiJfITXX5QcfSumNhfk5X13OLJemtkDgpihi2JtLEBE26WZm9GY0jwcn0kVLlKvSWTreDJ FinQdg2dp8lWNx04icAIO2ODaNzQRr13F7LUCn0KukOjZjia2d7m7puV/mHwlYFknGuoUCUimBs0d LULSTx5bnqGIyekXpHmg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5mn1-001syI-0p; Wed, 22 Nov 2023 12:57:11 +0000 Received: from mx.msync.work ([62.182.159.68]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5mmr-001sqe-0g; Wed, 22 Nov 2023 12:57:05 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 0047A53EDA; Wed, 22 Nov 2023 12:56:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lexina.in; s=dkim; t=1700657815; h=from:subject:date:message-id:to:mime-version: content-transfer-encoding:in-reply-to:references; bh=9FM903o2pn21k51UZjXAT7x1wyN7v04RutSMU2fbua0=; b=FtRsMvL+MGmcCxNEMbpc9Mov5zIfR/IZC+0XQKaH+0coLTkPfleeqBEp7delkJD/YmYbic MwmMR5WCIi2Snr9QUmz3U/b7jc+QqBPOabXv8rXcNmTaJ7tdug+KycOa56s/izHKhJ0vFs 0UBd7mMlzuuJek645V0EDtpLnwBKlVAJCtfXxwZvaQVPK2prlQwYcCQC2bM9GnDLzYc8It ikrlnGjun0H8qPC3Jh+DnqpLYAOAA3EksKzybeDevvqjmouTdD2iRqVjXp6r10Yxo/wTnb wOZavUYZQTI2qgWQvvCRdqOgc7JKthyJXdcUvKQSl6PRFiI+tHCwqpJxfiW6rQ== From: Viacheslav Bocharov To: Neil Armstrong , Jerome Brunet , Kevin Hilman , Martin Blumenstingl , linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 4/5] soc: amlogic: Add Amlogic secure-monitor SoC Information driver Date: Wed, 22 Nov 2023 15:56:42 +0300 Message-Id: <20231122125643.1717160-5-adeep@lexina.in> In-Reply-To: <20231122125643.1717160-1-adeep@lexina.in> References: <20231122125643.1717160-1-adeep@lexina.in> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=7167; h=from:subject; bh=Ts6D5zneNK9fsa5Hu2MDyTR0sZxwo+G3SlCocMKM3Xk=; b=owGbwMvMwCHmnhFhrJcZuJTxtFoSQ2rst6OFk/eIhL8o3vqGde4k1lCRb663fsgkvn2wc4aJ6v57 WxQEOkpZGMQ4GGTFFFnCOoKm7vNYfXHiAqMDMHNYmUCGMHBxCsBE7G8y/M+XuHJ0Pccm1oDfAiFPp5 1n4g6UFjLVLfWQ2nFotdK1o2wM/2t3hOms3erEteKpG9cf9mezxNsVK5e+Oa6w9P3XM4mZpxkA X-Developer-Key: i=adeep@lexina.in; a=openpgp; fpr=E2FA1A767ACB0716E02E3E7AEE36B110025A8DFA X-Last-TLS-Session-Version: TLSv1.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231122_045701_968044_BB054E91 X-CRM114-Status: GOOD ( 21.81 ) 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 Amlogic SoCs have a SoC information secure-monitor call for SoC type, package type, revision information and chipid. This patchs adds support for secure-monitor call decoding and exposing with the SoC bus infrastructure in addition to the previous SoC Information driver. Signed-off-by: Viacheslav Bocharov --- drivers/soc/amlogic/Kconfig | 10 ++ drivers/soc/amlogic/Makefile | 1 + drivers/soc/amlogic/meson-gx-socinfo-sm.c | 178 ++++++++++++++++++++++ 3 files changed, 189 insertions(+) create mode 100644 drivers/soc/amlogic/meson-gx-socinfo-sm.c diff --git a/drivers/soc/amlogic/Kconfig b/drivers/soc/amlogic/Kconfig index d08e398bdad4..5634ecb60478 100644 --- a/drivers/soc/amlogic/Kconfig +++ b/drivers/soc/amlogic/Kconfig @@ -26,6 +26,16 @@ config MESON_GX_SOCINFO Say yes to support decoding of Amlogic Meson GX SoC family information about the type, package and version. +config MESON_GX_SOCINFO_SM + bool "Amlogic Meson GX SoC Information driver via Secure Monitor" + depends on (ARM64 && ARCH_MESON && MESON_GX_SOCINFO && MESON_SM) || COMPILE_TEST + default MESON_GX_SOCINFO && MESON_SM + select SOC_BUS + help + Say yes to support decoding of Amlogic Meson GX SoC family + information about the type, package and version from secure + monitor call. + config MESON_MX_SOCINFO bool "Amlogic Meson MX SoC Information driver" depends on (ARM && ARCH_MESON) || COMPILE_TEST diff --git a/drivers/soc/amlogic/Makefile b/drivers/soc/amlogic/Makefile index c25f835e6a26..45d9d6f5904c 100644 --- a/drivers/soc/amlogic/Makefile +++ b/drivers/soc/amlogic/Makefile @@ -2,4 +2,5 @@ obj-$(CONFIG_MESON_CANVAS) += meson-canvas.o obj-$(CONFIG_MESON_CLK_MEASURE) += meson-clk-measure.o obj-$(CONFIG_MESON_GX_SOCINFO) += meson-gx-socinfo.o +obj-$(CONFIG_MESON_GX_SOCINFO_SM) += meson-gx-socinfo-sm.o obj-$(CONFIG_MESON_MX_SOCINFO) += meson-mx-socinfo.o diff --git a/drivers/soc/amlogic/meson-gx-socinfo-sm.c b/drivers/soc/amlogic/meson-gx-socinfo-sm.c new file mode 100644 index 000000000000..52bf3bce09e2 --- /dev/null +++ b/drivers/soc/amlogic/meson-gx-socinfo-sm.c @@ -0,0 +1,178 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2023 JetHome + * Author: Viacheslav Bocharov + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "meson-gx-socinfo-internal.h" + +static char *socinfo_get_cpuid(struct device *dev, struct meson_sm_firmware *fw, + unsigned int *socinfo) +{ + char *buf; + uint8_t *id_buf; + int chip_id_version; + int ret; + + id_buf = devm_kzalloc(dev, SM_CHIP_ID_LENGTH, GFP_KERNEL); + if (!id_buf) + return NULL; + + ret = meson_sm_call_read(fw, id_buf, SM_CHIP_ID_LENGTH, SM_GET_CHIP_ID, + 2, 0, 0, 0, 0); + if (ret < 0) { + kfree(id_buf); + return NULL; + } + + chip_id_version = *((unsigned int *)id_buf); + + if (chip_id_version != 2) { + uint8_t tmp; + /** + * Legacy 12-byte chip ID read out, transform data + * to expected order format + */ + + memmove(&id_buf[SM_CHIP_ID_OFFSET + 4], &id_buf[SM_CHIP_ID_OFFSET], 12); + for (int i = 0; i < 6; i++) { + tmp = id_buf[i + SM_CHIP_ID_OFFSET + 4]; + id_buf[i + SM_CHIP_ID_OFFSET + 4] = id_buf[15 - i + SM_CHIP_ID_OFFSET]; + id_buf[15 - i + SM_CHIP_ID_OFFSET] = tmp; + } + *(uint32_t *)(id_buf + SM_CHIP_ID_OFFSET) = + ((*socinfo & 0xff000000) | // Family ID + ((*socinfo << 8) & 0xff0000) | // Chip Revision + ((*socinfo >> 8) & 0xff00)) | // Package ID + ((*socinfo) & 0xff); // Misc + } else { + *socinfo = id_buf[SM_CHIP_ID_OFFSET] << 24 | // Family ID + id_buf[SM_CHIP_ID_OFFSET + 2] << 16 | // Chip revision + id_buf[SM_CHIP_ID_OFFSET + 1] << 8 | // Package ID + id_buf[SM_CHIP_ID_OFFSET + 3]; // Misc + } + + buf = kasprintf(GFP_KERNEL, "%16phN\n", &id_buf[SM_CHIP_ID_OFFSET]); + kfree(id_buf); + + return buf; +} + +static int meson_gx_socinfo_sm_probe(struct platform_device *pdev) +{ + struct soc_device_attribute *soc_dev_attr; + struct soc_device *soc_dev; + struct device_node *sm_np; + struct meson_sm_firmware *fw; + struct regmap *regmap; + unsigned int socinfo; + struct device *dev; + int ret; + + /* check if chip-id is available */ + if (!of_property_read_bool(pdev->dev.of_node, "amlogic,has-chip-id")) + return -ENODEV; + + /* node should be a syscon */ + regmap = syscon_node_to_regmap(pdev->dev.of_node); + if (IS_ERR(regmap)) { + dev_err(&pdev->dev, "failed to get regmap\n"); + return -ENODEV; + } + + sm_np = of_parse_phandle(pdev->dev.of_node, "secure-monitor", 0); + if (!sm_np) { + dev_err(&pdev->dev, "no secure-monitor node found\n"); + return -ENODEV; + } + + fw = meson_sm_get(sm_np); + of_node_put(sm_np); + if (!fw) + return -EPROBE_DEFER; + + dev_err(&pdev->dev, "secure-monitor node found\n"); + + ret = regmap_read(regmap, AO_SEC_SOCINFO_OFFSET, &socinfo); + if (ret < 0) + return ret; + + if (!socinfo) { + dev_err(&pdev->dev, "invalid regmap chipid value\n"); + return -EINVAL; + } + + soc_dev_attr = devm_kzalloc(&pdev->dev, sizeof(*soc_dev_attr), + GFP_KERNEL); + if (!soc_dev_attr) + return -ENOMEM; + + soc_dev_attr->serial_number = socinfo_get_cpuid(&pdev->dev, fw, &socinfo); + + meson_gx_socinfo_prepare_soc_driver_attr(soc_dev_attr, socinfo); + + soc_dev = soc_device_register(soc_dev_attr); + if (IS_ERR(soc_dev)) { + kfree(soc_dev_attr->revision); + kfree_const(soc_dev_attr->soc_id); + kfree(soc_dev_attr); + return PTR_ERR(soc_dev); + } + + dev = soc_device_to_device(soc_dev); + platform_set_drvdata(pdev, soc_dev); + + dev_info(dev, "Amlogic Meson %s Revision %x:%x (%x:%x) Detected at SM driver %x\n", + soc_dev_attr->soc_id, + socinfo_to_major(socinfo), + socinfo_to_minor(socinfo), + socinfo_to_pack(socinfo), + socinfo_to_misc(socinfo), socinfo); + + return PTR_ERR_OR_ZERO(dev); +} + + +static int meson_gx_socinfo_sm_remove(struct platform_device *pdev) +{ + struct soc_device *soc_dev = platform_get_drvdata(pdev); + + soc_device_unregister(soc_dev); + return 0; +} + +static const struct of_device_id meson_gx_socinfo_match[] = { + { .compatible = "amlogic,meson-gx-ao-secure", }, + { /* sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, meson_gx_socinfo_match); + +static struct platform_driver meson_gx_socinfo_driver = { + .probe = meson_gx_socinfo_sm_probe, + .remove = meson_gx_socinfo_sm_remove, + .driver = { + .name = "meson-gx-socinfo-sm", + .of_match_table = meson_gx_socinfo_match, + }, +}; + + +module_platform_driver(meson_gx_socinfo_driver); + +MODULE_AUTHOR("Viacheslav Bocharov "); +MODULE_DESCRIPTION("Amlogic Meson GX SOC SM driver"); +MODULE_LICENSE("GPL"); From patchwork Wed Nov 22 12:56:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viacheslav X-Patchwork-Id: 13464848 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 8E58CC61D9B for ; Wed, 22 Nov 2023 12:57:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EskSPwyfNqHXptPRTmALt9IzHn6lEAkOtZvKLdyEyPo=; b=Qm7IpH273OCW9Z uCrCSstVLFm0TtAxRlsDGKomkJ09YcLMukAaUcNnNRRWnn1ec4w9QoSrOirF/ODHkOhdAj/3qVbAc MhT/O0qoD28prBMCPCSGVnlO6XHMcj5vfgQ6YXnuScB21FeWNmcayvbu5hY12YGDSnOyPkKiOrZhQ XnsKlMk4lhs+UJJWrojClMx/01VRUEASYZFnWJvUkbu1PekUgl75gLoFaSM49BK/Q9fEmqQ9K9pjp ykkZAh21h4hVESSS8nw9/09ZKY8WRiCWXG4ZCiyiTd+Gs3kVYRdCm4JOdMkMRIdR3klR6F2TOhtkE Chj57L/wA6pbsWbroazw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5mnL-001tCe-1z; Wed, 22 Nov 2023 12:57:31 +0000 Received: from mx.msync.work ([62.182.159.68]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5mmv-001suA-2x; Wed, 22 Nov 2023 12:57:07 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 3F41A53EDB; Wed, 22 Nov 2023 12:56:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lexina.in; s=dkim; t=1700657815; h=from:subject:date:message-id:to:mime-version: content-transfer-encoding:in-reply-to:references; bh=Ulmefl5yig/F+2V9QAbbUBGE0S2hQKZ3IPeqik+z0UI=; b=obnqjWRUmpCSg3j42I/4HoO5hACMJaABq0MXfrlaqopRm6vDn6C0+Mj7rsbVzWyuJB6i0R rjEYNy2N5QabL5j55uL2EuFfluAXcRx1fVMIf3tqMODJ8ExoqO+oOUWxCMeB2ZZDxgXCtr 4WkKzmMnRlipOLOWil8NEG8ZgBUTv3Vp9hPkE7Z2lrMctIPzXeWkmdMsWZ7zhjRe10kITM sUfdmvw15/XacURTXUN/K3o3z/+4tys4qR+AsvUCkT9H7A86ubeZVzxzOvPG2XDsRLwb0w wCCSRyH6+5lprySgxtdAGPrpxv5NwOhk2gFWquNk4bZtT99ub8WMI+zbFJuvAg== From: Viacheslav Bocharov To: Neil Armstrong , Jerome Brunet , Kevin Hilman , Martin Blumenstingl , linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Krzysztof Kozlowski , Rob Herring Subject: [PATCH 5/5] arm64: dts: meson: add dts links to secure-monitor for soc driver in a1, axg, gx, g12 Date: Wed, 22 Nov 2023 15:56:43 +0300 Message-Id: <20231122125643.1717160-6-adeep@lexina.in> In-Reply-To: <20231122125643.1717160-1-adeep@lexina.in> References: <20231122125643.1717160-1-adeep@lexina.in> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2338; h=from:subject; bh=5P5fYju1OuJiL/byEBiP3PSi5QUDOL3VUZ+An0H3Yq0=; b=owGbwMvMwCHmnhFhrJcZuJTxtFoSQ2rst6PzpSIPfZiQwrL/6Lz/Yq6reYpjji2pORTNeLc+Rj79 0t/7HaUsDGIcDLJiiixhHUFT93msvjhxgdEBmDmsTCBDGLg4BWAi50QZ/krcyUy9e1Ag4O/3OF29F6 eL570SVgi+mt7GEMu57ENL3Sagiv4ltcEzrio+it5Q/COaS7csWft72s89slNKV35d8s2VEQA= X-Developer-Key: i=adeep@lexina.in; a=openpgp; fpr=E2FA1A767ACB0716E02E3E7AEE36B110025A8DFA X-Last-TLS-Session-Version: TLSv1.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231122_045706_127463_9D8CEBAF X-CRM114-Status: UNSURE ( 8.20 ) 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 links to secure-monitor in soc driver section for A1, AXG, GX, G12 Amlogic family. Signed-off-by: Viacheslav Bocharov --- arch/arm64/boot/dts/amlogic/meson-a1.dtsi | 1 + arch/arm64/boot/dts/amlogic/meson-axg.dtsi | 1 + arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 1 + arch/arm64/boot/dts/amlogic/meson-gx.dtsi | 1 + 4 files changed, 4 insertions(+) diff --git a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi b/arch/arm64/boot/dts/amlogic/meson-a1.dtsi index 648e7f49424f..449b328d62b1 100644 --- a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-a1.dtsi @@ -407,6 +407,7 @@ hwrng: rng@5118 { sec_AO: ao-secure@5a20 { compatible = "amlogic,meson-gx-ao-secure", "syscon"; reg = <0x0 0x5a20 0x0 0x140>; + secure-monitor = <&sm>; amlogic,has-chip-id; }; diff --git a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi index a49aa62e3f9f..6e80bdc525e5 100644 --- a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi @@ -1660,6 +1660,7 @@ mux { sec_AO: ao-secure@140 { compatible = "amlogic,meson-gx-ao-secure", "syscon"; reg = <0x0 0x140 0x0 0x140>; + secure-monitor = <&sm>; amlogic,has-chip-id; }; diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi index ff68b911b729..0a6b703b0dc0 100644 --- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi @@ -2026,6 +2026,7 @@ cec_AO: cec@100 { sec_AO: ao-secure@140 { compatible = "amlogic,meson-gx-ao-secure", "syscon"; reg = <0x0 0x140 0x0 0x140>; + secure-monitor = <&sm>; amlogic,has-chip-id; }; diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi index 2673f0dbafe7..656e08b3d872 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi @@ -471,6 +471,7 @@ cec_AO: cec@100 { sec_AO: ao-secure@140 { compatible = "amlogic,meson-gx-ao-secure", "syscon"; reg = <0x0 0x140 0x0 0x140>; + secure-monitor = <&sm>; amlogic,has-chip-id; };