From patchwork Thu Feb 16 22:25:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan.Wanner@microchip.com X-Patchwork-Id: 58264 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp563019wrn; Thu, 16 Feb 2023 14:32:52 -0800 (PST) X-Google-Smtp-Source: AK7set+MEe4r+K+DXnmwKU1re8k4ZZHO3WBnTzHOmhq5ZjxXgFCRUItHctfQ0D5EcAMv9GBdbFfg X-Received: by 2002:a05:6402:201:b0:4ad:152c:865c with SMTP id t1-20020a056402020100b004ad152c865cmr5016348edv.9.1676586772555; Thu, 16 Feb 2023 14:32:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676586772; cv=none; d=google.com; s=arc-20160816; b=r+C9J703rimX8+QS0Gn60nOhyA585wOpyHXbPskpwCSzyTLw033Wp5MkeuCJ0t3oAQ mZv9WR1llVkjWMqq/nWqdyQnHLITz+h83rvKx+yvQ/1j/Y823MVM2N3CPbH6VYGDblSl awBxr7EBED9BhwSGnNp54CXrEknLEObV3qakfDXm+ErLNdLwCqPEEwYPaU6TOgQIn+9V cXceuyF1k3tY/FyjFOEhev7arhniA9DoSSCY/8G/Qjrf3a4iufpC3aGbN6d3drJOwZJe oDulfc+WIl43y0PcmECq7zk5PQbJeD5KvNkzn0NFTX3LdjkQUmmbzksIowfIOqRvxQCn 5ooQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rwWhCb0yu+chKLRNsZTZOsiMGdk9XT4QN7Y4roGv4hc=; b=X3UK79eHFV0xsyA64Oqx2gid4V0Hpnd1SHkcDSGzwMBN83TJvO44x2hGSwdW+MJZH6 oxS8/GacQOp2S7v/gL6+ZAKR/ieIRtth3dL/fI6k1K1S7ebzV1thE8MpBrSlNmBZmjAi Wy6Wy/FrxtbWNANfZ7Tbq8XfFdOyC1nfCNLzSRtDu82AHjpWwhUKaQq3tJUBZEX/6qz6 O7bExt1RUfzw+lIBVFa8lL9gzW835s/R1fm6w3sVSSl7HJ+HhQDVg79edOZZG60ekEjV DTNShjM5lSN+94umXy80TKyl3/Y7k6HTh9I776slxs098X2Y6nd8N5CnB19YZMdhhhZ1 j5Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=iBiPCbH9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fe17-20020a1709072a5100b008b14da8ab72si2733991ejc.193.2023.02.16.14.32.29; Thu, 16 Feb 2023 14:32:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=iBiPCbH9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230357AbjBPWZZ (ORCPT + 99 others); Thu, 16 Feb 2023 17:25:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230147AbjBPWZW (ORCPT ); Thu, 16 Feb 2023 17:25:22 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C74005584; Thu, 16 Feb 2023 14:25:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1676586321; x=1708122321; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XGHfMTGCd/gJkWJX2zF7BZlRowokhbzmVWDbs2H6PWY=; b=iBiPCbH9RgMh+e2pLcsK2JHwlr3hqDOxW/L7QmpblJn9NbHAO7+H0Pqm UfCUXoWcBpiGGMcjXqyqAPz0cLMsOSz7izjF5+P6zstxCJE7BPE4d+XJE TtRs6PjBE59i3qW33oswlLETQhvHubydm2VUi9klawjAVClwBuZiaCAFX Q5PG8ShFnTRwrPsGV9KrGDUudJrUBuKiGYGppDe/i3RD1YP/AhgI/a+zf QHO8Sp/zUxELj23CV4dB26wqllYHUQStj5lqJ4h1ryP8U/sLjC0RZbPtt /8FEu3uDhIjOCIWZ6Lv6VJS4vfjhPipumhUaW2PXlXDuCj1zJH0MnaNng A==; X-IronPort-AV: E=Sophos;i="5.97,304,1669100400"; d="scan'208";a="201366782" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 16 Feb 2023 15:25:17 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) 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.2507.16; Thu, 16 Feb 2023 15:25:16 -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.16 via Frontend Transport; Thu, 16 Feb 2023 15:25:16 -0700 From: To: , , , , , , CC: , , , , Ryan Wanner Subject: [PATCH v2 1/2] pinctrl: at91-pio4: Implement the correct drive values for sama7g5 Date: Thu, 16 Feb 2023 15:25:23 -0700 Message-ID: <20230216222524.3107759-2-Ryan.Wanner@microchip.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230216222524.3107759-1-Ryan.Wanner@microchip.com> References: <20230216222524.3107759-1-Ryan.Wanner@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758028651713503680?= X-GMAIL-MSGID: =?utf-8?q?1758028651713503680?= From: Ryan Wanner Sama7g5 drive strength options have been updated from previous pio4 products. Now values will correctly align with sama7g5 drive strength options highlighted in the sama7g5 data sheet. Add xlate to separate the sama7g5 drive values and the sama5d27 drive values. Signed-off-by: Ryan Wanner --- drivers/pinctrl/pinctrl-at91-pio4.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c index 82b921fd630d..6b5a753ccd37 100644 --- a/drivers/pinctrl/pinctrl-at91-pio4.c +++ b/drivers/pinctrl/pinctrl-at91-pio4.c @@ -72,17 +72,32 @@ /* Custom pinconf parameters */ #define ATMEL_PIN_CONFIG_DRIVE_STRENGTH (PIN_CONFIG_END + 1) +static const u32 drive_strength_xlate_sama7g5[4] = { + ATMEL_PIO_DRVSTR_LO_D, + ATMEL_PIO_DRVSTR_HI_A, + ATMEL_PIO_DRVSTR_LO_C, + ATMEL_PIO_DRVSTR_LO_B +}; + +static const u32 drive_strength_xlate_sama5d2[4] = { + ATMEL_PIO_DRVSTR_LO, + ATMEL_PIO_DRVSTR_LO_1, + ATMEL_PIO_DRVSTR_ME, + ATMEL_PIO_DRVSTR_HI +}; /** * struct atmel_pioctrl_data - Atmel PIO controller (pinmux + gpio) data struct * @nbanks: number of PIO banks * @last_bank_count: number of lines in the last bank (can be less than * the rest of the banks). * @slew_rate_support: slew rate support + * @drv_stre_xlate: xlate for different drive values */ struct atmel_pioctrl_data { unsigned int nbanks; unsigned int last_bank_count; unsigned int slew_rate_support; + const unsigned int *drv_stre_xlate; }; struct atmel_group { @@ -121,6 +136,7 @@ struct atmel_pin { * @dev: device entry for the Atmel PIO controller. * @node: node of the Atmel PIO controller. * @slew_rate_support: slew rate support + * @drv_stre_xlate: xlate for different drive values */ struct atmel_pioctrl { void __iomem *reg_base; @@ -143,6 +159,7 @@ struct atmel_pioctrl { struct device *dev; struct device_node *node; unsigned int slew_rate_support; + const unsigned int *drv_stre_xlate; }; static const char * const atmel_functions[] = { @@ -872,12 +889,17 @@ static int atmel_conf_pin_config_group_set(struct pinctrl_dev *pctldev, conf &= ~ATMEL_PIO_SR_MASK; break; case ATMEL_PIN_CONFIG_DRIVE_STRENGTH: + if (arg > ATMEL_PIO_DRVSTR_HI || arg < ATMEL_PIO_DRVSTR_LO) { + dev_warn(pctldev->dev, "drive strength not updated (incorrect value)\n"); + break; + } switch (arg) { case ATMEL_PIO_DRVSTR_LO: + case ATMEL_PIO_DRVSTR_LO_1: case ATMEL_PIO_DRVSTR_ME: case ATMEL_PIO_DRVSTR_HI: conf &= (~ATMEL_PIO_DRVSTR_MASK); - conf |= arg << ATMEL_PIO_DRVSTR_OFFSET; + conf |= atmel_pioctrl->drv_stre_xlate[arg] << ATMEL_PIO_DRVSTR_OFFSET; break; default: dev_warn(pctldev->dev, "drive strength not updated (incorrect value)\n"); @@ -1013,12 +1035,14 @@ static const struct dev_pm_ops atmel_pctrl_pm_ops = { static const struct atmel_pioctrl_data atmel_sama5d2_pioctrl_data = { .nbanks = 4, .last_bank_count = ATMEL_PIO_NPINS_PER_BANK, + .drv_stre_xlate = drive_strength_xlate_sama5d2, }; static const struct atmel_pioctrl_data microchip_sama7g5_pioctrl_data = { .nbanks = 5, .last_bank_count = 8, /* sama7g5 has only PE0 to PE7 */ .slew_rate_support = 1, + .drv_stre_xlate = drive_strength_xlate_sama7g5, }; static const struct of_device_id atmel_pctrl_of_match[] = { @@ -1064,6 +1088,7 @@ static int atmel_pinctrl_probe(struct platform_device *pdev) atmel_pioctrl->npins += atmel_pioctrl_data->last_bank_count; } atmel_pioctrl->slew_rate_support = atmel_pioctrl_data->slew_rate_support; + atmel_pioctrl->drv_stre_xlate = atmel_pioctrl_data->drv_stre_xlate; atmel_pioctrl->reg_base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(atmel_pioctrl->reg_base)) From patchwork Thu Feb 16 22:25:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan.Wanner@microchip.com X-Patchwork-Id: 58265 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp563100wrn; Thu, 16 Feb 2023 14:33:07 -0800 (PST) X-Google-Smtp-Source: AK7set8Pmgy/sbhGQiw5OF3YnOmeQUPqWdjpj7SuPPL40RwQiixEeekmlwEyVsA9DdinX6X44rBJ X-Received: by 2002:a05:6402:8d4:b0:4ac:bcf9:6d6c with SMTP id d20-20020a05640208d400b004acbcf96d6cmr6922339edz.36.1676586786955; Thu, 16 Feb 2023 14:33:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676586786; cv=none; d=google.com; s=arc-20160816; b=K4FavhNbJqfcgH0FoWjyvhd6O/E9Bzwrc8NfXEFMR/exP4UIZL3ntjqfo3m9402sMh wI7aROaQv7dkhJGM1XxcAX/aCnpY9jM8/1A7v0vSf1yu1i4MxqgflhbWKy88wM5Iu+g8 PPKwclj30RdlgQZKJz+416ov6+X2xDpXJI40q4u4xXIvAb/074WdT8FxokNwiUfJoyXP g1FDuD7sADugJiXoESkxZ8swbUDfkogeKhjLEKO4X5VNFiokYweu1dLFm2IzfABIDfts w5sZ56nvFgrkvF0z0wUhzjjvD1JxzuQ9mEyugIhNewGVhRHJ35Ka8jsuLeVSj1dNlGc9 LB2g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Jg6G5z7O+fSFIVMnpM2sIWFLvJYYcRck+/aY5w9fnDQ=; b=yVYuGAn3QLB8yrTZOc7MAdoZiAF5Y89C45WLQY6DbW2qBppj5OE+n895AoOv8dy3J/ DFJqUNO2pHIanmOmFibNL0QTNgb4r4YIRem3jy9pQv9q7B292PweYGZa2/e8Mf0O1e8I BGHdwu/NFUsQcY+l4LN+Kr8BVWx11JSempdF2evc7qQGi4159VtA2xtv5A/P8IKrSDDU C4wDbY3WsBZoNauAWF/3S7So7fn3d0BhEOVnvkfTVv4QqtC2YPufqdPRrxj2NA8PYOY0 0JmSxgCMc8trQgU4Nlq9mKs0yIhpoQf/qyKX3cQc4hr8J7dXL5mpsxjnBUbvlhNWpq4S SWsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=BzN0k7gn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f4-20020a1709063f4400b008b177beb99dsi1667058ejj.1.2023.02.16.14.32.44; Thu, 16 Feb 2023 14:33:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=BzN0k7gn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229758AbjBPWZb (ORCPT + 99 others); Thu, 16 Feb 2023 17:25:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230283AbjBPWZW (ORCPT ); Thu, 16 Feb 2023 17:25:22 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA8D2558A; Thu, 16 Feb 2023 14:25:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1676586321; x=1708122321; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MY99QrfOBLMmoR5qfOBBHic4fkNzKFK/inr8InHiPlo=; b=BzN0k7gn72inAs2uKFv6lYLyR2/Nl4pUcLLijd2UcGMaBIQh40xF1x1M A2Gz4anC8vBkHabhrjLJTUWZbOy3KLuZlb2wsOvkWpvxd/7+vPZgv44U3 Zu8/FREvMNyLwOYKfWw2Sff3Rx8M3lqMZd5SBxnq8KaGs9fSpOkugHbPD QaAnAhE10FkAjbZPBHFtiSwAs58/Z+tfCkYwJYyMKgn62awfg0tiAcw36 HZ7hUEhH9QHpLQi4SP/vritMRO5iG4LvxApoTGsjVfUCoz2hG3DmYKYoX PQ/aLmsTsPOqySs7kEdztT0THDSctWJnDIVU+zbiaNHsN8ytcuSF+YoSI Q==; X-IronPort-AV: E=Sophos;i="5.97,304,1669100400"; d="scan'208";a="201366783" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 16 Feb 2023 15:25:17 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) 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.2507.16; Thu, 16 Feb 2023 15:25:16 -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.16 via Frontend Transport; Thu, 16 Feb 2023 15:25:16 -0700 From: To: , , , , , , CC: , , , , Ryan Wanner Subject: [PATCH v2 2/2] ARM: at91: dt: adding new macros Date: Thu, 16 Feb 2023 15:25:24 -0700 Message-ID: <20230216222524.3107759-3-Ryan.Wanner@microchip.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230216222524.3107759-1-Ryan.Wanner@microchip.com> References: <20230216222524.3107759-1-Ryan.Wanner@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758028666829419098?= X-GMAIL-MSGID: =?utf-8?q?1758028666829419098?= From: Ryan Wanner Adding macros for sama7g drive strength. Signed-off-by: Ryan Wanner --- changes from v1: - Fix ABI break. - Add some small comments to describe drive strength macros. include/dt-bindings/pinctrl/at91.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/include/dt-bindings/pinctrl/at91.h b/include/dt-bindings/pinctrl/at91.h index e8e117306b1b..12f3edf2a9c4 100644 --- a/include/dt-bindings/pinctrl/at91.h +++ b/include/dt-bindings/pinctrl/at91.h @@ -42,8 +42,16 @@ #define AT91_PERIPH_C 3 #define AT91_PERIPH_D 4 -#define ATMEL_PIO_DRVSTR_LO 1 +/*These macros are for all other at91 pinctrl drivers*/ +#define ATMEL_PIO_DRVSTR_LO 0 +#define ATMEL_PIO_DRVSTR_LO_1 1 #define ATMEL_PIO_DRVSTR_ME 2 #define ATMEL_PIO_DRVSTR_HI 3 +/* These macros are for the sama7g5 pinctrl driver*/ +#define ATMEL_PIO_DRVSTR_LO_D 0 +#define ATMEL_PIO_DRVSTR_HI_A 1 +#define ATMEL_PIO_DRVSTR_LO_C 2 +#define ATMEL_PIO_DRVSTR_LO_B 3 + #endif /* __DT_BINDINGS_AT91_PINCTRL_H__ */