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: Baolin Wang X-Patchwork-Id: 839454 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=devicetree-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="ZgVXUmDf"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3ygKGV2TS0z9ryv for ; Mon, 20 Nov 2017 17:54:58 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751029AbdKTGy4 (ORCPT ); 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-Google-Smtp-Source: AGs4zMZsABDf4rmAh5DaFmP4IohuVdCJey73uKPogvW9OZzJXoP/NkXc6rcYpI8oetIvBZbyj/XTeQ== 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(+) 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;