From patchwork Thu Nov 8 09:04:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 10673787 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 216431057 for ; Thu, 8 Nov 2018 09:05:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FFA42B659 for ; Thu, 8 Nov 2018 09:05:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 03B9C2BA97; Thu, 8 Nov 2018 09:05:43 +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 E653A2B659 for ; Thu, 8 Nov 2018 09:05:41 +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=jZ/acywTyWlFpzBx5EjJvF2CZfVwGi0Tw+LpMAtHP5M=; b=FpUOxsvxQXf1gYO30u6wuxOqr6 pqmsdxMvaOWrW6UkIDtaLmRK3t2ahOhh8gBkLTzXm71Kp797NYpX8n0ezoF6bznz8z3ixHKxMmZX3 qN+fltIAzBf966T+LLESFXMCYmoc8bPILSls6i7Jw++/Kk1Gwo+94HLObWXql6r2QNg8X06Hrik5v 88ttRUU4asgJevNhPM+c259scZpTVyG8KfVUsHhBo6l4yGKjN3FCZP9GppvvMfqfXmQiagkjNHyNV 2/gOjhSzYoJMX6NVtNpZ4ar+p9mgVfgfUmNYSsxRaKTk7pi70yE6kcTSvJVSYF+xUM4d7cU9ZKutA k3n1TBKA==; 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 1gKgFt-0001tW-WA; Thu, 08 Nov 2018 09:05:38 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gKgFk-0001jP-NW for linux-arm-kernel@lists.infradead.org; Thu, 08 Nov 2018 09:05:30 +0000 Received: by mail-wm1-x341.google.com with SMTP id 124-v6so453278wmw.0 for ; Thu, 08 Nov 2018 01:05:17 -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=jRCk5lNBlPCD7GwKBzaRehaZeMJbLJXp2+/KqxIsFvY=; b=PRCeYAKI1JDWmpfIB+fVwGmz1XhZopfERjhSMfAfj3b0fJndvCuqDwWV6yzY1OtbFK 0W//QSrqpdNuwU+HsEqHP9pCgjJsWcXAJay1v5nz294M2/jrG/HVUvpKpy0mHF2fRCeq M0S3gqspgYb9Z1kMebrHkdqa0KPLAVfu6Vbzg= 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=jRCk5lNBlPCD7GwKBzaRehaZeMJbLJXp2+/KqxIsFvY=; b=TDJst6pLVYunZtC82oDZfR8xRobRCvnTWB/bFmDTlMGcaARmjxuoOPnlMSHLPhytGe B47dNDh56tCOhTegzGUB/r2Bnv/ZWob6H5jwXhXFChk5ef5LIB4skKYMUVzP+Dj97rtW /kGBWhoWKN602uLtc9jNlfjZFiBZosMOsU2TfgKv0mc/R9+EFQUBLmojt3vCYU9cq9Xx eurmQvdH1XwVExEOo+yXgeGQ69doTu4jk8gmk0m2dijAnpTk8862EOjT2nunp+2GDh4W NBjCFCN6kwgOIZXgcBLMZN1rlmGzMMr+zob6pKVARRdkqNIirb7BeOBtmAepDjmXzdZU 2b/g== X-Gm-Message-State: AGRZ1gKXQF6ynSn9Ggh5YHsVMjGsUiSQb6Pha9rwvZLqr29/oHJBLQj3 a9Od2Ep59d5HF/2bf3alE29Zrw== X-Google-Smtp-Source: AJdET5fTS06uzWUmAt5qrVnJNaHoFWBuVdlyggZVVgrWQkFkHAKhOM7cxVKHTm9+CO0iMvwifDK43A== X-Received: by 2002:a1c:b4c1:: with SMTP id d184-v6mr412831wmf.143.1541667916129; Thu, 08 Nov 2018 01:05:16 -0800 (PST) Received: from lmecxl0911.lme.st.com ([2a04:cec0:1094:149:440c:9368:8cda:a020]) by smtp.gmail.com with ESMTPSA id l140-v6sm6974469wmb.24.2018.11.08.01.05.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Nov 2018 01:05:15 -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 v2 1/4] dt-bindings: hwlock: Document STM32 hwspinlock bindings Date: Thu, 8 Nov 2018 10:04:59 +0100 Message-Id: <20181108090502.14543-2-benjamin.gaignard@st.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20181108090502.14543-1-benjamin.gaignard@st.com> References: <20181108090502.14543-1-benjamin.gaignard@st.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181108_010528_760810_8BD4EA1E X-CRM114-Status: GOOD ( 13.72 ) 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 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..6e933b218574 --- /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 "hwspinlock". +- 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 Thu Nov 8 09:05:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 10673795 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 65CA81057 for ; Thu, 8 Nov 2018 09:05:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 529592B659 for ; Thu, 8 Nov 2018 09:05:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3CCF02BB12; Thu, 8 Nov 2018 09:05:59 +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 210022B659 for ; Thu, 8 Nov 2018 09:05:58 +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=rQFZqLiQMFksKv5F8iTXc0k02BQGZuhwrKzlMhA/gOA=; b=sDnz/4PhIAzTLOPTdONviXPE5c R7zNmIRjom0s5xwpg4eCdEHt2hlRGEOuBUu+y2dyQ7CYxCYdg5Wa4FppCc0FuJHL/FNbVvfb7qTL/ m/pgj/KcFZEOD8zMPhrdeWov3kLLqnf6R24adml3/STsEqNmGKjV6dSS2HwTFB8Fjsy8R013NFeZe E3r5Ze0DsRoxtVdpouwYCw+RqgJjPYBz+bA3nOI4AiCpH0iedM3KsYtolLpGedeNBAHzZuxaMYXxd TgE8e4cT95zqs2dWk1u9dO6K2yTnykEvs+A/gvibDRa3QgauYaYeju0DY20iyOGhhRf1zWnGEC8OT MX2v9nzQ==; 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 1gKgG4-0002Au-VT; Thu, 08 Nov 2018 09:05:48 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gKgFl-0001jQ-Ky for linux-arm-kernel@lists.infradead.org; Thu, 08 Nov 2018 09:05:31 +0000 Received: by mail-wm1-x342.google.com with SMTP id f10-v6so437513wme.3 for ; Thu, 08 Nov 2018 01:05:19 -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=vfYBXlI8TGzQiJThszSCkUGyt2x6cRpuleHBiD2O0WI=; b=gKwZFQEdxyx71OjEc1WYHh9hL7tMQAk1Q8NN1gKz3OPhXyowjVnmGmtP0pclDo03UO jjKBlQLxFIkeyqHRGQsU/p+AQxRhePTpYb9qaM1xBbr821jcgAfPA1Av1uKR1HzXbFeP acI/vnI+Lg+psXV1HGPrLaaUyj1gdfRBbrkuk= 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=vfYBXlI8TGzQiJThszSCkUGyt2x6cRpuleHBiD2O0WI=; b=ADhM9LDKlvoNDMeX4xa8yZE92Bif/RZnDQspunvHs4PeV9BY9GIvwBZKIrNvnVi+af Uyc5EXVL77xCmMeXdXM3l++ueuJM1SJNUSgwVvBCnXBjXabPrgBFcnwm+lR75EOFyxAI 21WMI8A0Ebt05di1eCeGwpKza0gRXFOdJnJ5azuvYoZQsHfjnd6oQpUvcxvEy814RKNa U5PXkto/s2c+/dc2Crc7QPpyshXZAgtUyCMEDpzlhUGiLwpAU6K5YyDxJ1Wr6p//9zNS CnS5af7t4zlazlvnSoestW1NYW3VV3AnsbcxI+H4Kb/vA/eDqs6Fe6yi+y70bRBre1ws HMtA== X-Gm-Message-State: AGRZ1gIEE2VAZKmAirsCnZYVauXmnIoWoOV3SfO9jVxH5/bCSPX2GXGu qKas43ETa7gcuF4Ci4l8HfalHScttlE= X-Google-Smtp-Source: AJdET5daqR3GTzFPF6l1if10VOkqfNJEXMu/mgNdH/Wxr1L2Ju2kHGfkTLvH6nFDdqH4PTUsvvOX4A== X-Received: by 2002:a1c:5706:: with SMTP id l6-v6mr443683wmb.51.1541667918008; Thu, 08 Nov 2018 01:05:18 -0800 (PST) Received: from lmecxl0911.lme.st.com ([2a04:cec0:1094:149:440c:9368:8cda:a020]) by smtp.gmail.com with ESMTPSA id l140-v6sm6974469wmb.24.2018.11.08.01.05.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Nov 2018 01:05:17 -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 v2 2/4] hwspinlock: add STM32 hwspinlock device Date: Thu, 8 Nov 2018 10:05:00 +0100 Message-Id: <20181108090502.14543-3-benjamin.gaignard@st.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20181108090502.14543-1-benjamin.gaignard@st.com> References: <20181108090502.14543-1-benjamin.gaignard@st.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181108_010529_683605_0FA31D6B X-CRM114-Status: GOOD ( 19.56 ) 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 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 | 144 ++++++++++++++++++++++++++++++++++ 3 files changed, 154 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..7eb36a5bbf68 --- /dev/null +++ b/drivers/hwspinlock/stm32_hwspinlock.c @@ -0,0 +1,144 @@ +// 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, + }, +}; +module_platform_driver(stm32_hwspinlock_driver); + +MODULE_LICENSE("GPL v2"); +MODULE_DESCRIPTION("Hardware spinlock driver for STM32 SoCs"); +MODULE_AUTHOR("Benjamin Gaignard "); From patchwork Thu Nov 8 09:05:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 10673807 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 A37C317D4 for ; Thu, 8 Nov 2018 09:06:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 928112B659 for ; Thu, 8 Nov 2018 09:06:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 870D52BA2B; Thu, 8 Nov 2018 09:06:27 +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 349F52BA97 for ; Thu, 8 Nov 2018 09:06:27 +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=wV0wIYkHCszxSAGsSZwF8runtR23gL8eAZJ109mFP3I=; b=mr6fDFvxwwnbBxTgDpz72VG1De OXfZig4Tmo7LPusgygwWlBZHYvsqn1vtyCH/k5LK/jpk8wQwZxQSzzTSpFJORwmSZrVGM4ZtMP3F/ jBah913M8GDLTUEYBrzd/mN1nf7kgkqCdU+jjbdbdrbIA6x01iRysecgSMlutYEsI1B5zxrVijnBv woq9hdRrMfhFf7PMlQCHoc6zFtjECHBdoHrPNFQilaoPur9t+eUgpIDCaifycRVwW0zysI8M460ZR DJ05MxiyZqh4bM7zaLSvNB4Vuq+OU2uQMr8O5+qTZqtEeBc0ZcskKV/NQ4+hFYwzg6yYZWsWRQUv7 MHJ3oUXA==; 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 1gKgGY-0002nx-4q; Thu, 08 Nov 2018 09:06:18 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gKgFn-0001jW-FG for linux-arm-kernel@lists.infradead.org; Thu, 08 Nov 2018 09:05:34 +0000 Received: by mail-wm1-x343.google.com with SMTP id a8-v6so419708wmf.1 for ; Thu, 08 Nov 2018 01:05:21 -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=tQkj1hz0jEEKFJdYxtoN3LCnWHFTEXeYAE7pWLaze8c=; b=bZP5HsXKn+NmVZUSWhMsRAUIB1J4stGd5tz0mcnKqJ8haMeq5yBEqxBOjzyK8AaaAT JBJ3ueWEg6b6sV9/RspHgteD14PuGQJvmvdkoNdoE08d1fT9H/ymvM88SjucAmv2IRgM yvlf5K+Ernu/tqAZ3JjtWOhJQLwrMBq8TLn2c= 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=tQkj1hz0jEEKFJdYxtoN3LCnWHFTEXeYAE7pWLaze8c=; b=Qq8Y3wd622ex6yt9UOtW0mTEPO66EF7gd5woUq/BqYPA4GkLsVDMUR6p50shGNYO84 njH386eydfXYxwRan+p7TwFteqQHJqr6gqlDUSpEkA/G85ihkpwqhGwBOEeq5zlGp6mY dgLXuNKildxV6dEwq1zgoKCG8MZlOyVKm5Gsft6vWa0n+W1fL32nlcOoPCWnkT8b1v8H WbOChAP9CXNAwnl/RMxcApvD3EiZSIR9umIUq2uXWP+ashLgrZdatcCHKquuVluuOz/q TpakHTYLTz4LNLL9Dbt8Y0KGdeYCaFu+XV1HEjNhEio7oPdoojK4isV0U+sw90SWs0hA rgWA== X-Gm-Message-State: AGRZ1gKtmiGdVMCRkSSzMslWRJeUySC8yQZ/dfhV6wI98VysA11FLj0Z f6n89opOOtXC9Pfx1WYJTsTZqw== X-Google-Smtp-Source: AJdET5dWLP0Ce4B9uITjiq/lmAggodgFZlChTXhroWfVryZH8jjR7e4xWMzgmBWrk3AvoTdTZjH9bg== X-Received: by 2002:a1c:8314:: with SMTP id f20-v6mr446270wmd.120.1541667919767; Thu, 08 Nov 2018 01:05:19 -0800 (PST) Received: from lmecxl0911.lme.st.com ([2a04:cec0:1094:149:440c:9368:8cda:a020]) by smtp.gmail.com with ESMTPSA id l140-v6sm6974469wmb.24.2018.11.08.01.05.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Nov 2018 01:05:19 -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 v2 3/4] ARM: dts: stm32: Add hwspinlock node for stm32mp157 SoC Date: Thu, 8 Nov 2018 10:05:01 +0100 Message-Id: <20181108090502.14543-4-benjamin.gaignard@st.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20181108090502.14543-1-benjamin.gaignard@st.com> References: <20181108090502.14543-1-benjamin.gaignard@st.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181108_010531_520358_64F17D15 X-CRM114-Status: GOOD ( 12.72 ) 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 --- version 2 : - change clock name from hwspinlock to hsem to be align with hardware documentation 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 Thu Nov 8 09:05:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 10673797 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 240911057 for ; Thu, 8 Nov 2018 09:06:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1068C2B659 for ; Thu, 8 Nov 2018 09:06:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 03FC62BA97; Thu, 8 Nov 2018 09:06:01 +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 AE2E72B659 for ; Thu, 8 Nov 2018 09:06:00 +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=sqRHmJEO4h7VTXrYuGPWjM6cdFdYVCsoFKn+M2FMNSQ=; b=Xi5NnAFYqIKtknURm9nN3KBL8c BInmwy0KzQYhetSllgjUJiWN97w8kf49ZDIuUiqq55+E+TakvciIVzsk20cdiv/bUnrsMB1D+X0Tl rL4wxx23QU0kPa00U1iB2SKVogRGYd7mtuTPT42MyLtYaLFKEJ5TQOyYlTxgE1DdPa767kj5C40qH Ge3hWcVyqJR8QKrpEhYknRdFHo5H/3x+IyEo+uFYRxsOvJotVmICAcYySaFhqVVkHZiNhYQ14ePYK 1+aKjbKyLCXGvlEM1njf2xvQ8h85qvaJtedrED67VwR4AME/Q06ExG3PS63X05QvYV437NnwjHU2M uOJaEufQ==; 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 1gKgGE-0002Qu-KY; Thu, 08 Nov 2018 09:05:58 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gKgFl-0001jo-Kz for linux-arm-kernel@lists.infradead.org; Thu, 08 Nov 2018 09:05:32 +0000 Received: by mail-wm1-x342.google.com with SMTP id f2-v6so413227wme.3 for ; Thu, 08 Nov 2018 01:05:22 -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=7C/wrspMfUQvsFMTcgDRLQWNrIa3gG/vxf/pbqlMaK8=; b=GFUvTNHosU9EGyVuBqbiVyi/VR8Q1jV/Q7erazAt4wlxRAbU/4G+zA8uahY1+BZmSF LA9GoVdAOQg+ysjc/Qx1d58HPqtMRA/Z/jA9HnVi2qRMb+oByD6bymWrzK2OzP4pG52g EpzWWHFiljYmWJ847nAWMLssfJo19wqjuMhWg= 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=7C/wrspMfUQvsFMTcgDRLQWNrIa3gG/vxf/pbqlMaK8=; b=Ve5sQPlG4CjEyxL6NCXTOXA74urduMsn44QjMgbE4WKSmxsWq6E80UprSwyZGK3LCi oNknSn34Pt0wKH9nj6L+VyLtlLwwngPBMDH3nmAv99ogdUMwlNf5vR2VRXvxojcuXWoh 5h+5k67mRR02GcviLpPRl5iobQusBp4iQVcD9Yy8XrW3FrEExn+cMyaFP21cV6A1L5sg PBsZpx0dEAvg8aMWfXXtD/ZSWGbOV4DRpwxSTU9QGdHTOBfVXsAxIi5y9N2SKoqIj4Xt nBu1Kp0B9iMas4Y8ZiTj6g2vC99D+A78HiLZcZELM3TEzzoV+FSX3LWLO7vIu4HBic2+ 9w/g== X-Gm-Message-State: AGRZ1gJzBJyRxkjLMR1A3BT9Qv+/NHk6rEVDRWbfbOLnReTPwYzT4jKV H3aAtEt4bTEc+NoZ6/N9mSL7tg== X-Google-Smtp-Source: AJdET5eo7NLKsq4nCro/TskDB1tEsDKTt/G/XujosQSzN7bJZQt7DssrB8rqYu0lQxZHrJtkrl0aRQ== X-Received: by 2002:a1c:84:: with SMTP id 126-v6mr410351wma.96.1541667921577; Thu, 08 Nov 2018 01:05:21 -0800 (PST) Received: from lmecxl0911.lme.st.com ([2a04:cec0:1094:149:440c:9368:8cda:a020]) by smtp.gmail.com with ESMTPSA id l140-v6sm6974469wmb.24.2018.11.08.01.05.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Nov 2018 01:05:21 -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 v2 4/4] ARM: dts: stm32: enable hwspinlock on stm32mp157c-ed1 Date: Thu, 8 Nov 2018 10:05:02 +0100 Message-Id: <20181108090502.14543-5-benjamin.gaignard@st.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20181108090502.14543-1-benjamin.gaignard@st.com> References: <20181108090502.14543-1-benjamin.gaignard@st.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181108_010529_682755_11B41D33 X-CRM114-Status: GOOD ( 11.22 ) 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 Activate hwspinlock for stm32mp157c-ed1 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"; +};