From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from CHN02-BJS-obe.outbound.protection.partner.outlook.cn (mail-bjschn02on2139.outbound.protection.partner.outlook.cn [139.219.17.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F01B83947B0; Fri, 24 Apr 2026 11:34:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=139.219.17.139 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777030466; cv=fail; b=QYhCYrXMT7XvaP7cll6nZ9V8eS9AFsVsWjcP0g0WYPjb8P4KGhjM8qVCU+dGvlEx9YeQ2b2LmItvzc0GAC2CrXkAMyZyk+/E7w3GUTtHtfqXoPnhYGmBJKR/UTncq7croRmr8tRsCYARGIljLJtCiUQd+xCSve/q53127UXb1g0= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777030466; c=relaxed/simple; bh=PXKv+1tZ/zGZl9Hdl9ZQ3QPtXAb5Zl+yRJcfAOFxoDE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=IifVILqrmxupLXQ/64CcbWaN2RxJBBGuHPE+ao9XxGwto7Q0rO+5WUX/T0zIq69CsCSlPvDOUiaGvXkoQFD8TNomgcQJhMI8T8qWbaXE/TxxHdrTtx6j3lfTjkNNkTxtfJJWcvUWBGmA86PBZRO5T42HpcfqiiSe4mctjRNTx9c= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=starfivetech.com; spf=pass smtp.mailfrom=starfivetech.com; arc=fail smtp.client-ip=139.219.17.139 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=starfivetech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=starfivetech.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LXYSpcuDWv4v+3ZWAJWdjFUWiR/5Fqa36qUTa0PH5SLMaTnnMFbkqxFwwoJYJOlo8NBzfN+Hnsv7VJAIqvX/cizWKOAB5uSId+kMtb4pjWlL8ZRQmGBiXUmANPn1BaxQpH1rf1g8sIX9GOsxSN8TZAwyu4Kjpzuey0KexBv5tBSrql3fcOCcQJ7VuWQ0//DkTbTyBR09NNJmdRPVzBn506wr/j79xKBMSMI29dfEb0RIAhLJg1lOLitLcTpXBryorXz8yzklArP/7U3sdvgGHSMdZ7Hlbq0jZF1p6oWRRXT5LFO8alX1FWL3tcgtm72vBZMEFxrOQcuNXjypXULIrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UBwkIOq6B2reee1LevWUV3iwNpJfXnG62D5DZL8F3s4=; b=gJKNXoyjLD+XN/AMqTWugWVcD1AdMDmB1HkHE5uqpYdyrbsI7ncexFybPFnz4x3B0DLL/3ZA1nChiK+8+X1VyfLbah6Ho7/r/rYBaDHWopuhOxJE1WPVml4Wgmxa+EnjXjuo7Eo0SRRWeL3GRTiQbwL+kCAUoHwZZKjVYjaYC7p2q1n3YqAOasbWrN79nBoeHXiYsac5Iq4CO3C+p+nwcwsrW9yVmn5bkimje1CqJ+oDdv7pyqwkjjQlSHRMLjaL7c5C2vfv0pd4YyEowoMbpkZUs5Y2IXuC4228AkpsrRp5W8/Kfzo+T6F4kF3iQrDeXp18lg+qioK9W1ie8X+gsg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; Received: from ZQ4PR01MB1202.CHNPR01.prod.partner.outlook.cn (2406:e500:c550:17::6) by ZQ4PR01MB1156.CHNPR01.prod.partner.outlook.cn (2406:e500:c550:14::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9846.22; Fri, 24 Apr 2026 11:14:02 +0000 Received: from ZQ4PR01MB1202.CHNPR01.prod.partner.outlook.cn ([fe80::e7d4:256c:b066:850d]) by ZQ4PR01MB1202.CHNPR01.prod.partner.outlook.cn ([fe80::e7d4:256c:b066:850d%5]) with mapi id 15.20.9846.021; Fri, 24 Apr 2026 11:14:02 +0000 From: Changhuang Liang To: Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Emil Renner Berthing , Paul Walmsley , Albert Ou , Palmer Dabbelt , Alexandre Ghiti , Philipp Zabel , Bartosz Golaszewski Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, Lianfeng Ouyang , Changhuang Liang Subject: [PATCH v1 18/20] pinctrl: starfive: Add StarFive JHB100 per3 controller driver Date: Fri, 24 Apr 2026 04:13:28 -0700 Message-Id: <20260424111330.702272-19-changhuang.liang@starfivetech.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20260424111330.702272-1-changhuang.liang@starfivetech.com> References: <20260424111330.702272-1-changhuang.liang@starfivetech.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SHXPR01CA0025.CHNPR01.prod.partner.outlook.cn (2406:e500:c311:1b::34) To ZQ4PR01MB1202.CHNPR01.prod.partner.outlook.cn (2406:e500:c550:17::6) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: ZQ4PR01MB1202:EE_|ZQ4PR01MB1156:EE_ X-MS-Office365-Filtering-Correlation-Id: 0054a019-f448-436c-ed1a-08dea1f29748 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|52116014|376014|366016|1800799024|38350700014|921020|56012099003|18002099003|22082099003; X-Microsoft-Antispam-Message-Info: XcZCJI/MlsmykaCMQCJiULam5SR1dFXuVmS5XOernOifKLVhKeSFdQorbeqmSPzLdDObKzjnzvWaz4fc18u6oUVO9VWmmOf7Hb0qvblvCoFARwRQwitbB+KD9dacBLwkKp9RFAzkZSawtbvmUGHoL5MhbzdXzqihA0aYjy8QsyHEjHg1IDJPntL8RHomp1KQeyhq6xYqlJF1bVeBMRpu0iru6BvCcdZMh+KaeX4shGVsls7iXltNAky3fKfdcS5OZEkeLv/AJsXzLM1ENqdqAf3t38VKJxLwUJTX2OmcyNpTXXsaTR+E8Xj4qPzQ3WObl7qxxoDsbVR3tTQzHriaYqwe9aEXjZJmXHMeHMs6gmuKOJLMaRNX/LWhK73PjAybA4+HVkNCBBlNULwbHlwfpS3q/yneycxD653fOgvKgRgbtD+Ekt9Iwi9p38BHJoW/KUK3+urNpcF2vX3j+p3WpMqELHEc09jx7+CAzcw8qHWQ1dKdHRtM0v65k15TA7yzfiOpopsnfyWovwY3b0g+KUtHvOBCwVRcF3KfejHJzfOa0IKSPpWWgsXCvAztaAfyEdoGPK6NFdIaPjWp/kwPOYfykawoLRfa+Mgu7uFE20c= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:ZQ4PR01MB1202.CHNPR01.prod.partner.outlook.cn;PTR:;CAT:NONE;SFS:(13230040)(7416014)(52116014)(376014)(366016)(1800799024)(38350700014)(921020)(56012099003)(18002099003)(22082099003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?svVcVa9iovRMM+nnvyaGhhyhf52s+K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riginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0054a019-f448-436c-ed1a-08dea1f29748 X-MS-Exchange-CrossTenant-AuthSource: ZQ4PR01MB1202.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2026 11:14:02.6569 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: M5tBXSfnwWHUPql67h/EgvhrZSuRUttzvxswtRoh8BiyeOGwp5NzZ66vf0dpIxLpTYQd7rqLFSbfX6RUmXiWaUGT9raVlg3QZCd8NoIqowjfqY3qwaxS2+ad2abIjeUP X-MS-Exchange-Transport-CrossTenantHeadersStamped: ZQ4PR01MB1156 Add pinctrl driver for StarFive JHB100 SoC Peripheral-3(per3) pinctrl controller. Signed-off-by: Lianfeng Ouyang Signed-off-by: Changhuang Liang --- drivers/pinctrl/starfive/Kconfig | 12 +++ drivers/pinctrl/starfive/Makefile | 1 + .../starfive/pinctrl-starfive-jhb100-per3.c | 101 ++++++++++++++++++ 3 files changed, 114 insertions(+) create mode 100644 drivers/pinctrl/starfive/pinctrl-starfive-jhb100-per3.c diff --git a/drivers/pinctrl/starfive/Kconfig b/drivers/pinctrl/starfive/Kconfig index ed29f87e9d7a..07cef96f8e90 100644 --- a/drivers/pinctrl/starfive/Kconfig +++ b/drivers/pinctrl/starfive/Kconfig @@ -107,6 +107,18 @@ config PINCTRL_STARFIVE_JHB100_PER2POK peripherals supporting inputs, outputs, configuring pull-up/pull-down and interrupts on input changes. +config PINCTRL_STARFIVE_JHB100_PER3 + tristate "StarFive JHB100 SoC Peripheral-3 pinctrl and GPIO driver" + depends on ARCH_STARFIVE || COMPILE_TEST + depends on OF + select PINCTRL_STARFIVE_JHB100 + default ARCH_STARFIVE + help + Say yes here to support Peripheral-3 pin control on the StarFive JHB100 SoC. + This also provides an interface to the GPIO pins not used by other + peripherals supporting inputs, outputs, configuring pull-up/pull-down + and interrupts on input changes. + config PINCTRL_STARFIVE_JHB100_SYS0 tristate "StarFive JHB100 SoC System-0 pinctrl and GPIO driver" depends on ARCH_STARFIVE || COMPILE_TEST diff --git a/drivers/pinctrl/starfive/Makefile b/drivers/pinctrl/starfive/Makefile index 213002da9cdd..351fce524fec 100644 --- a/drivers/pinctrl/starfive/Makefile +++ b/drivers/pinctrl/starfive/Makefile @@ -11,6 +11,7 @@ obj-$(CONFIG_PINCTRL_STARFIVE_JHB100_PER0) += pinctrl-starfive-jhb100-per0.o obj-$(CONFIG_PINCTRL_STARFIVE_JHB100_PER1) += pinctrl-starfive-jhb100-per1.o obj-$(CONFIG_PINCTRL_STARFIVE_JHB100_PER2) += pinctrl-starfive-jhb100-per2.o obj-$(CONFIG_PINCTRL_STARFIVE_JHB100_PER2POK) += pinctrl-starfive-jhb100-per2pok.o +obj-$(CONFIG_PINCTRL_STARFIVE_JHB100_PER3) += pinctrl-starfive-jhb100-per3.o obj-$(CONFIG_PINCTRL_STARFIVE_JHB100_SYS0) += pinctrl-starfive-jhb100-sys0.o obj-$(CONFIG_PINCTRL_STARFIVE_JHB100_SYS0H) += pinctrl-starfive-jhb100-sys0h.o obj-$(CONFIG_PINCTRL_STARFIVE_JHB100_SYS1) += pinctrl-starfive-jhb100-sys1.o diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jhb100-per3.c b/drivers/pinctrl/starfive/pinctrl-starfive-jhb100-per3.c new file mode 100644 index 000000000000..a2e6ea4097a5 --- /dev/null +++ b/drivers/pinctrl/starfive/pinctrl-starfive-jhb100-per3.c @@ -0,0 +1,101 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Pinctrl / GPIO driver for StarFive JHB100 SoC Peripheral-3 domain + * + * Copyright (C) 2024 StarFive Technology Co., Ltd. + * Author: Alex Soo + * + */ + +#include +#include + +#include "pinctrl-starfive-jhb100.h" + +static const struct jhb100_pin_layout_desc jhb100_per3_pl_desc[] = { + { .pin_start = 0, .pin_cnt = 11, .name = "gpio", .gpio_func_sel = 0 }, + { .pin_start = 11, .pin_cnt = 1, .name = "peci1_out", .gpio_func_sel = -1 }, + { .pin_start = 12, .pin_cnt = 1, .name = "peci2_out", .gpio_func_sel = -1 }, + { 0xff }, +}; + +static struct config_reg_layout_desc jhb100_per3_pinctrl_rl_desc[] = { + { + .pin_start = 0, + .pin_cnt = 2, + .drive_strength_2bit = { .shift = 0, .width = 2 }, + .input_enable = { .shift = 2, .width = 1 }, + .pull_down = { .shift = 3, .width = 1 }, + .pull_up = { .shift = 4, .width = 1 }, + .slew_rate = { .shift = 5, .width = 1 }, + .schmitt_trigger_select = { .shift = 6, .width = 1 }, + .reserved = { .shift = 7, .width = 8 }, + .debounce_width = { .shift = 15, .width = 17 }, + }, + { + .pin_start = 2, + .pin_cnt = 9, + .input_enable = { .shift = 0, .width = 1 }, + .slew_rate = { .shift = 1, .width = 1 }, + .vsel = { .shift = 2, .width = 2, + .func = BIT(PER3_GMAC_RMII_FUNC) }, + .reserved = { .shift = 4, .width = 11 }, + .debounce_width = { .shift = 15, .width = 17 }, + }, + { 0xff }, +}; + +static const struct pinvref_desc pinvref_desc_per3[] = { + { + .name = "gpios", + .range = BIT(JHB100_PINVREF_1_8V) | BIT(JHB100_PINVREF_2_5V) | + BIT(JHB100_PINVREF_3_3V) + }, + { NULL }, +}; + +struct starfive_pinctrl_regs jhb100_per3_pinctrl_regs = { + .vref = { .reg = 0x00, .pv_desc = pinvref_desc_per3 }, + .config = { .reg = 0x04, .width_per_pin = 1 }, + .output = { .reg = 0x30, .width_per_pin = 1 }, + .output_en = { .reg = 0x34, .width_per_pin = 1 }, + .gpio_status = { .reg = 0x38, .width_per_pin = 1 }, + .func_sel = { .reg = 0x3c, .width_per_pin = 2 }, + .irq_en = { .reg = 0x40, .width_per_pin = 1 }, + .irq_status = { .reg = 0x44, .width_per_pin = 1 }, + .irq_clr = { .reg = 0x48, .width_per_pin = 1 }, + .irq_trigger = { .reg = 0x4c, .width_per_pin = 1 }, + .irq_level = { .reg = 0x50, .width_per_pin = 1 }, + .irq_both_edge = { .reg = 0x54, .width_per_pin = 1 }, + .irq_edge = { .reg = 0x58, .width_per_pin = 1 }, +}; + +static const struct jhb100_pinctrl_domain_info jhb100_per3_pinctrl_info = { + .name = "jhb100-per3", + .gc_base = -1, + .pl_desc = jhb100_per3_pl_desc, + .crl_desc = jhb100_per3_pinctrl_rl_desc, + .regs = &jhb100_per3_pinctrl_regs, +}; + +static const struct of_device_id jhb100_per3_pinctrl_of_match[] = { + { + .compatible = "starfive,jhb100-per3-pinctrl", + .data = &jhb100_per3_pinctrl_info, + }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, jhb100_per3_pinctrl_of_match); + +static struct platform_driver jhb100_per3_pinctrl_driver = { + .probe = jhb100_pinctrl_probe, + .driver = { + .name = "starfive-jhb100-per3-pinctrl", + .of_match_table = jhb100_per3_pinctrl_of_match, + }, +}; +module_platform_driver(jhb100_per3_pinctrl_driver); + +MODULE_DESCRIPTION("Pinctrl driver for StarFive JHB100 SoC Peripheral-3 domain"); +MODULE_AUTHOR("Alex Soo "); +MODULE_LICENSE("GPL"); -- 2.25.1