From patchwork Fri Apr 9 08:25:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 12193331 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A766C433ED for ; Fri, 9 Apr 2021 08:27:22 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0061761185 for ; Fri, 9 Apr 2021 08:27:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0061761185 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject: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=ku+bDYM/Mrfq4AwLI5ytR8s+XQrGOHkCI1rQ7+DHjxA=; b=CyZH1XQ69oLxMS8hX+0i9jt+Qz jhSC6Y6pvj0w3lKyAtcvdKsr4HP7S5ULR/AZh60GshpnamYQu/VtH02DespWGeRO3MYqsGLVyKrrP 0HxiY6VH5qNMm5Vi4hcZEK4MESqJCjgeOZXHPV+0HmsURshUz9mUWpoGhVGtfAiIGfjAdoC6ixmoR Z5oZ4gSk47E6UUzU7kkblfKC/MtiAVDU6ZmlfCunMjeW+qC5WD2Pr2PR1g79ubmm6YGl9KyR1kvjB yMg70ocmoPBpqeg3zMXxFZ4jjHMv6hMP/DvLghN+jGSkRU76kU5K5GqqykZHVhqRnWzqvW4NUMWIR de1HxkGg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lUmSW-0002Tq-Oc; Fri, 09 Apr 2021 08:25:44 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lUmSK-0002Ro-G9 for linux-arm-kernel@lists.infradead.org; Fri, 09 Apr 2021 08:25:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1617956731; x=1649492731; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=4H3DCv2rJZGlo//cFsdwjkvun9rW0cNQWVYoSvplp70=; b=eV7TEZwBELsMdh9kk92uOlIUkhBzNRqL3CjeqcMlp+Ju50eqMdEtSABz YqH0xI7HKAesdIHpg4kkwJkPNP+vxXyHrAixA3NrHIFPfwkTsMULp7Jyp yiftg1F1u272AhVsk2nBSTpkrg934i2HnnVHVGYTV1Dht3EVNP21CXytn CD/K7AOP87L3LuBGM00//82SpwnpyN3wC1HHdjREBV5G55vCCIO36Vq6J 7gOGO/B5qdPrquuEizRrs06xBxL+rln/BKwASmf6uSbMzt4Y2RJ3AhVQa 0Z/5zrQehWrzmg3WADwYewWblhVqT9yz1XfHKIhZv6WUqmx7zh42VVbOg Q==; IronPort-SDR: PNfEfxS9qld+x8sKLRIlorTtZz+P54O6boNjGQj/g9ARreK39HF0VOnhDFUCadbKm18EuCqsw6 mFyiOjTMlzxS7JrLVrKjba3ebGKz7K78TMAkgqYXmTtpEs8ISH97xDIfAc3lGxR/iEe6emT/Jw w3stGybC2F82yzGikYl7ie2rEQbj0vejngE8McC+tU+bVL/abx1JiWAGRWMUHRO9zwUNjIeMZ2 YgwVEBviQ1kWksanIVYdWEx/cFaucWnPo9efK/rFDc2GRVDmQRNTv5+lf8+QyYI6GvlljBa1wC 1fU= X-IronPort-AV: E=Sophos;i="5.82,208,1613458800"; d="scan'208";a="110235837" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 09 Apr 2021 01:25:27 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Fri, 9 Apr 2021 01:25:27 -0700 Received: from atudor-ThinkPad-T470p.amer.actel.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Fri, 9 Apr 2021 01:25:24 -0700 From: Tudor Ambarus To: , , Subject: [PATCH] pinctrl: at91-pio4: Fix slew rate disablement Date: Fri, 9 Apr 2021 11:25:22 +0300 Message-ID: <20210409082522.625168-1-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210409_092533_235468_4D45D5AA X-CRM114-Status: GOOD ( 11.70 ) 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: , Cc: alexandre.belloni@bootlin.com, Tudor Ambarus , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The slew rate was enabled by default for each configuration of the pin. In case the pin had more than one configuration, even if we set the slew rate as disabled in the device tree, the next pin configuration would set again the slew rate enabled by default, overwriting the slew rate disablement. Instead of enabling the slew rate by default for each pin configuration, enable the slew rate by default just once per pin, regardless of the number of configurations. This way the slew rate disablement will also work for cases where pins have multiple configurations. Fixes: 440b144978ba ("pinctrl: at91-pio4: add support for slew-rate") Signed-off-by: Tudor Ambarus Reviewed-by: Claudiu Beznea Acked-by: Ludovic Desroches --- drivers/pinctrl/pinctrl-at91-pio4.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c index a5d328808e4c..4c01d8471ffa 100644 --- a/drivers/pinctrl/pinctrl-at91-pio4.c +++ b/drivers/pinctrl/pinctrl-at91-pio4.c @@ -801,6 +801,10 @@ static int atmel_conf_pin_config_group_set(struct pinctrl_dev *pctldev, conf = atmel_pin_config_read(pctldev, pin_id); + /* Keep slew rate enabled by default. */ + if (atmel_pioctrl->slew_rate_support) + conf |= ATMEL_PIO_SR_MASK; + for (i = 0; i < num_configs; i++) { unsigned int param = pinconf_to_config_param(configs[i]); unsigned int arg = pinconf_to_config_argument(configs[i]); @@ -808,10 +812,6 @@ static int atmel_conf_pin_config_group_set(struct pinctrl_dev *pctldev, dev_dbg(pctldev->dev, "%s: pin=%u, config=0x%lx\n", __func__, pin_id, configs[i]); - /* Keep slew rate enabled by default. */ - if (atmel_pioctrl->slew_rate_support) - conf |= ATMEL_PIO_SR_MASK; - switch (param) { case PIN_CONFIG_BIAS_DISABLE: conf &= (~ATMEL_PIO_PUEN_MASK);