From patchwork Tue Oct 31 14:22:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 739559 Delivered-To: patch@linaro.org Received: by 2002:a5d:4c47:0:b0:32d:baff:b0ca with SMTP id n7csp1675569wrt; Tue, 31 Oct 2023 07:22:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHiJRMDRVU925r6NFr1jpXXb5fWLDZytCEnfLZ3CEKy8TTNrjoxqlAeRu7EI4RKgzQn82SA X-Received: by 2002:adf:f1d0:0:b0:32d:84e8:eef2 with SMTP id z16-20020adff1d0000000b0032d84e8eef2mr8819495wro.33.1698762168095; Tue, 31 Oct 2023 07:22:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698762168; cv=none; d=google.com; s=arc-20160816; b=QvIWkaC4oUr9Al3yLcyjUBXpNYiXsOi6nyjMAkekcxrb97v+mkWQXD6Eh+zprPAbBw 3vKDIbPMOHIqFYIzzQS5h/qG13sfDknzEfYPY4zxOGkOss7tEkl+2mfWFFzZvPK7wbeZ iFUFcTptSh5GoEqREHX12UeyCkEKg8Ii2ZieS5Ih+EGXedG/hdKetYlNZTH1J2hrS1sa N3nGokiD10ViOOMOJsBEPgtBABBdEMVHa/N1yDW6OgNF7fAd2AmVafoaFjdxa9NQa0GX DIiS4tj2ULyAfMHUeGJDGQF++WFS2aJ/PILiLtF4opzbfdoQYIpGWmaaCNnk3ntEf/KS MPSQ== 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=yTxwk+o2oHFLR8mo6cJIBFxUXKrIaZXMTcYPDaI9F7Q=; fh=GowdQhFHojjDa0VFAVprx0l6qpleMCeMha4WUJGY9kk=; b=kAmHKnxU5eXVKgSISrIUVpx3P1PEaRqM/mbBC02H0Bii0C2iT/QNRUQlDxrOc3lPZD jEQf96dnNl7M7eoKbTrP0TTgnjOJP1pYyJVb+N+2wCJqhlEZ9VbEwFwDIEhucd6hud9+ emS8R6THnCsia1ndVWKZ3FMc3YAKS+vWKjmBrKGwZHj2mi88OYKC0d0ZR/fSp7DXr6nZ BC2H2/7nk7a1Pv4HVbnaSFfDwlEWZJEsUuXHVhaxhVJvfYDqslH+HU+RrBuCym4QPY92 LkPXeEhU1hj6GdDC/GJFZet1oLD0cD1BGZ2XOtC/Fvvkhqagzx2kbEK1A1RWgz0XraYm 5CNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aRZ7j9xr; 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 c3-20020adfe703000000b0032d97faad67si976691wrm.948.2023.10.31.07.22.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 07:22:48 -0700 (PDT) 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=aRZ7j9xr; 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 254EC87CE9; Tue, 31 Oct 2023 15:22:32 +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="aRZ7j9xr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6DCC687CD2; Tue, 31 Oct 2023 15:22:30 +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 autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) (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 2253187CD3 for ; Tue, 31 Oct 2023 15:22:26 +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-x22a.google.com with SMTP id 38308e7fff4ca-2c5720a321aso74436761fa.1 for ; Tue, 31 Oct 2023 07:22:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698762145; x=1699366945; 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=yTxwk+o2oHFLR8mo6cJIBFxUXKrIaZXMTcYPDaI9F7Q=; b=aRZ7j9xrQkhS88N1yCbC5eEAbRewBgtVkDX33SQEQ871o+eWt/6MbNEAWH6yrMraoK xVa9vtBKSJu1GhjkIr3jf5i2B5O9xUJ9WhKb70tBEuB1G15a/RJIpzJzjpi0nCN7qxW1 dpU5BpGx3g3dJ1wcBgTw/36HpjU6C4KsbSSEQmzWiUI4bmGE3k7/gUZQ25vB1bAjt0XI 7q0L2KqGFcnts0dCzUUbXoYUjaojmPITYraV9MvlgBrHMMNSXeu7nK0o3vTj/HeNwXGy oy774O2kKeP+lfgz7V6+BGMNTVgfdKdOH7SCe0W1A8hi75B/p0yAe2ESSJcwTPsDS4wt dQHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698762145; x=1699366945; 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=yTxwk+o2oHFLR8mo6cJIBFxUXKrIaZXMTcYPDaI9F7Q=; b=nBodUtvbT7a0eUq7/kGHw+Oz6DAplj6aouJz3OzE3nVDF/KQLBLJ7/pX8JOE6S2jUP vzxiyVIjlA6UcpgL6I+qWFTFJShrL0EXK0bbJWiyqSQVJo2n5moln4aLM4kMrzn1VEfH VpRI9OCg6Db8Xe4wjuapNdfjnPLlJU60++5aoKH+AipfL937oIMxsSy8uaowLotYrlxw op3AqVzG4m9Z0xs3sqGdc4edBFJrTjMqAJ0wnW0sypK6JfXWhWo9px+GRMp+yCPr7kc9 ZwqqMZeiS9ZLjlg4UHO3aQLHFQ7g2QaDHqttzr4FzxIb310gsF8BaXUX40EgqjLB+Ze9 HnFA== X-Gm-Message-State: AOJu0Ywmt/veWohOhCht0iyEmvPCrhxqJ98bc9c2Smn4yEYSwLwkcYnm GTKTeGWvsT4/9+Xk2x1Xm5DRjw== X-Received: by 2002:a2e:b1c7:0:b0:2c5:b4d2:e9c1 with SMTP id e7-20020a2eb1c7000000b002c5b4d2e9c1mr10242347lja.1.1698762145386; Tue, 31 Oct 2023 07:22:25 -0700 (PDT) Received: from lion.localdomain (host-92-25-138-185.as13285.net. [92.25.138.185]) by smtp.gmail.com with ESMTPSA id i8-20020a05600011c800b0032179c4a46dsm1606372wrx.100.2023.10.31.07.22.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 07:22:24 -0700 (PDT) From: Caleb Connolly Date: Tue, 31 Oct 2023 14:22:20 +0000 Subject: [PATCH 1/6] pinctrl: qcom: move out of mach-snapdragon MIME-Version: 1.0 Message-Id: <20231025-b4-qcom-pinctrl-v1-1-9123d6a217eb@linaro.org> References: <20231025-b4-qcom-pinctrl-v1-0-9123d6a217eb@linaro.org> In-Reply-To: <20231025-b4-qcom-pinctrl-v1-0-9123d6a217eb@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-46309 X-Developer-Signature: v=1; a=openpgp-sha256; l=15298; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=iKkdUxMzQM+517lI1SuARfyiDnBA9QwIvFrUBC9lhtA=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhlRH3nnFJX7iF+KW/5zQaXDjwlHZpPvuTSuetnVP3dx/u VFJrHhlRykLgyAHg6yYIov4iWWWTWsv22tsX3ABZg4rE8gQBi5OAZgI81yGf7plpl2/z9m80drw 8PlnBl6LxIsXInw6P4erfvoS2Kn4QIWRYcPdY2vv/FV8rvic64jSebXd04VZLj9+POdlYOeP3Qf qOcoA 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. Signed-off-by: Caleb Connolly Reviewed-by: Sumit Garg --- 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 +++++++++-- 12 files changed, 148 insertions(+), 37 deletions(-) diff --git a/arch/arm/mach-snapdragon/Kconfig b/arch/arm/mach-snapdragon/Kconfig index eaf75abf4bd5..d12eb42ef9e2 100644 --- a/arch/arm/mach-snapdragon/Kconfig +++ b/arch/arm/mach-snapdragon/Kconfig @@ -17,6 +17,7 @@ config SDM845 default n select LINUX_KERNEL_IMAGE_HEADER imply CLK_QCOM_SDM845 + imply PINCTRL_QCOM_SDM845 config LNX_KRNL_IMG_TEXT_OFFSET_BASE default 0x80000000 @@ -29,6 +30,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: @@ -43,6 +45,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: @@ -77,6 +80,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..d41272ce9c95 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("qcom_pinctrl"); + 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(qcom_pinctrl) = { + .name = "qcom_pinctrl", .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 Tue Oct 31 14:22:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 739558 Delivered-To: patch@linaro.org Received: by 2002:a5d:4c47:0:b0:32d:baff:b0ca with SMTP id n7csp1675461wrt; Tue, 31 Oct 2023 07:22:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEhD5ZgRlk5oTvW55IqXDuxBdsk5tfb82ybhYphGkdQ8HzGEkyZFDC6m4dee2n7/WtTAhQO X-Received: by 2002:a05:600c:5489:b0:402:f5c4:2e5a with SMTP id iv9-20020a05600c548900b00402f5c42e5amr11508625wmb.37.1698762157965; Tue, 31 Oct 2023 07:22:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698762157; cv=none; d=google.com; s=arc-20160816; b=CQ7UCfp+v9yT2Cuy4HzTS+xtZW00t7sJISkXg3SwaHfhOCXUvIN7y9uPaM5hsOnRnt OqhDBpHMhsILcuf4g9cekZvQha66XMiT6P7zSGGbUCzBKLjBVzGHkOzp9PDVIzy9SjPU rPZSRzd6tkpTkNhtHw7a048BCa7l9+ep26LTmC2FuEJUY3fC98JFBJcZAVdoYlfyYRqn k6CaPgmbEOQNr/5Bnxln7YqLf+WBkNiI2bKyIX2tkC3rl/lXI8QCiJagcQ8Ejok2fhAO lz8kZZEExJrqxR2asi9FI6hLHx15R7jDO2YX7M59sq57meYzeOZc0nmXNNgR4pJy9ae7 H4ew== 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=eaO9lw4pbX+Whsfho8D3KoTkibmHVZw0Fz2SAbWnL/E=; fh=GowdQhFHojjDa0VFAVprx0l6qpleMCeMha4WUJGY9kk=; b=px9ECH1LMZNDVbVlMNeCrvLt0SWoWlet86ZeilGmqMBcm5oCuNdvPNiyUKGCNWJ0Ww +T0lvgWD2RZ2srlDSg09z7dPSCHwjTjilIsTqz88uomMTY9kKsVJ1RQ4XCeK4ag/hMs5 yRE+ez807SnGewlKOWGmlbxq66oNP2Y4U4xiyao9wJMG8h1imdzDHEXg10fmCv3ksA8h +WKV9aq3d5bbYT8Nh15qs26l5ZOYCouGoWzUsN2Vqn0X8U7qbgFtOepR9fNc5lz11QTh Qeg8K5JYjiVgEgJ+Wvip3z90mQXWjG8dU6X/z38fGVs1LGzhSeoLXQP4JokKnYfyZwzq S2Kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CoxjdtNa; 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 x11-20020adfec0b000000b0032339d25a63si1035157wrn.106.2023.10.31.07.22.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 07:22:37 -0700 (PDT) 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=CoxjdtNa; 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 9174387CDC; Tue, 31 Oct 2023 15:22:31 +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="CoxjdtNa"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 24C3C87CE4; Tue, 31 Oct 2023 15:22:30 +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 autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) (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 0938587CD2 for ; Tue, 31 Oct 2023 15:22: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=caleb.connolly@linaro.org Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40850b244beso44295135e9.2 for ; Tue, 31 Oct 2023 07:22:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698762146; x=1699366946; 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=eaO9lw4pbX+Whsfho8D3KoTkibmHVZw0Fz2SAbWnL/E=; b=CoxjdtNaMyFnkoaH1yt8kAsjnHya5ynnpNIJLt6ugONS5pTlTkdyp5ZkS7vEeD6Skn R4wNjZG2/WP/0nIYZAR/wnT1VPKDXmwKYP2hyY7E1UxPtDOwBfhhbfWpGZU8N9a2Xn5a t32t92yZxRAnsbRU5OJRP/db5ylhkZoA3lpWpvYdU3JlYEIola3NFcca07pQCdKAMEQZ xV0fsgBLoifV/P6O/6b/wvDB06iSJTVL8zkOLbZdiZQas7Z7kEZFthWIvpbzecGMNDsr RSJsAbhqU1Xcvg5UJywt5X85VRHUMVd9lZJpWqmdDRXFehE5CgeuGFdvx/zUKP7GKaJ2 FhCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698762146; x=1699366946; 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=eaO9lw4pbX+Whsfho8D3KoTkibmHVZw0Fz2SAbWnL/E=; b=S9aeB4L1dXi0/rpNQLIsyeSWLxa/MVm2Fbj6OK2AgwSTGDC6f6nvkm+znKcbk0PqwD TDnlrkjlNixSVxxbNfJMhMevjDIg9FAMBrZrgKbPyH4jt/ZBCeR4dT5fDDR/eKtxGCZB 47oAtN+f/mZd81Y/z5axzrgMOiCg/l0jICE7up0RLQ0S71NeW9pxQMngjHHDn8YV3RF6 yf70p/NikW6fI0cp/Is+A8nN5pWN1XbIq/bA9/cPG0xcZ/Fq0DzHWQiSXOfdcUDwhHEX nAgMALGRxLnJyZ+mJse4KztId5/VOaJghtpRJKxWIkI36EzjI7NAFVF+jiz/mqXW9O/5 PgaQ== X-Gm-Message-State: AOJu0YwRrNlL0WBvloRBWhVTwovltmuWrTFuVoKuCwvywcR/DkFwRf4B /7m1aaHrCodtDGk7wJ8FDdaIWQ== X-Received: by 2002:a05:600c:3ba0:b0:405:359e:ee43 with SMTP id n32-20020a05600c3ba000b00405359eee43mr12056950wms.1.1698762146310; Tue, 31 Oct 2023 07:22:26 -0700 (PDT) Received: from lion.localdomain (host-92-25-138-185.as13285.net. [92.25.138.185]) by smtp.gmail.com with ESMTPSA id i8-20020a05600011c800b0032179c4a46dsm1606372wrx.100.2023.10.31.07.22.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 07:22:25 -0700 (PDT) From: Caleb Connolly Date: Tue, 31 Oct 2023 14:22:21 +0000 Subject: [PATCH 2/6] pinctrl: qcom: make compatible with linux DTs MIME-Version: 1.0 Message-Id: <20231025-b4-qcom-pinctrl-v1-2-9123d6a217eb@linaro.org> References: <20231025-b4-qcom-pinctrl-v1-0-9123d6a217eb@linaro.org> In-Reply-To: <20231025-b4-qcom-pinctrl-v1-0-9123d6a217eb@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-46309 X-Developer-Signature: v=1; a=openpgp-sha256; l=17614; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=TtZM3vcBWcpxSGjSgH3enzxdVBoW1AlEr6z1kDiUcaA=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhlRH3nnis9TSOrwcKrllTnJeuvqL6b6HntuCqN9X7NyaJ Sb3X3LtKGVhEORgkBVTZBE/scyyae1le43tCy7AzGFlAhnCwMUpABNxN2BkmH0sxvmM34Oa2ohi N+7w2Z5pFqpL1p+9nf36kfqRj+ybChn+Z9bOLhPv6b1XcOnRy72xLlOtc/R7XG5ya9j4ynCVvnH jBQA= 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 --- 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 ++++++------ drivers/gpio/msm_gpio.c | 36 +++++++++++++++----------- drivers/pinctrl/qcom/pinctrl-apq8016.c | 2 +- drivers/pinctrl/qcom/pinctrl-apq8096.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 +++++++++++++++++++++++++++++++-- include/qcom-gpio.h | 28 ++++++++++++++++++++ 12 files changed, 133 insertions(+), 57 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/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-qcom.c b/drivers/pinctrl/qcom/pinctrl-qcom.c index d41272ce9c95..fb255f9572f4 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..efb6a44b1409 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, diff --git a/include/qcom-gpio.h b/include/qcom-gpio.h new file mode 100644 index 000000000000..8dac62f870b9 --- /dev/null +++ b/include/qcom-gpio.h @@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Qualcomm common pin control data. + * + * 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_ */ From patchwork Tue Oct 31 14:22:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 739560 Delivered-To: patch@linaro.org Received: by 2002:a5d:4c47:0:b0:32d:baff:b0ca with SMTP id n7csp1675672wrt; Tue, 31 Oct 2023 07:22:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGo1ptFDuA0n9XThSsRQ8lZfLMWwg9DcYpWfXX9ZIAvtdoNVY7ITD1VbBzZ3Q2ndR0Yg92o X-Received: by 2002:a05:6512:1388:b0:508:26b6:bc21 with SMTP id fc8-20020a056512138800b0050826b6bc21mr11111287lfb.40.1698762177366; Tue, 31 Oct 2023 07:22:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698762177; cv=none; d=google.com; s=arc-20160816; b=zHPfBEL2VYoHDjwNLMGMPQWI0su3iVHZTq2GP2MbKfQhxoxfffHi9epDz91gJMfp7A OWMlmk9j1yzGNlF/jo8sBFXXsmyRzwTtSpNvmuDavDWSqWzYZEhROqdysOCa1D/aigdZ g8RjXL+HBK6QC++dU+wpbO1TiuBMxN4VLKu1TLYKsXJ777+IhgrOAcp08mwHFSR0VhIk mcRze3jcJ3x+B8nPUd6HQp7TvfJhZg6ITM9K8Q57Gc87IpMqPgAEPRdwBPZSSIyPXcla NpKjp1kTFrLmTo7yy2O7jW34VLjol9n8+8QMiut13Kmv5xgF9ThvcGHcprMgFg6HYIpL qcoQ== 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=NhJkvsqeH26xhzz3On9J8EE5x3d4Voihs5NEbH/jPBA=; fh=GowdQhFHojjDa0VFAVprx0l6qpleMCeMha4WUJGY9kk=; b=I7hGgw5Wr7iCJVIzNLtZ567h5trJi+FTOp0++S6giMTMfem8fuUFCzqfHk7oLgHlS9 JQ05Skl+BoVt2cUkLop9uf3Urb8ZDT+EzE58U/5Sby5ylvUgN7tpqqFbuYhJ5eJVOIGs UEGEjKmWwoOwl1B2MjlkjSjI+5uBTh3b9uRfY4zsJwdz4fY9DYGxkGZ74/FsnJmwzK8o b3G2Rm/ffwKZAfHwHMjvdF2WGebxx8qFUezuMfYNNC48kCux+i32EwKUpm6+olJpNk8i /CFMIw6jwjrYUZXPSY2h59TJ8l3i7ODp9vY9ZGbHkiNf3abg/gJfA3h2HMgtYpUAm4LF slnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=exmKQ1BJ; 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 i11-20020adffdcb000000b0032d9756f644si1007441wrs.148.2023.10.31.07.22.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 07:22:57 -0700 (PDT) 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=exmKQ1BJ; 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 A6B3787CD5; Tue, 31 Oct 2023 15:22: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="exmKQ1BJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E7C1187CE3; Tue, 31 Oct 2023 15:22:30 +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 autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) (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 1E72887CCE for ; Tue, 31 Oct 2023 15:22:28 +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-x233.google.com with SMTP id 38308e7fff4ca-2c503da4fd6so83871861fa.1 for ; Tue, 31 Oct 2023 07:22:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698762147; x=1699366947; 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=NhJkvsqeH26xhzz3On9J8EE5x3d4Voihs5NEbH/jPBA=; b=exmKQ1BJZP+h48HCM8LyqbAAY6g9eyhSvJVu5wyouSzzAfSThqMCm4FcHjX9VGaIOr 6e7pzEddBnnXG1zxBViy3cgm4b7Cils7SmtOjw69ZW75+86zbSlH8wcnUv1sxgJiyrmM TtAQyZTQmlTvPHvL5gbVCqFpdHjLSwlg67h+St3OgPGIvvZZqS5wEWnYQCPsowYD0Aq6 M/mq8obCaJ/6sU0aQBSaEdcGOmBkx85BqjJIdEYsZri9aLLECC58mBUsT39XKsyYwHrx Bx6Yb77H3gZmjsUQZ7pAq7oM6zGDNX+QTKCfk9dn1rY7mcJaCDWEst+TzaHeRU6ilz2D X1QQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698762147; x=1699366947; 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=NhJkvsqeH26xhzz3On9J8EE5x3d4Voihs5NEbH/jPBA=; b=Lhd/i5mvrgU0AjlVBtoGylf5xPeA6WMebmo6XDZ/MzVZx+ifLny89mehFxuRczfta/ lrdtrRMgyLrdK271fnQfncZvczEd8BvpNVvkWufu7CrnRwznRCQm+LRqwf5pvuAZhmFx WPHCti5cOgLPaYQA52+nXaS8e121f0POTykmrwz3/jaeHy90kkphghu7zp7UIMqK19lY e0rOIasHL1RagicfgF9sVt5tfNoOv/pUM3DUdAAEIcLRT/M+EMcdkt/e2XoXlJlZTfEX tZTR5UtDw0Pum2hmpQJ1MPPtHZ+NdWlJFyTmCdmw/wbaTNqoGP/7irAvkSktKd8ip8z/ hExA== X-Gm-Message-State: AOJu0YwAT+JV3er/5gAc/UA0txK/h+Tp6vtKyW/5Mfeq1zZNYJhCQWC4 MCrVXSZyg9HxbJHV2BC88NwAKQ== X-Received: by 2002:a2e:7214:0:b0:2c5:16c0:6239 with SMTP id n20-20020a2e7214000000b002c516c06239mr9418790ljc.51.1698762147388; Tue, 31 Oct 2023 07:22:27 -0700 (PDT) Received: from lion.localdomain (host-92-25-138-185.as13285.net. [92.25.138.185]) by smtp.gmail.com with ESMTPSA id i8-20020a05600011c800b0032179c4a46dsm1606372wrx.100.2023.10.31.07.22.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 07:22:26 -0700 (PDT) From: Caleb Connolly Date: Tue, 31 Oct 2023 14:22:22 +0000 Subject: [PATCH 3/6] pinctrl: qcom: handle reserved ranges MIME-Version: 1.0 Message-Id: <20231025-b4-qcom-pinctrl-v1-3-9123d6a217eb@linaro.org> References: <20231025-b4-qcom-pinctrl-v1-0-9123d6a217eb@linaro.org> In-Reply-To: <20231025-b4-qcom-pinctrl-v1-0-9123d6a217eb@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-46309 X-Developer-Signature: v=1; a=openpgp-sha256; l=6450; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=0UA8x4Su+Co9GLP/yQeQXq0nmQNoFwaS3kSMCHitRRc=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhlRH3nl75pg8O70wVW3+4i+Pz3ds/Kse4l1yoEaOqfB16 xz1vccOd5SyMAhyMMiKKbKIn1hm2bT2sr3G9gUXYOawMoEMYeDiFICJbHzF8E8vdYdn2Ka0lQ9k Tz1nLe2zCr8Wbn3Y5uKFsjVXUlqPe4QzMrRGPsoJvVpx54j4MyPB3cdnlequ/Fy3+odYqbbtq1k beacCAA== 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 Some Qualcomm boards feature reserved ranges of pins which are protected by firmware. Attempting to read or write any registers associated with these pins results the board resetting. Add support for parsing these ranges from devicetree and ensure that the pinctrl and GPIO drivers don't try to interact with these pins. Signed-off-by: Caleb Connolly --- drivers/gpio/msm_gpio.c | 15 +++++++++ drivers/pinctrl/qcom/pinctrl-qcom.c | 64 +++++++++++++++++++++++++++++++++++++ include/qcom-gpio.h | 15 +++++++++ 3 files changed, 94 insertions(+) diff --git a/drivers/gpio/msm_gpio.c b/drivers/gpio/msm_gpio.c index 7d77776a25fd..7a09abdafb2e 100644 --- a/drivers/gpio/msm_gpio.c +++ b/drivers/gpio/msm_gpio.c @@ -39,6 +39,9 @@ static int msm_gpio_direction_input(struct udevice *dev, unsigned int gpio) { struct msm_gpio_bank *priv = dev_get_priv(dev); + if (msm_pinctrl_is_reserved(dev_get_parent(dev), gpio)) + return 0; + /* Disable OE bit */ clrsetbits_le32(priv->base + GPIO_CONFIG_REG(dev, gpio), GPIO_OE_MASK, GPIO_OE_DISABLE); @@ -50,6 +53,9 @@ static int msm_gpio_set_value(struct udevice *dev, unsigned gpio, int value) { struct msm_gpio_bank *priv = dev_get_priv(dev); + if (msm_pinctrl_is_reserved(dev_get_parent(dev), gpio)) + return 0; + value = !!value; /* set value */ writel(value << GPIO_OUT, priv->base + GPIO_IN_OUT_REG(dev, gpio)); @@ -62,6 +68,9 @@ static int msm_gpio_direction_output(struct udevice *dev, unsigned gpio, { struct msm_gpio_bank *priv = dev_get_priv(dev); + if (msm_pinctrl_is_reserved(dev_get_parent(dev), gpio)) + return 0; + value = !!value; /* set value */ writel(value << GPIO_OUT, priv->base + GPIO_IN_OUT_REG(dev, gpio)); @@ -76,6 +85,9 @@ static int msm_gpio_get_value(struct udevice *dev, unsigned gpio) { struct msm_gpio_bank *priv = dev_get_priv(dev); + if (msm_pinctrl_is_reserved(dev_get_parent(dev), gpio)) + return 0; + return !!(readl(priv->base + GPIO_IN_OUT_REG(dev, gpio)) >> GPIO_IN); } @@ -83,6 +95,9 @@ static int msm_gpio_get_function(struct udevice *dev, unsigned gpio) { struct msm_gpio_bank *priv = dev_get_priv(dev); + if (msm_pinctrl_is_reserved(dev_get_parent(dev), gpio)) + return GPIOF_UNKNOWN; + if (readl(priv->base + GPIO_CONFIG_REG(dev, gpio)) & GPIO_OE_ENABLE) return GPIOF_OUTPUT; diff --git a/drivers/pinctrl/qcom/pinctrl-qcom.c b/drivers/pinctrl/qcom/pinctrl-qcom.c index fb255f9572f4..92b35c198788 100644 --- a/drivers/pinctrl/qcom/pinctrl-qcom.c +++ b/drivers/pinctrl/qcom/pinctrl-qcom.c @@ -20,9 +20,13 @@ #include "pinctrl-qcom.h" +#define MSM_PINCTRL_MAX_RESERVED_RANGES 32 + struct msm_pinctrl_priv { phys_addr_t base; struct msm_pinctrl_data *data; + u32 reserved_ranges[MSM_PINCTRL_MAX_RESERVED_RANGES * 2]; + int reserved_ranges_count; }; #define GPIO_CONFIG_REG(priv, x) \ @@ -61,13 +65,53 @@ static const char *msm_get_function_name(struct udevice *dev, return priv->data->get_function_name(dev, selector); } +static int msm_pinctrl_parse_ranges(struct udevice *dev) +{ + struct msm_pinctrl_priv *priv = dev_get_priv(dev); + int count; + + if (ofnode_read_prop(dev_ofnode(dev), "gpio-reserved-ranges", + &count)) { + if (count % 2 == 1) { + dev_err(dev, "gpio-reserved-ranges must be a multiple of 2\n"); + return -EINVAL; + } + /* Size is in bytes, but we're indexing by ints */ + count /= 4; + + if (count > MSM_PINCTRL_MAX_RESERVED_RANGES) { + dev_err(dev, "gpio-reserved-ranges must be less than %d (got %d)\n", + MSM_PINCTRL_MAX_RESERVED_RANGES, count); + return -EINVAL; + } + + priv->reserved_ranges_count = count; + for (count = 0; count < priv->reserved_ranges_count; count++) { + if (ofnode_read_u32_index(dev_ofnode(dev), "gpio-reserved-ranges", + count, &priv->reserved_ranges[count])) { + dev_err(dev, "failed to read gpio-reserved-ranges[%d]\n", count); + return -EINVAL; + } + } + } + + return 0; +} + static int msm_pinctrl_probe(struct udevice *dev) { struct msm_pinctrl_priv *priv = dev_get_priv(dev); + int ret; priv->base = dev_read_addr(dev); priv->data = (struct msm_pinctrl_data *)dev_get_driver_data(dev); + ret = msm_pinctrl_parse_ranges(dev); + if (ret) { + printf("Couldn't parse reserved GPIO ranges!\n"); + return ret; + } + return priv->base == FDT_ADDR_T_NONE ? -EINVAL : 0; } @@ -83,6 +127,9 @@ static int msm_pinmux_set(struct udevice *dev, unsigned int pin_selector, { struct msm_pinctrl_priv *priv = dev_get_priv(dev); + if (msm_pinctrl_is_reserved(dev, pin_selector)) + return 0; + 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); @@ -94,6 +141,9 @@ static int msm_pinconf_set(struct udevice *dev, unsigned int pin_selector, { struct msm_pinctrl_priv *priv = dev_get_priv(dev); + if (msm_pinctrl_is_reserved(dev, pin_selector)) + return 0; + switch (param) { case PIN_CONFIG_DRIVE_STRENGTH: argument = (argument / 2) - 1; @@ -178,3 +228,17 @@ U_BOOT_DRIVER(qcom_pinctrl) = { .ops = &msm_pinctrl_ops, .probe = msm_pinctrl_probe, }; + +bool msm_pinctrl_is_reserved(struct udevice *dev, unsigned int pin) +{ + struct msm_pinctrl_priv *priv = dev_get_priv(dev); + unsigned int i, start; + + for (i = 0; i < priv->reserved_ranges_count; i += 2) { + start = priv->reserved_ranges[i]; + if (pin >= start && pin < start + priv->reserved_ranges[i + 1]) + return true; + } + + return false; +} diff --git a/include/qcom-gpio.h b/include/qcom-gpio.h index 8dac62f870b9..490a1de55f89 100644 --- a/include/qcom-gpio.h +++ b/include/qcom-gpio.h @@ -25,4 +25,19 @@ static inline u32 qcom_pin_offset(const unsigned int *offs, unsigned int selecto return out; } +struct udevice; + +/** + * msm_pinctrl_is_reserved() - Check if a pin lies in a reserved range + * + * @dev: pinctrl device + * @pin: Pin number + * + * Returns: true if pin is reserved, otherwise false + * + * Call using dev_get_parent() from the GPIO device, it is a child of + * the pinctrl device. + */ +bool msm_pinctrl_is_reserved(struct udevice *dev, unsigned int pin); + #endif /* _QCOM_GPIO_H_ */ From patchwork Tue Oct 31 14:22:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 739561 Delivered-To: patch@linaro.org Received: by 2002:a5d:4c47:0:b0:32d:baff:b0ca with SMTP id n7csp1675738wrt; Tue, 31 Oct 2023 07:23:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFiq6iYz3Yoq9+0W8Q00Lwo/g3A+rrs5/USs0jMPQfKKiWiF66pKX0bhiN+A7USknGfNO2I X-Received: by 2002:a05:6512:401d:b0:503:3787:f75a with SMTP id br29-20020a056512401d00b005033787f75amr11052402lfb.62.1698762187721; Tue, 31 Oct 2023 07:23:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698762187; cv=none; d=google.com; s=arc-20160816; b=j2lbz+p4msOx/u25TpAsXkooC4+ToeO8g32MCTPabcCJsTkIpvicoEjuutZ3Mu0znu EsxFIw9HUyXxfZ/ctABLvmSYZPZ5GV9NxCewYemV4OjXduwrieoI8ighge9vV92+VotX YqPClEgGoTID7Et1AtZmOWLq4xTtO7yjVfNBwBLKKcfHba6/U8DOTujrpzj3JmsjVOkM gnWX4Ml1+fRDy0mmGN7MfqJSLNvj6FOjUBQZ5s5Rb5F0XZQm3fcjbH5XbNEpAB8OSQu+ 4opa6Yqyf+LsK/mXZZBYjVffpGBXZB4ORyuZ1GMaGRdqILwtQSlEdK0oPBuMbz0dW0zK Mhlw== 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=XSVO4sgdYl+x8pJZ214whfLvPOHlW+yGmHoHraAK74I=; fh=GowdQhFHojjDa0VFAVprx0l6qpleMCeMha4WUJGY9kk=; b=M4lbczZwiMUsZG1pgi4eumKXQHjv9/E83l3WTGmAk3qNvwkalpETBNs8p5XWRZ1JHt NkGmxfwIIWDUqwpZTKfMV7uNP/qAJrH3lmm3MIbd+x1it50HonIWzEq1Pphrf8x0vjzZ 2rCTtltgIULWhXv+Tshebsc63gkFb3ppLWScVMf8OSwN4fNb0UN38WYas+514bGQwTnC RqW4hM6gCZ1Z14gEauPLtRu7jKP95pPixvDqsi9H8sp9c4vZL+6TIKQ51aq5zjMu5wZC xz8CQ4wZ2ipiFZ3yE0ShboUIwTWEggGjfr9LrB19aomB/NHyVa1GtE3b9PCrVZYoHzq/ piFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="jSJ/sOf1"; 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 c1-20020a5d4f01000000b003215c6dcde9si946119wru.369.2023.10.31.07.23.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 07:23:07 -0700 (PDT) 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="jSJ/sOf1"; 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 3310587CDA; Tue, 31 Oct 2023 15:22: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="jSJ/sOf1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F03B387CE8; Tue, 31 Oct 2023 15:22:31 +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 autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) (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 E3CFA87CE0 for ; Tue, 31 Oct 2023 15:22:28 +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-wr1-x42b.google.com with SMTP id ffacd0b85a97d-32dc918d454so3641491f8f.2 for ; Tue, 31 Oct 2023 07:22:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698762148; x=1699366948; 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=XSVO4sgdYl+x8pJZ214whfLvPOHlW+yGmHoHraAK74I=; b=jSJ/sOf1rgHwfqpB1kbXCT+jJ9PUqG1+0ubmaj2SOSouyrrBYxPm01LmJKEiQyrp5W skJz7aIoB8rPvCyfabkdpSPx93qdMI6kOXKqZ5mOnb6XRAMiB9auqd71YqO8cSCKLYry AzPqMHZtx0MyZP2V9D2op1uOmaO1vRMUOD7HxxmssmJatJ3QrFz0JSdWbcVFv8Mn+Sm5 43/C0yRQcKvQr7Wp7V3W2PNHuDtWHoKtT80dRW4qYd9nY0l9iYi2NYEzgRuU2HLK231z dIVTWs7ZFusQmkcE/G2raq/kME9rFWtGv4ujkmzDYxE4/hWiV1OPyVu+GIjzN+j4rUOo ZMFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698762148; x=1699366948; 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=XSVO4sgdYl+x8pJZ214whfLvPOHlW+yGmHoHraAK74I=; b=HnFTTNae0wTEgR2nUUiIiMpKstHWkSl5U7C8zyfbUSK9G7lYpIzYMSaZ4vOsAiC2pX olwQQFUCjH+/g125M1z+HEK3s01Oo+Vu71XxyWKmnwX71i47SdR7q5ac5TsOh9/koUEi 2kzkSLbk9cJNJxVSqo8PYPKhW+xM6kr5aOk7CPsrA8mQCfRUaFW8mWfC5koAzm6mJDg+ 6dq/I22iAd28vUCU3gnTcJT+6DVhT3Na2a+oopRO2rMmJ0zkMzGrBFZ4VKU3JxDVXjnR orZxPUdmwuHvWBRVPqkdy/DOIyEFVOOqCxkPNledLLPwcVhuw0gZA1+GHoXpvHGn/4uf +XvQ== X-Gm-Message-State: AOJu0YxDMAqyO8R7cD7WKaa3vfgsIyNqACKbfIrsdkkbPjRhzdaIj355 Vrer93we1cR6yebzl5IINmiBXA== X-Received: by 2002:adf:eacf:0:b0:32d:a2c3:19f3 with SMTP id o15-20020adfeacf000000b0032da2c319f3mr8566708wrn.41.1698762148495; Tue, 31 Oct 2023 07:22:28 -0700 (PDT) Received: from lion.localdomain (host-92-25-138-185.as13285.net. [92.25.138.185]) by smtp.gmail.com with ESMTPSA id i8-20020a05600011c800b0032179c4a46dsm1606372wrx.100.2023.10.31.07.22.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 07:22:27 -0700 (PDT) From: Caleb Connolly Date: Tue, 31 Oct 2023 14:22:23 +0000 Subject: [PATCH 4/6] msm_qcom: use unsigned int MIME-Version: 1.0 Message-Id: <20231025-b4-qcom-pinctrl-v1-4-9123d6a217eb@linaro.org> References: <20231025-b4-qcom-pinctrl-v1-0-9123d6a217eb@linaro.org> In-Reply-To: <20231025-b4-qcom-pinctrl-v1-0-9123d6a217eb@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-46309 X-Developer-Signature: v=1; a=openpgp-sha256; l=1754; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=laGwLFWmOYwYMdfhRKLjhUz9Wsyx8bfPIGbW+nHyTkA=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhlRH3nmhVV03kn7fM+pP9uy91PLK6Dh7sNo7vyXv0zc+X LA/Ra+lo5SFQZCDQVZMkUX8xDLLprWX7TW2L7gAM4eVCWQIAxenAEzklxXDP52flk4Nj9vOHKnR NlaemqVnHbD6j5WKnbzDoeL1usWLzzP8Uzt24sW63/z7t6385XrkQfv5Day/Yr9vFdCduPqo3Iz Gc5kA 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". Signed-off-by: Caleb Connolly Reviewed-by: Sumit Garg --- 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 7a09abdafb2e..7d01fecf46f2 100644 --- a/drivers/gpio/msm_gpio.c +++ b/drivers/gpio/msm_gpio.c @@ -49,7 +49,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); @@ -63,7 +63,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); @@ -81,7 +81,7 @@ 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); @@ -91,7 +91,7 @@ static int msm_gpio_get_value(struct udevice *dev, unsigned gpio) 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 Tue Oct 31 14:22:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 739562 Delivered-To: patch@linaro.org Received: by 2002:a5d:4c47:0:b0:32d:baff:b0ca with SMTP id n7csp1675843wrt; Tue, 31 Oct 2023 07:23:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IECX753tr6Dx3IY70X906BXdzoCPCO8INvcyesHtxc6Ubyg7zOHEKPy0iqbnNhUrTw3oFD0 X-Received: by 2002:a05:6512:31d0:b0:508:1332:558a with SMTP id j16-20020a05651231d000b005081332558amr12745588lfe.2.1698762197450; Tue, 31 Oct 2023 07:23:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698762197; cv=none; d=google.com; s=arc-20160816; b=NG1mv2alceEol+u+gKL8QgLgN7IhZAhc/BNIWkXWFt6NB0DET6W6kMNzD7Yk9490ME MNhyu1dnltCrGwSdDIFtj/0sl7hwCh09EpJtH/BpxZGb8bafE9crIlbvX1FE/c9qVedX 6m9ogSiVnN2hp0TPlkNDn46AG7V6cAO/Cj1BvDG21iYS3jzubdXIC3iDuRJcAfskMaHc bHxl18DsVBFYZKeN8PW2RGxadkzBkgMqDc3Ax8zvSJ2d2ON0ZSzu6a/BkxQ6ZfaDfDmM ypTKS3yZxbmvnUe9tPrOaS1ZZLEEyXLUHSqkngEEFD+BfB2HfKJPX9c/WpBCBuXKZWS2 j7fQ== 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=tPP2fJgWyUNhL5R/J+/+FyEazXc/PnhBFKL8CgJOmGQ=; fh=GowdQhFHojjDa0VFAVprx0l6qpleMCeMha4WUJGY9kk=; b=PFjRx94NfOXBv+Z3DS687zs36GxQXiP2n0LlIu1Q7gV1bkZV1zvF9GEV86cYLr8t6q oAv8IZ2vBV87kedADYqfvIMW2NLn99Sa3+4sydfH1BB8M5BF2xij/njq6ycz5hy6Ml0S 4rDHUqugdXHQ0gZcbJBRcwHg2nOQS3Lqufdz3tXmylX/WEtxhplulYunivtVN0OvREhj zYVNPCpz+/fzo2pP9kHb5iDzzD937dBaMU0mIxZz7H5rJulBTfE7krOY6P9MGR0Ez+qY dv+6fYwC68TDZMCeA23q6UOfxd+Ke06+h8BjnwySDQO1MVQLYK4zrELYRAZU8PjoT9Er kjiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XF5P6MDH; 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 c5-20020a05600c0ac500b0040303e87ee7si1019789wmr.156.2023.10.31.07.23.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 07:23:17 -0700 (PDT) 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=XF5P6MDH; 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 9A7CD87CE7; Tue, 31 Oct 2023 15:22: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="XF5P6MDH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8FDCB87CD3; Tue, 31 Oct 2023 15:22:33 +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 autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) (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 7F1F287CD6 for ; Tue, 31 Oct 2023 15:22:30 +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-wr1-x433.google.com with SMTP id ffacd0b85a97d-32deb2809daso3640326f8f.3 for ; Tue, 31 Oct 2023 07:22:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698762150; x=1699366950; 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=tPP2fJgWyUNhL5R/J+/+FyEazXc/PnhBFKL8CgJOmGQ=; b=XF5P6MDHhgw9F/U1h7qILiS3Oyls7w2hwz2VrYH6nhSmi7HJsn/Y9dK65BMPtzJVRe WNjRSbyTYKVjfR92zJ4VXVrcvcEZ8K9bylXJgaBfUt2g1wyIH26QFxBBj4EtrNiu8elU O3ALhL1kApDYZXM8PAI5B33z+W0d1r8dQ1K81h+Ft+wVtF/D7KrFSSpi8EF3Ars8D1cD Gp4+ykuC8jyi+gjUlhKGJ9Pp4enmKMh8MkcACCqPF0C6Afaf4YXWLpeX/O4iEcSlHTBk fJoBETGLnHQP7l9O2af/UMkAVIJnPgM607DL2v4c7efHangsL1utrh+f4dMm70gRRbAd Wgnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698762150; x=1699366950; 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=tPP2fJgWyUNhL5R/J+/+FyEazXc/PnhBFKL8CgJOmGQ=; b=aCa5YMqWxpSU7UTkMK81Yr3Fd9FloMaGC0rhWmc7HqhCbYFYLS2iwiVmq4oLWukuDC RXYZ/SADf+Cw0eouFibZRxbPj6ITzq039FDWNXAMn3GUHAfuIAo6k6w8mq0MtBUZgjuF wpRpPXShtQN7fukFTOLJQeSfnD4zso7rvDI84Q0/otXHtC/5t8KJyUc18xNhcZJFVNcu tzT82nQgeXFm8PWmVrScXBCSaeIl2Ibt3YGTbYc/0+WJUk9MmB7vVr237N+Vg2QfXNyD AO/ZLUwpv3xDz3tzk36ZiAodAdwH1vYhHMYdp2g8AAxvHNtU+6UTgBpmRg5PBT6A+a2F fnQQ== X-Gm-Message-State: AOJu0Yw0L8/0WcRGIsq0HNN00GxyrqI7m54tGt44lQSNsMpIn74mhczw tygcWfUPJsyYVLFh1rWRWbj0kQ== X-Received: by 2002:adf:f605:0:b0:32d:89b5:7fd9 with SMTP id t5-20020adff605000000b0032d89b57fd9mr9794708wrp.56.1698762149920; Tue, 31 Oct 2023 07:22:29 -0700 (PDT) Received: from lion.localdomain (host-92-25-138-185.as13285.net. [92.25.138.185]) by smtp.gmail.com with ESMTPSA id i8-20020a05600011c800b0032179c4a46dsm1606372wrx.100.2023.10.31.07.22.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 07:22:28 -0700 (PDT) From: Caleb Connolly Date: Tue, 31 Oct 2023 14:22:24 +0000 Subject: [PATCH 5/6] pinctrl: qcom: move ipq4019 driver from mach-ipq40xx MIME-Version: 1.0 Message-Id: <20231025-b4-qcom-pinctrl-v1-5-9123d6a217eb@linaro.org> References: <20231025-b4-qcom-pinctrl-v1-0-9123d6a217eb@linaro.org> In-Reply-To: <20231025-b4-qcom-pinctrl-v1-0-9123d6a217eb@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-46309 X-Developer-Signature: v=1; a=openpgp-sha256; l=10212; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=sEd3ij01Ig8S3I9DQ25cjXKatV1D5I0TjxGQBhEyvJE=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhlRH3nlT375VXb8h5DOLwuXcY6fjbBbaJ816+j+kPTfd9 tScjNgZHaUsDIIcDLJiiiziJ5ZZNq29bK+xfcEFmDmsTCBDGLg4BWAip5MY/qfH2JlUWpw/FXxO JWBhisibA9b2W3gefZAU6vy7qYXh9UuG/8FOrW4hk06nxz5fsbH4ffPNXX8Ppb9uvPToWOYWn6w T6goA 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. Signed-off-by: Caleb Connolly Acked-by: Sumit Garg --- 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 | 25 +++- 7 files changed, 28 insertions(+), 210 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index faccfaf720a8..23daed70aac9 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 71% rename from arch/arm/mach-ipq40xx/pinctrl-ipq4019.c rename to drivers/pinctrl/qcom/pinctrl-ipq4019.c index 3e365f8cc86a..2d99f99e1e45 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 = { - .pin_count = 100, +static const struct msm_pinctrl_data ipq4019_data = { + .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, .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 Tue Oct 31 14:22:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 739563 Delivered-To: patch@linaro.org Received: by 2002:a5d:4c47:0:b0:32d:baff:b0ca with SMTP id n7csp1675933wrt; Tue, 31 Oct 2023 07:23:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH+2hsvpV5zTg/1qr5Vt02HWWuZBWcjv81APQsJxs7/L4BmaiRLlE08mxpTTHwC5SUvZF2i X-Received: by 2002:a05:600c:1d83:b0:407:8ee2:997e with SMTP id p3-20020a05600c1d8300b004078ee2997emr11583448wms.27.1698762207189; Tue, 31 Oct 2023 07:23:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698762207; cv=none; d=google.com; s=arc-20160816; b=lvARsD0aUVDysm1doUSYMlrqOI9wGxOJjxcFAjQ63opkfO3eb+7M2NQQ5F0UE2+5UU ircHWAoV9wg+DIibLj9biHN6P++8xgUb4FBEFhDcUKHy2PflfobUyhBcvXxcG5Lhy5IY +NzYUuUlPI2eDdvYpNcxS4XIbul9CDl7WwNN+cdmdopEw0r9jARaPH5Q7V9HwrFfmsAY c0ulO8usnvxti6xHblMYo9lG009L0dt4zaWwSPbzeptcr6uE8Tt3iITNG+OVH6qT8CY8 o08PzANLn8WE3g2XjtpDqQZh5k7m5GxBPqxCtSa/oeUIpoxNKwD09bt0LmMDoYwKY7/R twjg== 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=5uoCT7PoRTkJeEpw5eufKaCQTLnL7NpGre9wPOb5iQc=; fh=GowdQhFHojjDa0VFAVprx0l6qpleMCeMha4WUJGY9kk=; b=pK5x7zU0wHxCypJw3OSDv5AmjbnrmbBWxxgkSs9rwr1YMWSMEn+rx02gYDJ+HB+9ox lUnsSGXbjBlcnp2gKUQIkVXVQJBV6cy7rlvyQV793r2xVXoinPlF1/63QZHEzOxseLZi 6+R1IlUlsJw9NTaJbwHjHOuApsmJfoAwf8d4eGIqUIcN1m4B8+auUdN9zClL+PZEt5qu YHVkp8obOj3x8HKQHOt06FhzhOk9o0lTCyVa/Vi+4+8Jbf12vqfuObCHCWY/BAqgeKj8 eH31V2LTlhvd9rWMUF0Oh6TjX56+ZK6XDCVEZHhAd35ZvOosBcy1oPHRcZf8CKj5FDbr LvfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=obFgFA65; 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 p16-20020a1c7410000000b003fed86af7c5si1019218wmc.178.2023.10.31.07.23.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 07:23:27 -0700 (PDT) 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=obFgFA65; 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 3093C87CE8; Tue, 31 Oct 2023 15:22:40 +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="obFgFA65"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E2FCD87CCF; Tue, 31 Oct 2023 15:22:34 +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 autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) (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 A244287CE3 for ; Tue, 31 Oct 2023 15:22:31 +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-wr1-x435.google.com with SMTP id ffacd0b85a97d-32ddfb38c02so4110484f8f.3 for ; Tue, 31 Oct 2023 07:22:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698762151; x=1699366951; 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=5uoCT7PoRTkJeEpw5eufKaCQTLnL7NpGre9wPOb5iQc=; b=obFgFA659rxNDpXdObRiTwlaG9N5PAICig87On5To8qDgbpz+gaNzBxLpHyKAvzbDM Uzw2bfYlCPmWRgAWNgupxuY1F+1NPfEgvuh9yeJ5u6kn76B0c6gM3K4ZQzTyUW+pA4WZ t6VHhVaD3iLZcQW5TXR7tDVQuM4pp5B4/ESZ4/NpGfqDtpIDL1PvPXKIxBDuvQW3e1xC XV+XyE2OnDLCKB6xKp+BU3SGfrggyZC36H1fGaEsmF/gzuRhcL08iojeqO3mf6RDkrWb WH9BCJqvvG6Z3mT4FHt0XCRXIVl0W3OgGFvSp5iharJCMeB7E/XHXk/I2ATgbu71djHz 7Cng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698762151; x=1699366951; 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=5uoCT7PoRTkJeEpw5eufKaCQTLnL7NpGre9wPOb5iQc=; b=JHbHIQXqd+gfa8IhqrslmVZQkreVZ9Myg+pt7pZPRopnpupFn7EKG8aKrrSWJ4rRkN vXnqAKHwXS5NrI/25sa9T4A5iGW1IfQwwNvYOTQk33o6sKVNeKqX8fyj8ekTyX+AQkb/ uDz9joqKNbdqY+sJWLAUuMBEzzG4lob7kTqIBQweDb3O32k9IZi8pK7mXDJBc0OuIOxi 73OfhR7Cw/ygIyUh/5OG/6do58aAHdje/lc7nTWF4ErWvkE69tdQXLg6EoAy8tdQy+9B 1Gm+4kkvoCJtSbmRoeFdycqPtQ/pY6FEsxq8BJbXnMKdbffjRfLYuAgF1Vt2RuBE6TbL cXlA== X-Gm-Message-State: AOJu0YyHcvmnKGABrY+7tWkj5ZTZsBNArEIjSofXvQ14NqYiDwUaaS6I jk+dkGIRyHmraS1pj7E+gcIFFg== X-Received: by 2002:a05:6000:1566:b0:32f:92f3:dbbb with SMTP id 6-20020a056000156600b0032f92f3dbbbmr2407335wrz.70.1698762151054; Tue, 31 Oct 2023 07:22:31 -0700 (PDT) Received: from lion.localdomain (host-92-25-138-185.as13285.net. [92.25.138.185]) by smtp.gmail.com with ESMTPSA id i8-20020a05600011c800b0032179c4a46dsm1606372wrx.100.2023.10.31.07.22.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 07:22:30 -0700 (PDT) From: Caleb Connolly Date: Tue, 31 Oct 2023 14:22:25 +0000 Subject: [PATCH 6/6] pinctrl: qcom: rename msm -> qcom MIME-Version: 1.0 Message-Id: <20231025-b4-qcom-pinctrl-v1-6-9123d6a217eb@linaro.org> References: <20231025-b4-qcom-pinctrl-v1-0-9123d6a217eb@linaro.org> In-Reply-To: <20231025-b4-qcom-pinctrl-v1-0-9123d6a217eb@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-46309 X-Developer-Signature: v=1; a=openpgp-sha256; l=30957; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=Kk5cxdKp+JzzGsMYkxXwi2E8uJ9QDVD/HewzvlCnQkw=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhlRH3nkbjuaWMp1/fJ7pS+3r1q7D+4La/whnvvvzc9nWp etOzCuN7yhlYRDkYJAVU2QRP7HMsmntZXuN7QsuwMxhZQIZwsDFKQAT0TRg+Cs0R2/yLisfRTbp T2sc2Z49ET2bfUTpnIrGgWfelts4OX8w/FNaMlHkzyeGdNuWFdsbXp2IM4oz26wgezruoFf0tP4 fweoA 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 "MSM" naming hasn't been correct for quite a while now, in line with Linux lets rename all these msm_* functions to qcom_* as well as ensure namespacing is consistent across the pinctrl and GPIO drivers. Signed-off-by: Caleb Connolly --- configs/dragonboard410c_defconfig | 2 +- configs/dragonboard845c_defconfig | 2 +- configs/qcs404evb_defconfig | 2 +- configs/starqltechn_defconfig | 2 +- drivers/gpio/Kconfig | 6 +- drivers/gpio/Makefile | 2 +- drivers/gpio/{msm_gpio.c => qcom_gpio.c} | 72 ++++++++++++------------ drivers/pinctrl/qcom/pinctrl-apq8016.c | 22 ++++---- drivers/pinctrl/qcom/pinctrl-apq8096.c | 22 ++++---- drivers/pinctrl/qcom/pinctrl-ipq4019.c | 18 +++--- drivers/pinctrl/qcom/pinctrl-qcom.c | 96 ++++++++++++++++---------------- drivers/pinctrl/qcom/pinctrl-qcom.h | 8 +-- drivers/pinctrl/qcom/pinctrl-qcs404.c | 22 ++++---- drivers/pinctrl/qcom/pinctrl-sdm845.c | 19 +++---- include/qcom-gpio.h | 6 +- 15 files changed, 149 insertions(+), 152 deletions(-) diff --git a/configs/dragonboard410c_defconfig b/configs/dragonboard410c_defconfig index b338326e34c0..11c631799ccf 100644 --- a/configs/dragonboard410c_defconfig +++ b/configs/dragonboard410c_defconfig @@ -43,7 +43,7 @@ CONFIG_USB_FUNCTION_FASTBOOT=y CONFIG_FASTBOOT_BUF_ADDR=0x91000000 CONFIG_FASTBOOT_FLASH=y CONFIG_FASTBOOT_FLASH_MMC_DEV=0 -CONFIG_MSM_GPIO=y +CONFIG_QCOM_GPIO=y CONFIG_QCOM_PMIC_GPIO=y CONFIG_LED=y CONFIG_LED_GPIO=y diff --git a/configs/dragonboard845c_defconfig b/configs/dragonboard845c_defconfig index a69d82761a8d..afbdc15d88b2 100644 --- a/configs/dragonboard845c_defconfig +++ b/configs/dragonboard845c_defconfig @@ -19,7 +19,7 @@ CONFIG_SYS_CBSIZE=512 CONFIG_CMD_GPIO=y # CONFIG_NET is not set CONFIG_CLK=y -CONFIG_MSM_GPIO=y +CONFIG_QCOM_GPIO=y CONFIG_QCOM_PMIC_GPIO=y CONFIG_PINCTRL=y CONFIG_DM_PMIC=y diff --git a/configs/qcs404evb_defconfig b/configs/qcs404evb_defconfig index 9e72f64f7849..545ee25b0e7d 100644 --- a/configs/qcs404evb_defconfig +++ b/configs/qcs404evb_defconfig @@ -31,7 +31,7 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y # CONFIG_NET is not set CONFIG_CLK=y -CONFIG_MSM_GPIO=y +CONFIG_QCOM_GPIO=y CONFIG_QCOM_PMIC_GPIO=y CONFIG_MISC=y CONFIG_MMC_HS400_SUPPORT=y diff --git a/configs/starqltechn_defconfig b/configs/starqltechn_defconfig index 5b85ce5fe96f..9962211d8ab7 100644 --- a/configs/starqltechn_defconfig +++ b/configs/starqltechn_defconfig @@ -23,7 +23,7 @@ CONFIG_CMD_BMP=y # CONFIG_NET is not set CONFIG_BUTTON=y CONFIG_CLK=y -CONFIG_MSM_GPIO=y +CONFIG_QCOM_GPIO=y CONFIG_QCOM_PMIC_GPIO=y CONFIG_DM_KEYBOARD=y CONFIG_BUTTON_KEYBOARD=y diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 74baa98d3c15..2e57eedd466f 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -259,7 +259,7 @@ config MSCC_SGPIO SIO controller is to connect control signals from SFP modules and to act as an LED controller. -config MSM_GPIO +config QCOM_GPIO bool "Qualcomm GPIO driver" depends on DM_GPIO help @@ -268,9 +268,7 @@ config MSM_GPIO gpio has it's own set of registers. Only simple GPIO operations are supported (get/set, change of direction and checking pin function). - Supported devices: - - APQ8016 - - MSM8916 + See PINCTRL_QCOM for a list of supported platforms. config MXC_GPIO bool "Freescale/NXP MXC GPIO driver" diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index c8b3fd78141a..b5ebcf75dbfa 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -58,7 +58,7 @@ obj-$(CONFIG_IMX_RGPIO2P) += imx_rgpio2p.o obj-$(CONFIG_PIC32_GPIO) += pic32_gpio.o obj-$(CONFIG_OCTEON_GPIO) += octeon_gpio.o obj-$(CONFIG_MVEBU_GPIO) += mvebu_gpio.o -obj-$(CONFIG_MSM_GPIO) += msm_gpio.o +obj-$(CONFIG_QCOM_GPIO) += qcom_gpio.o obj-$(CONFIG_$(SPL_)PCF8575_GPIO) += pcf8575_gpio.o obj-$(CONFIG_$(SPL_TPL_)QCOM_PMIC_GPIO) += qcom_pmic_gpio.o obj-$(CONFIG_MT7620_GPIO) += mt7620_gpio.o diff --git a/drivers/gpio/msm_gpio.c b/drivers/gpio/qcom_gpio.c similarity index 50% rename from drivers/gpio/msm_gpio.c rename to drivers/gpio/qcom_gpio.c index 7d01fecf46f2..a0b183eb0784 100644 --- a/drivers/gpio/msm_gpio.c +++ b/drivers/gpio/qcom_gpio.c @@ -24,22 +24,22 @@ DECLARE_GLOBAL_DATA_PTR; #define GPIO_IN 0 #define GPIO_OUT 1 -struct msm_gpio_bank { +struct qcom_gpio_priv { phys_addr_t base; - const struct msm_pin_data *pin_data; + const struct qcom_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)) + (qcom_pin_offset(((struct qcom_gpio_priv *)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) +static int qcom_gpio_direction_input(struct udevice *dev, unsigned int gpio) { - struct msm_gpio_bank *priv = dev_get_priv(dev); + struct qcom_gpio_priv *priv = dev_get_priv(dev); - if (msm_pinctrl_is_reserved(dev_get_parent(dev), gpio)) + if (qcom_pinctrl_is_reserved(dev_get_parent(dev), gpio)) return 0; /* Disable OE bit */ @@ -49,11 +49,11 @@ static int msm_gpio_direction_input(struct udevice *dev, unsigned int gpio) return 0; } -static int msm_gpio_set_value(struct udevice *dev, unsigned int gpio, int value) +static int qcom_gpio_set_value(struct udevice *dev, unsigned int gpio, int value) { - struct msm_gpio_bank *priv = dev_get_priv(dev); + struct qcom_gpio_priv *priv = dev_get_priv(dev); - if (msm_pinctrl_is_reserved(dev_get_parent(dev), gpio)) + if (qcom_pinctrl_is_reserved(dev_get_parent(dev), gpio)) return 0; value = !!value; @@ -63,12 +63,12 @@ static int msm_gpio_set_value(struct udevice *dev, unsigned int gpio, int value) return 0; } -static int msm_gpio_direction_output(struct udevice *dev, unsigned int gpio, - int value) +static int qcom_gpio_direction_output(struct udevice *dev, unsigned int gpio, + int value) { - struct msm_gpio_bank *priv = dev_get_priv(dev); + struct qcom_gpio_priv *priv = dev_get_priv(dev); - if (msm_pinctrl_is_reserved(dev_get_parent(dev), gpio)) + if (qcom_pinctrl_is_reserved(dev_get_parent(dev), gpio)) return 0; value = !!value; @@ -81,21 +81,21 @@ static int msm_gpio_direction_output(struct udevice *dev, unsigned int gpio, return 0; } -static int msm_gpio_get_value(struct udevice *dev, unsigned int gpio) +static int qcom_gpio_get_value(struct udevice *dev, unsigned int gpio) { - struct msm_gpio_bank *priv = dev_get_priv(dev); + struct qcom_gpio_priv *priv = dev_get_priv(dev); - if (msm_pinctrl_is_reserved(dev_get_parent(dev), gpio)) + if (qcom_pinctrl_is_reserved(dev_get_parent(dev), gpio)) return 0; return !!(readl(priv->base + GPIO_IN_OUT_REG(dev, gpio)) >> GPIO_IN); } -static int msm_gpio_get_function(struct udevice *dev, unsigned int gpio) +static int qcom_gpio_get_function(struct udevice *dev, unsigned int gpio) { - struct msm_gpio_bank *priv = dev_get_priv(dev); + struct qcom_gpio_priv *priv = dev_get_priv(dev); - if (msm_pinctrl_is_reserved(dev_get_parent(dev), gpio)) + if (qcom_pinctrl_is_reserved(dev_get_parent(dev), gpio)) return GPIOF_UNKNOWN; if (readl(priv->base + GPIO_CONFIG_REG(dev, gpio)) & GPIO_OE_ENABLE) @@ -104,28 +104,28 @@ static int msm_gpio_get_function(struct udevice *dev, unsigned int gpio) return GPIOF_INPUT; } -static const struct dm_gpio_ops gpio_msm_ops = { - .direction_input = msm_gpio_direction_input, - .direction_output = msm_gpio_direction_output, - .get_value = msm_gpio_get_value, - .set_value = msm_gpio_set_value, - .get_function = msm_gpio_get_function, +static const struct dm_gpio_ops qcom_gpio_ops = { + .direction_input = qcom_gpio_direction_input, + .direction_output = qcom_gpio_direction_output, + .get_value = qcom_gpio_get_value, + .set_value = qcom_gpio_set_value, + .get_function = qcom_gpio_get_function, }; -static int msm_gpio_probe(struct udevice *dev) +static int qcom_gpio_probe(struct udevice *dev) { - struct msm_gpio_bank *priv = dev_get_priv(dev); + struct qcom_gpio_priv *priv = dev_get_priv(dev); priv->base = dev_read_addr(dev); - priv->pin_data = (struct msm_pin_data *)dev_get_driver_data(dev); + priv->pin_data = (struct qcom_pin_data *)dev_get_driver_data(dev); return priv->base == FDT_ADDR_T_NONE ? -EINVAL : 0; } -static int msm_gpio_of_to_plat(struct udevice *dev) +static int qcom_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); + const struct qcom_pin_data *pin_data = (struct qcom_pin_data *)dev_get_driver_data(dev); /* Get the pin count from the pinctrl driver */ uc_priv->gpio_count = pin_data->pin_count; @@ -137,12 +137,12 @@ static int msm_gpio_of_to_plat(struct udevice *dev) return 0; } -U_BOOT_DRIVER(gpio_msm) = { - .name = "gpio_msm", +U_BOOT_DRIVER(qcom_gpio) = { + .name = "qcom_gpio", .id = UCLASS_GPIO, - .of_to_plat = msm_gpio_of_to_plat, - .probe = msm_gpio_probe, - .ops = &gpio_msm_ops, + .of_to_plat = qcom_gpio_of_to_plat, + .probe = qcom_gpio_probe, + .ops = &qcom_gpio_ops, .flags = DM_UC_FLAG_SEQ_ALIAS, - .priv_auto = sizeof(struct msm_gpio_bank), + .priv_auto = sizeof(struct qcom_gpio_priv), }; diff --git a/drivers/pinctrl/qcom/pinctrl-apq8016.c b/drivers/pinctrl/qcom/pinctrl-apq8016.c index 8149ffd83cc4..652f8a51be60 100644 --- a/drivers/pinctrl/qcom/pinctrl-apq8016.c +++ b/drivers/pinctrl/qcom/pinctrl-apq8016.c @@ -13,7 +13,7 @@ #define MAX_PIN_NAME_LEN 32 static char pin_name[MAX_PIN_NAME_LEN] __section(".data"); -static const char * const msm_pinctrl_pins[] = { +static const char * const qcom_pinctrl_pins[] = { "SDC1_CLK", "SDC1_CMD", "SDC1_DATA", @@ -28,14 +28,14 @@ static const char * const msm_pinctrl_pins[] = { "QDSD_DATA3", }; -static const struct pinctrl_function msm_pinctrl_functions[] = { +static const struct pinctrl_function qcom_pinctrl_functions[] = { {"blsp1_uart", 2}, }; static const char *apq8016_get_function_name(struct udevice *dev, unsigned int selector) { - return msm_pinctrl_functions[selector].name; + return qcom_pinctrl_functions[selector].name; } static const char *apq8016_get_pin_name(struct udevice *dev, @@ -45,24 +45,24 @@ static const char *apq8016_get_pin_name(struct udevice *dev, snprintf(pin_name, MAX_PIN_NAME_LEN, "GPIO_%u", selector); return pin_name; } else { - return msm_pinctrl_pins[selector - 122]; + return qcom_pinctrl_pins[selector - 122]; } } static unsigned int apq8016_get_function_mux(unsigned int selector) { - return msm_pinctrl_functions[selector].val; + return qcom_pinctrl_functions[selector].val; } -static const struct msm_pinctrl_data apq8016_data = { +static const struct qcom_pinctrl_data apq8016_data = { .pin_data = { .pin_count = 133, }, - .functions_count = ARRAY_SIZE(msm_pinctrl_functions), + .functions_count = ARRAY_SIZE(qcom_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[] = { +static const struct udevice_id qcom_pinctrl_ids[] = { { .compatible = "qcom,msm8916-pinctrl", .data = (ulong)&apq8016_data }, { /* Sentinal */ } }; @@ -70,7 +70,7 @@ static const struct udevice_id msm_pinctrl_ids[] = { U_BOOT_DRIVER(pinctrl_apq8016) = { .name = "pinctrl_apq8016", .id = UCLASS_NOP, - .of_match = msm_pinctrl_ids, - .ops = &msm_pinctrl_ops, - .bind = msm_pinctrl_bind, + .of_match = qcom_pinctrl_ids, + .ops = &qcom_pinctrl_ops, + .bind = qcom_pinctrl_bind, }; diff --git a/drivers/pinctrl/qcom/pinctrl-apq8096.c b/drivers/pinctrl/qcom/pinctrl-apq8096.c index d64ab1ff7bee..d0c1424dff7a 100644 --- a/drivers/pinctrl/qcom/pinctrl-apq8096.c +++ b/drivers/pinctrl/qcom/pinctrl-apq8096.c @@ -13,7 +13,7 @@ #define MAX_PIN_NAME_LEN 32 static char pin_name[MAX_PIN_NAME_LEN] __section(".data"); -static const char * const msm_pinctrl_pins[] = { +static const char * const qcom_pinctrl_pins[] = { "SDC1_CLK", "SDC1_CMD", "SDC1_DATA", @@ -23,14 +23,14 @@ static const char * const msm_pinctrl_pins[] = { "SDC1_RCLK", }; -static const struct pinctrl_function msm_pinctrl_functions[] = { +static const struct pinctrl_function qcom_pinctrl_functions[] = { {"blsp_uart8", 2}, }; static const char *apq8096_get_function_name(struct udevice *dev, unsigned int selector) { - return msm_pinctrl_functions[selector].name; + return qcom_pinctrl_functions[selector].name; } static const char *apq8096_get_pin_name(struct udevice *dev, @@ -40,24 +40,24 @@ static const char *apq8096_get_pin_name(struct udevice *dev, snprintf(pin_name, MAX_PIN_NAME_LEN, "GPIO_%u", selector); return pin_name; } else { - return msm_pinctrl_pins[selector - 150]; + return qcom_pinctrl_pins[selector - 150]; } } static unsigned int apq8096_get_function_mux(unsigned int selector) { - return msm_pinctrl_functions[selector].val; + return qcom_pinctrl_functions[selector].val; } -static const struct msm_pinctrl_data apq8096_data = { +static const struct qcom_pinctrl_data apq8096_data = { .pin_data = { .pin_count = 157, }, - .functions_count = ARRAY_SIZE(msm_pinctrl_functions), + .functions_count = ARRAY_SIZE(qcom_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[] = { +static const struct udevice_id qcom_pinctrl_ids[] = { { .compatible = "qcom,msm8996-pinctrl", .data = (ulong)&apq8096_data }, { /* Sentinal */ } }; @@ -65,7 +65,7 @@ static const struct udevice_id msm_pinctrl_ids[] = { U_BOOT_DRIVER(pinctrl_apq8096) = { .name = "pinctrl_apq8096", .id = UCLASS_NOP, - .of_match = msm_pinctrl_ids, - .ops = &msm_pinctrl_ops, - .bind = msm_pinctrl_bind, + .of_match = qcom_pinctrl_ids, + .ops = &qcom_pinctrl_ops, + .bind = qcom_pinctrl_bind, }; diff --git a/drivers/pinctrl/qcom/pinctrl-ipq4019.c b/drivers/pinctrl/qcom/pinctrl-ipq4019.c index 2d99f99e1e45..2081d6d86f82 100644 --- a/drivers/pinctrl/qcom/pinctrl-ipq4019.c +++ b/drivers/pinctrl/qcom/pinctrl-ipq4019.c @@ -14,7 +14,7 @@ #define MAX_PIN_NAME_LEN 32 static char pin_name[MAX_PIN_NAME_LEN] __section(".data"); -static const struct pinctrl_function msm_pinctrl_functions[] = { +static const struct pinctrl_function qcom_pinctrl_functions[] = { {"gpio", 0}, {"blsp_uart0_0", 1}, /* Only for GPIO:16,17 */ {"blsp_uart0_1", 2}, /* Only for GPIO:60,61 */ @@ -30,7 +30,7 @@ static const struct pinctrl_function msm_pinctrl_functions[] = { static const char *ipq4019_get_function_name(struct udevice *dev, unsigned int selector) { - return msm_pinctrl_functions[selector].name; + return qcom_pinctrl_functions[selector].name; } static const char *ipq4019_get_pin_name(struct udevice *dev, @@ -42,18 +42,18 @@ static const char *ipq4019_get_pin_name(struct udevice *dev, static unsigned int ipq4019_get_function_mux(unsigned int selector) { - return msm_pinctrl_functions[selector].val; + return qcom_pinctrl_functions[selector].val; } -static const struct msm_pinctrl_data ipq4019_data = { +static const struct qcom_pinctrl_data ipq4019_data = { .pin_data = { .pin_count = 100, }, - .functions_count = ARRAY_SIZE(msm_pinctrl_functions), + .functions_count = ARRAY_SIZE(qcom_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[] = { +static const struct udevice_id qcom_pinctrl_ids[] = { { .compatible = "qcom,ipq4019-pinctrl", .data = (ulong)&ipq4019_data }, { /* Sentinal */ } }; @@ -61,7 +61,7 @@ static const struct udevice_id msm_pinctrl_ids[] = { U_BOOT_DRIVER(pinctrl_ipq4019) = { .name = "pinctrl_ipq4019", .id = UCLASS_NOP, - .of_match = msm_pinctrl_ids, - .ops = &msm_pinctrl_ops, - .bind = msm_pinctrl_bind, + .of_match = qcom_pinctrl_ids, + .ops = &qcom_pinctrl_ops, + .bind = qcom_pinctrl_bind, }; diff --git a/drivers/pinctrl/qcom/pinctrl-qcom.c b/drivers/pinctrl/qcom/pinctrl-qcom.c index 92b35c198788..4f5ef5c14dd4 100644 --- a/drivers/pinctrl/qcom/pinctrl-qcom.c +++ b/drivers/pinctrl/qcom/pinctrl-qcom.c @@ -20,12 +20,12 @@ #include "pinctrl-qcom.h" -#define MSM_PINCTRL_MAX_RESERVED_RANGES 32 +#define qcom_PINCTRL_MAX_RESERVED_RANGES 32 -struct msm_pinctrl_priv { +struct qcom_pinctrl_priv { phys_addr_t base; - struct msm_pinctrl_data *data; - u32 reserved_ranges[MSM_PINCTRL_MAX_RESERVED_RANGES * 2]; + struct qcom_pinctrl_data *data; + u32 reserved_ranges[qcom_PINCTRL_MAX_RESERVED_RANGES * 2]; int reserved_ranges_count; }; @@ -37,37 +37,37 @@ struct msm_pinctrl_priv { #define TLMM_DRV_STRENGTH_MASK GENMASK(8, 6) #define TLMM_GPIO_DISABLE BIT(9) -static const struct pinconf_param msm_conf_params[] = { +static const struct pinconf_param qcom_conf_params[] = { { "drive-strength", PIN_CONFIG_DRIVE_STRENGTH, 2 }, { "bias-disable", PIN_CONFIG_BIAS_DISABLE, 0 }, { "bias-pull-up", PIN_CONFIG_BIAS_PULL_UP, 3 }, }; -static int msm_get_functions_count(struct udevice *dev) +static int qcom_get_functions_count(struct udevice *dev) { - struct msm_pinctrl_priv *priv = dev_get_priv(dev); + struct qcom_pinctrl_priv *priv = dev_get_priv(dev); return priv->data->functions_count; } -static int msm_get_pins_count(struct udevice *dev) +static int qcom_get_pins_count(struct udevice *dev) { - struct msm_pinctrl_priv *priv = dev_get_priv(dev); + struct qcom_pinctrl_priv *priv = dev_get_priv(dev); return priv->data->pin_data.pin_count; } -static const char *msm_get_function_name(struct udevice *dev, - unsigned int selector) +static const char *qcom_get_function_name(struct udevice *dev, + unsigned int selector) { - struct msm_pinctrl_priv *priv = dev_get_priv(dev); + struct qcom_pinctrl_priv *priv = dev_get_priv(dev); return priv->data->get_function_name(dev, selector); } -static int msm_pinctrl_parse_ranges(struct udevice *dev) +static int qcom_pinctrl_parse_ranges(struct udevice *dev) { - struct msm_pinctrl_priv *priv = dev_get_priv(dev); + struct qcom_pinctrl_priv *priv = dev_get_priv(dev); int count; if (ofnode_read_prop(dev_ofnode(dev), "gpio-reserved-ranges", @@ -79,9 +79,9 @@ static int msm_pinctrl_parse_ranges(struct udevice *dev) /* Size is in bytes, but we're indexing by ints */ count /= 4; - if (count > MSM_PINCTRL_MAX_RESERVED_RANGES) { + if (count > qcom_PINCTRL_MAX_RESERVED_RANGES) { dev_err(dev, "gpio-reserved-ranges must be less than %d (got %d)\n", - MSM_PINCTRL_MAX_RESERVED_RANGES, count); + qcom_PINCTRL_MAX_RESERVED_RANGES, count); return -EINVAL; } @@ -98,15 +98,15 @@ static int msm_pinctrl_parse_ranges(struct udevice *dev) return 0; } -static int msm_pinctrl_probe(struct udevice *dev) +static int qcom_pinctrl_probe(struct udevice *dev) { - struct msm_pinctrl_priv *priv = dev_get_priv(dev); + struct qcom_pinctrl_priv *priv = dev_get_priv(dev); int ret; priv->base = dev_read_addr(dev); - priv->data = (struct msm_pinctrl_data *)dev_get_driver_data(dev); + priv->data = (struct qcom_pinctrl_data *)dev_get_driver_data(dev); - ret = msm_pinctrl_parse_ranges(dev); + ret = qcom_pinctrl_parse_ranges(dev); if (ret) { printf("Couldn't parse reserved GPIO ranges!\n"); return ret; @@ -115,19 +115,19 @@ static int msm_pinctrl_probe(struct udevice *dev) return priv->base == FDT_ADDR_T_NONE ? -EINVAL : 0; } -static const char *msm_get_pin_name(struct udevice *dev, unsigned int selector) +static const char *qcom_get_pin_name(struct udevice *dev, unsigned int selector) { - struct msm_pinctrl_priv *priv = dev_get_priv(dev); + struct qcom_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) +static int qcom_pinmux_set(struct udevice *dev, unsigned int pin_selector, + unsigned int func_selector) { - struct msm_pinctrl_priv *priv = dev_get_priv(dev); + struct qcom_pinctrl_priv *priv = dev_get_priv(dev); - if (msm_pinctrl_is_reserved(dev, pin_selector)) + if (qcom_pinctrl_is_reserved(dev, pin_selector)) return 0; clrsetbits_le32(priv->base + GPIO_CONFIG_REG(priv, pin_selector), @@ -136,12 +136,12 @@ static int msm_pinmux_set(struct udevice *dev, unsigned int pin_selector, return 0; } -static int msm_pinconf_set(struct udevice *dev, unsigned int pin_selector, - unsigned int param, unsigned int argument) +static int qcom_pinconf_set(struct udevice *dev, unsigned int pin_selector, + unsigned int param, unsigned int argument) { - struct msm_pinctrl_priv *priv = dev_get_priv(dev); + struct qcom_pinctrl_priv *priv = dev_get_priv(dev); - if (msm_pinctrl_is_reserved(dev, pin_selector)) + if (qcom_pinctrl_is_reserved(dev, pin_selector)) return 0; switch (param) { @@ -165,22 +165,22 @@ static int msm_pinconf_set(struct udevice *dev, unsigned int pin_selector, return 0; } -struct pinctrl_ops msm_pinctrl_ops = { - .get_pins_count = msm_get_pins_count, - .get_pin_name = msm_get_pin_name, +struct pinctrl_ops qcom_pinctrl_ops = { + .get_pins_count = qcom_get_pins_count, + .get_pin_name = qcom_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, + .pinmux_set = qcom_pinmux_set, + .pinconf_num_params = ARRAY_SIZE(qcom_conf_params), + .pinconf_params = qcom_conf_params, + .pinconf_set = qcom_pinconf_set, + .get_functions_count = qcom_get_functions_count, + .get_function_name = qcom_get_function_name, }; -int msm_pinctrl_bind(struct udevice *dev) +int qcom_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 qcom_pinctrl_data *data = (struct qcom_pinctrl_data *)dev_get_driver_data(dev); struct driver *drv; struct udevice *pinctrl_dev; const char *name; @@ -204,9 +204,9 @@ int msm_pinctrl_bind(struct udevice *dev) if (!name) return -EINVAL; - drv = lists_driver_lookup_name("gpio_msm"); + drv = lists_driver_lookup_name("qcom_gpio"); if (!drv) { - printf("Can't find gpio_msm driver\n"); + printf("Can't find qcom_gpio driver\n"); return -ENODEV; } @@ -224,14 +224,14 @@ int msm_pinctrl_bind(struct udevice *dev) U_BOOT_DRIVER(qcom_pinctrl) = { .name = "qcom_pinctrl", .id = UCLASS_PINCTRL, - .priv_auto = sizeof(struct msm_pinctrl_priv), - .ops = &msm_pinctrl_ops, - .probe = msm_pinctrl_probe, + .priv_auto = sizeof(struct qcom_pinctrl_priv), + .ops = &qcom_pinctrl_ops, + .probe = qcom_pinctrl_probe, }; -bool msm_pinctrl_is_reserved(struct udevice *dev, unsigned int pin) +bool qcom_pinctrl_is_reserved(struct udevice *dev, unsigned int pin) { - struct msm_pinctrl_priv *priv = dev_get_priv(dev); + struct qcom_pinctrl_priv *priv = dev_get_priv(dev); unsigned int i, start; for (i = 0; i < priv->reserved_ranges_count; i += 2) { diff --git a/drivers/pinctrl/qcom/pinctrl-qcom.h b/drivers/pinctrl/qcom/pinctrl-qcom.h index efb6a44b1409..2aa8c80c696f 100644 --- a/drivers/pinctrl/qcom/pinctrl-qcom.h +++ b/drivers/pinctrl/qcom/pinctrl-qcom.h @@ -13,8 +13,8 @@ struct udevice; -struct msm_pinctrl_data { - struct msm_pin_data pin_data; +struct qcom_pinctrl_data { + struct qcom_pin_data pin_data; int functions_count; const char *(*get_function_name)(struct udevice *dev, unsigned int selector); @@ -28,8 +28,8 @@ struct pinctrl_function { int val; }; -extern struct pinctrl_ops msm_pinctrl_ops; +extern struct pinctrl_ops qcom_pinctrl_ops; -int msm_pinctrl_bind(struct udevice *dev); +int qcom_pinctrl_bind(struct udevice *dev); #endif diff --git a/drivers/pinctrl/qcom/pinctrl-qcs404.c b/drivers/pinctrl/qcom/pinctrl-qcs404.c index ac00afa2a1f4..410cdbb23925 100644 --- a/drivers/pinctrl/qcom/pinctrl-qcs404.c +++ b/drivers/pinctrl/qcom/pinctrl-qcs404.c @@ -12,7 +12,7 @@ #define MAX_PIN_NAME_LEN 32 static char pin_name[MAX_PIN_NAME_LEN] __section(".data"); -static const char * const msm_pinctrl_pins[] = { +static const char * const qcom_pinctrl_pins[] = { "SDC1_RCLK", "SDC1_CLK", "SDC1_CMD", @@ -22,7 +22,7 @@ static const char * const msm_pinctrl_pins[] = { "SDC2_DATA", }; -static const struct pinctrl_function msm_pinctrl_functions[] = { +static const struct pinctrl_function qcom_pinctrl_functions[] = { {"blsp_uart2", 1}, {"rgmii_int", 1}, {"rgmii_ck", 1}, @@ -42,7 +42,7 @@ static const struct pinctrl_function msm_pinctrl_functions[] = { static const char *qcs404_get_function_name(struct udevice *dev, unsigned int selector) { - return msm_pinctrl_functions[selector].name; + return qcom_pinctrl_functions[selector].name; } static const char *qcs404_get_pin_name(struct udevice *dev, @@ -52,24 +52,24 @@ static const char *qcs404_get_pin_name(struct udevice *dev, snprintf(pin_name, MAX_PIN_NAME_LEN, "GPIO_%u", selector); return pin_name; } else { - return msm_pinctrl_pins[selector - 120]; + return qcom_pinctrl_pins[selector - 120]; } } static unsigned int qcs404_get_function_mux(unsigned int selector) { - return msm_pinctrl_functions[selector].val; + return qcom_pinctrl_functions[selector].val; } -static struct msm_pinctrl_data qcs404_data = { +static struct qcom_pinctrl_data qcs404_data = { .pin_data = { .pin_count = 126, }, - .functions_count = ARRAY_SIZE(msm_pinctrl_functions), + .functions_count = ARRAY_SIZE(qcom_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[] = { +static const struct udevice_id qcom_pinctrl_ids[] = { { .compatible = "qcom,qcs404-pinctrl", .data = (ulong)&qcs404_data }, { /* Sentinal */ } }; @@ -77,7 +77,7 @@ static const struct udevice_id msm_pinctrl_ids[] = { U_BOOT_DRIVER(pinctrl_qcs404) = { .name = "pinctrl_qcs404", .id = UCLASS_NOP, - .of_match = msm_pinctrl_ids, - .ops = &msm_pinctrl_ops, - .bind = msm_pinctrl_bind, + .of_match = qcom_pinctrl_ids, + .ops = &qcom_pinctrl_ops, + .bind = qcom_pinctrl_bind, }; diff --git a/drivers/pinctrl/qcom/pinctrl-sdm845.c b/drivers/pinctrl/qcom/pinctrl-sdm845.c index 9f0f4085ce2d..08cca602e94a 100644 --- a/drivers/pinctrl/qcom/pinctrl-sdm845.c +++ b/drivers/pinctrl/qcom/pinctrl-sdm845.c @@ -3,7 +3,6 @@ * Qualcomm SDM845 pinctrl * * (C) Copyright 2021 Dzmitry Sankouski - * (C) Copyright 2023 Linaro Ltd. * */ @@ -19,7 +18,7 @@ #define MAX_PIN_NAME_LEN 32 static char pin_name[MAX_PIN_NAME_LEN] __section(".data"); -static const struct pinctrl_function msm_pinctrl_functions[] = { +static const struct pinctrl_function qcom_pinctrl_functions[] = { {"qup9", 1}, {"gpio", 0}, }; @@ -60,7 +59,7 @@ static const unsigned int sdm845_pin_offsets[] = { static const char *sdm845_get_function_name(struct udevice *dev, unsigned int selector) { - return msm_pinctrl_functions[selector].name; + return qcom_pinctrl_functions[selector].name; } static const char *sdm845_get_pin_name(struct udevice *dev, @@ -72,21 +71,21 @@ static const char *sdm845_get_pin_name(struct udevice *dev, static unsigned int sdm845_get_function_mux(unsigned int selector) { - return msm_pinctrl_functions[selector].val; + return qcom_pinctrl_functions[selector].val; } -static struct msm_pinctrl_data sdm845_data = { +static struct qcom_pinctrl_data sdm845_data = { .pin_data = { .pin_offsets = sdm845_pin_offsets, .pin_count = ARRAY_SIZE(sdm845_pin_offsets), }, - .functions_count = ARRAY_SIZE(msm_pinctrl_functions), + .functions_count = ARRAY_SIZE(qcom_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[] = { +static const struct udevice_id qcom_pinctrl_ids[] = { { .compatible = "qcom,sdm845-pinctrl", .data = (ulong)&sdm845_data }, { /* Sentinal */ } }; @@ -94,7 +93,7 @@ static const struct udevice_id msm_pinctrl_ids[] = { U_BOOT_DRIVER(pinctrl_sdm845) = { .name = "pinctrl_sdm845", .id = UCLASS_NOP, - .of_match = msm_pinctrl_ids, - .ops = &msm_pinctrl_ops, - .bind = msm_pinctrl_bind, + .of_match = qcom_pinctrl_ids, + .ops = &qcom_pinctrl_ops, + .bind = qcom_pinctrl_bind, }; diff --git a/include/qcom-gpio.h b/include/qcom-gpio.h index 490a1de55f89..758a6ad9234f 100644 --- a/include/qcom-gpio.h +++ b/include/qcom-gpio.h @@ -10,7 +10,7 @@ #include #include -struct msm_pin_data { +struct qcom_pin_data { int pin_count; const unsigned int *pin_offsets; }; @@ -28,7 +28,7 @@ static inline u32 qcom_pin_offset(const unsigned int *offs, unsigned int selecto struct udevice; /** - * msm_pinctrl_is_reserved() - Check if a pin lies in a reserved range + * qcom_pinctrl_is_reserved() - Check if a pin lies in a reserved range * * @dev: pinctrl device * @pin: Pin number @@ -38,6 +38,6 @@ struct udevice; * Call using dev_get_parent() from the GPIO device, it is a child of * the pinctrl device. */ -bool msm_pinctrl_is_reserved(struct udevice *dev, unsigned int pin); +bool qcom_pinctrl_is_reserved(struct udevice *dev, unsigned int pin); #endif /* _QCOM_GPIO_H_ */