From patchwork Thu Nov 10 01:42:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 13038213 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 9803FC433FE for ; Thu, 10 Nov 2022 01:45:38 +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=tcn2+bHsr+gAzqqht3PpXpn0wQDNwHSOsDYI4jPzxP0=; b=NxvbyVQFAMEEF3 +sbkR7g9aPbsOgxY7jTMMaUPG82DZLA18e9gK6Wq866wdzkUcu3bIqbK1OgZAhyjVQrNJGh+N5v7H lgPnvh9y5lT12UJzOblTnd/enDMHdjMtqBiUd+YsaCySWxZNsvbHX6DQJg1+KvBrio7Um8vuE2Plw rc7DPwaOf1eaU6vi2WJKm7WRjHhhX+yp6MhSZysLFDye0UfwmeBcAdLeWRtHnDJEjxs3Z0Wplmlz3 gyz3S7CYyqYz5TonWRRpG/k0gJ6zefIoMpSG+0SQ3BaUuJtqdNmhqdBcDO+yfYmbiS9u4ot62s304 g/rds5DTTZNCyl2h64Yw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oswcV-001hzl-RY; Thu, 10 Nov 2022 01:44:43 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oswcG-001hx2-BE for linux-arm-kernel@lists.infradead.org; Thu, 10 Nov 2022 01:44:30 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9A0CFD6E; Wed, 9 Nov 2022 17:44:31 -0800 (PST) Received: from slackpad.fritz.box (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E2A0D3F703; Wed, 9 Nov 2022 17:44:23 -0800 (PST) From: Andre Przywara To: Linus Walleij , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: Icenowy Zheng , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev Subject: [RFC PATCH 2/2] pinctrl: sunxi: Add support for the Allwinner V5 pin controller Date: Thu, 10 Nov 2022 01:42:55 +0000 Message-Id: <20221110014255.20711-3-andre.przywara@arm.com> X-Mailer: git-send-email 2.35.5 In-Reply-To: <20221110014255.20711-1-andre.przywara@arm.com> References: <20221110014255.20711-1-andre.przywara@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221109_174428_500755_F667CA79 X-CRM114-Status: GOOD ( 16.21 ) 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 The Allwinner V5 contains pins in all 10 possible pin banks. Use the newly introduced DT based pinctrl driver to describe just the generic pinctrl properties, so advertise the number of pins per bank and the interrupt capabilities. The actual function/mux assignment is taken from the devicetree. Signed-off-by: Andre Przywara --- drivers/pinctrl/sunxi/Kconfig | 5 +++ drivers/pinctrl/sunxi/Makefile | 1 + drivers/pinctrl/sunxi/pinctrl-sun8i-v5.c | 52 ++++++++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 drivers/pinctrl/sunxi/pinctrl-sun8i-v5.c diff --git a/drivers/pinctrl/sunxi/Kconfig b/drivers/pinctrl/sunxi/Kconfig index a78fdbbdfc0c..6b8ea56c08fd 100644 --- a/drivers/pinctrl/sunxi/Kconfig +++ b/drivers/pinctrl/sunxi/Kconfig @@ -131,4 +131,9 @@ config PINCTRL_SUN50I_H616_R default ARM64 && ARCH_SUNXI select PINCTRL_SUNXI +config PINCTRL_SUN8I_V5 + bool "Support for the Allwinner V5 PIO" + default MACH_SUN8I + select PINCTRL_SUNXI + endif diff --git a/drivers/pinctrl/sunxi/Makefile b/drivers/pinctrl/sunxi/Makefile index f5bad7a52951..5b289e18bd5a 100644 --- a/drivers/pinctrl/sunxi/Makefile +++ b/drivers/pinctrl/sunxi/Makefile @@ -21,6 +21,7 @@ obj-$(CONFIG_PINCTRL_SUN8I_A83T_R) += pinctrl-sun8i-a83t-r.o obj-$(CONFIG_PINCTRL_SUN8I_H3) += pinctrl-sun8i-h3.o obj-$(CONFIG_PINCTRL_SUN8I_H3_R) += pinctrl-sun8i-h3-r.o obj-$(CONFIG_PINCTRL_SUN8I_V3S) += pinctrl-sun8i-v3s.o +obj-$(CONFIG_PINCTRL_SUN8I_V5) += pinctrl-sun8i-v5.o obj-$(CONFIG_PINCTRL_SUN20I_D1) += pinctrl-sun20i-d1.o obj-$(CONFIG_PINCTRL_SUN50I_H5) += pinctrl-sun50i-h5.o obj-$(CONFIG_PINCTRL_SUN50I_H6) += pinctrl-sun50i-h6.o diff --git a/drivers/pinctrl/sunxi/pinctrl-sun8i-v5.c b/drivers/pinctrl/sunxi/pinctrl-sun8i-v5.c new file mode 100644 index 000000000000..402b1c915e04 --- /dev/null +++ b/drivers/pinctrl/sunxi/pinctrl-sun8i-v5.c @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Allwinner V5 SoC pinctrl driver. + * + * Copyright (C) 2022 Arm Ltd. + */ + +#include +#include +#include +#include +#include + +#include "pinctrl-sunxi.h" + +static const unsigned int v5_irq_bank_map[] = { 0, 1, 5, 6, 7 }; + +static const u8 v5_irq_bank_muxes[SUNXI_PINCTRL_MAX_BANKS] = +/* PA PB PC PD PE PF PG PH */ + { 6, 6, 0, 0, 0, 6, 6, 6 }; + +static const u8 v5_nr_bank_pins[SUNXI_PINCTRL_MAX_BANKS] = +/* PA PB PC PD PE PF PG PH PI PJ */ + { 16, 11, 17, 23, 18, 7, 14, 16, 17, 18 }; + +static struct sunxi_pinctrl_desc v5_pinctrl_data = { + .irq_banks = ARRAY_SIZE(v5_irq_bank_map), + .irq_bank_map = v5_irq_bank_map, + .irq_read_needs_mux = true, + .io_bias_cfg_variant = BIAS_VOLTAGE_PIO_POW_MODE_SEL, +}; + +static int v5_pinctrl_probe(struct platform_device *pdev) +{ + return sunxi_pinctrl_dt_table_init(pdev, v5_nr_bank_pins, + v5_irq_bank_muxes, + &v5_pinctrl_data); +} + +static const struct of_device_id v5_pinctrl_match[] = { + { .compatible = "allwinner,sun8i-v5-pinctrl", }, + {} +}; + +static struct platform_driver v5_pinctrl_driver = { + .probe = v5_pinctrl_probe, + .driver = { + .name = "sun8i-v5-pinctrl", + .of_match_table = v5_pinctrl_match, + }, +}; +builtin_platform_driver(v5_pinctrl_driver);