From patchwork Mon Nov 20 06:54:16 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: 119256 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp3477357qgn; Sun, 19 Nov 2017 22:54:57 -0800 (PST) X-Google-Smtp-Source: AGs4zMb3jw04jBMf8LHMuzCqtkVSEmoFfmL+3u+ZeBDb2wf/Sz5BHRK+oT6tu0coCAOtc6+SjR9y X-Received: by 10.84.168.100 with SMTP id e91mr12930230plb.430.1511160897543; Sun, 19 Nov 2017 22:54:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511160897; cv=none; d=google.com; s=arc-20160816; b=ZCHwlEYhZ1jqyjZ4PR6I4RhroXwOufzrePzFujy9wh0px+ldxWIOXiGOTNjOeHNzoB +8odaJbYM4+ES8Fnb+9oT/rSokl2XvPS5yyngL+r7zT1nuBhvAalJolCOItautTh7M4A 3gP1/u6Lt9ufeQB0D4N4yPQVebVszNFAKhD4gRebeD4LtpiBh8hAIGgifFgbC9Uk3Uzp xBBolnFpyKMJBoUMM2Fu21rGYuXpIk/20isZvMsjFJVlw/JWlX8g9HKF9bcDTchMS25V nyt6+YcMmHE00GvkcRDUfQoR0kdEfUuIwQBXKDJly581XzJa89ZGYQtkZEuXdmZuis1C GSkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=H9v9eVOhlyA57+H3oHtuwCH7JTTgN6i5xwiqrwhhYVw=; b=PDsRqRn8Nraub4zbvTOLC9QZ2QLMF95JEN3c5zMwqyDs79J0Pj1xAevv7I3/lQ3rCo OEa9Ez0Wr40po0Wd2vlqT9wTWvO30Yp8tPxxWl8Yo91kwQji7tymddOGlXhSrIqBuYl8 0YIJ89q62qrt17MG606rKcWZj3KbXJT0Fx79rcWfJlXujctomLTQn9QQaI0hMDEaNaw4 Dss5NTAz8GdQviiiZbbeEv5Y2eaAexalC0nC8tjC4ehN0/807kuRPRUe+GGXjuGi8Y4F uKEg57xuw/CtHNgi/xiX0cen+m6mpSAgOj3m1eV9KUWWtPQPpUhIyArgO2c6pDmWvg2J DPBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ZgVXUmDf; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (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 x10si1089045pfk.208.2017.11.19.22.54.57; Sun, 19 Nov 2017 22:54:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ZgVXUmDf; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751029AbdKTGy4 (ORCPT + 6 others); Mon, 20 Nov 2017 01:54:56 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:44945 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750790AbdKTGyz (ORCPT ); Mon, 20 Nov 2017 01:54:55 -0500 Received: by mail-pf0-f195.google.com with SMTP id r14so95305pfl.11 for ; Sun, 19 Nov 2017 22:54: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; bh=PSukzoaVV9+asev7uHyeVitW9LAnLf9aXd+4537IeSI=; b=ZgVXUmDf262W6L52fzUtzE9Qf2J3BpZNxDT77mQAv0YY+w3JEYCBGupWC/NfPdwTJg WK5oYrRJRBZi79KD2mUBW+E3PMdPE45D1pFspSFA8Ph+TsCiyeicuV+Mxi1fIbEsDK2u svS+4gNncX8mtbqKAHQf+fPiwFTZjlHuvvwtU= 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=PSukzoaVV9+asev7uHyeVitW9LAnLf9aXd+4537IeSI=; b=YtZce2zshiopr90bcI/so4oPUy+NhoBRpk/zRUkH5NQHeKKuw+tn29GrDDhzaly3UL Zb6eIOAqKQREbd80CVA9jwrm9b9fMID7PKcdc0U0mu5Ax72zwb0T3cAzRnkEWLC47ieL 3gqwL6xXdhNhAEQ4IlSR/1OrTUAxcZsS1hXOu/+xxm1UlakWaDko88lzxRKRiLr7Tp3c KGtuev6bo0W3xUhFO9ezZHQnGhtElgwXH/QCy0zEIeWCmH5PBKydfxpWup1Y/GMFQIXR tKsLO1ynjFp+nDW5xY6nh779j0sAU7zzeVuavaCLAAnOtUCGcflrnzkLiw0t2HwNbw+J sW4w== X-Gm-Message-State: AJaThX4w1LQymLCJm+QfXYVgrhscxMTA+M9sk+1x9vTees7MackYxHUu 3E1mSefRcYVTfa3raomonBgxjA== X-Received: by 10.101.86.133 with SMTP id v5mr12364371pgs.266.1511160895103; Sun, 19 Nov 2017 22:54:55 -0800 (PST) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id r13sm17941031pfl.157.2017.11.19.22.54.51 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 19 Nov 2017 22:54:54 -0800 (PST) From: Baolin Wang To: lee.jones@linaro.org, arnd@arndb.de, robh+dt@kernel.org, mark.rutland@arm.com Cc: broonie@kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, baolin.wang@linaro.org Subject: [PATCH v3] mfd: syscon: Add hardware spinlock support Date: Mon, 20 Nov 2017 14:54:16 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@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 Acked-by: Rob Herring --- Changes since v2: - Add acked tag from Rob. Changes since v1: - Remove timeout configuration. - Modify the binding file to add hwlocks. Note: The hwspinlock support in regmap was merged by commit: (8698b9364710: "regmap: Add hardware spinlock support") The hwspinlock was changed to a bool by commit: (d048236dfdfe: "hwspinlock: Change hwspinlock to a bool") --- Documentation/devicetree/bindings/mfd/syscon.txt | 1 + drivers/mfd/syscon.c | 7 +++++++ 2 files changed, 8 insertions(+) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/Documentation/devicetree/bindings/mfd/syscon.txt b/Documentation/devicetree/bindings/mfd/syscon.txt index 8b92d45..f464cc8 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@20e0000 { 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;