From patchwork Mon Nov 12 15:23:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 10678845 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 21374139B for ; Mon, 12 Nov 2018 15:24:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D80F29D0B for ; Mon, 12 Nov 2018 15:24:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0093B29F30; Mon, 12 Nov 2018 15:24:32 +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=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW 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 8CE6F29D0B for ; Mon, 12 Nov 2018 15:24:32 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=zz9Jgn/b+YsERTZZYXuC29SAt1ibjINeBhzgoRW2SW0=; b=qYu8vwyNGZhF1LOPFl2Jby1Nqj XeA0PbCX4tf5gKDTRJffzGrx2As8o1kwkAiEXeFTr/R2P79byZWLdpduiGpIqcsyjSOqBHysklLgv 9m09XxeKn4JDfV31skvcbqgDOACVUYZQ+95FMukSUmpQWW95zHU3CZuuKV4cTJ4KW9cBg2gkWU6PA H6lbn9jPVxuiUh+nSm/w94bYmmIlPMVvX22MajzmYeBtGJ/tvrHWn4sw4ogYTE4RB5THuSPkSbiMl dBgZJ+B39GQDAT8CzrlA2cudysdz6teYBA15sjuZ9BQ7EEdSuiTARbx8gBYvf+KJnkwMj6DtoxgXd fxR7j+tg==; 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 1gME4d-0002CF-Mr; Mon, 12 Nov 2018 15:24:23 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gME4I-0001mq-Ir for linux-arm-kernel@lists.infradead.org; Mon, 12 Nov 2018 15:24:04 +0000 Received: by mail-wr1-x443.google.com with SMTP id z16-v6so9821253wrv.2 for ; Mon, 12 Nov 2018 07:23:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+scvbKSgWS1sZ8YB01SJV/sDev8JcNZzuzRnAPkaFfU=; b=b6y9GgLsXE2zRQnjmQunelvLgg8c9S0wwRJK0W/oiYfTleWd3qPPEJApTjNUCCq1EE uaozXLjzqYz84qZx6+GQRfk9u5zF9wjXRzAnEfyd7g5iykFth4NhXtDktP1yC+M3mIau 3mKYNxogJxOm+cDKkyc/0ftEVUj9LKTcW90lo= 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; bh=+scvbKSgWS1sZ8YB01SJV/sDev8JcNZzuzRnAPkaFfU=; b=TWv1yU/ESVHrrXcJiOIZBRpHjslS3G0Y7bz6qrcy0YRnjlFqv6F6glr5sMP9UgxvGC VKLHWYNykiaGFoUgfUxeoD8XKnfYmIUCjWFk162UUSg2oAY0fvH0kOrwhNAghSKhb0s/ McTsGqjwY2F6geC3xhDOM0jHhOpTsXLRhlavIbgJUmHXjkrKznsqoPYj8dxS4wHG5JqS +XnyDLIq218od5QnRY6MfEQDkLVIhlpx+0/VuZG+Y/ial9yNj8uLrRMc2rXiqi9OPL7W hLoIwi5E14SA4p7Z5HwAs0qWTo35NwQQONy5FdnmoQvugbqgL3KgiHl1087PdnQMXLSt x3TA== X-Gm-Message-State: AGRZ1gKe8wtqlGljtOZSo/K84Qv44M0t/DXq7dqpdi2Cyr/TQ5yTtQTP DUwdJk7OfXnf1yVk4P4IUKmN5A== X-Google-Smtp-Source: AJdET5eOqBQjVl2aY+ctwq8SwBfWpS6FCukxRI6DOeEBlq0uijcaAowAORTWJaIuYZfbUC+ORgVSvg== X-Received: by 2002:a5d:410d:: with SMTP id l13-v6mr1363524wrp.61.1542036230916; Mon, 12 Nov 2018 07:23:50 -0800 (PST) Received: from lmecxl0911.lme.st.com ([2a04:cec0:105e:a8d5:7c2c:2737:d373:11ee]) by smtp.gmail.com with ESMTPSA id t82-v6sm11192849wme.30.2018.11.12.07.23.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 12 Nov 2018 07:23:50 -0800 (PST) From: Benjamin Gaignard X-Google-Original-From: Benjamin Gaignard To: ohad@wizery.com, bjorn.andersson@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, alexandre.torgue@st.com Subject: [PATCH v3 1/4] dt-bindings: hwlock: Document STM32 hwspinlock bindings Date: Mon, 12 Nov 2018 16:23:39 +0100 Message-Id: <20181112152342.6561-2-benjamin.gaignard@st.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20181112152342.6561-1-benjamin.gaignard@st.com> References: <20181112152342.6561-1-benjamin.gaignard@st.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181112_072402_621799_62BD6F98 X-CRM114-Status: GOOD ( 13.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Benjamin Gaignard , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add bindings for STM32 hardware spinlock device Signed-off-by: Benjamin Gaignard Reviewed-by: Rob Herring --- version 3 : - fix clock name in properties description version 2 : - change clock name from hwspinlock to hsem to be align with hardware documentation .../bindings/hwlock/st,stm32-hwspinlock.txt | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwlock/st,stm32-hwspinlock.txt diff --git a/Documentation/devicetree/bindings/hwlock/st,stm32-hwspinlock.txt b/Documentation/devicetree/bindings/hwlock/st,stm32-hwspinlock.txt new file mode 100644 index 000000000000..adf4f000ea3d --- /dev/null +++ b/Documentation/devicetree/bindings/hwlock/st,stm32-hwspinlock.txt @@ -0,0 +1,23 @@ +STM32 Hardware Spinlock Device Binding +------------------------------------- + +Required properties : +- compatible : should be "st,stm32-hwspinlock". +- reg : the register address of hwspinlock. +- #hwlock-cells : hwlock users only use the hwlock id to represent a specific + hwlock, so the number of cells should be <1> here. +- clock-names : Must contain "hsem". +- clocks : Must contain a phandle entry for the clock in clock-names, see the + common clock bindings. + +Please look at the generic hwlock binding for usage information for consumers, +"Documentation/devicetree/bindings/hwlock/hwlock.txt" + +Example of hwlock provider: + hwspinlock@4c000000 { + compatible = "st,stm32-hwspinlock"; + #hwlock-cells = <1>; + reg = <0x4c000000 0x400>; + clocks = <&rcc HSEM>; + clock-names = "hsem"; + }; From patchwork Mon Nov 12 15:23:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 10678847 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 B113D109C for ; Mon, 12 Nov 2018 15:24:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B8B629D0B for ; Mon, 12 Nov 2018 15:24:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8F53229F30; Mon, 12 Nov 2018 15:24:39 +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=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=unavailable 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 1FBA429D0B for ; Mon, 12 Nov 2018 15:24:39 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=o9zPml/yMjcnfjb1Cc2waLVYGGDH1lBGTO68izDqr0M=; b=EcdLkgDHW+HAjwbRza3kE04/7a XMIaKjoBk31n7fxWX2Mmp1l6x4dXKGit5YeAesu1FDSTyzTIW4LNwJ9tbxgKDV92qwtmw7rw4Hk4c ddYGeqdCwTQZ8ARaEFUohBHYtaMjctX3SS/yOVIoRuJvQWH34Nzck53Bg5Z2Kx56sA/PNMmiMqZGI 71V7CLngXevN3wQaSQk7i5E5Ox3/CKIQ2Nx9qYb3EjSeU37CK/lIZHX9OXVFZAeLFxfznRXlDjOcc hdbYZ0ZcQsgTDkPGi8RgofqPE250K+dh6E3Gj68U7T4jR/Q4QjnZ3l/NFAwQmfOUxwCfQxepJsz8U ugsBxAaA==; 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 1gME4r-0002SI-5M; Mon, 12 Nov 2018 15:24:37 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gME4I-0001ms-Iu for linux-arm-kernel@lists.infradead.org; Mon, 12 Nov 2018 15:24:05 +0000 Received: by mail-wr1-x443.google.com with SMTP id j26-v6so9809691wre.1 for ; Mon, 12 Nov 2018 07:23:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=S8bHhUupkUTqv4GrIPDVQt3PTDb9g6MRhgvHMF/6NzU=; b=IlHdHvbIMsbZPOp6BcEzfi081E1nBwMoOoOCCVyl8k/KhFbV303J7JfVO79FU6nCKT 3cHwQfNISRvfaIlwEgKJ9rlzFqtTWBOJoVxk/PqEWpqglGHqa1WLjCB10wX+3qux7snj oph3ekQPWgiNowFuLstDMXdXZtjlK11a0g0fw= 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; bh=S8bHhUupkUTqv4GrIPDVQt3PTDb9g6MRhgvHMF/6NzU=; b=KywRlg3r9lCsIaU7KW5msUji/4I1n+lQ4I7kNXx8YZO302N+HH7iSUXIL6i6S3NTG+ 0LaRoa5vfGGIrG+NAb3/RFUwvJfKyftynZ8W+hJx5p2+T9adzGMejlcFzhkIRUdEHR2r atc+cAqMTtDau5q5t9fqiIKmtDuBXNU1EH0INvFC6KzpF46uhl8ATBrLvKKpbPq4gWZ1 958N/LmH8jI3AMUgEc0+kdJoizePgEs6QZbVCYXeYg3p/spNOGXkGfnd+G11aI0rReYt V+4uCQaGpUuAdoOJwcgLn6jIERf4kBDuJ1nl8RPiS3RAAa+IsiZwXRZAMtgZOwirM1JT EvCw== X-Gm-Message-State: AGRZ1gIUdEC+WhhpmxgEaLFRqK3iS6v9YOtfIBTd16964gUNWI3+L3tI uLk2xGhuvvlUnQbzzRqVRzkJlsSVUu0= X-Google-Smtp-Source: AJdET5cA2bajNqmYhIHLB1k1FJaj2+oQrwHDCnL2ofiDikN+XhF36fA4774jKtj0ApmhCZWIqHdANA== X-Received: by 2002:adf:a599:: with SMTP id g25-v6mr1474539wrc.188.1542036233846; Mon, 12 Nov 2018 07:23:53 -0800 (PST) Received: from lmecxl0911.lme.st.com ([2a04:cec0:105e:a8d5:7c2c:2737:d373:11ee]) by smtp.gmail.com with ESMTPSA id t82-v6sm11192849wme.30.2018.11.12.07.23.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 12 Nov 2018 07:23:53 -0800 (PST) From: Benjamin Gaignard X-Google-Original-From: Benjamin Gaignard To: ohad@wizery.com, bjorn.andersson@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, alexandre.torgue@st.com Subject: [PATCH v3 2/4] hwspinlock: add STM32 hwspinlock device Date: Mon, 12 Nov 2018 16:23:40 +0100 Message-Id: <20181112152342.6561-3-benjamin.gaignard@st.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20181112152342.6561-1-benjamin.gaignard@st.com> References: <20181112152342.6561-1-benjamin.gaignard@st.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181112_072402_620608_B9E9B4EB X-CRM114-Status: GOOD ( 19.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Benjamin Gaignard , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds support of hardware semaphores for stm32mp1 SoC. The hardware block provides 32 semaphores. Signed-off-by: Benjamin Gaignard --- version 3 : - use postcore_initcall() instead of module_platform_driver() version 2 : - change clock name from hwspinlock to hsem to be align with hardware documentation - remove useless licence terms from header - fix alphabetic order issues - do not abort remove function if hwspin_lock_unregister() failed drivers/hwspinlock/Kconfig | 9 ++ drivers/hwspinlock/Makefile | 1 + drivers/hwspinlock/stm32_hwspinlock.c | 156 ++++++++++++++++++++++++++++++++++ 3 files changed, 166 insertions(+) create mode 100644 drivers/hwspinlock/stm32_hwspinlock.c diff --git a/drivers/hwspinlock/Kconfig b/drivers/hwspinlock/Kconfig index e895d29500ee..7869c67e5b6b 100644 --- a/drivers/hwspinlock/Kconfig +++ b/drivers/hwspinlock/Kconfig @@ -49,6 +49,15 @@ config HWSPINLOCK_SPRD If unsure, say N. +config HWSPINLOCK_STM32 + tristate "STM32 Hardware Spinlock device" + depends on MACH_STM32MP157 + depends on HWSPINLOCK + help + Say y here to support the STM32 Hardware Spinlock device. + + If unsure, say N. + config HSEM_U8500 tristate "STE Hardware Semaphore functionality" depends on HWSPINLOCK diff --git a/drivers/hwspinlock/Makefile b/drivers/hwspinlock/Makefile index b87c01a506a4..ed053e3f02be 100644 --- a/drivers/hwspinlock/Makefile +++ b/drivers/hwspinlock/Makefile @@ -8,4 +8,5 @@ obj-$(CONFIG_HWSPINLOCK_OMAP) += omap_hwspinlock.o obj-$(CONFIG_HWSPINLOCK_QCOM) += qcom_hwspinlock.o obj-$(CONFIG_HWSPINLOCK_SIRF) += sirf_hwspinlock.o obj-$(CONFIG_HWSPINLOCK_SPRD) += sprd_hwspinlock.o +obj-$(CONFIG_HWSPINLOCK_STM32) += stm32_hwspinlock.o obj-$(CONFIG_HSEM_U8500) += u8500_hsem.o diff --git a/drivers/hwspinlock/stm32_hwspinlock.c b/drivers/hwspinlock/stm32_hwspinlock.c new file mode 100644 index 000000000000..34a8e009dc93 --- /dev/null +++ b/drivers/hwspinlock/stm32_hwspinlock.c @@ -0,0 +1,156 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) STMicroelectronics SA 2018 + * Author: Benjamin Gaignard for STMicroelectronics. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "hwspinlock_internal.h" + +#define STM32_MUTEX_COREID BIT(8) +#define STM32_MUTEX_LOCK_BIT BIT(31) +#define STM32_MUTEX_NUM_LOCKS 32 + +struct stm32_hwspinlock { + struct clk *clk; + struct hwspinlock_device bank; +}; + +static int stm32_hwspinlock_trylock(struct hwspinlock *lock) +{ + void __iomem *lock_addr = lock->priv; + u32 status; + + writel(STM32_MUTEX_LOCK_BIT | STM32_MUTEX_COREID, lock_addr); + status = readl(lock_addr); + + return status == (STM32_MUTEX_LOCK_BIT | STM32_MUTEX_COREID); +} + +static void stm32_hwspinlock_unlock(struct hwspinlock *lock) +{ + void __iomem *lock_addr = lock->priv; + + writel(STM32_MUTEX_COREID, lock_addr); +} + +static const struct hwspinlock_ops stm32_hwspinlock_ops = { + .trylock = stm32_hwspinlock_trylock, + .unlock = stm32_hwspinlock_unlock, +}; + +static int stm32_hwspinlock_probe(struct platform_device *pdev) +{ + struct stm32_hwspinlock *hw; + void __iomem *io_base; + struct resource *res; + size_t array_size; + int i, ret; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + io_base = devm_ioremap_resource(&pdev->dev, res); + if (!io_base) + return -ENOMEM; + + array_size = STM32_MUTEX_NUM_LOCKS * sizeof(struct hwspinlock); + hw = devm_kzalloc(&pdev->dev, sizeof(*hw) + array_size, GFP_KERNEL); + if (!hw) + return -ENOMEM; + + hw->clk = devm_clk_get(&pdev->dev, "hsem"); + if (IS_ERR(hw->clk)) + return PTR_ERR(hw->clk); + + for (i = 0; i < STM32_MUTEX_NUM_LOCKS; i++) + hw->bank.lock[i].priv = io_base + i * sizeof(u32); + + platform_set_drvdata(pdev, hw); + pm_runtime_enable(&pdev->dev); + + ret = hwspin_lock_register(&hw->bank, &pdev->dev, &stm32_hwspinlock_ops, + 0, STM32_MUTEX_NUM_LOCKS); + + if (ret) + pm_runtime_disable(&pdev->dev); + + return ret; +} + +static int stm32_hwspinlock_remove(struct platform_device *pdev) +{ + struct stm32_hwspinlock *hw = platform_get_drvdata(pdev); + int ret; + + ret = hwspin_lock_unregister(&hw->bank); + if (ret) + dev_err(&pdev->dev, "%s failed: %d\n", __func__, ret); + + pm_runtime_disable(&pdev->dev); + + return 0; +} + +static int __maybe_unused stm32_hwspinlock_runtime_suspend(struct device *dev) +{ + struct stm32_hwspinlock *hw = dev_get_drvdata(dev); + + clk_disable_unprepare(hw->clk); + + return 0; +} + +static int __maybe_unused stm32_hwspinlock_runtime_resume(struct device *dev) +{ + struct stm32_hwspinlock *hw = dev_get_drvdata(dev); + + clk_prepare_enable(hw->clk); + + return 0; +} + +static const struct dev_pm_ops stm32_hwspinlock_pm_ops = { + SET_RUNTIME_PM_OPS(stm32_hwspinlock_runtime_suspend, + stm32_hwspinlock_runtime_resume, + NULL) +}; + +static const struct of_device_id stm32_hwpinlock_ids[] = { + { .compatible = "st,stm32-hwspinlock", }, + {}, +}; +MODULE_DEVICE_TABLE(of, stm32_hwpinlock_ids); + +static struct platform_driver stm32_hwspinlock_driver = { + .probe = stm32_hwspinlock_probe, + .remove = stm32_hwspinlock_remove, + .driver = { + .name = "stm32_hwspinlock", + .of_match_table = stm32_hwpinlock_ids, + .pm = &stm32_hwspinlock_pm_ops, + }, +}; + +static int __init stm32_hwspinlock_init(void) +{ + return platform_driver_register(&stm32_hwspinlock_driver); +} +/* board init code might need to reserve hwspinlocks for predefined purposes */ +postcore_initcall(stm32_hwspinlock_init); + +static void __exit stm32_hwspinlock_exit(void) +{ + platform_driver_unregister(&stm32_hwspinlock_driver); +} +module_exit(stm32_hwspinlock_exit); + +MODULE_LICENSE("GPL v2"); +MODULE_DESCRIPTION("Hardware spinlock driver for STM32 SoCs"); +MODULE_AUTHOR("Benjamin Gaignard "); From patchwork Mon Nov 12 15:23:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 10678841 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 133F51759 for ; Mon, 12 Nov 2018 15:24:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 026EE29F37 for ; Mon, 12 Nov 2018 15:24:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB03429F3D; Mon, 12 Nov 2018 15:24:14 +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=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW 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 62A8229F37 for ; Mon, 12 Nov 2018 15:24:14 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=DLnhyOnf6hW3PQPWHWcBxqpOlI2gk1DZrnz6e+G0U+E=; b=TxLhOQaqA2YB1d97sY4VggKRPe DU0k2/bRx3q7ZBmHHKFpCbSS5tqQYETJa8TV5IBmvi1GUcH9OkkyCWV/k/zJUiy6tMDxzvUarKk6X B9BC0W2FW53LPuYGT+veIak8kW9o30q2N2Gk2aMQuWEE6LvZaefmA6/MnbRcXgGl7HNX0j1oR5GCt zkHYLZpOPcO9ZOlkKyNwKsVhXEMbM3jtycssJMJ75Z+nPH7g/yVCIk+drXTcYxyAZTLbsnb8H1rSE +pIVcLmJTEi00LZytb9sf/QtGPkMkt9B/cX5JbsrW34g52OxHpVA2+R6JgYx3Jt6sO84DF5nl1Vjv UxPplT4w==; 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 1gME4Q-0001wG-LG; Mon, 12 Nov 2018 15:24:10 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gME4I-0001mw-It for linux-arm-kernel@lists.infradead.org; Mon, 12 Nov 2018 15:24:03 +0000 Received: by mail-wr1-x443.google.com with SMTP id b13so9781474wrx.6 for ; Mon, 12 Nov 2018 07:23:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZZI6wSh5pBPJOFFIecGp1d55HkRDAwN8pNlGpBqhGKw=; b=KFlVX/WvZWh0RyvkOLNMSKoL7A36jKg8fG/u01HAb7u6qWkO5UAmA8p0XZ44fn/X6z i8j2RDHRwIOyqJaDJfK2rKxcIt4Gmk04/OMS2OixvaEN6chyRmWNwV1MtTk+yys1jTXE F6WsmlljpN37edOmiBYCypLIlrgaNQ0dJZnbs= 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; bh=ZZI6wSh5pBPJOFFIecGp1d55HkRDAwN8pNlGpBqhGKw=; b=sC/3K8KalZZqSQa0TtEbXxq6JWQeeTi41hPA2aCLuBqCBbgItAXlL+LH+lw/u73xqo XmdHztLbl0yD3pquhv/XCSRWV5ry0KcqY0lxFAn/XkbVJEPslT/Pm0yvs19FGnkqM7SW VBpC02crhjhRqKhboTsltxs49ihphQa8yDgerHWzFXXwlk0UYgOjJVaLBp3COtL6x3hC vw7hzy7mvlEHa10855rvAB51RKW6pQf+XSeezM42152ZwfaMrcNHKEvMigEnkb88rUpX VgzDAPa63a8Hfyy0KV8F8Gyf1oZpzo5wZH2ADNwHgJ1kvundaiyRAcLV5iBGNynqk6D6 PHdQ== X-Gm-Message-State: AGRZ1gJtYYc+t6x3mgL9cTIzvJ2URxN1is6D2Tsn0wlqYhPgH2SuK5Vz u5KLF/Xq8kz7ScIUw2oWC9QjBg== X-Google-Smtp-Source: AJdET5cjTcrn5Mw2RMk1opMiUKI3Y/OxS1br/jE6G3dZ2v16tZUPR0o8ah+z65E2P6ix3bJGuCJR4A== X-Received: by 2002:a5d:4b8b:: with SMTP id b11-v6mr1470899wrt.72.1542036236137; Mon, 12 Nov 2018 07:23:56 -0800 (PST) Received: from lmecxl0911.lme.st.com ([2a04:cec0:105e:a8d5:7c2c:2737:d373:11ee]) by smtp.gmail.com with ESMTPSA id t82-v6sm11192849wme.30.2018.11.12.07.23.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 12 Nov 2018 07:23:55 -0800 (PST) From: Benjamin Gaignard X-Google-Original-From: Benjamin Gaignard To: ohad@wizery.com, bjorn.andersson@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, alexandre.torgue@st.com Subject: [PATCH v3 3/4] ARM: dts: stm32: Add hwspinlock node for stm32mp157 SoC Date: Mon, 12 Nov 2018 16:23:41 +0100 Message-Id: <20181112152342.6561-4-benjamin.gaignard@st.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20181112152342.6561-1-benjamin.gaignard@st.com> References: <20181112152342.6561-1-benjamin.gaignard@st.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181112_072402_619917_75EEA757 X-CRM114-Status: GOOD ( 12.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Benjamin Gaignard , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Declare hwspinlock device for stm32mp157 SoC Signed-off-by: Benjamin Gaignard --- arch/arm/boot/dts/stm32mp157c.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm/boot/dts/stm32mp157c.dtsi b/arch/arm/boot/dts/stm32mp157c.dtsi index 185541a5b69f..98f824d8b0f0 100644 --- a/arch/arm/boot/dts/stm32mp157c.dtsi +++ b/arch/arm/boot/dts/stm32mp157c.dtsi @@ -803,6 +803,15 @@ status = "disabled"; }; + hsem: hwspinlock@4c000000 { + compatible = "st,stm32-hwspinlock"; + #hwlock-cells = <1>; + reg = <0x4c000000 0x400>; + clocks = <&rcc HSEM>; + clock-names = "hwsem"; + status = "disabled"; + }; + rcc: rcc@50000000 { compatible = "st,stm32mp1-rcc", "syscon"; reg = <0x50000000 0x1000>; From patchwork Mon Nov 12 15:23:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 10678849 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 8AD81109C for ; Mon, 12 Nov 2018 15:25:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 78A7529D0B for ; Mon, 12 Nov 2018 15:25:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C72329F46; Mon, 12 Nov 2018 15:25:03 +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=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW 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 0574F29D0B for ; Mon, 12 Nov 2018 15:25:03 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=Px3Fd8fqlS5X1ADrxiy30dwUaR4Tb2ZXpqiHb+rOKXc=; b=VOr1u9dq4cfBc7yvb6+ve5b3W/ POCglQq9dN7r3a3jEvKkGPjYLjsGKGkwOezrmJ/ZPE9poyOX0fU+4rojEk0r2p2sh8LYBXOKJsEkd 2aqIoBtW16jEr0Vwa2elyKHKcvmWCOjATqhfEsfqS5pktnAI35MlqfEuwc5Fsk3dd8vJ7wO1QsXlI jeu18mj2b+4VhpOCs7M7miJclp0ah5S0LHbW3o5DqVQ2Ix0dm9j2oBkyH3UxNsm3yMXdrxAg8By4X ofMjcE3kLlfzxSSBuiRWlEst3+0kTFf6lwZ1oAG3UlNCYknfl3pAj4MBBa6DVOhhKwe+ZT27spDkL eCye6ZHA==; 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 1gME5D-0002pA-De; Mon, 12 Nov 2018 15:24:59 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gME4P-0001my-Rb for linux-arm-kernel@lists.infradead.org; Mon, 12 Nov 2018 15:24:11 +0000 Received: by mail-wr1-x441.google.com with SMTP id u9-v6so9823498wrr.0 for ; Mon, 12 Nov 2018 07:23:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pwFNzDGdYuDr+YfGKasy9ggIzxKeenAzUyRgSfpdLck=; b=bMOTlLlUdjW8+zVxtBC4SQROn/62ERv+IV8Fa7SMmr5d9ocapIy0Rhtod83dQhZ0HS dopOX5TGph5besCCo3rep8zjrZfrSKZZ7lTVn6GrX+fhLqndJILjvPOKTZZ+gWFc3M9S gfAKFbcTp8kaxcPNq92P+U7pdCX6UAdTzl564= 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; bh=pwFNzDGdYuDr+YfGKasy9ggIzxKeenAzUyRgSfpdLck=; b=jjxYN6m+tIbNrhiQyamZeC6y3nxHxU9YeAaWY9xfp9FxtRsyACtceneaZkjq2q0anV 0khD2RxFp3RuWIV4a5fsEVjaBc8UF21FEuwdFs2JJtgieLpGR3wLRM33XDYZzS/EBMU9 x5sPCV5AMz5amkOg/2PqYFgSqaWcHa4XDfrJbFYPTM3leFUdtxXeHotGcm4yGC+fBoBA SsZsHjUGazDCmapvWkfq7hv5U+/a3i97NurYbsgwe4SDgXLwYpa2+2LibilA9BxVFgvX pvDnkdw16OLBh2+faHkdxO/u5q1Yjx93UH8XluKLePshU65icG+7/vtJ14BNc7D+bQIp gRRQ== X-Gm-Message-State: AGRZ1gKurUeyOW1bEtJAJJVDtxSR6fbTMrD8f7HjW4fh/icKbGeeQHBa VJPopG4ApDU4neF56KNMnEQNag== X-Google-Smtp-Source: AJdET5dnUue+mZR4muT5SwCJD/ipSNzhGq7/I3kuDnIr1Z6+1Uv2dhTjHNzojjhvGefVKPyoczcAnA== X-Received: by 2002:adf:ca03:: with SMTP id o3-v6mr1377834wrh.148.1542036238262; Mon, 12 Nov 2018 07:23:58 -0800 (PST) Received: from lmecxl0911.lme.st.com ([2a04:cec0:105e:a8d5:7c2c:2737:d373:11ee]) by smtp.gmail.com with ESMTPSA id t82-v6sm11192849wme.30.2018.11.12.07.23.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 12 Nov 2018 07:23:57 -0800 (PST) From: Benjamin Gaignard X-Google-Original-From: Benjamin Gaignard To: ohad@wizery.com, bjorn.andersson@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, alexandre.torgue@st.com Subject: [PATCH v3 4/4] ARM: dts: stm32: enable hwspinlock on stm32mp157c-ed1 Date: Mon, 12 Nov 2018 16:23:42 +0100 Message-Id: <20181112152342.6561-5-benjamin.gaignard@st.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20181112152342.6561-1-benjamin.gaignard@st.com> References: <20181112152342.6561-1-benjamin.gaignard@st.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181112_072409_910980_0989191E X-CRM114-Status: GOOD ( 11.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Benjamin Gaignard , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Benjamin Gaignard --- arch/arm/boot/dts/stm32mp157c-ed1.dts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/boot/dts/stm32mp157c-ed1.dts b/arch/arm/boot/dts/stm32mp157c-ed1.dts index f77bea49c079..158a337b3129 100644 --- a/arch/arm/boot/dts/stm32mp157c-ed1.dts +++ b/arch/arm/boot/dts/stm32mp157c-ed1.dts @@ -94,3 +94,7 @@ vdda1v1-supply = <®11>; vdda1v8-supply = <®18>; }; + +&hsem { + status = "okay"; +};