From patchwork Thu Jun 6 13:24:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Krzysztof_Micho=C5=84ski?= X-Patchwork-Id: 10979535 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5B40415E6 for ; Thu, 6 Jun 2019 13:24:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4893D2897A for ; Thu, 6 Jun 2019 13:24:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B38828470; Thu, 6 Jun 2019 13:24:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CFD9E28991 for ; Thu, 6 Jun 2019 13:24:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=2FHmyTv+uUmdg8LfawpoMTAHATOSg/4M3EZtBNdNh9k=; b=OTnk9GP7YgLrOW vX68mzok783jP9tWLaD+JM1njbH0l9fFp8jVjrE1M30oS8e7XzzIyO3yZopWpC3PCZ8934T4SlNiP PawwV83k3WthS1L7CHE8RMn5EaXqHfzjgn4li5+YM8reDornVZAWQufwXUY4MogeUqElIbeHoJGcL jBsVfxeMtTqfIiGHAkGPdCDXXGwHwkrq4GSzkyctQVDLiSgJH6EtPpfLKPZIdl5Lk0SC1/xk8Ebnk 2gGswh8ltUqtbdkrj6iqEL5hpSr1Q7WXhihr/BlCL5Wh4oQvbWHe7GBB9NAoakABMMBHSkBsqvyRV 8M2aglPXrSZCcrZTVWMQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hYsNx-0005qO-43; Thu, 06 Jun 2019 13:24:53 +0000 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hYsNt-0005p3-SR for linux-amlogic@lists.infradead.org; Thu, 06 Jun 2019 13:24:51 +0000 Received: by mail-lj1-x241.google.com with SMTP id k18so583891ljc.11 for ; Thu, 06 Jun 2019 06:24:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=AgdqLQXn+eFsENGi3TGX3m0oH1+i9BXYaFNzwUk2hBY=; b=Jv1//QGczOL8PJgA/8yTe+F/gSGzICINohuxCQVRNucqu5hQ6bn7PgtzSeSQOhlMr4 cCEQkV1jo7lUGqW57t5xMMrPKNO0Wx4bkDWTVHBrycYVQ/X1daYRrJ0j77rjduSmu3mQ jJ5AlCPZOByb3x3QbOTvts/hfA/nX1BIzCAz+ySLKT/YYP9ajVfuUsXEwj8mt6P0oiH2 SUDhb7mVl171rzx+yAtpT0w1K+Jk+QkuYYwHdjSXeMKCObNKY+A2INPsA1hjg0UO4SXc 0tZmZVds3u3uXFDLj2yeyYA+CK65goKkLuZjHuhoMObcpyN330slrJd6DfN3nhnhWRTy 2biQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=AgdqLQXn+eFsENGi3TGX3m0oH1+i9BXYaFNzwUk2hBY=; b=UfpvnekSxMaQbV7j35Dp0erhkCSlQTOuPCWzJJBsNlAIWAFKuw9tz4T5CY503ES6vs iL9W7jY9UcnBh3aZ+GxmnFkc4DPQfDf030pk2VWS9i26Q138fDelKnbFUDxktD47JqeH Nu0ndSy7ygB+6f9eg50J8VIyspPjctlyLprVk+SGbjAfbxOuS761MPne3pPt0oH+spvv 2A5IIX6Cd6quTD0VJ3aETcXc3NGW6+iEEOQulaxQljk3IBFdSq/m2d8mhuC/m0p/qsVY CwYZpR6i6OoYoejFL5xKVSZktNiYRK4lJRkBeO0m1s9sns9Gm24vHjj2F8Wu/sGirbiu lViQ== X-Gm-Message-State: APjAAAU6FoKCPz/290IffmZ0wkIe6eoi8h3PowzIN+kED0u0f0EHj/OF DMBQicHJf1bSYqlKK9Rt53U= X-Google-Smtp-Source: APXvYqxgk8rER+f9lmPOhKSCoUcCstS8fs4nd7WspvhCjtNJa5VUcOM+isChxUcBcyADq7/DKh0JRw== X-Received: by 2002:a2e:b0d0:: with SMTP id g16mr12359591ljl.161.1559827486062; Thu, 06 Jun 2019 06:24:46 -0700 (PDT) Received: from localhost.localdomain ([217.153.215.58]) by smtp.googlemail.com with ESMTPSA id t21sm354932ljg.60.2019.06.06.06.24.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 06 Jun 2019 06:24:44 -0700 (PDT) From: Krzysztof Michonski X-Google-Original-From: Krzysztof Michonski To: khilman@baylibre.com, linux-amlogic@lists.infradead.org, devicetree@vger.kernel.org Subject: [PATCH 1/2] meson_sm: Extend meson_sm driver to be compatible with gxl chip Date: Thu, 6 Jun 2019 15:24:38 +0200 Message-Id: <20190606132439.25182-1-krzysztof.michonski@digitalstrom.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190606_062449_947370_B45046A3 X-CRM114-Status: GOOD ( 10.64 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Krzysztof Michonski , afenkart@gmail.com Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Krzysztof Michonski Extend the meson_sm driver by adding gxl structure and SECURITY_KEY commands. Signed-off-by: Krzysztof Michonski --- drivers/firmware/meson/meson_sm.c | 14 ++++++++++++++ include/linux/firmware/meson/meson_sm.h | 3 +++ 2 files changed, 17 insertions(+) diff --git a/drivers/firmware/meson/meson_sm.c b/drivers/firmware/meson/meson_sm.c index 29fbc818a573..b19489f759fc 100644 --- a/drivers/firmware/meson/meson_sm.c +++ b/drivers/firmware/meson/meson_sm.c @@ -54,6 +54,19 @@ struct meson_sm_chip gxbb_chip = { }, }; +struct meson_sm_chip gxl_chip = { + .shmem_size = SZ_4K, + .cmd_shmem_in_base = 0x82000023, + .cmd_shmem_out_base = 0x82000024, + .cmd = { + CMD(SM_SECURITY_KEY_READ, 0x82000061), + CMD(SM_SECURITY_KEY_WRITE, 0x82000062), + CMD(SM_SECURITY_KEY_TELL, 0x82000063), + CMD(SM_GET_CHIP_ID, 0x82000044), + { /* sentinel */ }, + }, +}; + struct meson_sm_firmware { const struct meson_sm_chip *chip; void __iomem *sm_shmem_in_base; @@ -269,6 +282,7 @@ static const struct attribute_group meson_sm_sysfs_attr_group = { static const struct of_device_id meson_sm_ids[] = { { .compatible = "amlogic,meson-gxbb-sm", .data = &gxbb_chip }, + { .compatible = "amlogic,meson-gxl-sm", .data = &gxl_chip }, { /* sentinel */ }, }; diff --git a/include/linux/firmware/meson/meson_sm.h b/include/linux/firmware/meson/meson_sm.h index f98c20dd266e..9352d35c6e96 100644 --- a/include/linux/firmware/meson/meson_sm.h +++ b/include/linux/firmware/meson/meson_sm.h @@ -18,6 +18,9 @@ enum { SM_EFUSE_WRITE, SM_EFUSE_USER_MAX, SM_GET_CHIP_ID, + SM_SECURITY_KEY_READ, + SM_SECURITY_KEY_WRITE, + SM_SECURITY_KEY_TELL, }; struct meson_sm_firmware; From patchwork Thu Jun 6 13:24:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Krzysztof_Micho=C5=84ski?= X-Patchwork-Id: 10979537 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2620817D2 for ; Thu, 6 Jun 2019 13:24:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 157AE28980 for ; Thu, 6 Jun 2019 13:24:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 13CFD289AF; Thu, 6 Jun 2019 13:24:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9EC1F28980 for ; Thu, 6 Jun 2019 13:24:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc: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:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=v9XG2IJ2n7PFHvcSVpZ1Nh2Acq7YufwNb2/Hz0lAb+0=; b=iCWRQWh00VCJdo NhsjNnYeRkatCa2zcBwUix+TR5iGjDepJX+tuZPddcRQjcjxwkLHZT57GClnoEI+GlXv9yK40Lhaz DRIfN+VLFXfqAf08JO6bO4YHLEVALEAfAC4gN5uN0aMI63UouSfGYEy7AXhm8LCSwuutRJc6PUeNv 85dx982a1qVqX0rugaxyoECN5JIMVFpngfdJTQpxQTyj7j1QLD6IfmwDPzyr2NBX3J+qM8hEQKEWo euerlgO7Ntln0m2vT8wiWzsQTlYSB7CStTzQVRvfQcmF73xK3zDKHZAbitYKevIwv9Y45tpQszZnM tgGNBFobfycrVWZ4fMzA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hYsNx-0005r9-Uv; Thu, 06 Jun 2019 13:24:53 +0000 Received: from mail-lj1-x242.google.com ([2a00:1450:4864:20::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hYsNu-0005pK-PF for linux-amlogic@lists.infradead.org; Thu, 06 Jun 2019 13:24:51 +0000 Received: by mail-lj1-x242.google.com with SMTP id v18so2013295ljh.6 for ; Thu, 06 Jun 2019 06:24:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LzAzlX0RIFpmEOPyKd7L5UTvYpPd/VYX5UpRcJFDD9c=; b=ISvIfUwteBIdzflTCBaFl2o8TAUOseWkc5P7K7P2AIn9YlqtRq+BVcbxUKjf0brXuR ulad3xlhqbKy8saBohRZBtXjB1YY21vaaQSfhkUgyb25aGG03PpGReLxpLrIo5ETjW29 l1vIBLnciZ5WaXjTrryKs4vGY9a+gTFOuxfyUg0aWmwlnYzw0SSGFI24/53ROxl6fveW Q+HqUgjtDqwPqvP6ov/9/B/aE5RNZQ3l5yd5C/3P5F8ykvf1duvTNjhtb1m+BjDccIxK Lk6iyBzRBdY+9i6wumFZz7LDuK1wbptNMk3wddRKZpl6ygV1S8i9JtKBliE0u4nWB6HH R0oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LzAzlX0RIFpmEOPyKd7L5UTvYpPd/VYX5UpRcJFDD9c=; b=pyEhilAkMNUqimKsgM3jOW7rJQeEPWspM5Vc8j/TCggQp5TaE4BMUTFBLekNTFbEyZ PqjwD7KGcUXlGiEYXJAL3mTr7UPuduO+eR0uw1UvhbMFanpFm6wIftGINYDDIo6RYjGw Z9py4ye6yv55cZ2FcEnogeaDjvc3RIwgYK2+HPQcEVZgp9xC0b7nMRGZcbI6CJ11EzsF LTzD/tX60/EQaoE49z2jo/4pT10QXn5rsJYPchVC8GkoprPerzUHlgDr7aHB1w0xH6xM DS/DT0PMWNaro9RbsQM0ujONi6HEd1Z9/NrBr/EqrcB7PCRxhIiRDk0ESBTiLzB2kUwQ 8J+A== X-Gm-Message-State: APjAAAXijANDY53ptpCBeZRd3Sr/kTARRo3NgmbUnejPUVkR2J3QX1vb k/XUCA19OcwVopmyw+IwqTM= X-Google-Smtp-Source: APXvYqzwNCVniwtux2uKgU0PbDinjvkAvfhz2iw7+tBYSDw1HUi9lAQ5PwjN3s+IHNjxWawqiWov9g== X-Received: by 2002:a2e:9582:: with SMTP id w2mr9495289ljh.136.1559827488900; Thu, 06 Jun 2019 06:24:48 -0700 (PDT) Received: from localhost.localdomain ([217.153.215.58]) by smtp.googlemail.com with ESMTPSA id t21sm354932ljg.60.2019.06.06.06.24.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 06 Jun 2019 06:24:48 -0700 (PDT) From: Krzysztof Michonski X-Google-Original-From: Krzysztof Michonski To: khilman@baylibre.com, linux-amlogic@lists.infradead.org, devicetree@vger.kernel.org Subject: [PATCH 2/2] Enable secure monitor on gxl Date: Thu, 6 Jun 2019 15:24:39 +0200 Message-Id: <20190606132439.25182-2-krzysztof.michonski@digitalstrom.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190606132439.25182-1-krzysztof.michonski@digitalstrom.com> References: <20190606132439.25182-1-krzysztof.michonski@digitalstrom.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190606_062450_815173_4C31BCD7 X-CRM114-Status: UNSURE ( 8.68 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Krzysztof Michonski , afenkart@gmail.com Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Krzysztof Michonski Add secure monitor node in the gxl dtsi file. Signed-off-by: Krzysztof Michonski --- arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi index 3093ae421b17..fd75538ee9f9 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi @@ -37,6 +37,10 @@ }; }; }; + + sm: secure-monitor { + compatible = "amlogic,meson-gxl-sm"; + }; }; &apb {