Received: by 10.223.164.202 with SMTP id h10csp484972wrb; Thu, 30 Nov 2017 02:38:55 -0800 (PST) X-Google-Smtp-Source: AGs4zMbcoedwk7X0U8HZGm+2MaEM1ywY3TM28pURqQT8lsZ+Z8oKiAieTkG1FIfJHm5nN4VUsMcC X-Received: by 10.99.45.4 with SMTP id t4mr1959167pgt.254.1512038335047; Thu, 30 Nov 2017 02:38:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512038335; cv=none; d=google.com; s=arc-20160816; b=k/rXfh4Zrrr5h8bCYllhokqvxoO4r84ibfU8DQSeLMs+C2jXTYuL05oqHSwkKNguS8 MqnN7ODPnON0gzaG4pDW4ylZGZIGRa5hE5JQW72aollvhHDNqvaT8f3A/SvCIgNRCJ9T /Nxs7smGVunCuz7NwjZVtULu7W4j3bIjdWTi2mueZpxR7j+nYtwaM6yJSk9Ea2Knis4d fJUFCUB0dLO+gC3IuypYciMB2WkG5EIOPyOCcCPytpUCkdVkkWf+P9WxzDlSCPFTUEud mvu2MwNg7tegwwC7MMn4FMKjP8eTeN8m7muSh6GI4ywOf8yFf6bYhb7TDP8+02qH1mJC XSFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:arc-authentication-results; bh=fmncp63SpsVwqa2cFi2JBjiXcRygYJKywD8jaa2b5c4=; b=xj3rO3P3RJTj+kkMru9yH2zjV1SHxD3Lyenm1GTk5S4jG7uE4YE2yKGiuBveIQg514 1zlO1bkILp53zf86BXKONPzLbaVOihoswS54wBzIC9dSbjCJ3rlr89QMV4Do9Oz5LUVM eVS7vhTfU/Cqe4ZCoVlAShLnHYC/TrqZ+7DR2+goppfoZcDaWFrqtQUSzu5+7Q5rpFze dlljVkcX1BVzbd+fK7oOkUfbSahw56s52kYn16Ysk0qe8iYV5YURn4skMJaUzOEVe2hx 8LXmZlAmF7cORfR5pfB9hMGNiAWTNpYAoVDlgFXnodTgBnxzHhAZybEdesUBdyYyCQ6f gbTw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y38si2899554plh.271.2017.11.30.02.38.41; Thu, 30 Nov 2017 02:38:55 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752336AbdK3KiS (ORCPT + 99 others); Thu, 30 Nov 2017 05:38:18 -0500 Received: from relay1.mentorg.com ([192.94.38.131]:52847 "EHLO relay1.mentorg.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752233AbdK3KiQ (ORCPT ); Thu, 30 Nov 2017 05:38:16 -0500 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-MBX-04.mgc.mentorg.com) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1eKMEQ-00037h-Oy from Vladimir_Zapolskiy@mentor.com ; Thu, 30 Nov 2017 02:38:14 -0800 Received: from [137.202.108.198] (137.202.0.87) by SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Thu, 30 Nov 2017 10:38:09 +0000 Subject: Re: [PATCH v5] mfd: syscon: Add hardware spinlock support To: Baolin Wang , , , , References: <9bd0bfdaf4e869e6216a0ef032b52cd28b33ab16.1512032962.git.baolin.wang@linaro.org> CC: , , From: Vladimir Zapolskiy Message-ID: <78c06786-8bfc-3f15-fdb5-061691010509@mentor.com> Date: Thu, 30 Nov 2017 12:38:07 +0200 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Icedove/45.2.0 MIME-Version: 1.0 In-Reply-To: <9bd0bfdaf4e869e6216a0ef032b52cd28b33ab16.1512032962.git.baolin.wang@linaro.org> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [137.202.0.87] X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/30/2017 11:10 AM, Baolin Wang wrote: > 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 v4: > - Add one exapmle to show how to add hwlock. > - Fix the coding style issue. > > Changes since v3: > - Add error handling for of_hwspin_lock_get_id() > > Changes since v2: > - Add acked tag from Rob. > > Changes since v1: > - Remove timeout configuration. > - Modify the binding file to add hwlocks. > --- > Documentation/devicetree/bindings/mfd/syscon.txt | 8 ++++++++ > drivers/mfd/syscon.c | 21 +++++++++++++++++++++ > 2 files changed, 29 insertions(+) > > diff --git a/Documentation/devicetree/bindings/mfd/syscon.txt b/Documentation/devicetree/bindings/mfd/syscon.txt > index 8b92d45..25d9e9c 100644 > --- a/Documentation/devicetree/bindings/mfd/syscon.txt > +++ b/Documentation/devicetree/bindings/mfd/syscon.txt > @@ -16,9 +16,17 @@ 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 { > compatible = "fsl,imx6q-iomuxc-gpr", "syscon"; > reg = <0x020e0000 0x38>; > + hwlocks = <&hwlock1 1>; > +}; > + > +hwlock1: hwspinlock@40500000 { > + ... > + reg = <0x40500000 0x1000>; > + #hwlock-cells = <1>; > }; > diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c > index b93fe4c..5b67dbc 100644 > --- a/drivers/mfd/syscon.c > +++ b/drivers/mfd/syscon.c > @@ -13,6 +13,7 @@ > */ > > #include > +#include > #include > #include > #include > @@ -87,6 +88,26 @@ 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; > + } else { > + switch (ret) { > + case -ENOENT: > + /* Ignore missing hwlock, it's optional. */ > + break; > + case 0: > + ret = -EINVAL; > + /* fall-through */ It breaks the execution on all kernels without CONFIG_HWSPINLOCK enabled. > + default: > + pr_err("Failed to retrieve valid hwlock: %d\n", ret); > + /* fall-through */ > + case -EPROBE_DEFER: > + goto err_regmap; > + } > + } > + > 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; > -- With best wishes, Vladimir From 1585481643792908327@xxx Thu Nov 30 09:12:02 +0000 2017 X-GM-THRID: 1584567099391769753 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread