From patchwork Wed Apr 12 17:51:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Wanner X-Patchwork-Id: 13209386 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 923D1C77B72 for ; Wed, 12 Apr 2023 17:52:28 +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=iI9P87nn/CWEEZbHrcYzMWzKZks7mrOIoCRNQIgtsoI=; b=WXILRMzHMuu8Zh VkGqACzUeteNo6TTf2kWdnaHkunPk2eMYPDJwKDSwy6SsRrPh7F7hLWCtFrwxTW1d9l8VTatCskCL gbxrWZvNI+BACUVqBR8RxsxHIvHtJl9gC+aAu4bzLg2qeo5ZI3PY0mCinhlSYg3R2zIWf8Fz1Bbnh 0AYm2SUNJ2Q3O39gxC9AO3SwNHf/gKceIbo11xoTqrzUMmKSiJSRcSiRMT7RFFanbcv745FK7FKzd LNouc0BuRJtanidaXpFQLl01PsmFvgiqvK1racwfOIexxCU2PVLXzPkW2cHzqgzzHP3IA7VXcKo+k b/4o+wRIGbrka5992K7A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pmedA-00411p-0v; Wed, 12 Apr 2023 17:51:40 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pmed6-00410a-2e for linux-arm-kernel@lists.infradead.org; Wed, 12 Apr 2023 17:51:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1681321896; x=1712857896; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=gmb/rlmitwhnf0NxNDqppMtOJV914w5lfvnM7EmTvKM=; b=X7z67h0L4vusSCkmP2/BT6TDGdu6rCUivGFpOiqw2WoY9g2rxnaQb/8V cyEg3X54OdCSGpKVwFvloftmksFx70b4XHxEuOShGqBsjt9Sn2D+hInca AUlBuCO1OHarQoG8fWv1Fk7QBtStq1IU+gCXxj8XZsZIX9sWz2bDQ8UTg /X2Nb0xyIu5okf1SzCFREAglHeIluCAZcLyeIdZ9noJCoUOXGy0Gqb1kt pfd/SeZc4zR5xjr4SqomgjLgVpWVclvZzutX5i/LxWwk/5LKktq5fkkS7 5rlAifr834irIwkYjb9v4S1BOAaplOGqjoxMpc5NKXeIIjxK5R0s/6Wqz g==; X-IronPort-AV: E=Sophos;i="5.98,339,1673938800"; d="scan'208";a="208825837" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 12 Apr 2023 10:51:34 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Wed, 12 Apr 2023 10:51:33 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Wed, 12 Apr 2023 10:51:33 -0700 From: To: , , , , CC: , , , Ryan Wanner Subject: [linux][PATCH] pinctrl: at91-pio4: Add push-pull drive configuration Date: Wed, 12 Apr 2023 10:51:46 -0700 Message-ID: <20230412175146.886684-1-Ryan.Wanner@microchip.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230412_105136_919005_B102BE00 X-CRM114-Status: GOOD ( 13.98 ) 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 From: Ryan Wanner The PIO4 does support push-pull configuration as this is the default state of the open-drain register. Adapt the driver for this. Signed-off-by: Ryan Wanner --- This patch also fixes the warning of unsupported configuration param 8. This was tested on both sama5d2-som1-ek and sama7g5ek. I used dbg_show fucntion to test if the configuration was correct when adding drive-open-drain or drive-push-pull to the dts file. drivers/pinctrl/pinctrl-at91-pio4.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c index a30c6f7c9016..9a0cddfeaf92 100644 --- a/drivers/pinctrl/pinctrl-at91-pio4.c +++ b/drivers/pinctrl/pinctrl-at91-pio4.c @@ -776,6 +776,11 @@ static int atmel_conf_pin_config_group_get(struct pinctrl_dev *pctldev, return -EINVAL; arg = 1; break; + case PIN_CONFIG_DRIVE_PUSH_PULL: + if ((res & ATMEL_PIO_OPD_MASK)) + return -EINVAL; + arg = 1; + break; case PIN_CONFIG_INPUT_SCHMITT_ENABLE: if (!(res & ATMEL_PIO_SCHMITT_MASK)) return -EINVAL; @@ -839,10 +844,10 @@ static int atmel_conf_pin_config_group_set(struct pinctrl_dev *pctldev, conf &= (~ATMEL_PIO_PUEN_MASK); break; case PIN_CONFIG_DRIVE_OPEN_DRAIN: - if (arg == 0) - conf &= (~ATMEL_PIO_OPD_MASK); - else - conf |= ATMEL_PIO_OPD_MASK; + conf |= ATMEL_PIO_OPD_MASK; + break; + case PIN_CONFIG_DRIVE_PUSH_PULL: + conf &= (~ATMEL_PIO_OPD_MASK); break; case PIN_CONFIG_INPUT_SCHMITT_ENABLE: if (arg == 0) @@ -937,8 +942,10 @@ static void atmel_conf_pin_config_dbg_show(struct pinctrl_dev *pctldev, seq_printf(s, "%s ", "pull-down"); if (conf & ATMEL_PIO_IFEN_MASK) seq_printf(s, "%s ", "debounce"); - if (conf & ATMEL_PIO_OPD_MASK) + if ((conf & ATMEL_PIO_OPD_MASK) > 0) seq_printf(s, "%s ", "open-drain"); + if ((conf & ATMEL_PIO_OPD_MASK) == 0) + seq_printf(s, "%s ", "push-pull"); if (conf & ATMEL_PIO_SCHMITT_MASK) seq_printf(s, "%s ", "schmitt"); if (atmel_pioctrl->slew_rate_support && (conf & ATMEL_PIO_SR_MASK))