Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp73458pxf; Wed, 10 Mar 2021 00:18:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJywagPmXiReqtxLG/kerRRDMLAEMAcJZz8wRH0D4z4hw61WbffDjDE8WQkuDhJVyMOdlBK9 X-Received: by 2002:a17:907:2b03:: with SMTP id gc3mr2418427ejc.448.1615364335255; Wed, 10 Mar 2021 00:18:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615364335; cv=none; d=google.com; s=arc-20160816; b=PZ0+NhO3C7xzv+rG3ifEjBj5oKBdJ7AkYouKz0FeltrqVHcRv0LTuoW/nQhCVU7Hx2 wTTFG42J0J9mqprZyvBoTSRzgf1Wivi2IHncvYdE+p3YtjKjGTA+aEzYIO6nvatiJU3p m2UNz8vIEau21EWwo7Njtktzrl9MeArQ2ksDs71Ap3MiaVED9usRFs5wCNGmiA4fW176 Xo7nwVbAt5FBWRwjdfHvsgNye1N7oLCA77cDs26wSC+BdW3DnT4H6EYaPDNtGZPnNpsl yIDrXIyVdglcpmqhs7Eozlq3gJqNXFXh+pSKD0R15tqYVGvrIn9yKW830Q9UbcNydWBx XnPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=3Yz3/NapStuDE+x+ZZl/tDltLKdbda90tbUvwhJ9e1s=; b=ZF3zQFikrVvCQW8YXcbemQJbTtSbe9oNbBH5oQzVhG0yU59LnTBR8k4qrftDmlxyz4 M1nA4ZhyUXXasrp4yNZnJLhp5Tis8nKFDT8CDYkd00mdOdsJiUVkF74EBjnqjUkGfQeK kroKDIYdn+MJmMo/hMse7iRSkHSYkq9wk5Czjmxli/Z8kVyYE1fKjJ9APopn1KlwMaOR cQHMSQTpNWkQ3F7zUNHCseZ660KAup/lMx3PcFsp4X17lxONxWJb1XsY/uolMxIXXMLX P2kBh0k1SxkjoZGNqFjCMM8VT62/e8lVCtb9ENKBfzZOxs/hUmBddw5CpURZdMJ6aaE3 yLCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@monstr-eu.20150623.gappssmtp.com header.s=20150623 header.b=Sv0cLWYh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xilinx.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v2si10788268ejg.251.2021.03.10.00.18.32; Wed, 10 Mar 2021 00:18:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@monstr-eu.20150623.gappssmtp.com header.s=20150623 header.b=Sv0cLWYh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xilinx.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231966AbhCJIRL (ORCPT + 99 others); Wed, 10 Mar 2021 03:17:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229900AbhCJIRB (ORCPT ); Wed, 10 Mar 2021 03:17:01 -0500 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30FD9C061760 for ; Wed, 10 Mar 2021 00:17:01 -0800 (PST) Received: by mail-ej1-x629.google.com with SMTP id dx17so36786484ejb.2 for ; Wed, 10 Mar 2021 00:17:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3Yz3/NapStuDE+x+ZZl/tDltLKdbda90tbUvwhJ9e1s=; b=Sv0cLWYhmCUh8YdfxgJyfrGi6dqUoz1gT1CKoOPY1xRit3aV0WpSBVplnFeY4YPBao ybFdFpEIWsjPTOyg/HAzTSmlLCecF306hfaQF6KxEVrmcHPC97jb0oVcjTO00QToKXX0 fufJyXV84DvMDHwoUmZi5IDsC2KrZtCReRQlgi+U7T8jkyu3WYRACB7QSJduykpPrWwH uvtPloc5adPXHp6D1oCzbRQZxVoLTnWXfPmezHx4RhI8qnUzlsJk2zXGkKrxZasZCYaP vbLgZ0gwZlywG2hxADX3PdYMcyDbTSlXkhk9Ff8oqPFodigGejMlq1o7yGVQ22ivaH9c uKPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=3Yz3/NapStuDE+x+ZZl/tDltLKdbda90tbUvwhJ9e1s=; b=eXNUsLAAUrwjD+X7gmFv8IPqa0yKbGYuwCLc1wxKPjvCM5KB09HwIrj+eS2/HIGUIr foUPKe5GqlPveGtRj6Iawq7+edmdZBYwM+QDi2/r3kkMar3EldQLquRhVPTuAZGbUYBQ czwtt9kp6bH0qYTmb9niqlZMeECP/uqxKE/hmqrvRjc7hUuneggT9QcjOHvvMGVR7u4I kbK3ZnF/cOtxN028UAeX7nZArvl6O9VoCDcVlE9sS8OuBS/SakRwCQya+OhqXV2c0ZRr WilaSO8Zdcihu/UogR2mJrpGrmAQYXsXoYV1pu3txhw19j3yCcE/km65gA6QClzkTqGl p3Kw== X-Gm-Message-State: AOAM5316i8Abj28ZSaLowVwKrMLnXBjiNwbPXZ1ZYwyuf6Vef4K6rfLc FaKFP+mmqDaPQneB32FVKXb85k1N46hlStAu X-Received: by 2002:a17:907:9870:: with SMTP id ko16mr2344119ejc.227.1615364219497; Wed, 10 Mar 2021 00:16:59 -0800 (PST) Received: from localhost ([2a02:768:2307:40d6:f666:9af6:3fed:e53b]) by smtp.gmail.com with ESMTPSA id n25sm10513909edq.55.2021.03.10.00.16.58 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Mar 2021 00:16:58 -0800 (PST) Sender: Michal Simek From: Michal Simek To: linux-kernel@vger.kernel.org, monstr@monstr.eu, michal.simek@xilinx.com, git@xilinx.com, Linus Walleij Cc: linux-gpio@vger.kernel.org Subject: [PATCH] pinctrl: core: Handling pinmux and pinconf separately Date: Wed, 10 Mar 2021 09:16:54 +0100 Message-Id: X-Mailer: git-send-email 2.30.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Right now the handling order depends on how entries are coming which is corresponding with order in DT. We have reached the case with DT overlays where conf and mux descriptions are exchanged which ends up in sequence that firmware has been asked to perform configuration before requesting the pin. The patch is enforcing the order that pin is requested all the time first followed by pin configuration. This change will ensure that firmware gets requests in the right order. Signed-off-by: Michal Simek --- drivers/pinctrl/core.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index 7d3370289938..f5c32d2a3c91 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c @@ -1258,13 +1258,34 @@ static int pinctrl_commit_state(struct pinctrl *p, struct pinctrl_state *state) p->state = NULL; - /* Apply all the settings for the new state */ + /* Apply all the settings for the new state - pinmux first */ list_for_each_entry(setting, &state->settings, node) { switch (setting->type) { case PIN_MAP_TYPE_MUX_GROUP: ret = pinmux_enable_setting(setting); break; case PIN_MAP_TYPE_CONFIGS_PIN: + case PIN_MAP_TYPE_CONFIGS_GROUP: + break; + default: + ret = -EINVAL; + break; + } + + if (ret < 0) + goto unapply_new_state; + + /* Do not link hogs (circular dependency) */ + if (p != setting->pctldev->p) + pinctrl_link_add(setting->pctldev, p->dev); + } + + /* Apply all the settings for the new state - pinconf after */ + list_for_each_entry(setting, &state->settings, node) { + switch (setting->type) { + case PIN_MAP_TYPE_MUX_GROUP: + break; + case PIN_MAP_TYPE_CONFIGS_PIN: case PIN_MAP_TYPE_CONFIGS_GROUP: ret = pinconf_apply_setting(setting); break; -- 2.30.1