From patchwork Mon Nov 6 15:29:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 741401 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1149235wrr; Mon, 6 Nov 2023 07:29:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IEWKyyqZKgrGkAIKmriPvFLvo4LVJOlTXwCMLzSLHdLWPis5LHjJvw7a74q/5bT0Vn2Wnni X-Received: by 2002:a17:906:ee85:b0:9d0:4b8f:3d65 with SMTP id wt5-20020a170906ee8500b009d04b8f3d65mr15542351ejb.23.1699284582760; Mon, 06 Nov 2023 07:29:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699284582; cv=none; d=google.com; s=arc-20160816; b=DqzfNy5pquH9UN6eEdfvNJmAG+Jh2EEqZ1n7XgmSD46azAkcZVOvcJc+lgIovZeOLA PqH/LJIGqRKUGW5yIAvWHVvCbltMpSQ7qwbGctFr6ysI3ay3B0tj6MF93YI/D2zSTs6W lc1N3LwXvsqHUtZ4SmkP5i6Yx85M0wQ/8ExgKC/rzho55VLe0zquQOUWGMHox3cGZC2L cva1VaBzP4xwyC9GrimqvUD0eCcTpSEAsOpfkQWce3PvhCrvLbg6yzcnMAJyY6bHbJaX wsFlQ/R6OVBJNjl4rgcSIzlxCCR4tVz4r71wUvBsiWmremxQ7CJE2RjbyX6yPpMhK2pQ y4zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=78Cyh3zW3APIyO7gD4yXfHPq1RkMdkCi3LzSU5I59Cs=; fh=GowdQhFHojjDa0VFAVprx0l6qpleMCeMha4WUJGY9kk=; b=txKET+Q9Uqr1pkfRZ22nayr9TVa17iCkde88eAc80ZoaZxMUd2KfYezST44QQ6kvRF 65bRX1ArmT/ZidNcUMFab/Fj+syADAZp2Jm64vy9thLFqH2j4uyZo0iNmRMs3lSLXRlr z5r7eifEX+/z0XLOiEUy3HuLj8SWsiKSqOVUW3hNQqduL+4cbq0ij/gHFSGuqkGm/6t7 4h594IA9PfrsXLZGXo19GMatEPIqSnXSB1cBld0HYTkbFDlCKt0F1L5DakWV1BtIko+6 g+EsbCNDGM6u5jj19Wc97ythHchrwq3l7w95XLloT7snvTrKT0nWeLumMYTbZKI12bwN +GIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IXoXjmpy; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id c8-20020a05640227c800b0053f82aed3cbsi4944865ede.154.2023.11.06.07.29.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 07:29:42 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IXoXjmpy; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 122F186BF7; Mon, 6 Nov 2023 16:29:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="IXoXjmpy"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C94EB86E40; Mon, 6 Nov 2023 16:29:20 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 74DB286F15 for ; Mon, 6 Nov 2023 16:29:05 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-40836ea8cbaso32622095e9.0 for ; Mon, 06 Nov 2023 07:29:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699284545; x=1699889345; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=78Cyh3zW3APIyO7gD4yXfHPq1RkMdkCi3LzSU5I59Cs=; b=IXoXjmpyI+A26A0ODNepO9YJVEouUVUZJ2wDQ55OCD3XZUUdoD/Xc1cxGUHRZcq+Ko G+SeLqLDIGvLHX+CN6smeqCkDvsEDeGekXQ/KIkw0bq2CleBSjk7xqhVwpQ0Dm8lF7RI fCY/qephlRNihjnbqUudvTxMbVxFB5AQ1Iq1xzmoPLd0rX+65L+MdNKGLz2tP0eOW4ix Jnmeepo12YFksxsoPVU8h47HCUPY1qV0odWjPhVqdb65pzSLEB/T5urjOF0iUoX4GDa5 bCy4ji1AEdbjso3nXeV9s200uwzwRirIIkxscUAbJWIXM1casK8B1S5zkWk+Sn/qy5wq sYkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699284545; x=1699889345; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=78Cyh3zW3APIyO7gD4yXfHPq1RkMdkCi3LzSU5I59Cs=; b=MKqYufrmOx2Szw7gyhMTsEmBMDbubdcOiQewHb6UdtxjqezYq86HXYYOgcj4t8+0SJ 1D17SoZLk4YpEMTGtD6KejMCmItLhLgpAfIJF+pWPPHa1Prq+nwiaJbVVcOY26hDITGQ l632cpdotg6rp6v1rpmC2drY73wOG4eQNQTrMwuukgSmwp7iLyaHOGOOucALxIgjyGxc +FpFjxx/qqoc0uowuMbkeXUPFKRMBRXioUF0MIgX9g2l0JgyaEE10GqcSdQCNJyAccl0 IbXUs9x1x2nG/irWIFXxiHs/APNDIphnd5bBIL1Qmebb/cAr1Xm0TrA+Ik13eRtCV1TR K8Jw== X-Gm-Message-State: AOJu0YzJpSZTkKHwG41JfhdlRtPiwIHeO/xI2k23MTM1p5Om5EWnWNl7 YXymujBoDSkmyHVth9UkTAPJ0MjzcaiRLMTtD+hLmA== X-Received: by 2002:a05:600c:4f16:b0:405:3885:490a with SMTP id l22-20020a05600c4f1600b004053885490amr50318wmq.0.1699284544843; Mon, 06 Nov 2023 07:29:04 -0800 (PST) Received: from lion.localdomain (host-92-25-138-185.as13285.net. [92.25.138.185]) by smtp.gmail.com with ESMTPSA id bx30-20020a5d5b1e000000b0032f7d1e2c7csm8116094wrb.95.2023.11.06.07.29.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 07:29:04 -0800 (PST) From: Caleb Connolly Date: Mon, 06 Nov 2023 15:29:00 +0000 Subject: [PATCH v2 1/5] pinctrl: qcom: move out of mach-snapdragon MIME-Version: 1.0 Message-Id: <20231106-b4-qcom-pinctrl-v2-1-406e8d8689ca@linaro.org> References: <20231106-b4-qcom-pinctrl-v2-0-406e8d8689ca@linaro.org> In-Reply-To: <20231106-b4-qcom-pinctrl-v2-0-406e8d8689ca@linaro.org> To: Sumit Garg , Ramon Fried , Lukasz Majewski , Sean Anderson , Rayagonda Kokatanur , Robert Marko , Bhupesh Sharma , Luka Perkov , Dzmitry Sankouski , Jorge Ramirez-Ortiz Cc: Vladimir Zapolskiy , u-boot@lists.denx.de, Caleb Connolly X-Mailer: b4 0.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=15814; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=70pAKhGlUqkz3MTy6ufSgdl+vaSQt4f5WBAx1dwtBe4=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhlRPNju9+6pvo7jW35A5G+6y/ebZ6RKrbif5Li+bFB1yp ZDPTb2oo5SFQZCDQVZMkUX8xDLLprWX7TW2L7gAM4eVCWQIAxenAEzkw0SGf1YC6n9W7nsdsEZ1 sne3LkPp2lyXTfrTFmTu37LSotxoTjbD/zKDuHVpvjN+XNi7S0o6u+1EFPcSX0mWk9uuf5m7ibs gVAgA X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Move the Qualcomm pinctrl drivers out of mach-snapdragon and over to the rest of the pinctrl drivers, adjust the drivers so that support for each platform can be enabled/disabled individually and introduce platform specific configuration options. Reviewed-by: Sumit Garg Signed-off-by: Caleb Connolly --- MAINTAINERS | 1 + arch/arm/mach-snapdragon/Kconfig | 4 +++ arch/arm/mach-snapdragon/Makefile | 5 --- drivers/pinctrl/Kconfig | 1 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/qcom/Kconfig | 39 ++++++++++++++++++++++ drivers/pinctrl/qcom/Makefile | 9 +++++ .../pinctrl/qcom}/pinctrl-apq8016.c | 19 +++++++++-- .../pinctrl/qcom}/pinctrl-apq8096.c | 19 +++++++++-- .../pinctrl/qcom/pinctrl-qcom.c | 39 ++++++++++++---------- .../pinctrl/qcom/pinctrl-qcom.h | 11 +++--- .../pinctrl/qcom}/pinctrl-qcs404.c | 19 +++++++++-- .../pinctrl/qcom}/pinctrl-sdm845.c | 19 +++++++++-- 13 files changed, 149 insertions(+), 37 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index b483fa2ea95a..f6d63c8ab563 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -576,6 +576,7 @@ F: drivers/clk/qcom/ F: drivers/gpio/msm_gpio.c F: drivers/mmc/msm_sdhci.c F: drivers/phy/msm8916-usbh-phy.c +F: drivers/pinctrl/qcom/ F: drivers/serial/serial_msm.c F: drivers/serial/serial_msm_geni.c F: drivers/smem/msm_smem.c diff --git a/arch/arm/mach-snapdragon/Kconfig b/arch/arm/mach-snapdragon/Kconfig index dde37eccc55e..3c9f3bee3f18 100644 --- a/arch/arm/mach-snapdragon/Kconfig +++ b/arch/arm/mach-snapdragon/Kconfig @@ -16,6 +16,7 @@ config SDM845 bool "Qualcomm Snapdragon 845 SoC" select LINUX_KERNEL_IMAGE_HEADER imply CLK_QCOM_SDM845 + imply PINCTRL_QCOM_SDM845 config LNX_KRNL_IMG_TEXT_OFFSET_BASE default 0x80000000 @@ -28,6 +29,7 @@ config TARGET_DRAGONBOARD410C select BOARD_LATE_INIT select ENABLE_ARM_SOC_BOOT0_HOOK imply CLK_QCOM_APQ8016 + imply PINCTRL_QCOM_APQ8016 help Support for 96Boards Dragonboard 410C. This board complies with 96Board Open Platform Specifications. Features: @@ -42,6 +44,7 @@ config TARGET_DRAGONBOARD410C config TARGET_DRAGONBOARD820C bool "96Boards Dragonboard 820C" imply CLK_QCOM_APQ8096 + imply PINCTRL_QCOM_APQ8096 help Support for 96Boards Dragonboard 820C. This board complies with 96Board Open Platform Specifications. Features: @@ -76,6 +79,7 @@ config TARGET_QCS404EVB bool "Qualcomm Technologies, Inc. QCS404 EVB" select LINUX_KERNEL_IMAGE_HEADER imply CLK_QCOM_QCS404 + imply PINCTRL_QCOM_QCS404 help Support for Qualcomm Technologies, Inc. QCS404 evaluation board. Features: diff --git a/arch/arm/mach-snapdragon/Makefile b/arch/arm/mach-snapdragon/Makefile index 497ee35cf7d3..3a3a297c1768 100644 --- a/arch/arm/mach-snapdragon/Makefile +++ b/arch/arm/mach-snapdragon/Makefile @@ -8,9 +8,4 @@ obj-$(CONFIG_TARGET_DRAGONBOARD820C) += sysmap-apq8096.o obj-$(CONFIG_TARGET_DRAGONBOARD410C) += sysmap-apq8016.o obj-y += misc.o obj-y += dram.o -obj-y += pinctrl-snapdragon.o -obj-y += pinctrl-apq8016.o -obj-y += pinctrl-apq8096.o -obj-y += pinctrl-qcs404.o -obj-y += pinctrl-sdm845.o obj-$(CONFIG_TARGET_QCS404EVB) += sysmap-qcs404.o diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig index 75b3ff47a2e8..53f32ea1612e 100644 --- a/drivers/pinctrl/Kconfig +++ b/drivers/pinctrl/Kconfig @@ -355,6 +355,7 @@ source "drivers/pinctrl/mvebu/Kconfig" source "drivers/pinctrl/nexell/Kconfig" source "drivers/pinctrl/nuvoton/Kconfig" source "drivers/pinctrl/nxp/Kconfig" +source "drivers/pinctrl/qcom/Kconfig" source "drivers/pinctrl/renesas/Kconfig" source "drivers/pinctrl/rockchip/Kconfig" source "drivers/pinctrl/sunxi/Kconfig" diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile index fc1f01a02cbd..603c2e0a2da2 100644 --- a/drivers/pinctrl/Makefile +++ b/drivers/pinctrl/Makefile @@ -17,6 +17,7 @@ obj-$(CONFIG_ARCH_RMOBILE) += renesas/ obj-$(CONFIG_ARCH_RZN1) += renesas/ obj-$(CONFIG_PINCTRL_SANDBOX) += pinctrl-sandbox.o obj-$(CONFIG_PINCTRL_SUNXI) += sunxi/ +obj-$(CONFIG_PINCTRL_QCOM) += qcom/ obj-$(CONFIG_PINCTRL_UNIPHIER) += uniphier/ obj-$(CONFIG_PINCTRL_PIC32) += pinctrl_pic32.o obj-$(CONFIG_PINCTRL_EXYNOS) += exynos/ diff --git a/drivers/pinctrl/qcom/Kconfig b/drivers/pinctrl/qcom/Kconfig new file mode 100644 index 000000000000..412925c48788 --- /dev/null +++ b/drivers/pinctrl/qcom/Kconfig @@ -0,0 +1,39 @@ +if ARCH_SNAPDRAGON + +config PINCTRL_QCOM + depends on PINCTRL_GENERIC + def_bool n + +menu "Qualcomm pinctrl drivers" + +config PINCTRL_QCOM_APQ8016 + bool "Qualcomm APQ8016 GCC" + select PINCTRL_QCOM + help + Say Y here to enable support for pinctrl on the MSM8916 / APQ8016 + Snapdragon 410 SoC, as well as the associated GPIO driver. + +config PINCTRL_QCOM_APQ8096 + bool "Qualcomm APQ8096 GCC" + select PINCTRL_QCOM + help + Say Y here to enable support for pinctrl on the MSM8996 / APQ8096 + Snapdragon 820 SoC, as well as the associated GPIO driver. + +config PINCTRL_QCOM_QCS404 + bool "Qualcomm QCS404 GCC" + select PINCTRL_QCOM + help + Say Y here to enable support for pinctrl on the Snapdragon QCS404 SoC, + as well as the associated GPIO driver. + +config PINCTRL_QCOM_SDM845 + bool "Qualcomm SDM845 GCC" + select PINCTRL_QCOM + help + Say Y here to enable support for pinctrl on the Snapdragon 845 SoC, + as well as the associated GPIO driver. + +endmenu + +endif diff --git a/drivers/pinctrl/qcom/Makefile b/drivers/pinctrl/qcom/Makefile new file mode 100644 index 000000000000..86f507427301 --- /dev/null +++ b/drivers/pinctrl/qcom/Makefile @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (c) 2023 Linaro Ltd. + +obj-$(CONFIG_PINCTRL_QCOM) += pinctrl-qcom.o +obj-$(CONFIG_PINCTRL_QCOM_APQ8016) += pinctrl-apq8016.o +obj-$(CONFIG_PINCTRL_QCOM_APQ8096) += pinctrl-apq8096.o +obj-$(CONFIG_PINCTRL_QCOM_QCS404) += pinctrl-qcs404.o +obj-$(CONFIG_PINCTRL_QCOM_SDM845) += pinctrl-sdm845.o diff --git a/arch/arm/mach-snapdragon/pinctrl-apq8016.c b/drivers/pinctrl/qcom/pinctrl-apq8016.c similarity index 75% rename from arch/arm/mach-snapdragon/pinctrl-apq8016.c rename to drivers/pinctrl/qcom/pinctrl-apq8016.c index 70c0be0bca90..bcbc0df50715 100644 --- a/arch/arm/mach-snapdragon/pinctrl-apq8016.c +++ b/drivers/pinctrl/qcom/pinctrl-apq8016.c @@ -6,8 +6,10 @@ * */ -#include "pinctrl-snapdragon.h" #include +#include + +#include "pinctrl-qcom.h" #define MAX_PIN_NAME_LEN 32 static char pin_name[MAX_PIN_NAME_LEN] __section(".data"); @@ -52,10 +54,23 @@ static unsigned int apq8016_get_function_mux(unsigned int selector) return msm_pinctrl_functions[selector].val; } -struct msm_pinctrl_data apq8016_data = { +static const struct msm_pinctrl_data apq8016_data = { .pin_count = 133, .functions_count = ARRAY_SIZE(msm_pinctrl_functions), .get_function_name = apq8016_get_function_name, .get_function_mux = apq8016_get_function_mux, .get_pin_name = apq8016_get_pin_name, }; + +static const struct udevice_id msm_pinctrl_ids[] = { + { .compatible = "qcom,msm8916-pinctrl", .data = (ulong)&apq8016_data }, + { /* Sentinal */ } +}; + +U_BOOT_DRIVER(pinctrl_apq8016) = { + .name = "pinctrl_apq8016", + .id = UCLASS_NOP, + .of_match = msm_pinctrl_ids, + .ops = &msm_pinctrl_ops, + .bind = msm_pinctrl_bind, +}; diff --git a/arch/arm/mach-snapdragon/pinctrl-apq8096.c b/drivers/pinctrl/qcom/pinctrl-apq8096.c similarity index 74% rename from arch/arm/mach-snapdragon/pinctrl-apq8096.c rename to drivers/pinctrl/qcom/pinctrl-apq8096.c index 45462f01c2c7..525085617680 100644 --- a/arch/arm/mach-snapdragon/pinctrl-apq8096.c +++ b/drivers/pinctrl/qcom/pinctrl-apq8096.c @@ -6,8 +6,10 @@ * */ -#include "pinctrl-snapdragon.h" #include +#include + +#include "pinctrl-qcom.h" #define MAX_PIN_NAME_LEN 32 static char pin_name[MAX_PIN_NAME_LEN] __section(".data"); @@ -47,10 +49,23 @@ static unsigned int apq8096_get_function_mux(unsigned int selector) return msm_pinctrl_functions[selector].val; } -struct msm_pinctrl_data apq8096_data = { +static const struct msm_pinctrl_data apq8096_data = { .pin_count = 157, .functions_count = ARRAY_SIZE(msm_pinctrl_functions), .get_function_name = apq8096_get_function_name, .get_function_mux = apq8096_get_function_mux, .get_pin_name = apq8096_get_pin_name, }; + +static const struct udevice_id msm_pinctrl_ids[] = { + { .compatible = "qcom,msm8996-pinctrl", .data = (ulong)&apq8096_data }, + { /* Sentinal */ } +}; + +U_BOOT_DRIVER(pinctrl_apq8096) = { + .name = "pinctrl_apq8096", + .id = UCLASS_NOP, + .of_match = msm_pinctrl_ids, + .ops = &msm_pinctrl_ops, + .bind = msm_pinctrl_bind, +}; diff --git a/arch/arm/mach-snapdragon/pinctrl-snapdragon.c b/drivers/pinctrl/qcom/pinctrl-qcom.c similarity index 85% rename from arch/arm/mach-snapdragon/pinctrl-snapdragon.c rename to drivers/pinctrl/qcom/pinctrl-qcom.c index 826dc5148661..1cface7f610b 100644 --- a/arch/arm/mach-snapdragon/pinctrl-snapdragon.c +++ b/drivers/pinctrl/qcom/pinctrl-qcom.c @@ -11,10 +11,11 @@ #include #include #include +#include #include #include #include -#include "pinctrl-snapdragon.h" +#include "pinctrl-qcom.h" struct msm_pinctrl_priv { phys_addr_t base; @@ -109,7 +110,7 @@ static int msm_pinconf_set(struct udevice *dev, unsigned int pin_selector, return 0; } -static struct pinctrl_ops msm_pinctrl_ops = { +struct pinctrl_ops msm_pinctrl_ops = { .get_pins_count = msm_get_pins_count, .get_pin_name = msm_get_pin_name, .set_state = pinctrl_generic_set_state, @@ -121,12 +122,24 @@ static struct pinctrl_ops msm_pinctrl_ops = { .get_function_name = msm_get_function_name, }; -static int msm_pinctrl_bind(struct udevice *dev) +int msm_pinctrl_bind(struct udevice *dev) { ofnode node = dev_ofnode(dev); + struct msm_pinctrl_data *data = (struct msm_pinctrl_data *)dev_get_driver_data(dev); + struct driver *drv; + struct udevice *pinctrl_dev; const char *name; int ret; + drv = lists_driver_lookup_name("pinctrl_qcom"); + if (!drv) + return -ENOENT; + + ret = device_bind_with_driver_data(dev_get_parent(dev), drv, ofnode_get_name(node), (ulong)data, + dev_ofnode(dev), &pinctrl_dev); + if (ret) + return ret; + ofnode_get_property(node, "gpio-controller", &ret); if (ret < 0) return 0; @@ -139,28 +152,18 @@ static int msm_pinctrl_bind(struct udevice *dev) /* Bind gpio node */ ret = device_bind_driver_to_node(dev, "gpio_msm", name, node, NULL); - if (ret) + if (ret) { + device_unbind(pinctrl_dev); return ret; - - dev_dbg(dev, "bind %s\n", name); + } return 0; } -static const struct udevice_id msm_pinctrl_ids[] = { - { .compatible = "qcom,msm8916-pinctrl", .data = (ulong)&apq8016_data }, - { .compatible = "qcom,msm8996-pinctrl", .data = (ulong)&apq8096_data }, - { .compatible = "qcom,sdm845-pinctrl", .data = (ulong)&sdm845_data }, - { .compatible = "qcom,qcs404-pinctrl", .data = (ulong)&qcs404_data }, - { } -}; - -U_BOOT_DRIVER(pinctrl_snapdraon) = { - .name = "pinctrl_msm", +U_BOOT_DRIVER(pinctrl_qcom) = { + .name = "pinctrl_qcom", .id = UCLASS_PINCTRL, - .of_match = msm_pinctrl_ids, .priv_auto = sizeof(struct msm_pinctrl_priv), .ops = &msm_pinctrl_ops, .probe = msm_pinctrl_probe, - .bind = msm_pinctrl_bind, }; diff --git a/arch/arm/mach-snapdragon/pinctrl-snapdragon.h b/drivers/pinctrl/qcom/pinctrl-qcom.h similarity index 68% rename from arch/arm/mach-snapdragon/pinctrl-snapdragon.h rename to drivers/pinctrl/qcom/pinctrl-qcom.h index 178ee01a41f4..1edd9a43ffda 100644 --- a/arch/arm/mach-snapdragon/pinctrl-snapdragon.h +++ b/drivers/pinctrl/qcom/pinctrl-qcom.h @@ -5,8 +5,8 @@ * (C) Copyright 2018 Ramon Fried * */ -#ifndef _PINCTRL_SNAPDRAGON_H -#define _PINCTRL_SNAPDRAGON_H +#ifndef _PINCTRL_QCOM_H +#define _PINCTRL_QCOM_H struct udevice; @@ -25,9 +25,8 @@ struct pinctrl_function { int val; }; -extern struct msm_pinctrl_data apq8016_data; -extern struct msm_pinctrl_data apq8096_data; -extern struct msm_pinctrl_data sdm845_data; -extern struct msm_pinctrl_data qcs404_data; +extern struct pinctrl_ops msm_pinctrl_ops; + +int msm_pinctrl_bind(struct udevice *dev); #endif diff --git a/arch/arm/mach-snapdragon/pinctrl-qcs404.c b/drivers/pinctrl/qcom/pinctrl-qcs404.c similarity index 78% rename from arch/arm/mach-snapdragon/pinctrl-qcs404.c rename to drivers/pinctrl/qcom/pinctrl-qcs404.c index a6e53c4412ec..272331c90b5c 100644 --- a/arch/arm/mach-snapdragon/pinctrl-qcs404.c +++ b/drivers/pinctrl/qcom/pinctrl-qcs404.c @@ -5,8 +5,10 @@ * (C) Copyright 2022 Sumit Garg */ -#include "pinctrl-snapdragon.h" #include +#include + +#include "pinctrl-qcom.h" #define MAX_PIN_NAME_LEN 32 static char pin_name[MAX_PIN_NAME_LEN] __section(".data"); @@ -59,10 +61,23 @@ static unsigned int qcs404_get_function_mux(unsigned int selector) return msm_pinctrl_functions[selector].val; } -struct msm_pinctrl_data qcs404_data = { +static struct msm_pinctrl_data qcs404_data = { .pin_count = 126, .functions_count = ARRAY_SIZE(msm_pinctrl_functions), .get_function_name = qcs404_get_function_name, .get_function_mux = qcs404_get_function_mux, .get_pin_name = qcs404_get_pin_name, }; + +static const struct udevice_id msm_pinctrl_ids[] = { + { .compatible = "qcom,qcs404-pinctrl", .data = (ulong)&qcs404_data }, + { /* Sentinal */ } +}; + +U_BOOT_DRIVER(pinctrl_qcs404) = { + .name = "pinctrl_qcs404", + .id = UCLASS_NOP, + .of_match = msm_pinctrl_ids, + .ops = &msm_pinctrl_ops, + .bind = msm_pinctrl_bind, +}; diff --git a/arch/arm/mach-snapdragon/pinctrl-sdm845.c b/drivers/pinctrl/qcom/pinctrl-sdm845.c similarity index 70% rename from arch/arm/mach-snapdragon/pinctrl-sdm845.c rename to drivers/pinctrl/qcom/pinctrl-sdm845.c index 40f2f012fa0d..1a09c5c81dc6 100644 --- a/arch/arm/mach-snapdragon/pinctrl-sdm845.c +++ b/drivers/pinctrl/qcom/pinctrl-sdm845.c @@ -6,8 +6,10 @@ * */ -#include "pinctrl-snapdragon.h" #include +#include + +#include "pinctrl-qcom.h" #define MAX_PIN_NAME_LEN 32 static char pin_name[MAX_PIN_NAME_LEN] __section(".data"); @@ -35,10 +37,23 @@ static unsigned int sdm845_get_function_mux(unsigned int selector) return msm_pinctrl_functions[selector].val; } -struct msm_pinctrl_data sdm845_data = { +static struct msm_pinctrl_data sdm845_data = { .pin_count = 150, .functions_count = ARRAY_SIZE(msm_pinctrl_functions), .get_function_name = sdm845_get_function_name, .get_function_mux = sdm845_get_function_mux, .get_pin_name = sdm845_get_pin_name, }; + +static const struct udevice_id msm_pinctrl_ids[] = { + { .compatible = "qcom,sdm845-pinctrl", .data = (ulong)&sdm845_data }, + { /* Sentinal */ } +}; + +U_BOOT_DRIVER(pinctrl_sdm845) = { + .name = "pinctrl_sdm845", + .id = UCLASS_NOP, + .of_match = msm_pinctrl_ids, + .ops = &msm_pinctrl_ops, + .bind = msm_pinctrl_bind, +}; From patchwork Mon Nov 6 15:29:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 741400 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1149124wrr; Mon, 6 Nov 2023 07:29:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IHvIeBgkXBqP37FMl3xC0fokSHzrwlAu7m+reLA1LOaixli0Ha2prsLoFYbSeW/bEGlKapl X-Received: by 2002:a05:6512:3b23:b0:4fb:7559:aea3 with SMTP id f35-20020a0565123b2300b004fb7559aea3mr30377186lfv.39.1699284568163; Mon, 06 Nov 2023 07:29:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699284568; cv=none; d=google.com; s=arc-20160816; b=0+fQiV2yomDJwrL9OfJfIqVKgUDKuZMyHFN4O4i6EtZ1h6BtmdKv1x0gaST9BC/82x HiJC36jVl6io0Zx5WrHKiZ4cyxB58CwNey5RPNdHcQUDWpDiui5H5frIW4gpir9zy4Kt sA0VkhGq4swk5J1F/lWss47xYhYAG8inogf/C1wL2kGOpmO7u8sQbsic7e1CsKbHj6g3 rsmouIxLaDJUqqvEqdbBmaefA2lkUGd9AGTEiW4lbVekgpZhmAsnPqunuQXH/J0dA40G piydrRO30HW1I2v5/JtOJq74S7ozvqfAg/tILWF1Mjw3020y79GjlNIqwXAyE0mPGCPv caYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=e/ZiWW0cjJce+IfH34f+eIIp+X2ktDMxXDeWMBPqm1s=; fh=GowdQhFHojjDa0VFAVprx0l6qpleMCeMha4WUJGY9kk=; b=1HDY/bRK++yYcFwL2MLu8G4eAtiTAsmaHn9BNhc8dyE63xz5GQJz37iI5KQ3ur5x9d QsSapj0LImX7b2CDsXciLyD3HPrBEF7sQkMckiQ+8X26RPhTbcl+zEVYWunot/PL0tuJ jwTMYECzOrFqrT2vn/7u1L6FLP0bh729mqOJtoTDYFcV6dYxM7IoHRgIIcYD16HrVcPJ TS2YnMx5A9Bqzo5I7PxtZuIB0Ya3jc0vwz7/IsA6qW/gKHo+MBQfxUPpI8rGIeXc4yjY Gnuceg3bHmZHhUik2ldISztTYANcOc+rccpNOamhUIAhO9fhnAh1pa3bj9X9dqtnvFaH A9Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XNmM8Qe+; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id a26-20020a509b5a000000b0053ed6214d0dsi4314760edj.544.2023.11.06.07.29.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 07:29:28 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XNmM8Qe+; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8461F86F84; Mon, 6 Nov 2023 16:29:27 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="XNmM8Qe+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 71DF386E40; Mon, 6 Nov 2023 16:29:20 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B75BA86F87 for ; Mon, 6 Nov 2023 16:29:06 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2c5056059e0so66448361fa.3 for ; Mon, 06 Nov 2023 07:29:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699284546; x=1699889346; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=e/ZiWW0cjJce+IfH34f+eIIp+X2ktDMxXDeWMBPqm1s=; b=XNmM8Qe+CFm7LwzEbSTK4F9u8KbwzxNvU6egWdwLRmdyc041dFzOCXh3X0H2HgNb1d jOg+Qa00k3hJZ1fM2htS/WKFj1DfWv6WpV9MRJNWCYDrjOBax9DN32Cocd8oOfRqIVgw QQFXmYkSDn2/2CGvyxFAA7rXVkFJZAu0nF7q8Jq75+OYEXMTzOIVaIfKKdAjaNLgATdY csnCvG9O1nLMNScPCOmspHA6Wo34IvStgIjaH8hb7GiJzhFmq6J0PL4PbKvn2Q8Ul9kY smc1taZEd785U/X9pACLMaYjy+IBiOAT54ATTHzRv+s1c+JxKkiwtA5P3NUpqfFitLYv MTWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699284546; x=1699889346; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e/ZiWW0cjJce+IfH34f+eIIp+X2ktDMxXDeWMBPqm1s=; b=jb/bN9U7vQUiAf+qAsnusGTV6cQsJqbDa1xOKtOyq+dQArHGHtkm7/1ZYLiI3TN++I U/iqEZQz0MxkAFI/TXISK89LSWw60PA1blwapNhQIgWeN3k4L0t9vwz+T2xwgCzHLTHX PMIu4gxBzRdQcHtW6iaZkVXKbeDiQAuutHu7J9fK66h0qkDv9vORBCOt8uK4f6klgL5Q fVVZ2NnsIgpJ9WuPAvLgdkiz8PGxWxy3TKCgizmtip0F2x4GE5WghSZ6Ng6jffdU4XmD z0AYdXbhGYE4iCZ5euEicvjYhdm3LEdyBMbP9f8EGdW1b19YsCNijvEijBm+ZV5NTGUO JiGA== X-Gm-Message-State: AOJu0YyG1JEejfzAqo1sEI8fuxDvnQRlWUNntDE65t2QwDwcRf214pxz rPk7T4p/uEu8FhtEoAdf7gP6lA== X-Received: by 2002:a2e:8796:0:b0:2bc:f5a0:cc25 with SMTP id n22-20020a2e8796000000b002bcf5a0cc25mr23104204lji.2.1699284545915; Mon, 06 Nov 2023 07:29:05 -0800 (PST) Received: from lion.localdomain (host-92-25-138-185.as13285.net. [92.25.138.185]) by smtp.gmail.com with ESMTPSA id bx30-20020a5d5b1e000000b0032f7d1e2c7csm8116094wrb.95.2023.11.06.07.29.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 07:29:05 -0800 (PST) From: Caleb Connolly Date: Mon, 06 Nov 2023 15:29:01 +0000 Subject: [PATCH v2 2/5] pinctrl: qcom: move ipq4019 driver from mach-ipq40xx MIME-Version: 1.0 Message-Id: <20231106-b4-qcom-pinctrl-v2-2-406e8d8689ca@linaro.org> References: <20231106-b4-qcom-pinctrl-v2-0-406e8d8689ca@linaro.org> In-Reply-To: <20231106-b4-qcom-pinctrl-v2-0-406e8d8689ca@linaro.org> To: Sumit Garg , Ramon Fried , Lukasz Majewski , Sean Anderson , Rayagonda Kokatanur , Robert Marko , Bhupesh Sharma , Luka Perkov , Dzmitry Sankouski , Jorge Ramirez-Ortiz Cc: Vladimir Zapolskiy , u-boot@lists.denx.de, Caleb Connolly X-Mailer: b4 0.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=10219; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=FQ5ljogE2wv6Fa7iIMemlJI5ZKD7WF9y7651w5Lqiow=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhlRPNrvVeez9rZ0KNnn6JydlOplr6Qh9aHjfUvarbvVE4 wmTAvZ0lLIwCHIwyIopsoifWGbZtPayvcb2BRdg5rAygQxh4OIUgImcWczwPzToCItB78WUq9Xd qdqFB3QkH/30lrq6es7ZOOYK9kYpNYb/MbIRpu15IusXbMzS4bq77w6r8eM3nPqde/QW1J4Mbq1 XAgA= X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Drop the duplicated pinctrl-snapdragon driver from mach-ipq40xx and add it to drivers/pinctrl/qcom. Acked-by: Sumit Garg Signed-off-by: Caleb Connolly --- arch/arm/Kconfig | 1 + arch/arm/mach-ipq40xx/Makefile | 8 - arch/arm/mach-ipq40xx/pinctrl-snapdragon.c | 166 --------------------- arch/arm/mach-ipq40xx/pinctrl-snapdragon.h | 30 ---- drivers/pinctrl/qcom/Kconfig | 7 + drivers/pinctrl/qcom/Makefile | 1 + .../pinctrl/qcom}/pinctrl-ipq4019.c | 23 ++- 7 files changed, 27 insertions(+), 209 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 69144ff9cdab..bd48131292e3 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -767,6 +767,7 @@ config ARCH_IPQ40XX select SMEM select OF_CONTROL select CLK_QCOM_IPQ4019 + select PINCTRL_QCOM_IPQ4019 imply CMD_DM config ARCH_KEYSTONE diff --git a/arch/arm/mach-ipq40xx/Makefile b/arch/arm/mach-ipq40xx/Makefile deleted file mode 100644 index b36a935c6f9f..000000000000 --- a/arch/arm/mach-ipq40xx/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0+ -# -# Copyright (c) 2019 Sartura Ltd. -# -# Author: Robert Marko - -obj-y += pinctrl-snapdragon.o -obj-y += pinctrl-ipq4019.o diff --git a/arch/arm/mach-ipq40xx/pinctrl-snapdragon.c b/arch/arm/mach-ipq40xx/pinctrl-snapdragon.c deleted file mode 100644 index 036fec93d727..000000000000 --- a/arch/arm/mach-ipq40xx/pinctrl-snapdragon.c +++ /dev/null @@ -1,166 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * TLMM driver for Qualcomm IPQ40xx - * - * (C) Copyright 2018 Ramon Fried - * - * Copyright (c) 2020 Sartura Ltd. - * - * Author: Robert Marko - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "pinctrl-snapdragon.h" - -struct msm_pinctrl_priv { - phys_addr_t base; - struct msm_pinctrl_data *data; -}; - -#define GPIO_CONFIG_OFFSET(x) ((x) * 0x1000) -#define TLMM_GPIO_PULL_MASK GENMASK(1, 0) -#define TLMM_FUNC_SEL_MASK GENMASK(5, 2) -#define TLMM_DRV_STRENGTH_MASK GENMASK(8, 6) -#define TLMM_GPIO_DISABLE BIT(9) - -static const struct pinconf_param msm_conf_params[] = { - { "drive-strength", PIN_CONFIG_DRIVE_STRENGTH, 2 }, - { "bias-disable", PIN_CONFIG_BIAS_DISABLE, 0 }, - { "bias-pull-up", PIN_CONFIG_BIAS_PULL_UP, 2 }, -}; - -static int msm_get_functions_count(struct udevice *dev) -{ - struct msm_pinctrl_priv *priv = dev_get_priv(dev); - - return priv->data->functions_count; -} - -static int msm_get_pins_count(struct udevice *dev) -{ - struct msm_pinctrl_priv *priv = dev_get_priv(dev); - - return priv->data->pin_count; -} - -static const char *msm_get_function_name(struct udevice *dev, - unsigned int selector) -{ - struct msm_pinctrl_priv *priv = dev_get_priv(dev); - - return priv->data->get_function_name(dev, selector); -} - -static int msm_pinctrl_probe(struct udevice *dev) -{ - struct msm_pinctrl_priv *priv = dev_get_priv(dev); - - priv->base = devfdt_get_addr(dev); - priv->data = (struct msm_pinctrl_data *)dev->driver_data; - - return priv->base == FDT_ADDR_T_NONE ? -EINVAL : 0; -} - -static const char *msm_get_pin_name(struct udevice *dev, unsigned int selector) -{ - struct msm_pinctrl_priv *priv = dev_get_priv(dev); - - return priv->data->get_pin_name(dev, selector); -} - -static int msm_pinmux_set(struct udevice *dev, unsigned int pin_selector, - unsigned int func_selector) -{ - struct msm_pinctrl_priv *priv = dev_get_priv(dev); - - clrsetbits_le32(priv->base + GPIO_CONFIG_OFFSET(pin_selector), - TLMM_FUNC_SEL_MASK | TLMM_GPIO_DISABLE, - priv->data->get_function_mux(func_selector) << 2); - return 0; -} - -static int msm_pinconf_set(struct udevice *dev, unsigned int pin_selector, - unsigned int param, unsigned int argument) -{ - struct msm_pinctrl_priv *priv = dev_get_priv(dev); - - switch (param) { - case PIN_CONFIG_DRIVE_STRENGTH: - clrsetbits_le32(priv->base + GPIO_CONFIG_OFFSET(pin_selector), - TLMM_DRV_STRENGTH_MASK, argument << 6); - break; - case PIN_CONFIG_BIAS_DISABLE: - clrbits_le32(priv->base + GPIO_CONFIG_OFFSET(pin_selector), - TLMM_GPIO_PULL_MASK); - break; - case PIN_CONFIG_BIAS_PULL_UP: - clrsetbits_le32(priv->base + GPIO_CONFIG_OFFSET(pin_selector), - TLMM_GPIO_PULL_MASK, argument); - break; - default: - return 0; - } - - return 0; -} - -static int msm_pinctrl_bind(struct udevice *dev) -{ - ofnode node = dev_ofnode(dev); - const char *name; - int ret; - - ofnode_get_property(node, "gpio-controller", &ret); - if (ret < 0) - return 0; - - /* Get the name of gpio node */ - name = ofnode_get_name(node); - if (!name) - return -EINVAL; - - /* Bind gpio node */ - ret = device_bind_driver_to_node(dev, "gpio_msm", - name, node, NULL); - if (ret) - return ret; - - dev_dbg(dev, "bind %s\n", name); - - return 0; -} - -static struct pinctrl_ops msm_pinctrl_ops = { - .get_pins_count = msm_get_pins_count, - .get_pin_name = msm_get_pin_name, - .set_state = pinctrl_generic_set_state, - .pinmux_set = msm_pinmux_set, - .pinconf_num_params = ARRAY_SIZE(msm_conf_params), - .pinconf_params = msm_conf_params, - .pinconf_set = msm_pinconf_set, - .get_functions_count = msm_get_functions_count, - .get_function_name = msm_get_function_name, -}; - -static const struct udevice_id msm_pinctrl_ids[] = { - { .compatible = "qcom,ipq4019-pinctrl", .data = (ulong)&ipq4019_data }, - { } -}; - -U_BOOT_DRIVER(pinctrl_snapdraon) = { - .name = "pinctrl_msm", - .id = UCLASS_PINCTRL, - .of_match = msm_pinctrl_ids, - .priv_auto = sizeof(struct msm_pinctrl_priv), - .ops = &msm_pinctrl_ops, - .probe = msm_pinctrl_probe, - .bind = msm_pinctrl_bind, -}; diff --git a/arch/arm/mach-ipq40xx/pinctrl-snapdragon.h b/arch/arm/mach-ipq40xx/pinctrl-snapdragon.h deleted file mode 100644 index 2341a713495d..000000000000 --- a/arch/arm/mach-ipq40xx/pinctrl-snapdragon.h +++ /dev/null @@ -1,30 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * Qualcomm Pin control - * - * (C) Copyright 2018 Ramon Fried - * - */ -#ifndef _PINCTRL_SNAPDRAGON_H -#define _PINCTRL_SNAPDRAGON_H - -#include - -struct msm_pinctrl_data { - int pin_count; - int functions_count; - const char *(*get_function_name)(struct udevice *dev, - unsigned int selector); - unsigned int (*get_function_mux)(unsigned int selector); - const char *(*get_pin_name)(struct udevice *dev, - unsigned int selector); -}; - -struct pinctrl_function { - const char *name; - int val; -}; - -extern struct msm_pinctrl_data ipq4019_data; - -#endif diff --git a/drivers/pinctrl/qcom/Kconfig b/drivers/pinctrl/qcom/Kconfig index 412925c48788..2fe639814785 100644 --- a/drivers/pinctrl/qcom/Kconfig +++ b/drivers/pinctrl/qcom/Kconfig @@ -20,6 +20,13 @@ config PINCTRL_QCOM_APQ8096 Say Y here to enable support for pinctrl on the MSM8996 / APQ8096 Snapdragon 820 SoC, as well as the associated GPIO driver. +config PINCTRL_QCOM_IPQ4019 + bool "Qualcomm IPQ4019 GCC" + select PINCTRL_QCOM + help + Say Y here to enable support for pinctrl on the IPQ4019 SoC, + as well as the associated GPIO driver. + config PINCTRL_QCOM_QCS404 bool "Qualcomm QCS404 GCC" select PINCTRL_QCOM diff --git a/drivers/pinctrl/qcom/Makefile b/drivers/pinctrl/qcom/Makefile index 86f507427301..6d9aca6d7b7e 100644 --- a/drivers/pinctrl/qcom/Makefile +++ b/drivers/pinctrl/qcom/Makefile @@ -4,6 +4,7 @@ obj-$(CONFIG_PINCTRL_QCOM) += pinctrl-qcom.o obj-$(CONFIG_PINCTRL_QCOM_APQ8016) += pinctrl-apq8016.o +obj-$(CONFIG_PINCTRL_QCOM_IPQ4019) += pinctrl-ipq4019.o obj-$(CONFIG_PINCTRL_QCOM_APQ8096) += pinctrl-apq8096.o obj-$(CONFIG_PINCTRL_QCOM_QCS404) += pinctrl-qcs404.o obj-$(CONFIG_PINCTRL_QCOM_SDM845) += pinctrl-sdm845.o diff --git a/arch/arm/mach-ipq40xx/pinctrl-ipq4019.c b/drivers/pinctrl/qcom/pinctrl-ipq4019.c similarity index 73% rename from arch/arm/mach-ipq40xx/pinctrl-ipq4019.c rename to drivers/pinctrl/qcom/pinctrl-ipq4019.c index 3e365f8cc86a..87058e21ce80 100644 --- a/arch/arm/mach-ipq40xx/pinctrl-ipq4019.c +++ b/drivers/pinctrl/qcom/pinctrl-ipq4019.c @@ -7,12 +7,13 @@ * Author: Robert Marko */ -#include "pinctrl-snapdragon.h" #include +#include + +#include "pinctrl-qcom.h" #define MAX_PIN_NAME_LEN 32 -static char pin_name[MAX_PIN_NAME_LEN]; - +static char pin_name[MAX_PIN_NAME_LEN] __section(".data"); static const struct pinctrl_function msm_pinctrl_functions[] = { {"gpio", 0}, {"blsp_uart0_0", 1}, /* Only for GPIO:16,17 */ @@ -26,7 +27,6 @@ static const struct pinctrl_function msm_pinctrl_functions[] = { {"mdc_0", 1}, /* Only for GPIO7 */ {"mdc_1", 2}, /* Only for GPIO52 */ }; - static const char *ipq4019_get_function_name(struct udevice *dev, unsigned int selector) { @@ -45,10 +45,23 @@ static unsigned int ipq4019_get_function_mux(unsigned int selector) return msm_pinctrl_functions[selector].val; } -struct msm_pinctrl_data ipq4019_data = { +static const struct msm_pinctrl_data ipq4019_data = { .pin_count = 100, .functions_count = ARRAY_SIZE(msm_pinctrl_functions), .get_function_name = ipq4019_get_function_name, .get_function_mux = ipq4019_get_function_mux, .get_pin_name = ipq4019_get_pin_name, }; + +static const struct udevice_id msm_pinctrl_ids[] = { + { .compatible = "qcom,ipq4019-pinctrl", .data = (ulong)&ipq4019_data }, + { /* Sentinal */ } +}; + +U_BOOT_DRIVER(pinctrl_ipq4019) = { + .name = "pinctrl_ipq4019", + .id = UCLASS_NOP, + .of_match = msm_pinctrl_ids, + .ops = &msm_pinctrl_ops, + .bind = msm_pinctrl_bind, +}; From patchwork Mon Nov 6 15:29:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 741402 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1149355wrr; Mon, 6 Nov 2023 07:29:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IEo2YWXy61OCqS9jI1zGi00T0alUdmRCbSarp2RSnRYDBIMFFI3VCQL8J4PkEzuAylYbQbD X-Received: by 2002:a17:906:fd89:b0:9b9:a1dd:5105 with SMTP id xa9-20020a170906fd8900b009b9a1dd5105mr15488907ejb.50.1699284594465; Mon, 06 Nov 2023 07:29:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699284594; cv=none; d=google.com; s=arc-20160816; b=iAvzkXvY9GvBySSFQnmF2kSJC/HQiHOxyZblb1o5YZ8qXhV0874IwhEM6XF/ym4tgf cgOcYBdUEnLK1aIUch9IX8d7aMBG7O6aODp22168mZoInfiYsTzMRxZy+hEvWSOWOFSW rIHBDSJFqypt8d1HXo0bKPi9hH5/AFDU4KIdrBrKYGBpxn/mK754M5Lv6c+gmSqq8cEp d5YC4FuG6x1y1FAooEPqWV+M8BuTd8A8NAXcFcwRFmVe18jGJp+TR3+hX8Zp6qAQ4q+L ZPSC/6ia1W8tYTEKOHl0ozv7zGNDTF4im0J2EgNmLmSDslfjDbU/qT7tF59L1oohRSv9 9NnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=g+U3DwVyZtkxT0UszZEEmBs77pSqZ23KkQOvzCJuEMA=; fh=GowdQhFHojjDa0VFAVprx0l6qpleMCeMha4WUJGY9kk=; b=AtBtgE6DmdwTp9ALUB0nzE3agf8yh9NV+/PD2vpLmUHLLgDi+fe1BqMZfgrirQu28r vOMu0/2ADp6fevPNVoGPb7ZnRNDM8DL0gd4h/cGm64mzqShkmTPzehSUs/UF6Av1VvdF wnT6FseNH+guN0u4WA0eDWJdTFCni4H6xKeRnlIPGIez7KsrxTA07NbCQmvaLt28+x+4 xpetd+gqKZ25X1hpKN2R/QKDuK46jOA79NDx9aHTfUQjzFddN5tSd+LwVYFvT0IbHuSI IDlq5UciDGMn0lQQkxBbCv7Ec8um7AvuahuvvsO0NpieaLt+KoNodlEUDAmbwATMfWdp JNBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NvXct0AQ; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id ho37-20020a1709070ea500b0099c97c1e8a5si4371417ejc.92.2023.11.06.07.29.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 07:29:54 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NvXct0AQ; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6FF9A86F8A; Mon, 6 Nov 2023 16:29:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="NvXct0AQ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 20F1E86F1A; Mon, 6 Nov 2023 16:29:26 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 408DA86BF7 for ; Mon, 6 Nov 2023 16:29:08 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2c4fdf94666so61409701fa.2 for ; Mon, 06 Nov 2023 07:29:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699284547; x=1699889347; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=g+U3DwVyZtkxT0UszZEEmBs77pSqZ23KkQOvzCJuEMA=; b=NvXct0AQOKozuMGQLDOK+jZ8izhuy2scGw0s9z1rQGg13auZ1dVvwqE8qLV+FDFSLm AE5AuULhHvXIdmHuklVeZ86HQ6gXLtkqq6RgnNusu68qBVzBx/iDXvEXeuRrCc/q/MeL DWhJp42RXFIKMam3ksa6SH1dIY7DyJHzETMZFSbeGnkiQI763/fYVM1N1EmfvReWmgTk ol2unC1O4XSKl1qZ+6HcSE6mWo2SxKSQh0xXxAWIcmhMomYv8kMIt0Us/8w+qXqYauTL 2wa5auEAlgGqZqky71Hkj2TJQ6JYQ9aagB6U5UA6wWLZ93b0MbEOqcNm/F3MIEr87I+r MblQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699284547; x=1699889347; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=g+U3DwVyZtkxT0UszZEEmBs77pSqZ23KkQOvzCJuEMA=; b=NsC3FgDBnjf2nPbNxLJVTObn5vNCA1Cao/Uhb5F3mfShS72BtvuuuGtiDMYBW5Ee3M Hp/33Vyxe2E84kh9mvdML8R57a1foKRmju/4dAZCoGTaBTw7VO5+ZY4Nk7fleFP7ND4C Qp8fiy59HOfUpHnxsy3v57y/ltkOKw4x6qKgxsgAfT9cdMqyM0+oQJ6cPyuGRxSu/+qs KphTEayJ7PK1ULjx+8qKb0Pq8CkMk8Bia2C5eBsEhVyujadzLVeMHjx5cpGGCn7a5XS5 WoNQy/7XetNqQPT5mk5CO6JsaVQ25w1VsqFhvT2M3u0G5Vm+wcBvaUGzbBupY2GpAg3g Ijeg== X-Gm-Message-State: AOJu0Yx8Kj61pvFgWuzAlyvfzu8zYicz3//7F5Gk+sfa1anqHOGmpSId fkV+M4PeAcMKR36UV9rVjfSJeA== X-Received: by 2002:a2e:8548:0:b0:2c0:a0c:be7 with SMTP id u8-20020a2e8548000000b002c00a0c0be7mr22115614ljj.8.1699284547068; Mon, 06 Nov 2023 07:29:07 -0800 (PST) Received: from lion.localdomain (host-92-25-138-185.as13285.net. [92.25.138.185]) by smtp.gmail.com with ESMTPSA id bx30-20020a5d5b1e000000b0032f7d1e2c7csm8116094wrb.95.2023.11.06.07.29.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 07:29:06 -0800 (PST) From: Caleb Connolly Date: Mon, 06 Nov 2023 15:29:02 +0000 Subject: [PATCH v2 3/5] pinctrl: qcom: make compatible with linux DTs MIME-Version: 1.0 Message-Id: <20231106-b4-qcom-pinctrl-v2-3-406e8d8689ca@linaro.org> References: <20231106-b4-qcom-pinctrl-v2-0-406e8d8689ca@linaro.org> In-Reply-To: <20231106-b4-qcom-pinctrl-v2-0-406e8d8689ca@linaro.org> To: Sumit Garg , Ramon Fried , Lukasz Majewski , Sean Anderson , Rayagonda Kokatanur , Robert Marko , Bhupesh Sharma , Luka Perkov , Dzmitry Sankouski , Jorge Ramirez-Ortiz Cc: Vladimir Zapolskiy , u-boot@lists.denx.de, Caleb Connolly X-Mailer: b4 0.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=18565; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=8DPp8KBYlCk8Jw2M5gOXEW8W7QG0gbJfpUafvyIqzcs=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhlRPNruoGVmZD5S7lruyzH/SNe/cfVG+M6mnZrG019w60 2PMNWt1RykLgyAHg6yYIov4iWWWTWsv22tsX3ABZg4rE8gQBi5OAZhIlzXDT0b/8wYpCx+dr7Bd E94a68GfmyvNfCzNe99fd2EvN73Wtwz/069xlZ069vNQ2imhs53pR1JlQg2VPN/FyelNSJlsHyl sDAA= X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The pinctrl and GPIO drivers are currently heavily incompatible with upstream. Most Qualcomm pinctrl blocks feature "tiles" of pins, each at it's own address. Introduce support for these by allowing the soc driver to specify per-pin register offsets similarly to the Linux driver. Adjust the GPIO driver to handle these too, and finally enable support for all pins with the same numbering as used in Linux. Signed-off-by: Caleb Connolly Reviewed-by: Sumit Garg --- arch/arm/dts/dragonboard845c-uboot.dtsi | 2 +- arch/arm/dts/sdm845.dtsi | 16 ++-------- arch/arm/dts/starqltechn-uboot.dtsi | 5 +--- arch/arm/dts/starqltechn.dts | 16 +++++----- arch/arm/mach-snapdragon/include/mach/gpio.h | 28 ++++++++++++++--- drivers/gpio/msm_gpio.c | 36 ++++++++++++---------- drivers/pinctrl/qcom/pinctrl-apq8016.c | 2 +- drivers/pinctrl/qcom/pinctrl-apq8096.c | 2 +- drivers/pinctrl/qcom/pinctrl-ipq4019.c | 2 +- drivers/pinctrl/qcom/pinctrl-qcom.c | 31 ++++++++++++------- drivers/pinctrl/qcom/pinctrl-qcom.h | 5 +++- drivers/pinctrl/qcom/pinctrl-qcs404.c | 2 +- drivers/pinctrl/qcom/pinctrl-sdm845.c | 45 ++++++++++++++++++++++++++-- 13 files changed, 130 insertions(+), 62 deletions(-) diff --git a/arch/arm/dts/dragonboard845c-uboot.dtsi b/arch/arm/dts/dragonboard845c-uboot.dtsi index 7106db8a7348..7728f4f4a3e5 100644 --- a/arch/arm/dts/dragonboard845c-uboot.dtsi +++ b/arch/arm/dts/dragonboard845c-uboot.dtsi @@ -19,7 +19,7 @@ bootph-all; }; - pinctrl_north@3900000 { + pinctrl@3400000 { bootph-all; }; }; diff --git a/arch/arm/dts/sdm845.dtsi b/arch/arm/dts/sdm845.dtsi index 3b86b9328fc6..4798ace0ff8b 100644 --- a/arch/arm/dts/sdm845.dtsi +++ b/arch/arm/dts/sdm845.dtsi @@ -26,23 +26,13 @@ #power-domain-cells = <1>; }; - gpio_north: gpio_north@3900000 { - #gpio-cells = <2>; + tlmm: pinctrl@3400000 { compatible = "qcom,sdm845-pinctrl"; - reg = <0x3900000 0x400000>; - gpio-count = <150>; - gpio-controller; - gpio-ranges = <&gpio_north 0 0 150>; - gpio-bank-name = "soc_north."; - }; - - tlmm_north: pinctrl_north@3900000 { - compatible = "qcom,sdm845-pinctrl"; - reg = <0x3900000 0x400000>; + reg = <0x3400000 0xc00000>; gpio-count = <150>; gpio-controller; #gpio-cells = <2>; - gpio-ranges = <&tlmm_north 0 0 150>; + gpio-ranges = <&tlmm 0 0 150>; /* DEBUG UART */ qup_uart9: qup-uart9-default { diff --git a/arch/arm/dts/starqltechn-uboot.dtsi b/arch/arm/dts/starqltechn-uboot.dtsi index d81a22ffe492..034d5c1c07ed 100644 --- a/arch/arm/dts/starqltechn-uboot.dtsi +++ b/arch/arm/dts/starqltechn-uboot.dtsi @@ -19,10 +19,7 @@ clock-controller@100000 { bootph-all; }; - gpio_north@3900000 { - bootph-all; - }; - pinctrl_north@3900000 { + pinctrl@3400000 { bootph-all; }; }; diff --git a/arch/arm/dts/starqltechn.dts b/arch/arm/dts/starqltechn.dts index eec51d165f98..5b6372bee79a 100644 --- a/arch/arm/dts/starqltechn.dts +++ b/arch/arm/dts/starqltechn.dts @@ -65,15 +65,15 @@ serial@a84000 { status = "okay"; }; + }; +}; - pinctrl_north@3900000 { - muic_i2c: muic_i2c { - pins = "GPIO_33", "GPIO_34"; - drive-strength = <0x2>; - function = "gpio"; - bias-disable; - }; - }; +&tlmm { + muic_i2c: muic-i2c-n { + pins = "GPIO_33", "GPIO_34"; + drive-strength = <0x2>; + function = "gpio"; + bias-disable; }; }; diff --git a/arch/arm/mach-snapdragon/include/mach/gpio.h b/arch/arm/mach-snapdragon/include/mach/gpio.h index bbc2bc16175d..8dac62f870b9 100644 --- a/arch/arm/mach-snapdragon/include/mach/gpio.h +++ b/arch/arm/mach-snapdragon/include/mach/gpio.h @@ -1,8 +1,28 @@ /* SPDX-License-Identifier: GPL-2.0+ */ /* - * Empty gpio.h + * Qualcomm common pin control data. * - * This file must stay as arch/arm/include/asm/gpio.h requires it. - * - * (C) Copyright 2015 Mateusz Kulikowski + * Copyright (C) 2023 Linaro Ltd. */ +#ifndef _QCOM_GPIO_H_ +#define _QCOM_GPIO_H_ + +#include +#include + +struct msm_pin_data { + int pin_count; + const unsigned int *pin_offsets; +}; + +static inline u32 qcom_pin_offset(const unsigned int *offs, unsigned int selector) +{ + u32 out = (selector * 0x1000); + + if (offs) + return out + offs[selector]; + + return out; +} + +#endif /* _QCOM_GPIO_H_ */ diff --git a/drivers/gpio/msm_gpio.c b/drivers/gpio/msm_gpio.c index 51670f263716..7d77776a25fd 100644 --- a/drivers/gpio/msm_gpio.c +++ b/drivers/gpio/msm_gpio.c @@ -11,13 +11,10 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; -/* Register offsets */ -#define GPIO_CONFIG_OFF(no) ((no) * 0x1000) -#define GPIO_IN_OUT_OFF(no) ((no) * 0x1000 + 0x4) - /* OE */ #define GPIO_OE_DISABLE (0x0 << 9) #define GPIO_OE_ENABLE (0x1 << 9) @@ -29,15 +26,22 @@ DECLARE_GLOBAL_DATA_PTR; struct msm_gpio_bank { phys_addr_t base; + const struct msm_pin_data *pin_data; }; +#define GPIO_CONFIG_REG(dev, x) \ + (qcom_pin_offset(((struct msm_gpio_bank *)dev_get_priv(dev))->pin_data->pin_offsets, x)) + +#define GPIO_IN_OUT_REG(dev, x) \ + (GPIO_CONFIG_REG(dev, x) + 0x4) + static int msm_gpio_direction_input(struct udevice *dev, unsigned int gpio) { struct msm_gpio_bank *priv = dev_get_priv(dev); - phys_addr_t reg = priv->base + GPIO_CONFIG_OFF(gpio); /* Disable OE bit */ - clrsetbits_le32(reg, GPIO_OE_MASK, GPIO_OE_DISABLE); + clrsetbits_le32(priv->base + GPIO_CONFIG_REG(dev, gpio), + GPIO_OE_MASK, GPIO_OE_DISABLE); return 0; } @@ -48,7 +52,7 @@ static int msm_gpio_set_value(struct udevice *dev, unsigned gpio, int value) value = !!value; /* set value */ - writel(value << GPIO_OUT, priv->base + GPIO_IN_OUT_OFF(gpio)); + writel(value << GPIO_OUT, priv->base + GPIO_IN_OUT_REG(dev, gpio)); return 0; } @@ -57,13 +61,13 @@ static int msm_gpio_direction_output(struct udevice *dev, unsigned gpio, int value) { struct msm_gpio_bank *priv = dev_get_priv(dev); - phys_addr_t reg = priv->base + GPIO_CONFIG_OFF(gpio); value = !!value; /* set value */ - writel(value << GPIO_OUT, priv->base + GPIO_IN_OUT_OFF(gpio)); + writel(value << GPIO_OUT, priv->base + GPIO_IN_OUT_REG(dev, gpio)); /* switch direction */ - clrsetbits_le32(reg, GPIO_OE_MASK, GPIO_OE_ENABLE); + clrsetbits_le32(priv->base + GPIO_CONFIG_REG(dev, gpio), + GPIO_OE_MASK, GPIO_OE_ENABLE); return 0; } @@ -72,14 +76,14 @@ static int msm_gpio_get_value(struct udevice *dev, unsigned gpio) { struct msm_gpio_bank *priv = dev_get_priv(dev); - return !!(readl(priv->base + GPIO_IN_OUT_OFF(gpio)) >> GPIO_IN); + return !!(readl(priv->base + GPIO_IN_OUT_REG(dev, gpio)) >> GPIO_IN); } -static int msm_gpio_get_function(struct udevice *dev, unsigned offset) +static int msm_gpio_get_function(struct udevice *dev, unsigned gpio) { struct msm_gpio_bank *priv = dev_get_priv(dev); - if (readl(priv->base + GPIO_CONFIG_OFF(offset)) & GPIO_OE_ENABLE) + if (readl(priv->base + GPIO_CONFIG_REG(dev, gpio)) & GPIO_OE_ENABLE) return GPIOF_OUTPUT; return GPIOF_INPUT; @@ -98,6 +102,7 @@ static int msm_gpio_probe(struct udevice *dev) struct msm_gpio_bank *priv = dev_get_priv(dev); priv->base = dev_read_addr(dev); + priv->pin_data = (struct msm_pin_data *)dev_get_driver_data(dev); return priv->base == FDT_ADDR_T_NONE ? -EINVAL : 0; } @@ -105,9 +110,10 @@ static int msm_gpio_probe(struct udevice *dev) static int msm_gpio_of_to_plat(struct udevice *dev) { struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); + const struct msm_pin_data *pin_data = (struct msm_pin_data *)dev_get_driver_data(dev); - uc_priv->gpio_count = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), - "gpio-count", 0); + /* Get the pin count from the pinctrl driver */ + uc_priv->gpio_count = pin_data->pin_count; uc_priv->bank_name = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "gpio-bank-name", NULL); if (uc_priv->bank_name == NULL) diff --git a/drivers/pinctrl/qcom/pinctrl-apq8016.c b/drivers/pinctrl/qcom/pinctrl-apq8016.c index bcbc0df50715..8149ffd83cc4 100644 --- a/drivers/pinctrl/qcom/pinctrl-apq8016.c +++ b/drivers/pinctrl/qcom/pinctrl-apq8016.c @@ -55,7 +55,7 @@ static unsigned int apq8016_get_function_mux(unsigned int selector) } static const struct msm_pinctrl_data apq8016_data = { - .pin_count = 133, + .pin_data = { .pin_count = 133, }, .functions_count = ARRAY_SIZE(msm_pinctrl_functions), .get_function_name = apq8016_get_function_name, .get_function_mux = apq8016_get_function_mux, diff --git a/drivers/pinctrl/qcom/pinctrl-apq8096.c b/drivers/pinctrl/qcom/pinctrl-apq8096.c index 525085617680..d64ab1ff7bee 100644 --- a/drivers/pinctrl/qcom/pinctrl-apq8096.c +++ b/drivers/pinctrl/qcom/pinctrl-apq8096.c @@ -50,7 +50,7 @@ static unsigned int apq8096_get_function_mux(unsigned int selector) } static const struct msm_pinctrl_data apq8096_data = { - .pin_count = 157, + .pin_data = { .pin_count = 157, }, .functions_count = ARRAY_SIZE(msm_pinctrl_functions), .get_function_name = apq8096_get_function_name, .get_function_mux = apq8096_get_function_mux, diff --git a/drivers/pinctrl/qcom/pinctrl-ipq4019.c b/drivers/pinctrl/qcom/pinctrl-ipq4019.c index 87058e21ce80..2d99f99e1e45 100644 --- a/drivers/pinctrl/qcom/pinctrl-ipq4019.c +++ b/drivers/pinctrl/qcom/pinctrl-ipq4019.c @@ -46,7 +46,7 @@ static unsigned int ipq4019_get_function_mux(unsigned int selector) } static const struct msm_pinctrl_data ipq4019_data = { - .pin_count = 100, + .pin_data = { .pin_count = 100, }, .functions_count = ARRAY_SIZE(msm_pinctrl_functions), .get_function_name = ipq4019_get_function_name, .get_function_mux = ipq4019_get_function_mux, diff --git a/drivers/pinctrl/qcom/pinctrl-qcom.c b/drivers/pinctrl/qcom/pinctrl-qcom.c index 1cface7f610b..dc3d8c4d9034 100644 --- a/drivers/pinctrl/qcom/pinctrl-qcom.c +++ b/drivers/pinctrl/qcom/pinctrl-qcom.c @@ -13,8 +13,11 @@ #include #include #include +#include #include #include +#include + #include "pinctrl-qcom.h" struct msm_pinctrl_priv { @@ -22,7 +25,9 @@ struct msm_pinctrl_priv { struct msm_pinctrl_data *data; }; -#define GPIO_CONFIG_OFFSET(x) ((x) * 0x1000) +#define GPIO_CONFIG_REG(priv, x) \ + (qcom_pin_offset((priv)->data->pin_data.pin_offsets, x)) + #define TLMM_GPIO_PULL_MASK GENMASK(1, 0) #define TLMM_FUNC_SEL_MASK GENMASK(5, 2) #define TLMM_DRV_STRENGTH_MASK GENMASK(8, 6) @@ -45,7 +50,7 @@ static int msm_get_pins_count(struct udevice *dev) { struct msm_pinctrl_priv *priv = dev_get_priv(dev); - return priv->data->pin_count; + return priv->data->pin_data.pin_count; } static const char *msm_get_function_name(struct udevice *dev, @@ -61,7 +66,7 @@ static int msm_pinctrl_probe(struct udevice *dev) struct msm_pinctrl_priv *priv = dev_get_priv(dev); priv->base = dev_read_addr(dev); - priv->data = (struct msm_pinctrl_data *)dev->driver_data; + priv->data = (struct msm_pinctrl_data *)dev_get_driver_data(dev); return priv->base == FDT_ADDR_T_NONE ? -EINVAL : 0; } @@ -78,7 +83,7 @@ static int msm_pinmux_set(struct udevice *dev, unsigned int pin_selector, { struct msm_pinctrl_priv *priv = dev_get_priv(dev); - clrsetbits_le32(priv->base + GPIO_CONFIG_OFFSET(pin_selector), + clrsetbits_le32(priv->base + GPIO_CONFIG_REG(priv, pin_selector), TLMM_FUNC_SEL_MASK | TLMM_GPIO_DISABLE, priv->data->get_function_mux(func_selector) << 2); return 0; @@ -92,15 +97,15 @@ static int msm_pinconf_set(struct udevice *dev, unsigned int pin_selector, switch (param) { case PIN_CONFIG_DRIVE_STRENGTH: argument = (argument / 2) - 1; - clrsetbits_le32(priv->base + GPIO_CONFIG_OFFSET(pin_selector), + clrsetbits_le32(priv->base + GPIO_CONFIG_REG(priv, pin_selector), TLMM_DRV_STRENGTH_MASK, argument << 6); break; case PIN_CONFIG_BIAS_DISABLE: - clrbits_le32(priv->base + GPIO_CONFIG_OFFSET(pin_selector), + clrbits_le32(priv->base + GPIO_CONFIG_REG(priv, pin_selector), TLMM_GPIO_PULL_MASK); break; case PIN_CONFIG_BIAS_PULL_UP: - clrsetbits_le32(priv->base + GPIO_CONFIG_OFFSET(pin_selector), + clrsetbits_le32(priv->base + GPIO_CONFIG_REG(priv, pin_selector), TLMM_GPIO_PULL_MASK, argument); break; default: @@ -149,9 +154,15 @@ int msm_pinctrl_bind(struct udevice *dev) if (!name) return -EINVAL; - /* Bind gpio node */ - ret = device_bind_driver_to_node(dev, "gpio_msm", - name, node, NULL); + drv = lists_driver_lookup_name("gpio_msm"); + if (!drv) { + printf("Can't find gpio_msm driver\n"); + return -ENODEV; + } + + /* Bind gpio device as a child of the pinctrl device */ + ret = device_bind_with_driver_data(pinctrl_dev, drv, + name, (ulong)&data->pin_data, node, NULL); if (ret) { device_unbind(pinctrl_dev); return ret; diff --git a/drivers/pinctrl/qcom/pinctrl-qcom.h b/drivers/pinctrl/qcom/pinctrl-qcom.h index 1edd9a43ffda..07f2eae9baea 100644 --- a/drivers/pinctrl/qcom/pinctrl-qcom.h +++ b/drivers/pinctrl/qcom/pinctrl-qcom.h @@ -8,10 +8,13 @@ #ifndef _PINCTRL_QCOM_H #define _PINCTRL_QCOM_H +#include +#include + struct udevice; struct msm_pinctrl_data { - int pin_count; + struct msm_pin_data pin_data; int functions_count; const char *(*get_function_name)(struct udevice *dev, unsigned int selector); diff --git a/drivers/pinctrl/qcom/pinctrl-qcs404.c b/drivers/pinctrl/qcom/pinctrl-qcs404.c index 272331c90b5c..ac00afa2a1f4 100644 --- a/drivers/pinctrl/qcom/pinctrl-qcs404.c +++ b/drivers/pinctrl/qcom/pinctrl-qcs404.c @@ -62,7 +62,7 @@ static unsigned int qcs404_get_function_mux(unsigned int selector) } static struct msm_pinctrl_data qcs404_data = { - .pin_count = 126, + .pin_data = { .pin_count = 126, }, .functions_count = ARRAY_SIZE(msm_pinctrl_functions), .get_function_name = qcs404_get_function_name, .get_function_mux = qcs404_get_function_mux, diff --git a/drivers/pinctrl/qcom/pinctrl-sdm845.c b/drivers/pinctrl/qcom/pinctrl-sdm845.c index 1a09c5c81dc6..9f0f4085ce2d 100644 --- a/drivers/pinctrl/qcom/pinctrl-sdm845.c +++ b/drivers/pinctrl/qcom/pinctrl-sdm845.c @@ -3,6 +3,7 @@ * Qualcomm SDM845 pinctrl * * (C) Copyright 2021 Dzmitry Sankouski + * (C) Copyright 2023 Linaro Ltd. * */ @@ -11,6 +12,10 @@ #include "pinctrl-qcom.h" +#define NORTH 0x00500000 +#define SOUTH 0x00900000 +#define EAST 0x00100000 + #define MAX_PIN_NAME_LEN 32 static char pin_name[MAX_PIN_NAME_LEN] __section(".data"); @@ -19,6 +24,39 @@ static const struct pinctrl_function msm_pinctrl_functions[] = { {"gpio", 0}, }; +static const unsigned int sdm845_pin_offsets[] = { + [0] = EAST, [1] = EAST, [2] = EAST, [3] = EAST, [4] = NORTH, + [5] = NORTH, [6] = NORTH, [7] = NORTH, [8] = EAST, [9] = EAST, + [10] = EAST, [11] = EAST, [12] = SOUTH, [13] = SOUTH, [14] = SOUTH, + [15] = SOUTH, [16] = SOUTH, [17] = SOUTH, [18] = SOUTH, [19] = SOUTH, + [20] = SOUTH, [21] = SOUTH, [22] = SOUTH, [23] = SOUTH, [24] = SOUTH, + [25] = SOUTH, [26] = SOUTH, [27] = EAST, [28] = EAST, [29] = EAST, + [30] = EAST, [31] = NORTH, [32] = NORTH, [33] = NORTH, [34] = NORTH, + [35] = SOUTH, [36] = SOUTH, [37] = SOUTH, [38] = NORTH, [39] = EAST, + [40] = SOUTH, [41] = EAST, [42] = EAST, [43] = EAST, [44] = EAST, + [45] = EAST, [46] = EAST, [47] = EAST, [48] = EAST, [49] = NORTH, + [50] = NORTH, [51] = NORTH, [52] = NORTH, [53] = NORTH, [54] = NORTH, + [55] = NORTH, [56] = NORTH, [57] = NORTH, [58] = NORTH, [59] = NORTH, + [60] = NORTH, [61] = NORTH, [62] = NORTH, [63] = NORTH, [64] = NORTH, + [65] = NORTH, [66] = NORTH, [67] = NORTH, [68] = NORTH, [69] = EAST, + [70] = EAST, [71] = EAST, [72] = EAST, [73] = EAST, [74] = EAST, + [75] = EAST, [76] = EAST, [77] = EAST, [78] = EAST, [79] = NORTH, + [80] = NORTH, [81] = NORTH, [82] = NORTH, [83] = NORTH, [84] = NORTH, + [85] = EAST, [86] = EAST, [87] = EAST, [88] = EAST, [89] = SOUTH, + [90] = SOUTH, [91] = SOUTH, [92] = SOUTH, [93] = SOUTH, [94] = SOUTH, + [95] = SOUTH, [96] = SOUTH, [97] = NORTH, [98] = NORTH, [99] = NORTH, + [100] = NORTH, [101] = NORTH, [102] = NORTH, [103] = NORTH, [104] = NORTH, + [105] = NORTH, [106] = NORTH, [107] = NORTH, [108] = NORTH, [109] = NORTH, + [110] = NORTH, [111] = NORTH, [112] = NORTH, [113] = NORTH, [114] = NORTH, + [115] = NORTH, [116] = NORTH, [117] = NORTH, [118] = NORTH, [119] = NORTH, + [120] = NORTH, [121] = NORTH, [122] = EAST, [123] = EAST, [124] = EAST, + [125] = EAST, [126] = EAST, [127] = NORTH, [128] = NORTH, [129] = NORTH, + [130] = NORTH, [131] = NORTH, [132] = NORTH, [133] = NORTH, [134] = NORTH, + [135] = NORTH, [136] = NORTH, [137] = NORTH, [138] = NORTH, [139] = NORTH, + [140] = NORTH, [141] = NORTH, [142] = NORTH, [143] = NORTH, [144] = NORTH, + [145] = NORTH, [146] = NORTH, [147] = NORTH, [148] = NORTH, [149] = NORTH, +}; + static const char *sdm845_get_function_name(struct udevice *dev, unsigned int selector) { @@ -28,7 +66,7 @@ static const char *sdm845_get_function_name(struct udevice *dev, static const char *sdm845_get_pin_name(struct udevice *dev, unsigned int selector) { - snprintf(pin_name, MAX_PIN_NAME_LEN, "GPIO_%u", selector); + snprintf(pin_name, MAX_PIN_NAME_LEN, "gpio%u", selector); return pin_name; } @@ -38,7 +76,10 @@ static unsigned int sdm845_get_function_mux(unsigned int selector) } static struct msm_pinctrl_data sdm845_data = { - .pin_count = 150, + .pin_data = { + .pin_offsets = sdm845_pin_offsets, + .pin_count = ARRAY_SIZE(sdm845_pin_offsets), + }, .functions_count = ARRAY_SIZE(msm_pinctrl_functions), .get_function_name = sdm845_get_function_name, .get_function_mux = sdm845_get_function_mux, From patchwork Mon Nov 6 15:29:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 741404 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1149608wrr; Mon, 6 Nov 2023 07:30:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IFX4LxwjI1Viu2gC3ynhdOoOJsx+CW9wWJ5+4gPOnUvkIHLQmQtPGlH+FnG+AOEian0TSbt X-Received: by 2002:a05:6402:2029:b0:53d:a7d9:5149 with SMTP id ay9-20020a056402202900b0053da7d95149mr22835140edb.6.1699284617994; Mon, 06 Nov 2023 07:30:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699284617; cv=none; d=google.com; s=arc-20160816; b=turTdL3BYgp/U/Jao9i2E5RXjs7XO9d/dtIFqBbwazt7NyLNb1sP7JEusQZT8fXuKv k+GbWprV+/27kYBvSw5e5oQ4x1i16qB2bZdAfoHiNgibsZEfUDeKAICIKNJV/++y7CkC GfBogKBzMetFitPm9sZwsa4ViKqCXn0ZhFR1RTI4oWCqTMDt/1utCzpjd9S7O6teyLHW xojQBZreGav19ER61++MnqdwXTl2A2j3Kg5l2OjHGSkSL9I9pO6LgdW9sOOkowU6+MFM SmaJVie6LKW8nfZfR0ToyW/BQDKsMjvHQKCeWnltY+YU73Li5cuMnYEQEj6VWf99iZOt b8yA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=UtIt9RHM7jSGdXgOG4034U97MhrFmyCZJewGF1z1I/g=; fh=GowdQhFHojjDa0VFAVprx0l6qpleMCeMha4WUJGY9kk=; b=dJYuwDfoZdpcPCWQfccCr056ELyZ6lJQzan8fyi8S+M8p0SxqqFBX7oqM/bNC5ipjE Avb3bnmA/lL2V5Wq4ALA/C8mLGgEqGhptibT8GEF7QxRaLn88sjNWWJC9YxnPYEzTC4N CwIARzya9/GF3iBt8jusETsmiUyaPY/fcV6Vc7CY+G2TBwR29sKkzjMMxz6YUEC6Z8Ll VFFXF7Tr8Y8Hr5twH+zajs8jZSEQVHjDtfaLUJOAk09UdyFO9Np5Rk6p0I3uB0G9B3Eg pDboWynnNp4NZt5/gV6qKf20/4Y3ORzKppeL+tH+L29h8E77p+s6l/EPNC7JkLy2mmXM KLpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I+jploHT; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id o27-20020a509b1b000000b00532ea5bd937si588793edi.527.2023.11.06.07.30.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 07:30:17 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I+jploHT; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 65B8D87063; Mon, 6 Nov 2023 16:29:35 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="I+jploHT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8783586F42; Mon, 6 Nov 2023 16:29:32 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C7D3586F8D for ; Mon, 6 Nov 2023 16:29:08 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-40836ea8cbaso32622465e9.0 for ; Mon, 06 Nov 2023 07:29:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699284548; x=1699889348; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=UtIt9RHM7jSGdXgOG4034U97MhrFmyCZJewGF1z1I/g=; b=I+jploHTWlDTh6upvGYY7ff+pwrDMf7L2fwHu/34YVgUzC2A6/p7YTc4PPZ31YSQPg HY+E5SqW3SKl9S/Z8GUpPJsGi+oBsT0WM1kIyQ3Z/HfwHK8vNHX+v3qf+uZVOm4ynfKX M5CYqIXca/cPyLCn+0zzorU3AoTlfyzSiwFQoYAr4bhaxrF4EIoCwVgPxElCA7fc1JRs vwJMbEZfmrG+PICGRQqbMAkZImYWcgdWb4DMmqXcXtJBvQZBhxmgMPy2nMVgnamMQRo/ Hm+wX8u94S3hLta2Awo6wzoy5D3a1D+0c52OTmJ5xwGqrntf/14id91/UHqrahDQWLBx TZHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699284548; x=1699889348; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UtIt9RHM7jSGdXgOG4034U97MhrFmyCZJewGF1z1I/g=; b=obAFYHIJXxIrJ3+OXNMSIsAGjKWe4p4xLQJbyBofl3R8iZQ+PBM++/jCKtF9BW48Xn EGjw3yrdx+q/+CER0bCnQs2x6Gj7GElzHQhhG8yiBUk9cz9LPkwLe5MVHy6SuKJLOoeS 2Sp6i6pu9S5rccoNyhXqBow5rFNoIUP3OL7r4hIZZ4VlGVEMCBVkwZ6IChHWcjAt218I szl6B/2XdX3fCwBL8Y4jDsRkiXsth7SFSKPATDpahAhg0T5ejYc57R5T4345li2O+DeR ghJ/ZRPWqLk7/XXv/W35OT2USsGDASZaymDD7Q51Lr2apfIPJ4/nNRVDCvQ5QmGpSNY/ gmtQ== X-Gm-Message-State: AOJu0YztU0LrGssWEaoqlsmeR35pLCTZtuK00wMSh/kyvgICH1en06Ty SNN5n5NE5zuQVx388B7118agyw== X-Received: by 2002:a05:600c:1c08:b0:40a:28b1:70fc with SMTP id j8-20020a05600c1c0800b0040a28b170fcmr21196wms.8.1699284548183; Mon, 06 Nov 2023 07:29:08 -0800 (PST) Received: from lion.localdomain (host-92-25-138-185.as13285.net. [92.25.138.185]) by smtp.gmail.com with ESMTPSA id bx30-20020a5d5b1e000000b0032f7d1e2c7csm8116094wrb.95.2023.11.06.07.29.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 07:29:07 -0800 (PST) From: Caleb Connolly Date: Mon, 06 Nov 2023 15:29:03 +0000 Subject: [PATCH v2 4/5] msm_gpio: use unsigned int MIME-Version: 1.0 Message-Id: <20231106-b4-qcom-pinctrl-v2-4-406e8d8689ca@linaro.org> References: <20231106-b4-qcom-pinctrl-v2-0-406e8d8689ca@linaro.org> In-Reply-To: <20231106-b4-qcom-pinctrl-v2-0-406e8d8689ca@linaro.org> To: Sumit Garg , Ramon Fried , Lukasz Majewski , Sean Anderson , Rayagonda Kokatanur , Robert Marko , Bhupesh Sharma , Luka Perkov , Dzmitry Sankouski , Jorge Ramirez-Ortiz Cc: Vladimir Zapolskiy , u-boot@lists.denx.de, Caleb Connolly X-Mailer: b4 0.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=1720; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=LwYk6/r+mWoVE7/aOiPWrqkTuHS6dGyX68p0AcAA5Ak=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhlRPNrvLds9FPt34MEXnW/alJXMmpXYZHbiR/a3UP3qXm 57X5Y2zOkpZGAQ5GGTFFFnETyyzbFp72V5j+4ILMHNYmUCGMHBxCsBE9uxiZOiZm8WxUeArP1Nc TKlRlaPbL4WyDWZTbF7H57eEVXTp8zAy9P5XbdggVfb7WFnFr+/GKgIfrr4y3NpgYGZ4xtnl7aH VegA= X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Replaces the uses of "unsigned" with "unsigned int". Reviewed-by: Sumit Garg Signed-off-by: Caleb Connolly --- drivers/gpio/msm_gpio.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/msm_gpio.c b/drivers/gpio/msm_gpio.c index 7d77776a25fd..3e4a0194b10a 100644 --- a/drivers/gpio/msm_gpio.c +++ b/drivers/gpio/msm_gpio.c @@ -46,7 +46,7 @@ static int msm_gpio_direction_input(struct udevice *dev, unsigned int gpio) return 0; } -static int msm_gpio_set_value(struct udevice *dev, unsigned gpio, int value) +static int msm_gpio_set_value(struct udevice *dev, unsigned int gpio, int value) { struct msm_gpio_bank *priv = dev_get_priv(dev); @@ -57,7 +57,7 @@ static int msm_gpio_set_value(struct udevice *dev, unsigned gpio, int value) return 0; } -static int msm_gpio_direction_output(struct udevice *dev, unsigned gpio, +static int msm_gpio_direction_output(struct udevice *dev, unsigned int gpio, int value) { struct msm_gpio_bank *priv = dev_get_priv(dev); @@ -72,14 +72,14 @@ static int msm_gpio_direction_output(struct udevice *dev, unsigned gpio, return 0; } -static int msm_gpio_get_value(struct udevice *dev, unsigned gpio) +static int msm_gpio_get_value(struct udevice *dev, unsigned int gpio) { struct msm_gpio_bank *priv = dev_get_priv(dev); return !!(readl(priv->base + GPIO_IN_OUT_REG(dev, gpio)) >> GPIO_IN); } -static int msm_gpio_get_function(struct udevice *dev, unsigned gpio) +static int msm_gpio_get_function(struct udevice *dev, unsigned int gpio) { struct msm_gpio_bank *priv = dev_get_priv(dev); From patchwork Mon Nov 6 15:29:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 741403 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1149464wrr; Mon, 6 Nov 2023 07:30:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IGF8ZwN/uWu98Lkre2jz8HtrwKE9/LqL3f+3MOXWRS6czh1vLQFWuXPvHnsUQiBDPuZ26V+ X-Received: by 2002:aa7:d392:0:b0:53e:6013:7fe8 with SMTP id x18-20020aa7d392000000b0053e60137fe8mr24457534edq.22.1699284606125; Mon, 06 Nov 2023 07:30:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699284606; cv=none; d=google.com; s=arc-20160816; b=Lb2zG8MoS1LS9DIQ6hrxwDqHQ4fFEHgwYQi9ZcNFb/XpIcHHDLlJSar0f3ffloKxi2 Dfq2GY4SLnLqNqSgpSbdzUgosR8F4jFF7Q/YnBSWM/tCZuQ03VnnRbUIXs3v/r0DRrLb bqqQMxlERExHukL4n+3ToWcd8KnAQHdDhZgXnuN6YKWai+jcRqVaMzwmx514XDpCfWx4 UVRGonYPZnSiqAr9UXJOAYf9OF1bWoLEz8RUrHOCWdHe0ScjH8NIWQBXLaLplq+zbL+y xMlBTWc2Wry6rR5zQadqBbaFR6umEmf770t/W5Bdnqk3RFadqm8kM6F01ZUdURsOjSOX 6z9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=ohm0Ty9NZ/yJiYODYeT3dcktkgD6Cz39pMYzl1qtWE4=; fh=X9uTKQbrDp6onOpVMgy5fyhAvaHA+C7HNKlPkgja0nQ=; b=pKmVvzkpbTHNucrj+AssJHXpeAqTSEjjPPWA6VbJVsCN4SAPMgHZhdjTrXAH+3NHm/ oFA0qtMtxepZfelPYmtAbZo/kYNAH0nSLHtrFuATrAhvjzKUSITJtyM12H0SjxzH0GCG 9sJNwU54UaB98Cv/KNCb8xJh4PtXvlkQtxeBkc6P/f+n0saDh39Vy8PMOKiARxXTv+LU v6RwLhwsmLlGLQpZD1BdVKTV2vDeQspJg7xL3NSOfqMR9t4cS6eR9YR4wMXvPLFvBju6 X6PU6lBAasyd/lr0df/WgU3Gqqk53tWe/wB9fbgRnJl++JzDiUIfF4RNld83zW5A6/dg yMwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="yGHXs/El"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id m6-20020a056402510600b0053ebb1e5b31si4602837edd.213.2023.11.06.07.30.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 07:30:06 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="yGHXs/El"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DAFE686FFA; Mon, 6 Nov 2023 16:29:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="yGHXs/El"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D7EFA86D7E; Mon, 6 Nov 2023 16:29:27 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B538986FFA for ; Mon, 6 Nov 2023 16:29:09 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4083cd3917eso35362425e9.3 for ; Mon, 06 Nov 2023 07:29:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699284549; x=1699889349; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ohm0Ty9NZ/yJiYODYeT3dcktkgD6Cz39pMYzl1qtWE4=; b=yGHXs/Elj9XIegF61Sv/02OrrJe616tzRmaR2DMPQ2X99D9bPGoa5FP8gbBkPr7uuA r4iW9ny+9apk+iled7WSxnuKZrNPb1M3I+CdtzcoxB9l2MMmoUFb1H5Csuc168xedjHU Pnc1cdGmJe4g4Mxnt9QnYzVEMYZNXsMQE3jLQjbgvp66HGnlVe2S1pIvl8K6nrbpLpKH JAyQlbzxM+M+Ctj8puu2rjVk9UlEcifIvb9candDkcKVOtmpZcqz5uauqdyl0O7GNJdm SmhwE5odgLJg6vit5WRUXRF7kAUtXVP/lw+7/qljLiiSQBx34gbMZSGsrb2TRA10m4FT ab0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699284549; x=1699889349; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ohm0Ty9NZ/yJiYODYeT3dcktkgD6Cz39pMYzl1qtWE4=; b=e2tR2WWzYLRNEIhj5lbWua6ALh1Iemk0asgUGhLOMu0mABKvZ8wa9gOEy2rJoGVlUd nZrM1DVmfXtxAtWynlJAmJtFnX4xTgTm+/OUiUqJQShyz1dJvvjAjAlNlm5wvRt+9Zag qlW/MN8A1X9gDmZs/XRAC66AM7j4eX2CjJCY82fedODFBed0s4rhtNhlgW6uFV4Xd/tk 3W7cZW1GXV4ABio0+1TBey53bqa520RD0wUwOM+jadyE4pLFgBE+QjVOYi+vXn/dmxRG CO2wXONUhNx1q3/D8VL5i02xAE52hSc3PzhiZhQ78Q9VebrPPqBPDdZlV05K6MCrv5mV Ms2w== X-Gm-Message-State: AOJu0Yy453uE26fdVpff/iPosVE+Lx9bSIJtblllXpzAcuu+F6ZXwSRn /sRcXIkDEbMFJM0YLqNZc6BowA== X-Received: by 2002:a05:6000:144c:b0:32f:7901:c462 with SMTP id v12-20020a056000144c00b0032f7901c462mr26407559wrx.3.1699284549245; Mon, 06 Nov 2023 07:29:09 -0800 (PST) Received: from lion.localdomain (host-92-25-138-185.as13285.net. [92.25.138.185]) by smtp.gmail.com with ESMTPSA id bx30-20020a5d5b1e000000b0032f7d1e2c7csm8116094wrb.95.2023.11.06.07.29.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 07:29:08 -0800 (PST) From: Caleb Connolly Date: Mon, 06 Nov 2023 15:29:04 +0000 Subject: [PATCH v2 5/5] fixup! pinctrl: qcom: make compatible with linux DTs MIME-Version: 1.0 Message-Id: <20231106-b4-qcom-pinctrl-v2-5-406e8d8689ca@linaro.org> References: <20231106-b4-qcom-pinctrl-v2-0-406e8d8689ca@linaro.org> In-Reply-To: <20231106-b4-qcom-pinctrl-v2-0-406e8d8689ca@linaro.org> To: Sumit Garg , Ramon Fried , Lukasz Majewski , Sean Anderson , Rayagonda Kokatanur , Robert Marko , Bhupesh Sharma , Luka Perkov , Dzmitry Sankouski , Jorge Ramirez-Ortiz Cc: Vladimir Zapolskiy , u-boot@lists.denx.de X-Mailer: b4 0.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=449; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=qwiGsHKwozAMMS6EVpb+Q3aDDHWfLWZujYHlXyFYC0I=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhlRPNjsGsdyN6h1VFp5VCZp/lp7QOjO3Q8TO+csHntkHt NmLGc52lLIwCHIwyIopsoifWGbZtPayvcb2BRdg5rAygQ3h4hSAiUx8yfA/c7mqlk7jjNN+zPNX Rn78enNHu87OScYBBwO9D0z2iriQw/C/yFVSqVdv5clLzWyl/DOYCr4yCd4IjmHadmqZuWiQqnI 1AA== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean --- drivers/gpio/msm_gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/msm_gpio.c b/drivers/gpio/msm_gpio.c index 3e4a0194b10a..80cd28bb231f 100644 --- a/drivers/gpio/msm_gpio.c +++ b/drivers/gpio/msm_gpio.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include DECLARE_GLOBAL_DATA_PTR;