From patchwork Mon Mar 11 14:22:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13588816 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1CF57C54E58 for ; Mon, 11 Mar 2024 14:24:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=leaupfqSiWb1I7phVtMU/3g+gh+CJZ4WHBikyc2r7d0=; b=BRNNMt5Ay6zuWE 5CB8Q6XW7DkZ1yJen1vOlu9i3fOK5D/De593J94Ki/HBXZQNnkN+i1SeoDd/joOW8tiTt4HmbLz8Z kh9k3/C+chao6lZnGrke8lInwmbGhICxzA0/Dke8nkYJZP7g2cjeCn4P+aL/GC8DWoysW+xwm6LUD 280M3ECEUvAhtphTmmx3nRYCzvIgwUvgln6hd+RpzwfiU0ptQP8RFexgIyZKV2YTTkyO6lsNR4i6z D/nxon83lp676nyLMEU52ZsxcrzcEvB4yeeEGZJzxoRMOHqEReKsGa4cOKejX81tNjHpeLk39xLpI F+j/zM9EAEcejpcPydOw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rjgZG-00000001muG-3tlG; Mon, 11 Mar 2024 14:23:54 +0000 Received: from mgamail.intel.com ([192.198.163.8]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rjgZD-00000001msM-3rMG for linux-arm-kernel@lists.infradead.org; Mon, 11 Mar 2024 14:23:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710167032; x=1741703032; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=RAljMRZTESMUnqSWSdhDReDCoHPcNMTfVdGXxHn/jo0=; b=AUV7S3k6aH2HQiVUrvuesPLprymokxBjhdtP2Nvu5KbbjCeSddfsSlde wLFZ6g8JHyIkJhGsaGX2P3yR7bwvT4KPLhyYJWc0jXQeOM/N7P0WsHV2j wrrXiaSdxOLRgga6ftSMB3ZGlSb66XdvYzKLBlqTVM15FtRRx6xPXfFW6 mQCwCvMuHovbcAB9jeM+9kf72ShnkbD51QLvUUtuAASAqv99xHUep+Nzf kY6pm/i0Ei3I3c0rfmBzy9nvtb2u1i68PQOGrj6wIqEzY9FjVgrOHZ8wP JiKvFIsCUWEMR42LRaIh0tAPCAwhPHSD5M85hjip4vcavt2Vpr1CyoHJJ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,11009"; a="22352735" X-IronPort-AV: E=Sophos;i="6.07,116,1708416000"; d="scan'208";a="22352735" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2024 07:23:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11009"; a="937049993" X-IronPort-AV: E=Sophos;i="6.07,116,1708416000"; d="scan'208";a="937049993" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 11 Mar 2024 07:23:48 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id C5872177; Mon, 11 Mar 2024 16:23:47 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Linus Walleij Subject: [PATCH v1 1/1] pinctrl: pxa2xx: Make use of struct pingroup Date: Mon, 11 Mar 2024 16:22:48 +0200 Message-ID: <20240311142346.1261203-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240311_072352_011146_57094A7C X-CRM114-Status: GOOD ( 17.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Since pin control provides a generic data type for the pin group, use it in the driver. Signed-off-by: Andy Shevchenko --- This depends on https://lore.kernel.org/r/20240311140833.1168742-1-andriy.shevchenko@linux.intel.com drivers/pinctrl/pxa/pinctrl-pxa2xx.c | 31 ++++++++++++++-------------- drivers/pinctrl/pxa/pinctrl-pxa2xx.h | 7 +------ 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/drivers/pinctrl/pxa/pinctrl-pxa2xx.c b/drivers/pinctrl/pxa/pinctrl-pxa2xx.c index f24bf49fa82b..9e34b92ff5f2 100644 --- a/drivers/pinctrl/pxa/pinctrl-pxa2xx.c +++ b/drivers/pinctrl/pxa/pinctrl-pxa2xx.c @@ -32,7 +32,7 @@ static const char *pxa2xx_pctrl_get_group_name(struct pinctrl_dev *pctldev, unsigned tgroup) { struct pxa_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); - struct pxa_pinctrl_group *group = pctl->groups + tgroup; + struct pingroup *group = pctl->groups + tgroup; return group->name; } @@ -43,10 +43,10 @@ static int pxa2xx_pctrl_get_group_pins(struct pinctrl_dev *pctldev, unsigned *num_pins) { struct pxa_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); - struct pxa_pinctrl_group *group = pctl->groups + tgroup; + struct pingroup *group = pctl->groups + tgroup; - *pins = (unsigned *)&group->pin; - *num_pins = 1; + *pins = group->pins; + *num_pins = group->npins; return 0; } @@ -139,20 +139,18 @@ static int pxa2xx_pmx_set_mux(struct pinctrl_dev *pctldev, unsigned function, unsigned tgroup) { struct pxa_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); - struct pxa_pinctrl_group *group = pctl->groups + tgroup; + struct pingroup *g = pctl->groups + tgroup; + unsigned int pin = g->pins[0]; struct pxa_desc_function *df; - int pin, shift; unsigned long flags; void __iomem *gafr, *gpdr; + int shift; u32 val; - - df = pxa_desc_by_func_group(pctl, group->name, - (pctl->functions + function)->name); + df = pxa_desc_by_func_group(pctl, g->name, (pctl->functions + function)->name); if (!df) return -EINVAL; - pin = group->pin; gafr = pctl->base_gafr[pin / 16]; gpdr = pctl->base_gpdr[pin / 32]; shift = (pin % 16) << 1; @@ -186,9 +184,9 @@ static int pxa2xx_pconf_group_get(struct pinctrl_dev *pctldev, unsigned long *config) { struct pxa_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); - struct pxa_pinctrl_group *g = pctl->groups + group; + struct pingroup *g = pctl->groups + group; + unsigned int pin = g->pins[0]; unsigned long flags; - unsigned pin = g->pin; void __iomem *pgsr = pctl->base_pgsr[pin / 32]; u32 val; @@ -208,9 +206,9 @@ static int pxa2xx_pconf_group_set(struct pinctrl_dev *pctldev, unsigned num_configs) { struct pxa_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); - struct pxa_pinctrl_group *g = pctl->groups + group; + struct pingroup *g = pctl->groups + group; + unsigned int pin = g->pins[0]; unsigned long flags; - unsigned pin = g->pin; void __iomem *pgsr = pctl->base_pgsr[pin / 32]; int i, is_set = 0; u32 val; @@ -328,8 +326,8 @@ static int pxa2xx_build_groups(struct pxa_pinctrl *pctl) static int pxa2xx_build_state(struct pxa_pinctrl *pctl, const struct pxa_desc_pin *ppins, int npins) { - struct pxa_pinctrl_group *group; struct pinctrl_pin_desc *pins; + struct pingroup *group; int ret, i; pctl->npins = npins; @@ -353,7 +351,8 @@ static int pxa2xx_build_state(struct pxa_pinctrl *pctl, for (i = 0; i < npins; i++) { group = pctl->groups + i; group->name = ppins[i].pin.name; - group->pin = ppins[i].pin.number; + group->pins = &ppins[i].pin.number; + group->npins = 1; } ret = pxa2xx_build_functions(pctl); diff --git a/drivers/pinctrl/pxa/pinctrl-pxa2xx.h b/drivers/pinctrl/pxa/pinctrl-pxa2xx.h index a0bdcec55158..b292b79efdf8 100644 --- a/drivers/pinctrl/pxa/pinctrl-pxa2xx.h +++ b/drivers/pinctrl/pxa/pinctrl-pxa2xx.h @@ -52,11 +52,6 @@ struct pxa_desc_pin { struct pxa_desc_function *functions; }; -struct pxa_pinctrl_group { - const char *name; - unsigned pin; -}; - struct pxa_pinctrl { spinlock_t lock; void __iomem **base_gafr; @@ -68,7 +63,7 @@ struct pxa_pinctrl { unsigned npins; const struct pxa_desc_pin *ppins; unsigned ngroups; - struct pxa_pinctrl_group *groups; + struct pingroup *groups; unsigned nfuncs; struct pinfunction *functions; char *name;