Received: by 10.213.65.68 with SMTP id h4csp1329628imn; Thu, 29 Mar 2018 02:41:15 -0700 (PDT) X-Google-Smtp-Source: AIpwx49jjlunrFSMna+TxjWGTEoRU7pxZsPEdPaqDpYU7fVXf0OGPYljaOzIYVKq6okoD3Kg5KCi X-Received: by 10.101.99.66 with SMTP id p2mr4876562pgv.384.1522316475681; Thu, 29 Mar 2018 02:41:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522316475; cv=none; d=google.com; s=arc-20160816; b=knYJPzweyrYAMnvl5bGSwYwCgIshBI1xVwvW3XX29QP7aKCxWqq0YQv0EPt1uL95Jw zZPUEPa8ll9j1/SnXoegMeUsEGB/gXZuxZnykCVWT5ZnJjqUAFAIbcsLkUPt+/cK0NVw IW2sJcxu81YZeh8VCXQmtKBbmYuVUp0OrZlAKQP1bjZecZQHowv11yLOWvE5e1Y1yhK4 1p6wqux1WdZbs6fT0tn0P1Z2VL8pYseTmOgQgYezzdQyoMsdRPRFjPbVWQ8i7s8xaVxI C46LFzVvvRqwVVpDtZAx9e6OVjDY04sEYgtt92ksq629x0yzH/2QAZTCtrdC9BDNY2Ok cskw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=6nUg2ENlzf1mH+H3i/XBOFKBDaKDQ6dlpQtMJsT12C8=; b=kPKCWw+J58gfgAsn/uD8Z11m+opwi795wsgFlnn00iYVFTSlDw/u4eN9B+GqHHjf6z BsGboZln4j1YHlyjp0NiY1KhvPMZmGn6aPftRSvqEdpsLwJdY7Vv6qFjkhcuY4AKj4fq wLlA23/D3OmJhQrqa7/m6C4m2GLI9DWINNiE6Ip2p1iOIdFBuhey04i6eUxOjKEjO5tD u1H1K+deuduYzD+uYEw02UTCZRneEMidLogvx1WgPNcI7BuWgCIihoJosUx3laligutD 7SB1//ZVCJVx0mH8/ain8OeHKxVHwHBegxFQgGz++yaB3E6uDMSBioVwjXqgisBQZVo9 YBmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@renesasgroup.onmicrosoft.com header.s=selector1-renesas-com header.b=CS6CEobU; 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 n3si4078238pff.312.2018.03.29.02.41.00; Thu, 29 Mar 2018 02:41:15 -0700 (PDT) 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; dkim=pass header.i=@renesasgroup.onmicrosoft.com header.s=selector1-renesas-com header.b=CS6CEobU; 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 S1752209AbeC2JkC (ORCPT + 99 others); Thu, 29 Mar 2018 05:40:02 -0400 Received: from relmlor4.renesas.com ([210.160.252.174]:55582 "EHLO relmlie3.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750971AbeC2Jj7 (ORCPT ); Thu, 29 Mar 2018 05:39:59 -0400 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie3.idc.renesas.com with ESMTP; 29 Mar 2018 18:39:42 +0900 Received: from relmlii1.idc.renesas.com (relmlii1.idc.renesas.com [10.200.68.65]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 067ED8CED2; Thu, 29 Mar 2018 18:39:42 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.48,376,1517842800"; d="scan'208";a="275221390" Received: from mail-ty1jpn01lp0184.outbound.protection.outlook.com (HELO JPN01-TY1-obe.outbound.protection.outlook.com) ([23.103.139.184]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 29 Mar 2018 18:39:41 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesas-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=6nUg2ENlzf1mH+H3i/XBOFKBDaKDQ6dlpQtMJsT12C8=; b=CS6CEobUFZUlRLe4i+HZoLeLCxoNOe3vyLZO0PEhExxatWX1+exnumY5U32VjiazmsKcKqWXhBKGoIE1Khh9RvAsoh5Vo0eSw9Szbja7JK/DjbpqMy8Sg4XGbDQTNiBgz6+tOxEtvoOAq5Ks/Zwa+68vT6qt3PLQ4+qlaxcIDis= Received: from TY1PR01MB1769.jpnprd01.prod.outlook.com (52.133.163.146) by TY1PR01MB0048.jpnprd01.prod.outlook.com (10.161.133.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.609.10; Thu, 29 Mar 2018 09:39:38 +0000 Received: from TY1PR01MB1769.jpnprd01.prod.outlook.com ([fe80::d9dc:5082:2f7a:3dfd]) by TY1PR01MB1769.jpnprd01.prod.outlook.com ([fe80::d9dc:5082:2f7a:3dfd%13]) with mapi id 15.20.0609.012; Thu, 29 Mar 2018 09:39:38 +0000 From: Phil Edworthy To: Hoan Tran , Linus Walleij , "Rob Herring" , Mark Rutland CC: Andy Shevchenko , Michel Pollet , "linux-gpio@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-renesas-soc@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] gpio: dwapb: Add support for 32 interrupts Thread-Topic: [PATCH] gpio: dwapb: Add support for 32 interrupts Thread-Index: AQHTxqA8Q/Tp1OQLo0C0CX9dPZ3BD6Pm9V/w Date: Thu, 29 Mar 2018 09:39:38 +0000 Message-ID: References: <1522246950-9110-1-git-send-email-phil.edworthy@renesas.com> In-Reply-To: <1522246950-9110-1-git-send-email-phil.edworthy@renesas.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=phil.edworthy@renesas.com; x-originating-ip: [193.141.220.21] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;TY1PR01MB0048;7:T1wkWFMH96GQWqhuq/V+7ZW8gl80OQRasfkS0TcnFaZq/itvZql3sOfzOvPPId0AuzsyBk3lzPpl49HS6fV2IUuHcBqk1coH6xPEpyVpiYjKdjqxGcNHyLlLFViVxlWRr2w9QfRsR9yleNbyx2Uncc8yIv0czidIgY5WHgpZ74vZXotOoUh0u06RW0n9B7jSOBdVeTH8tFKsaj3hvBpSQJsW1F6vc1TcUa8fee7pDBKpZ8bsXFS0VVtjdG388JWM;20:V/HnDat3aZXHCMNIMFrcfrtk4GdKT9y59vH0QIkJdrf9dPvMmCCPGgXOn/Kbv3U0PxT8NoWbcimNRgI8LfdZHrcdPyrsG85j1rT+NyeV3i7+452gnY3ba8knFmQ/L+ahLGXlZPKwiU5BbJV3G9McSiZJJoDO6/qyjoRCt6m1ZKI= x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: ad8f5dc3-a1d1-4b3c-1733-08d59558fd8e x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:TY1PR01MB0048; x-ms-traffictypediagnostic: TY1PR01MB0048: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501327)(52105095)(10201501046)(3002001)(93006095)(93001095)(6055026)(6041310)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(6072148)(201708071742011);SRVR:TY1PR01MB0048;BCL:0;PCL:0;RULEID:;SRVR:TY1PR01MB0048; x-forefront-prvs: 0626C21B10 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(39860400002)(39380400002)(396003)(346002)(376002)(199004)(189003)(6436002)(81166006)(486005)(486005)(316002)(476003)(105586002)(6116002)(3846002)(446003)(229853002)(11346002)(2900100001)(54906003)(99286004)(4326008)(26005)(186003)(97736004)(8936002)(53936002)(66066001)(5660300001)(478600001)(39060400002)(110136005)(6246003)(7736002)(3660700001)(305945005)(106356001)(86362001)(74316002)(2906002)(53546011)(8676002)(3280700002)(5250100002)(6506007)(7696005)(76176011)(59450400001)(25786009)(81156014)(14454004)(102836004)(68736007)(55016002)(9686003)(33656002);DIR:OUT;SFP:1102;SCL:1;SRVR:TY1PR01MB0048;H:TY1PR01MB1769.jpnprd01.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: renesas.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: iF0kn3aZrBeTxhacoDEt6csLy0RVqHmtzxOMdbCx82Rr5KxcebbGqQFU9BNC51GIR0cZTbaDj1r70XitWaNfZbMdJhpCwIFA0IcZ/gFXl/NZEVLVMTNBgMCpGEd0gH/FSAtfLznKbUkA+5HsFfyI9/LiNVHWOUrHYQcu63c0jTlL+hO3SpaqbzSiCcfrso2hw0bseqKaluxBBjxrD6V8x46pPWioGielf85nIfk5hR92Wht5cCfcEeXNiYjphs0Fcqnr4inrTHzCo/tjmC0vDjruGNROA5iZ0zCCHq9ReaA1pFeonMrmKF9x1FydJWNg9/zVPT2U708Td6I3Hiwayg== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: ad8f5dc3-a1d1-4b3c-1733-08d59558fd8e X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Mar 2018 09:39:38.3901 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY1PR01MB0048 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 28 March 2018 15:23, Phil Edworthy wrote: > The DesignWare GPIO IP can be configured for either 1 or 32 interrupts, > but the driver currently only supports 1 interrupt. See the DesignWare > DW_apb_gpio Databook description of the 'GPIO_INTR_IO' parameter. >=20 > This change allows the driver to work with up to 32 interrupts, it will > get as many interrupts as specified in the DT 'interrupts' property. > It doesn't do anything clever with the different interrupts, it just call= s > the same handler used for single interrupt hardware. >=20 > Signed-off-by: Phil Edworthy > --- > Note: There are a few lines over 80 chars, but this is just guidance, rig= ht? > Especially as there are already some lines over 80 chars. > --- > .../devicetree/bindings/gpio/snps-dwapb-gpio.txt | 10 ++++- > drivers/gpio/gpio-dwapb.c | 44 ++++++++++++++++= +----- > include/linux/platform_data/gpio-dwapb.h | 3 +- > 3 files changed, 45 insertions(+), 12 deletions(-) This patch triggers a build error for Quark MFD driver, which is the only u= ser of the structure outside of the driver. I will fix that with an additional = patch, but I'll wait to see what other comments I get first. Thanks Phil > diff --git a/Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt > b/Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt > index 4a75da7..e343581 100644 > --- a/Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt > +++ b/Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt > @@ -26,8 +26,14 @@ controller. > the second encodes the triger flags encoded as described in > Documentation/devicetree/bindings/interrupt-controller/interrupts.txt > - interrupt-parent : The parent interrupt controller. > -- interrupts : The interrupt to the parent controller raised when GPIOs > - generate the interrupts. > +- interrupts : The interrupts to the parent controller raised when GPIOs > + generate the interrupts. If the controller provides one combined inter= rupt > + for all GPIOs, specify a single interrupt. If the controller provides = one > + interrupt for each GPIO, provide a list of interrupts that correspond = to each > + of the GPIO pins. When specifying multiple interrupts, if any of the G= PIOs > are > + not connected to an interrupt, use the interrupt-mask property. > +- interrupt-mask : a 32-bit bit mask that specifies which interrupts in = the list > + of interrupts is valid, bit is 1 for a valid irq. > - snps,nr-gpios : The number of pins in the port, a single cell. > - resets : Reset line for the controller. >=20 > diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c > index 226977f..47d82f9 100644 > --- a/drivers/gpio/gpio-dwapb.c > +++ b/drivers/gpio/gpio-dwapb.c > @@ -441,14 +441,19 @@ static void dwapb_configure_irqs(struct > dwapb_gpio *gpio, > irq_gc->chip_types[1].handler =3D handle_edge_irq; >=20 > if (!pp->irq_shared) { > - irq_set_chained_handler_and_data(pp->irq, > dwapb_irq_handler, > - gpio); > + int i; > + > + for (i =3D 0; i < pp->ngpio; i++) { > + if (pp->irq[i]) > + irq_set_chained_handler_and_data(pp- > >irq[i], > + dwapb_irq_handler, gpio); > + } > } else { > /* > * Request a shared IRQ since where MFD would have > devices > * using the same irq pin > */ > - err =3D devm_request_irq(gpio->dev, pp->irq, > + err =3D devm_request_irq(gpio->dev, pp->irq[0], > dwapb_irq_handler_mfd, > IRQF_SHARED, "gpio-dwapb-mfd", gpio); > if (err) { > @@ -524,7 +529,7 @@ static int dwapb_gpio_add_port(struct dwapb_gpio > *gpio, > if (pp->idx =3D=3D 0) > port->gc.set_config =3D dwapb_gpio_set_config; >=20 > - if (pp->irq) > + if (pp->has_irq) > dwapb_configure_irqs(gpio, port, pp); >=20 > err =3D gpiochip_add_data(&port->gc, port); > @@ -535,7 +540,7 @@ static int dwapb_gpio_add_port(struct dwapb_gpio > *gpio, > port->is_registered =3D true; >=20 > /* Add GPIO-signaled ACPI event support */ > - if (pp->irq) > + if (pp->has_irq) > acpi_gpiochip_request_interrupts(&port->gc); >=20 > return err; > @@ -601,13 +606,34 @@ dwapb_gpio_get_pdata(struct device *dev) > if (dev->of_node && pp->idx =3D=3D 0 && > fwnode_property_read_bool(fwnode, > "interrupt-controller")) { > - pp->irq =3D > irq_of_parse_and_map(to_of_node(fwnode), 0); > - if (!pp->irq) > + struct device_node *np =3D to_of_node(fwnode); > + u32 irq_mask =3D 0xFFFFFFFF; > + int j; > + > + /* Optional irq mask */ > + fwnode_property_read_u32(fwnode, "interrupt- > mask", &irq_mask); > + > + /* > + * The IP has configuration options to allow a single > + * combined interrupt or one per gpio. If one per > gpio, > + * some might not be used. > + */ > + for (j =3D 0; j < pp->ngpio; j++) { > + if (irq_mask & BIT(j)) { > + pp->irq[j] =3D > irq_of_parse_and_map(np, j); > + if (pp->irq[j]) > + pp->has_irq =3D true; > + } > + } > + if (!pp->has_irq) > dev_warn(dev, "no irq for port%d\n", pp- > >idx); > } >=20 > - if (has_acpi_companion(dev) && pp->idx =3D=3D 0) > - pp->irq =3D > platform_get_irq(to_platform_device(dev), 0); > + if (has_acpi_companion(dev) && pp->idx =3D=3D 0) { > + pp->irq[0] =3D > platform_get_irq(to_platform_device(dev), 0); > + if (pp->irq[0]) > + pp->has_irq =3D true; > + } >=20 > pp->irq_shared =3D false; > pp->gpio_base =3D -1; > diff --git a/include/linux/platform_data/gpio-dwapb.h > b/include/linux/platform_data/gpio-dwapb.h > index 2dc7f4a..5a52d69 100644 > --- a/include/linux/platform_data/gpio-dwapb.h > +++ b/include/linux/platform_data/gpio-dwapb.h > @@ -19,7 +19,8 @@ struct dwapb_port_property { > unsigned int idx; > unsigned int ngpio; > unsigned int gpio_base; > - unsigned int irq; > + unsigned int irq[32]; > + bool has_irq; > bool irq_shared; > }; >=20 > -- > 2.7.4