From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762895AbdALBw2 (ORCPT ); Wed, 11 Jan 2017 20:52:28 -0500 Received: from lelnx193.ext.ti.com ([198.47.27.77]:44644 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751259AbdALBw0 (ORCPT ); Wed, 11 Jan 2017 20:52:26 -0500 Subject: Re: [PATCH 2/2] gpio: davinci: Remove gpio2regs function to accommodate multi instances To: Linus Walleij References: <1483518389-6200-1-git-send-email-j-keerthy@ti.com> <1483518389-6200-2-git-send-email-j-keerthy@ti.com> <55d29408-2ccc-d6a1-8ef6-5418ba8df0b7@ti.com> CC: "linux-kernel@vger.kernel.org" , "linux-gpio@vger.kernel.org" , Alexandre Courbot , Tero Kristo From: Keerthy Message-ID: <2683ca92-e1c3-7b87-cd8c-bf6095b09ff9@ti.com> Date: Thu, 12 Jan 2017 07:22:19 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday 11 January 2017 09:23 PM, Linus Walleij wrote: > On Wed, Jan 11, 2017 at 1:40 PM, Keerthy wrote: >> On Wednesday 11 January 2017 04:34 PM, Linus Walleij wrote: >>> On Wed, Jan 4, 2017 at 9:26 AM, Keerthy wrote: >>> >>>> gpio2regs is written making an assumption that driver supports only >>>> one instance of gpio controller. Removing this and adding a generic >>>> array so as to support multiple instances of gpio controllers. >>>> >>>> Signed-off-by: Keerthy >>> >>> >>>> - regs = gpio2regs(base); >>>> + regs = gpio_base + offset_array[i]; >>> >>> >>> I understand this. >>> >>>> - struct davinci_gpio_regs __iomem *g = gpio2regs(hw); >>>> + struct davinci_gpio_controller *chips = >>>> + (struct davinci_gpio_controller >>>> *)d->host_data; >>>> + struct davinci_gpio_regs __iomem *g = chips[hw / 32].regs; >>> >>> >>> And this, if each instans has 32 GPIOs. >>> >>>> - g = gpio2regs(0); >>>> + g = chips[0].regs; >>> >>> >>> Also makes sense. >>> >>>> - g = gpio2regs(gpio); >>>> + g = chips[bank / 2].regs; >>> >>> >>> But what is this? I don't understand that /2 at all. Please insert a >>> comment explaining it so I can figure it out. Are there two banks >>> per instance? >> >> >> Yes! There are register sets for 32 GPIOs. 2 banks of 16 GPIOs are covered >> by each set of registers hence /2. Shall i add a comment and send this patch >> alone separately? > > Yeah. > > I am currently confused by several patch sets for davinci in my inbox, > can you rebase on my devel branch when I push it and resend > *all* you have cooking for DaVinci? Sure Linus i will do that. Thanks, Keerthy > > Yours, > Linus Walleij >