Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031257AbbD1X13 (ORCPT ); Tue, 28 Apr 2015 19:27:29 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:9089 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031059AbbD1X11 (ORCPT ); Tue, 28 Apr 2015 19:27:27 -0400 Message-ID: <554016A5.7040209@imgtec.com> Date: Tue, 28 Apr 2015 20:24:21 -0300 From: Ezequiel Garcia User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Andrew Bresticker , Linus Walleij , Alexandre Courbot , "Ralf Baechle" CC: , , , , James Hartley , James Hogan , "Damien Horsley" , Govindraj Raja , Kevin Cernekee , "Paul Bolle" Subject: Re: [PATCH V3 2/2] pinctrl: Add Pistachio SoC pin control driver References: <1428435862-14354-1-git-send-email-abrestic@chromium.org> <1428435862-14354-3-git-send-email-abrestic@chromium.org> In-Reply-To: <1428435862-14354-3-git-send-email-abrestic@chromium.org> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.100.200.184] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1960 Lines: 63 Andrew, On 04/07/2015 04:44 PM, Andrew Bresticker wrote: [..] > +static int pistachio_pinmux_enable(struct pinctrl_dev *pctldev, > + unsigned func, unsigned group) > +{ > + struct pistachio_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); > + const struct pistachio_pin_group *pg = &pctl->groups[group]; > + const struct pistachio_function *pf = &pctl->functions[func]; > + struct pinctrl_gpio_range *range; > + unsigned int i; > + u32 val; > + > + if (pg->mux_reg > 0) { > + for (i = 0; i < ARRAY_SIZE(pg->mux_option); i++) { > + if (pg->mux_option[i] == func) > + break; > + } > + if (i == ARRAY_SIZE(pg->mux_option)) { > + dev_err(pctl->dev, "Cannot mux pin %u to function %u\n", > + group, func); > + return -EINVAL; > + } > + > + val = pctl_readl(pctl, pg->mux_reg); > + val &= ~(pg->mux_mask << pg->mux_shift); > + val |= i << pg->mux_shift; > + pctl_writel(pctl, val, pg->mux_reg); > + > + if (pf->scenarios) { > + for (i = 0; i < pf->nscenarios; i++) { > + if (pf->scenarios[i] == group) > + break; > + } > + if (WARN_ON(i == pf->nscenarios)) > + return -EINVAL; > + > + val = pctl_readl(pctl, pf->scenario_reg); > + val &= ~(pf->scenario_mask << pf->scenario_shift); > + val |= i << pf->scenario_shift; > + pctl_writel(pctl, val, pf->scenario_reg); > + } > + } > + > + range = pinctrl_find_gpio_range_from_pin(pctl->pctldev, group); > + if (range) > + gpio_disable(gc_to_bank(range->gc), group - range->pin_base); > + If you plan to submit a v4, how about using "pg->pins" here instead of "group"? Using "group" relies on having the same numberspace for the group and the pin, and it'll break when introducing the RPU pinctrl. Thanks! -- Ezequiel -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/