From patchwork Thu Feb 9 15:45:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Wanner X-Patchwork-Id: 13134818 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 BD389C636D7 for ; Thu, 9 Feb 2023 15:46:58 +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:References:In-Reply-To: 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: List-Owner; bh=PyaswIgBNfdZgV6djQq9aKaxhfPB02ph7Y3QvJd0SRI=; b=Z8z8P3DCw2/9rW qpVTonwS/wakcPWYmEH6CI7orWbNTKy0e6itsoZdsL597Nj5rYNdDehvTGlqRA7YN5zNa7iF76EQK bTPP1viuGT6hxMTAtR9j9Y5FshHYv494/K/b3gKCGPcMGBUr+QPry5cDEks7Zk6Vbo3WD+bnEQEEJ eQggXjQXACjHCUMOgYYXQb0ZDyvnlfiO4vrfWfDT+lACRmMQhwW99C+vo5YBXTRh5kZ8MLVjuItmP QTESL04eoBmUI2XI5w+6xphTmmsFNDn8hkUTSErFNlSqn4uvHQI9XZqMwVTFeLTEWuruNb1cSeSMr PdOPIPqFs8vz2mbTMy5A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pQ97V-002GoP-LK; Thu, 09 Feb 2023 15:45:57 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pQ97K-002Gm1-9h for linux-arm-kernel@lists.infradead.org; Thu, 09 Feb 2023 15:45:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1675957546; x=1707493546; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=y31IcLg+PPKjxAHTBA7gQ6gNWlc/zLybYAacTecv50Y=; b=r1f6qH6acMdKRPzj/7bfrsX+oG5xr/zsjgIHRpKl3YulIXOOROaiUM4R HOOAle3VMsWzSn2SIcaAsriok5CxcNWKpBWjBcjAd3cmkAxiLBbyDvDAv VN5+O1UBhbZeoZHs4b8hG/QvOX5cRHO2dPatTGKPv5uBsmuqT8Zyjex/A Fig1L3yOE0JWspaqcSCbiu8iBahMAhl1EUvvnzulLovbYHojUSff1CToS 6tcRhUFpDMJaTCEtIxnDDqn0RZlQ6GrzA8UTtETBtkODQBXrr/nRCFbst WYa38HwTxorU1eT50Mag+cFfymTrTM2g9LP3rocJW2rM/UW+kkhLtBmua w==; X-IronPort-AV: E=Sophos;i="5.97,284,1669100400"; d="scan'208";a="211286111" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 09 Feb 2023 08:45:36 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Thu, 9 Feb 2023 08:45:35 -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, 9 Feb 2023 08:45:35 -0700 From: To: , , , , , , CC: , , , , , Ryan Wanner Subject: [PATCH 1/2] pinctrl: at91-pio4: Implement the correct drive values for sama7g5 Date: Thu, 9 Feb 2023 08:45:43 -0700 Message-ID: <20230209154544.535136-2-Ryan.Wanner@microchip.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230209154544.535136-1-Ryan.Wanner@microchip.com> References: <20230209154544.535136-1-Ryan.Wanner@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230209_074546_429474_8E1570B8 X-CRM114-Status: GOOD ( 13.78 ) 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 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 | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c index 82b921fd630d..5f0cf1426f7e 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, + 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_0) { + dev_warn(pctldev->dev, "drive strength not updated (incorrect value)\n"); + break; + } switch (arg) { - case ATMEL_PIO_DRVSTR_LO: + case ATMEL_PIO_DRVSTR_LO_0 + 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 9 15:45:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Wanner X-Patchwork-Id: 13134819 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 B982CC61DA4 for ; Thu, 9 Feb 2023 15:46:59 +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:References:In-Reply-To: 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: List-Owner; bh=i3edgTrOK3426hCJMgEAX5+9cGHSJ7nhXygX3WIcLLQ=; b=jo57L84EU41ZVJ sYSsiA20J/JB/o+ZjRxBQk6z83iXJYWR4YQEC02nUi60OcA8Y7LZrKgihBXTYFDN2pT5QwvWtthp3 5neddFmG8LxM/MHB8NFtEKvpJ79eeI54c/btZpKWhfmoRwKoMAZehc82P999S6lBVKwTSHNdl/iq0 9CaX5pbgpAXeQ0ntIMTFgiljgV8ZOA1/75cbWV7OA/K6/hlFI+Qm8GcyUkmtqlgjwoi4CWcACiGW7 BQWDlzotyr9GpExG2lkODpgOXjJ6YEP+HG0C1g+uFU7aZjuCgbUy/fMPq2w0O+wCIn8rAD7XtmXvJ i5E5MSlCJp9XIfRp9OTQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pQ97d-002Gpn-4Y; Thu, 09 Feb 2023 15:46:05 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pQ97M-002Glz-DN for linux-arm-kernel@lists.infradead.org; Thu, 09 Feb 2023 15:45:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1675957548; x=1707493548; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cRZrnanpYDkbJPYdwlxFjU/jZt2cfSVpf0RQ5VKig+c=; b=piJDadONOexaSgczXEE7eMgIHsEeF6YFPuqkLOV1f/pJCm5zNNkogDnu TGc/DTqW90vy1yMSfJehswinHcp9W1c3T/OVoRmn/Q1aRLJxAz4bZ2Em4 Hd566aeOASmws/qPp5VSiqXbI041wn/X2szHr23kHVq8WWo6YxVJxAePV ds05yGulUnxmvcAbaXZ6M5cLNYDNN2kUUcPUVYH2Qlza7DWFSK27yVzto P619qDPE5VT1n8TMhEmu1W9bpOYJyi+EZKD5ssemudW4MPuyS9Csft9Ql 8QRupd8Ance7K9buljagO70MTWjqdfBZcMvLpHE3BYj8u7x2VKFot/dmu Q==; X-IronPort-AV: E=Sophos;i="5.97,284,1669100400"; d="scan'208";a="211286114" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 09 Feb 2023 08:45:37 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Thu, 9 Feb 2023 08:45:35 -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, 9 Feb 2023 08:45:35 -0700 From: To: , , , , , , CC: , , , , , Ryan Wanner Subject: [PATCH 2/2] pinctrl: at91: adding new macros Date: Thu, 9 Feb 2023 08:45:44 -0700 Message-ID: <20230209154544.535136-3-Ryan.Wanner@microchip.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230209154544.535136-1-Ryan.Wanner@microchip.com> References: <20230209154544.535136-1-Ryan.Wanner@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230209_074548_475421_E1A63DFC X-CRM114-Status: UNSURE ( 8.25 ) X-CRM114-Notice: Please train this message. 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 Adding macros for sama7g drive strength. Signed-off-by: Ryan Wanner --- include/dt-bindings/pinctrl/at91.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/dt-bindings/pinctrl/at91.h b/include/dt-bindings/pinctrl/at91.h index e8e117306b1b..fd0a389b2a0f 100644 --- a/include/dt-bindings/pinctrl/at91.h +++ b/include/dt-bindings/pinctrl/at91.h @@ -42,8 +42,14 @@ #define AT91_PERIPH_C 3 #define AT91_PERIPH_D 4 -#define ATMEL_PIO_DRVSTR_LO 1 +#define ATMEL_PIO_DRVSTR_LO_0 0 +#define ATMEL_PIO_DRVSTR_LO_1 1 #define ATMEL_PIO_DRVSTR_ME 2 #define ATMEL_PIO_DRVSTR_HI 3 +#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__ */