From patchwork Tue Oct 31 06:35: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: 117517 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp3508883qgn; Mon, 30 Oct 2017 23:37:11 -0700 (PDT) X-Google-Smtp-Source: ABhQp+SyEN8wGfxmxBT7vMYqgMQgYk4ZoQIaiy37GzQBvp2uugYU1kvUb3z2P88FIFnkWZnfVHzw X-Received: by 10.159.218.142 with SMTP id w14mr980898plp.310.1509431831037; Mon, 30 Oct 2017 23:37:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509431831; cv=none; d=google.com; s=arc-20160816; b=rjLDVetMUdvTIbtXtR4oaOL+Y+EX/87b9MPvFTqj3Qz/DmAlzF3RhNl5X+CkHdCpJp e9p/b98TDp5R7Q2SQVcgcya7jI04EYWOeFhXe5sCukg8AgRsnyEJWwZfGZlDaCv3vi6M OLG8bkymaE0OsClhOriiJRmv3rBVm3Uxz3KiLnf2WfT+2FOxtVBTGcvkAR6BaO9bRfFH Aa3rjqO5ZapvuQzgG7YVhPM+B8ILvjFtBCqOJ9qZ9WQejuTUmkehF1I3nngU+yuC7DVG Xn4L51ZSA+zQM9vOgoN/rKSh23FfecjoaezwjXUvK/7QLgVXIDGsgn4iAbwrlHtayRut eV3Q== 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=snCLBiqHWwoMVDC5t2eudnhl+zWAo4QyebEbkTztpGo=; b=CR/czcnrC2Q5XTy7zqKLKrE5Vwp7ejY48h1CUjJPlYg1eRzUhNYT0SAk4GKEH5+7As Zspibbw52BhoWIn/HmX92l5aIxd4O/ZVahNFOBUP4ZImAbzy4SnxxJXBSC39DWGtyxzf OYGF6pDjdSovD/QiH7zaC73mLqYPIiWitFt0TwL3rdDgUCHkFEgvthQzTdfXLV6vt+H3 QkYSy/Jonnf6M6NUXC0f25M75IdV4HLrgu/NnDshS+szL+R2kmuj3CJVuW8k8+gshADw QUGDy1tvjF1tz71rBE7+M8TfqXOZhWM86qYOIxbQYtBckCihRkTTWx42EgM0Spu1eOgT QmhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=X5KkU1hV; 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 j24si820222pff.406.2017.10.30.23.37.10; Mon, 30 Oct 2017 23:37:11 -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=X5KkU1hV; 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 S1752877AbdJaGhI (ORCPT + 27 others); Tue, 31 Oct 2017 02:37:08 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:45276 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750916AbdJaGhF (ORCPT ); Tue, 31 Oct 2017 02:37:05 -0400 Received: by mail-pg0-f65.google.com with SMTP id b192so13836872pga.2 for ; Mon, 30 Oct 2017 23:37:05 -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=snCLBiqHWwoMVDC5t2eudnhl+zWAo4QyebEbkTztpGo=; b=X5KkU1hVUz82Fh9kGbdwNJ4iNdX/Keu7Ca+tKNem+nE8EYUyyySuaurFATfkBa+gyd 0W2VckTqx23jG2cS1HPBX85P5T5WZRFtc39+mmTKcggkIywBpr1+oSyLFy9pOwy5vY86 wUPmva2+AB6o+qH7hQ9oWcTXeqtNoc/nDFLOg= 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=snCLBiqHWwoMVDC5t2eudnhl+zWAo4QyebEbkTztpGo=; b=st+FF47hM1zEoWtnvy5YqUxQNEybdnVOajElANEW5NKeM8lcEgcPNtC9PQHzkr+xZZ mTi6IOCl+4Odlm8BDch2yfgBwUOgwS18NCitb/MCQv1HYtRdKko2WFChYoDd6w8EJwm2 USUIOf/4WjgtAaI9XFvloykyZO9KjaXBfvujJLwqMGq7rcRXPdHzpP/2Z0IpMpA8OYs/ cy/2wUp96rxB4IvM9Sn0RrIq9hht8m+CNVccWlEcm8wVX5iKTrQ4H/gunToWBRBcrS8q bOSMq0sREraZdonp34tMLWCjFZ/7WjK/Jax4dRpZDpA5mwvkmqOxiJAk8uWrToeQ1LoO vG9g== X-Gm-Message-State: AMCzsaVuA+AkPk9/HZfMHyCKwD8L5IFIpj5GRNzNzAHoaRq4NZRCW179 l1jvoUWaHBPmywV5BkAWSEr8Pw== X-Received: by 10.159.244.136 with SMTP id y8mr924604plr.251.1509431824616; Mon, 30 Oct 2017 23:37:04 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id 76sm1597477pfp.80.2017.10.30.23.37.02 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 30 Oct 2017 23:37:04 -0700 (PDT) From: Baolin Wang To: broonie@kernel.org, gregkh@linuxfoundation.org, lee.jones@linaro.org, arnd@arndb.de Cc: linux-kernel@vger.kernel.org, baolin.wang@linaro.org Subject: [PATCH 2/2] mfd: syscon: Add hardware spinlock support Date: Tue, 31 Oct 2017 14:35:56 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: 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 --- drivers/mfd/syscon.c | 9 +++++++++ 1 file changed, 9 insertions(+) -- 1.7.9.5 diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c index b93fe4c..adc1c9c 100644 --- a/drivers/mfd/syscon.c +++ b/drivers/mfd/syscon.c @@ -25,6 +25,8 @@ #include #include +#define SYSCON_HWSPINLOCK_TIMEOUT (~0U) + static struct platform_driver syscon_driver; static DEFINE_SPINLOCK(syscon_list_slock); @@ -87,6 +89,13 @@ 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.hwlock_timeout = SYSCON_HWSPINLOCK_TIMEOUT; + } + 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;