From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753250AbdBCN6z (ORCPT ); Fri, 3 Feb 2017 08:58:55 -0500 Received: from mail-io0-f171.google.com ([209.85.223.171]:32833 "EHLO mail-io0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752521AbdBCN6w (ORCPT ); Fri, 3 Feb 2017 08:58:52 -0500 MIME-Version: 1.0 In-Reply-To: <699f0c63e95ecdafe6946fdcdbb97a37@mail.crapouillou.net> References: <27071da2f01d48141e8ac3dfaa13255d@mail.crapouillou.net> <20170125185207.23902-1-paul@crapouillou.net> <20170125185207.23902-5-paul@crapouillou.net> <699f0c63e95ecdafe6946fdcdbb97a37@mail.crapouillou.net> From: Linus Walleij Date: Fri, 3 Feb 2017 14:58:50 +0100 Message-ID: Subject: Re: [PATCH v3 04/14] GPIO: Add gpio-ingenic driver To: Paul Cercueil Cc: Rob Herring , Mark Rutland , Ralf Baechle , Ulf Hansson , Boris Brezillon , Thierry Reding , Bartlomiej Zolnierkiewicz , Maarten ter Huurne , Lars-Peter Clausen , Paul Burton , "linux-gpio@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Linux MIPS , "linux-mmc@vger.kernel.org" , "linux-mtd@lists.infradead.org" , "linux-pwm@vger.kernel.org" , "linux-fbdev@vger.kernel.org" , James Hogan Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v13Dx0Ca011338 On Tue, Jan 31, 2017 at 4:29 PM, Paul Cercueil wrote: > Le 2017-01-31 15:20, Linus Walleij a écrit : > >>> + of_property_read_u32(dev->of_node, "base", &jzgc->gc.base); >> >> >> Remove this. Dynamic allocation should be fine, if you're using the >> new userspace ABI like tools/gpio/* or libgpiod and only that and >> in-kernel >> consumers, dynamic numbers are just fine. > > > The problem is that the QI_LB60 board code still have a lot of references > to global GPIO numbers. Just grep for JZ_GPIO_PORT in > arch/mips/jz4740/board-qi_lb60.c to see what I mean... OK I understand we might need a compromise here to get the code moving. But we need to keep it out of the device tree. I think it's better to put a base table relative to the memory base in the driver in that case: unsigned int gpio_global_base; switch (memory_base_address) { case 0x41000000: gpio_global_base = 0x00; break; case 0x42000000: gpio_global_base = 0x20; (...) etc. (Those are not your base addresses but you get the idea). Include a few comments like: /* * DO NOT EXPAND THIS: FOR BACKWARD GPIO NUMBERSPACE * COMPATIBIBILITY ONLY: WORK TO TRANSITION CONSUMERS TO * USE THE GPIO DESCRIPTOR API IN INSTEAD. */ Then I'll be happy :) Yours, Linus Walleij