From patchwork Wed Nov 1 02:11:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 117668 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp307237qgn; Tue, 31 Oct 2017 19:13:08 -0700 (PDT) X-Google-Smtp-Source: ABhQp+R1TGvD/BMIbkmhHbIVtzzuIyojml1TNkTR+IZ4Dv+HYNRcdgyF/UBX6y5i5BVzzvs3ymrX X-Received: by 10.99.167.79 with SMTP id w15mr3925468pgo.390.1509502388198; Tue, 31 Oct 2017 19:13:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509502388; cv=none; d=google.com; s=arc-20160816; b=kIgzvuGJMAw7XPtSf9R4SWRS6u4JP5IiliEjLEYroiy7z+DgHhPw1BMVZIhoGHG8Ph ZvRSRm7G1hwTmQOVwiU2lR1k60ewCBgfTTUu1rWtU5e8fiZSAjG+aTlpQPjDozI34rjK yVgXaRIlah8OBwOt/toxlShWdCST5vc+SKYWkEcpjFmveeS2PTttXz4n7mxUVoF+OLvl 5KErrQlZ9Ro3tC4Q7WWzMy5n46th0ylWJGjTBV9Nwgak3hp/essrv/+DCfCu0+rGl7uQ 2HFSFj3HxnIhg9T9L81AMZngjyrpxqHNphhf+dTKYjCZAERdk7P+6lqUA/3CKkrQogxr gdaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=MkvaihiPTqrchqo+54JbtyTvq6O+ABAi4K2v4QwbJ6Y=; b=ZW3gZZjbLSntkYf6CoteXmAjIQ7Qo8SkNRMWKDn2RdBvFfudoeS9k6V+63DZCGjVvP AJ94NHJ4VWsCmYx+a/NDKu71UA/Hm64xTfYkMkSOC6tjl1PX53gf6LydUr6IdtsiTneC KxJ0N442o9dx8EaRZP84w8CSW1+oVV9R9uIpfHW34XAa8UAM2FcqwmiNEITkOxZtFKwV W1pZoZM+JYS+QyiKJ7EuBnGN6Mhq2lFK/kskRtNyVeKJYxjWd9GD/8SxQqCbn8rzOVvG g9TP0hgnh0lkQxAVjmDGOUJ1k4MmEeyiXZvcsfimjpgW7pA5bzh6KSdBt+n8Nj9b4m70 b9Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gjlBOUhv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 63si2946514pgi.654.2017.10.31.19.13.07; Tue, 31 Oct 2017 19:13:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gjlBOUhv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933098AbdKACNF (ORCPT + 27 others); Tue, 31 Oct 2017 22:13:05 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:52257 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933031AbdKACNB (ORCPT ); Tue, 31 Oct 2017 22:13:01 -0400 Received: by mail-pg0-f67.google.com with SMTP id a192so827562pge.9 for ; Tue, 31 Oct 2017 19:13:01 -0700 (PDT) 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 :in-reply-to:references; bh=MkvaihiPTqrchqo+54JbtyTvq6O+ABAi4K2v4QwbJ6Y=; b=gjlBOUhvevmV5v6LtPRYdKlRY7gx9lzR78z/Ytg4wiHgkXDe9leq8fsWApy0aI+A5/ ljvtUIcEzp9TabfmgdJWj6uRCdJ6PlEoQRRiETrM+T1mZYhksa+GpeAcW5qeqZUX8nwP ZLAMh/wtbIzSAqqeSwc2WYQES1uPhOMvOCTzc= 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:in-reply-to:references; bh=MkvaihiPTqrchqo+54JbtyTvq6O+ABAi4K2v4QwbJ6Y=; b=LW8dbYOE+Ac9Zcfgy9w1ItkqClMHiP5R2BFZNibbOnlbROIrEuWlNUK46xPQ5fJxCX k0puZrf4Z35ndlu58EktGIbmLYaanU7qilKm/oIXxCKpdxQvFp3EvgWaQaui75Q32YS0 VclQt/iMVwcpjsRtuPBYUDr1nJt4F4Q2407tn73yu1Z1gcLMHjlxEX0rUmsFvNVNkdtr iDoB9fdcmT7fiV6ufc6TCjaVZTNr9PsXGYKTMnwZAJ9uooNrT1H4+StfWMmAdsS/j+YG oXsdGH5la0+XqkQXmn9BqyUtkHYGxNbrZ78WXpv2lsJxdIanuVzRTLefAFxURkDkwx2J RCKA== X-Gm-Message-State: AMCzsaVHpbzTTmdgnuqp0Xov1tMlYaGjjfMANId409RVO7QmO9FxZoDC wW234Y4XbrgrLKcQ2DHauHWCcg== X-Received: by 10.101.78.130 with SMTP id b2mr4005750pgs.160.1509502380879; Tue, 31 Oct 2017 19:13:00 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id x87sm5108406pfi.10.2017.10.31.19.12.58 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 31 Oct 2017 19:13:00 -0700 (PDT) From: Baolin Wang To: broonie@kernel.org, gregkh@linuxfoundation.org, lee.jones@linaro.org, arnd@arndb.de, robh+dt@kernel.org, mark.rutland@arm.com Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, baolin.wang@linaro.org Subject: [PATCH v2 2/2] mfd: syscon: Add hardware spinlock support Date: Wed, 1 Nov 2017 10:11:56 +0800 Message-Id: <8bb857ed54569196d646084a9817a8a1985e2029.1509501110.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <00b91de822135699da81f70c4d2b8fecbc113ab1.1509501110.git.baolin.wang@linaro.org> References: <00b91de822135699da81f70c4d2b8fecbc113ab1.1509501110.git.baolin.wang@linaro.org> In-Reply-To: <00b91de822135699da81f70c4d2b8fecbc113ab1.1509501110.git.baolin.wang@linaro.org> References: <00b91de822135699da81f70c4d2b8fecbc113ab1.1509501110.git.baolin.wang@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some system control registers need hardware spinlock to synchronize between the multiple subsystems, so we should add hardware spinlock support for syscon. Signed-off-by: Baolin Wang --- Changes since v1: - Remove timeout configuration. - Modify the binding file to add hwlocks. --- Documentation/devicetree/bindings/mfd/syscon.txt | 1 + drivers/mfd/syscon.c | 7 +++++++ 2 files changed, 8 insertions(+) -- 1.7.9.5 diff --git a/Documentation/devicetree/bindings/mfd/syscon.txt b/Documentation/devicetree/bindings/mfd/syscon.txt index 408f768..3120fdf 100644 --- a/Documentation/devicetree/bindings/mfd/syscon.txt +++ b/Documentation/devicetree/bindings/mfd/syscon.txt @@ -16,6 +16,7 @@ Required properties: Optional property: - reg-io-width: the size (in bytes) of the IO accesses that should be performed on the device. +- hwlocks: reference to a phandle of a hardware spinlock provider node. Examples: gpr: iomuxc-gpr@020e0000 { diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c index b93fe4c..f1dccce 100644 --- a/drivers/mfd/syscon.c +++ b/drivers/mfd/syscon.c @@ -13,6 +13,7 @@ */ #include +#include #include #include #include @@ -87,6 +88,12 @@ static struct syscon *of_syscon_register(struct device_node *np) if (ret) reg_io_width = 4; + ret = of_hwspin_lock_get_id(np, 0); + if (ret > 0) { + syscon_config.hwlock_id = ret; + syscon_config.hwlock_mode = HWLOCK_IRQSTATE; + } + syscon_config.reg_stride = reg_io_width; syscon_config.val_bits = reg_io_width * 8; syscon_config.max_register = resource_size(&res) - reg_io_width;