From patchwork Tue Nov 27 12:49:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 152119 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1219396ljp; Tue, 27 Nov 2018 04:50:14 -0800 (PST) X-Google-Smtp-Source: AJdET5cft8XTh8Efn4cDKEp7/f/zHDbLlfGmlNgwbTA7x4umFVn9LKVwyluJwV3BugXFF24K1Piv X-Received: by 2002:a17:906:48c5:: with SMTP id d5-v6mr23368570ejt.85.1543323014351; Tue, 27 Nov 2018 04:50:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543323014; cv=none; d=google.com; s=arc-20160816; b=RjIEdHmlL596F3Jzd/uf+QgIbylea/vjV8fvf4mB94j919s1LyF65o7XEcV4ZUReJQ 7W+Y1OppH+I1oohMa6TgU+8Fh5wLg7CU5E4YekUvqmdXmeoauzZsFvwfP8ymwJKcS4DV IJIdyW7JpDKQXua55JkhJCZKAzsKSAHBEcJgIWmBrayM6ubqGLJMVH8TNks8IzaHC4ml RqvJt53wtMqUuEOM0TYHCJvv9jYnT7ziLbk1/g9j1vroBM/5fWCrAB8kE5Lss/MR3+xq aniZyNymA7gt0XSrZKxk34Tr1QSXyj0k6Grlsp4wRkVz2ku9P31afe5wzncVocYQ7Wo9 zeIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:message-id:date:to:from :dkim-signature; bh=jwHU95eiwnIPfRtqLnzhNNcu+v73scKKV7zwKAw2Urc=; b=ZcGpRKd6b5eaYV8GD0zTyX984UBPefi87XgevOhg7RyQoG8rxhUOeuc4rGkzoDl0qX 5ftePcFviX6zXMoaLsldnkH+F2xAYYaCB38e7Eq6uRP2sdcIFw4SZSGr178TpWgzHA5X +2zHW+42AE05JMPxfjdBfod5M12iD9DuW7r7tpm0JhKGou7yFEZgli4NpOR8Lf35QaIY UAY2ZUmetlvY/0FvIVv6St6ER4TEg5s8D/Iz47CXX6fCWJ6FloEaZl/gnwzFO0mbRqjA vxyEHGQOOa60JCS/RVyf7lxG3BbIoCQt+/KFpRT3tqp0BM5F2QTU/Xl9UL6DJNjLlNl0 Dfwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=WyeMwY+C; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id 7-v6si1901888eji.75.2018.11.27.04.50.14; Tue, 27 Nov 2018 04:50:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=WyeMwY+C; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id E4561C222BD; Tue, 27 Nov 2018 12:50:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 60E56C220D3; Tue, 27 Nov 2018 12:50:10 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 26731C220CB; Tue, 27 Nov 2018 12:50:08 +0000 (UTC) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by lists.denx.de (Postfix) with ESMTPS id BD244C21FE1 for ; Tue, 27 Nov 2018 12:50:07 +0000 (UTC) Received: by mail-wm1-f66.google.com with SMTP id q26so21981818wmf.5 for ; Tue, 27 Nov 2018 04:50:07 -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; bh=SNWI+y7KetWuGd6Yw6Lb7tXm0sP/X0AX/fF6qiOqEps=; b=WyeMwY+CUNnV5rVGqIw1D401xD2nDNrkTk5H2jmiAy7LQdn4M2n61+Z7pS7VzobKoc 7NTVaAAgJX0GsrPE6EmXj0NND8oQmhOgyNpHKK8ZDIBs5kNz5bCUpdhFLZ4AUNTmYie3 8n4Eq5RUpbeyyrW7DAhLTiZz8pcfA0NDjyo7o= 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; bh=SNWI+y7KetWuGd6Yw6Lb7tXm0sP/X0AX/fF6qiOqEps=; b=RRIO3v0BbN4NZSPZX6xBPnZrskVfdzxs/I7DEVU4YxEiB83ksRbV6mjtikboQJ/kPv f9OsnBYgeDeCGVips/AbvwiHYPisgJOVo46QJY96KGGZEQTNPicDuLmuiY5YIEJW79zG u/8GrV2hg4uZtS893/h5sRWyhPRP19ZVNmSNaIdTJCVaiQ8gNjYm05B4C+8MkfWOJbBZ HFpCEqXzMVzy6LWDyv+EN0In8RMyM7SETfkZlnMfbgNf2gQLqScO1Wa2gJuJnSxYx6uR vGSbL46v/kxDZj0TPw5V23sNLAHXbFZuvdf/fCN+3CIvd+xkcnpYC19O8Guyu6vZWbyu Ddfw== X-Gm-Message-State: AA+aEWYsAmDvTJ6JYZE34+6SLCcnWmYw41P59Sj6bWUZhfoHGm8K2DCu Um1wqExS9FuM+3xO7kGAAGEA4w== X-Received: by 2002:a1c:b189:: with SMTP id a131mr25086294wmf.38.1543323007285; Tue, 27 Nov 2018 04:50:07 -0800 (PST) Received: from lmecxl0911.lme.st.com ([2a04:cec0:1087:3904:205d:1327:2414:27b8]) by smtp.gmail.com with ESMTPSA id p14sm3098056wrt.37.2018.11.27.04.50.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Nov 2018 04:50:06 -0800 (PST) From: Benjamin Gaignard X-Google-Original-From: Benjamin Gaignard To: patrick.delaunay@st.com, albert.u.boot@aribaud.net, sjg@chromium.org, christophe.kerello@st.com, patrice.chotard@st.com, trini@konsulko.com Date: Tue, 27 Nov 2018 13:49:49 +0100 Message-Id: <20181127124953.4458-1-benjamin.gaignard@st.com> X-Mailer: git-send-email 2.15.0 Cc: uboot-stm32@st-md-mailman.stormreply.com, u-boot@lists.denx.de, Benjamin Gaignard Subject: [U-Boot] [PATCH v5 0/4] Add Hardware Spinlock class X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" version 5: - rebased on top of master branch (patches 1 and 4) version 4: - make timeout loop more robust version 3: - use dev_get_parent - add Review-by version 2: - use -ETIMEDOUT and -ENOSYS for errors cases - do not test if ops is valid - remove useless include - add a private structure to store base address - be more verbose in configuration flag description and commit message - log the error after hwspinlock_get_by_index() This series add a news class to support hardware spinlock. Hardware spinlock could be used to protect critical sections of code between multi-processors. The proposed API remain simple with only 3 functions to be called client: - hwspinlock_get_by_index: get a hardware spinlock by integer index from device-tree node - hwspinlock_lock_timeout: lock the hardware spinlock - hwspinlock_unlock: unlock the hardware spinlock Driver API offert 4 operations: - of_xlate: translate a client's device-tree (OF) hardware specifier - lock: lock the hardware spinlock - unlock: unlock the hardware spinlock - relax: wait time between two calls to lock operations Benjamin Gaignard (4): dm: Add Hardware Spinlock class clk: stm32: add hardware spinlock clock hwspinlock: add stm32 hardware spinlock support pinctrl: stm32: make pinctrl use hwspinlock arch/arm/dts/stm32mp157c-ed1.dts | 8 ++ arch/arm/dts/stm32mp157c.dtsi | 9 ++ arch/sandbox/dts/test.dts | 4 + arch/sandbox/include/asm/state.h | 1 + configs/sandbox_defconfig | 2 + configs/stm32mp15_basic_defconfig | 2 + drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/clk/clk_stm32mp1.c | 3 + drivers/hwspinlock/Kconfig | 24 ++++++ drivers/hwspinlock/Makefile | 7 ++ drivers/hwspinlock/hwspinlock-uclass.c | 144 ++++++++++++++++++++++++++++++++ drivers/hwspinlock/sandbox_hwspinlock.c | 56 +++++++++++++ drivers/hwspinlock/stm32_hwspinlock.c | 92 ++++++++++++++++++++ drivers/pinctrl/pinctrl_stm32.c | 27 +++++- include/dm/uclass-id.h | 1 + include/hwspinlock.h | 140 +++++++++++++++++++++++++++++++ test/dm/Makefile | 1 + test/dm/hwspinlock.c | 40 +++++++++ 19 files changed, 560 insertions(+), 4 deletions(-) create mode 100644 drivers/hwspinlock/Kconfig create mode 100644 drivers/hwspinlock/Makefile create mode 100644 drivers/hwspinlock/hwspinlock-uclass.c create mode 100644 drivers/hwspinlock/sandbox_hwspinlock.c create mode 100644 drivers/hwspinlock/stm32_hwspinlock.c create mode 100644 include/hwspinlock.h create mode 100644 test/dm/hwspinlock.c