Received: by 10.223.176.46 with SMTP id f43csp465825wra; Fri, 26 Jan 2018 01:38:39 -0800 (PST) X-Google-Smtp-Source: AH8x226BIyVhrGoK1zJB1BFyFAY2JwyOvfs3IoVsc2lPcpQ6Sy4O5bMDNJ9ls0gnTMf/YIkdjrtm X-Received: by 10.99.120.203 with SMTP id t194mr15206511pgc.39.1516959519123; Fri, 26 Jan 2018 01:38:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516959519; cv=none; d=google.com; s=arc-20160816; b=wXWCpEmWRdWUa5v5tufWHY/seMoFseLB6UiUBfsov9Jq5KxNfo3iQ+0NWEmlDhjIgf t23wHrudQ4z7JflJRnrX3SVNJLEFZ0AFb1lg/zovN8NXhBOeaRT4FSnBAQqn2mNmcLyv 0HjpXa+wqRR0kem1o0ncSRJsxO0rDXSmmiDaBSrbhD1OCndKLNv3yK6aoFFwQDC3R/SV kho9KlyDNufQ/UTEm5g1kjagPwzwS39MJNjuAwTP1qJu3RrFiYqUcHTikMHNC9kU1SvG 8x9Wca4edLGC+lLLVbcdpMAF0kD96DPm9MfbWtHVnTvJtFVixTsflXWpl/1qwGqwbKyw btFw== 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:mime-version :organization:references:in-reply-to:date:cc:to:from:subject :message-id:arc-authentication-results; bh=OL+WPSMIr1COmTEyl95aCDpxIyA+XC9JjR223mTjSSQ=; b=ibRjyNR3cLGi+Uj34g7q3RXWfcsJd6XxyCCtpXctn/59bM+pjmo3doJJHqGGWXOLIx y7xQ3qEqgUdh1iiPsNOZf5NxokMn2v/MA0j6/iyd6ToLtCFPzj5Fj9ETs/MNw6aR2wso sgjlHTsZ8w6q/2Zy7HxZrWoHYdApmB8ps1fAfTJMkrdBgZkTUXPFwqnQ3CZbA9EChe2B tWX2e3osK8JRrsxV+n/BhkSp0c2FogG4DC0XwfSqQ3yQGYgosEovXt3nMB86ikdesuJr P56Z9xtxpNZWkpVX2gIBlYLQIwqtMJgz8auie1V4kOa57oQTeNas0x0hwW9IF6Pexvfi DwAQ== 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 f125si2789157pgc.17.2018.01.26.01.38.25; Fri, 26 Jan 2018 01:38:39 -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 S1752950AbeAZJfz (ORCPT + 99 others); Fri, 26 Jan 2018 04:35:55 -0500 Received: from mga07.intel.com ([134.134.136.100]:6945 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752649AbeAZJfu (ORCPT ); Fri, 26 Jan 2018 04:35:50 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Jan 2018 01:35:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,415,1511856000"; d="scan'208";a="22478846" Received: from smile.fi.intel.com (HELO smile) ([10.237.72.86]) by orsmga003.jf.intel.com with ESMTP; 26 Jan 2018 01:35:46 -0800 Message-ID: <1516959345.7000.1281.camel@linux.intel.com> Subject: Re: [PATCH v2 2/3] gpiolib-of: Support 'reserved-gpio-ranges' property From: Andy Shevchenko To: Stephen Boyd , Linus Walleij Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Timur Tabi , Bjorn Andersson , linux-gpio@vger.kernel.org, Grant Likely , devicetree@vger.kernel.org Date: Fri, 26 Jan 2018 11:35:45 +0200 In-Reply-To: <20180126011400.2191-3-sboyd@codeaurora.org> References: <20180126011400.2191-1-sboyd@codeaurora.org> <20180126011400.2191-3-sboyd@codeaurora.org> Organization: Intel Finland Oy Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.3-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2018-01-25 at 17:13 -0800, Stephen Boyd wrote: > Some qcom platforms make some GPIOs or pins unavailable for use > by non-secure operating systems, and thus reading or writing the > registers for those pins will cause access control issues. Add > support for a DT property to describe the set of GPIOs that are > available for use so that higher level OSes are able to know what > pins to avoid reading/writing. > > For now, we plumb this into the gpiochip irq APIs so that > GPIO/pinctrl drivers can use the gpiochip_irqchip_irq_valid() to > test validity of GPIOs. > +static void of_gpiochip_init_irq_valid_mask(struct gpio_chip *chip) > +{ > + int len, i; > + u32 start, count; > + struct device_node *np = chip->of_node; Perhaps reversed tree style? (In the following function as well) > + len = of_property_count_u32_elems(np, "reserved-gpio- > ranges"); > > + for (i = 0; i < len; i += 2) { > + of_property_read_u32_index(np, "reserved-gpio- > ranges", > + i, &start); > + of_property_read_u32_index(np, "reserved-gpio- > ranges", > + i + 1, &count); of_find_property() + of_prop_next_u32() ? > + if (size > 0 && size % 2 == 0) > + gpiochip->irq.need_valid_mask = true; ffs(size) >= 2 ? -- Andy Shevchenko Intel Finland Oy