From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757262AbdELMZ2 (ORCPT ); Fri, 12 May 2017 08:25:28 -0400 Received: from mail-it0-f50.google.com ([209.85.214.50]:37373 "EHLO mail-it0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751370AbdELMZZ (ORCPT ); Fri, 12 May 2017 08:25:25 -0400 MIME-Version: 1.0 In-Reply-To: References: <1493281194-5200-2-git-send-email-jacopo+renesas@jmondi.org> <20170508160120.GB25206@w540> <20170508172516.GC25206@w540> From: Geert Uytterhoeven Date: Fri, 12 May 2017 14:25:23 +0200 X-Google-Sender-Auth: PydQaweiSmyvHsii9sE1u7R6gF4 Message-ID: Subject: Re: [PATCH v5 01/10] pinctrl: generic: Add bi-directional and output-enable To: Chris Brandt Cc: Linus Walleij , jmondi , Andy Shevchenko , Jacopo Mondi , Geert Uytterhoeven , Laurent Pinchart , Rob Herring , Mark Rutland , Russell King - ARM Linux , Linux-Renesas , "linux-gpio@vger.kernel.org" , devicetree , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Chris, On Fri, May 12, 2017 at 2:13 PM, Chris Brandt wrote: > On Friday, May 12, 2017, Geert Uytterhoeven wrote: >> Jacopo, Chris: Would two bits per pin/function (none, input, output, >> bidir) >> be sufficient? >> That makes one u16 per pin. So roughtly 12 ports x 16 pins => 384 bytes. >> Plus code to handle it. After all not that bad... > > OK...I give up! > If that's what it takes to get it, I'm fine. > > NOTE, your math is a little off, the issue is that depending on the > function that you use, you might need to do extra settings, so you'd > have to have a lookup table for every pin & function. > Each pin can have 1 of 8 functions (which is good because a 'byte' has > 8 bits). > > So, > 12 ports x 16 pins => 384 bytes (this table would just be for checking if bi-dir is needed) > 12 ports x 16 pins => 384 bytes (this table would just be for checking if input is needed) > 12 ports x 16 pins => 384 bytes (this table would just be for checking if input is needed) ------------ > 1,152 bytes 12 x 16 = 192, not 384. Do you need all possible combinations of input, output, and bi-dir? I assumed they're mutually exclusive. If not, you need 3 bits/pin/function. > But then...there are package variations so you need another entire > table for those parts. > 1,152 bytes x 2 = 2,304 bytes With packages, do you mean e.g. RZ/A1H vs. RZ/A1L? These indeed differ, but should use different compatible values. Or do you mean QFP/BGA256 vs. BGA324? Isn't the former a subset of the latter? > #What we should really do is just make a look-up table (tables) for the > 'special' ones. But, we can have that discussion in a different thread. Yep, depending on what gives the smallest code/data size. > There is still a need for "input-enable" and "output-enable" for the timer > pins. Because, when you choose the pin to be connected to the MTU2 timer, > the pin can be used as either input-capture/output-compare/PWM and that's > the user's choice. So that's probably a valid usage of the generic pin > properties for configuration. OK. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds