From patchwork Wed Jul 1 19:34:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Cochran X-Patchwork-Id: 490296 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id D9186140549 for ; Thu, 2 Jul 2015 05:34:13 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=ikDTX+61; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753230AbbGATeM (ORCPT ); Wed, 1 Jul 2015 15:34:12 -0400 Received: from mail-wi0-f170.google.com ([209.85.212.170]:34249 "EHLO mail-wi0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751433AbbGATeL (ORCPT ); Wed, 1 Jul 2015 15:34:11 -0400 Received: by wiar9 with SMTP id r9so79516717wia.1; Wed, 01 Jul 2015 12:34:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JCKmPghZZFjnQHfVZARCHcO+1YwPb97rVUpODFmofOg=; b=ikDTX+61vWUjsB8S4p9KoDaGMDxWk9UzDEHzCiEzm+ZwQIowZBK0jRkR6hyIyk31zF g2PgRD/BJiGOrt/DxpW8+tRUGVwHIYJqa2T0JhPX1gTi+oUhOjdoUFNz/tui6ZHrd5SA iKgro8lEgIu7meN5A44xCaeSKkR/x/wzO+3lTKsmjRgrK3ZGGboXcdBmeQ/R3epIs/0c b/vJCT3/QR0w6cGj7sqcW1I2OtrpdTT++BhrAgUJlE9HaotjSgc2uVCZtq6PFQZAMiWB eIlODCumZGML7VHqH0jY7qSD/PJGpYtj/N99BeuMKlN0HEBaRG8yKPBhXEAJ0YfaikIS 1yVQ== X-Received: by 10.180.160.210 with SMTP id xm18mr9182541wib.93.1435779250105; Wed, 01 Jul 2015 12:34:10 -0700 (PDT) Received: from localhost.localdomain (91-115-36-30.adsl.highway.telekom.at. [91.115.36.30]) by mx.google.com with ESMTPSA id wi1sm4306871wjb.41.2015.07.01.12.34.08 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 01 Jul 2015 12:34:09 -0700 (PDT) From: Richard Cochran X-Google-Original-From: Richard Cochran To: linux-arm-kernel@lists.infradead.org Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, Alan Tull , Alexandre Courbot , Dinh Nguyen , Linus Walleij , Sebastian Andrzej Siewior Subject: [PATCH 1/2] gpio: dwapb: Use human understandable gpio numbering. Date: Wed, 1 Jul 2015 21:34:02 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org The system-on-chips using this IP core have well defined gpio numbers. Instead of using random numbers, this patch lets the device tree specify the correct gpio numbering. Signed-off-by: Richard Cochran --- Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt | 2 ++ drivers/gpio/gpio-dwapb.c | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt b/Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt index dd5d2c0..5c9effd 100644 --- a/Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt +++ b/Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt @@ -28,6 +28,7 @@ controller. - interrupt-parent : The parent interrupt controller. - interrupts : The interrupt to the parent controller raised when GPIOs generate the interrupts. +- snps,base : The base gpio number. - snps,nr-gpios : The number of pins in the port, a single cell. Example: @@ -42,6 +43,7 @@ gpio: gpio@20000 { compatible = "snps,dw-apb-gpio-port"; gpio-controller; #gpio-cells = <2>; + snps,base = <8>; snps,nr-gpios = <8>; reg = <0>; interrupt-controller; diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c index 58faf04..b7e7977 100644 --- a/drivers/gpio/gpio-dwapb.c +++ b/drivers/gpio/gpio-dwapb.c @@ -491,6 +491,13 @@ dwapb_gpio_get_pdata_of(struct device *dev) return ERR_PTR(-EINVAL); } + if (of_property_read_u32(port_np, "snps,base", + &pp->gpio_base)) { + dev_info(dev, "no base gpio specified for %s\n", + port_np->full_name); + pp->gpio_base = -1; + } + if (of_property_read_u32(port_np, "snps,nr-gpios", &pp->ngpio)) { dev_info(dev, "failed to get number of gpios for %s\n", @@ -512,7 +519,6 @@ dwapb_gpio_get_pdata_of(struct device *dev) } pp->irq_shared = false; - pp->gpio_base = -1; pp->name = port_np->full_name; }