From patchwork Thu Aug 4 14:27:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Garg X-Patchwork-Id: 595324 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:b345:0:0:0:0 with SMTP id w5csp483217maz; Thu, 4 Aug 2022 07:28:40 -0700 (PDT) X-Google-Smtp-Source: AA6agR7mZKUPQWaLx+M+dzFpnxUJhxlCD+XL0AG+kCmWVFLsyop/W9tp2RyqG7xlFv6qAV6PWMRT X-Received: by 2002:a6b:6707:0:b0:67b:d457:39cf with SMTP id b7-20020a6b6707000000b0067bd45739cfmr899819ioc.179.1659623320107; Thu, 04 Aug 2022 07:28:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659623320; cv=none; d=google.com; s=arc-20160816; b=q0tKqSaSgiBVGBHyqB0QwUsq359Ta4FiA5l8YKu1FOCwcMe7x8QV7hZWTVPx0rdKwA oKM/KwvfbeaZTc4OuXI6xLG4rJJd3tyCQhIcCkjnKHvp0lhRcTx0Y0aFbWTPE0wMueGG 4YbXM8ysJQSNwgSgesqZMpzs6g2W0/p4nvti7mzeCIqBaXM7KdKrVifmtAnzkjOcGEit Q902RvEL3ylHsk8PpK3Dajz8ub5SsZahFPaOIppNIZFvetr1DZEHStIF0SZ2YlxHRpvY 9nfvbXija4IOie9OPcMq1HGUKxPFLb/B/aGiL4ATvgMvOT8+P/GE0YQEVzgPz6rwsAJM sokA== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XYW+mee8J4gKG0B4BKN9YdV6f8WW+oho2MMLftdhBAc=; b=HNmz8afQxqXOxuu0WPvMq5MDCgv6emP5X71MYDDGtbayMM+skf3eCX1ChPXjM606BW /EvR+9VAEVpkLzPd86xta+8v44R8oibsWvraTlwgvhDFKz/2OKpkr9WKQs/Nje+cRw1m IKAhcYkPeHbgPOwJhCY4cRDfAZ6FmFRjPdP2IDaTp0xZ7PlHndSQQv7lTDokz/eIBL+t oDNpQF8LeH3qeZzI1C8rNA1PeKlDKgb0YvKJTVz5M/vjNzj4xO8ZYnMagf8QgOz5kR+8 +ldUkCBcBIv943A8FGNuBYuXnGXdvUnsvC5QuZbJxT8FZGl14+pEFMdthM1uW954Qb95 nw8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pyQrMXrz; 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 b8-20020a029a08000000b00342a251f3b2si1223628jal.56.2022.08.04.07.28.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 07:28:40 -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=pyQrMXrz; 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 883D884832; Thu, 4 Aug 2022 16:28:14 +0200 (CEST) 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="pyQrMXrz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 64A178482D; Thu, 4 Aug 2022 16:28:13 +0200 (CEST) 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=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) (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 A1DDA84834 for ; Thu, 4 Aug 2022 16:28:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sumit.garg@linaro.org Received: by mail-pf1-x431.google.com with SMTP id h28so13155400pfq.11 for ; Thu, 04 Aug 2022 07:28:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XYW+mee8J4gKG0B4BKN9YdV6f8WW+oho2MMLftdhBAc=; b=pyQrMXrzvxqptKS+BGoyo4ANQRB1DpNLori1JXngMYUoZGAM+s9KK+LYp/mBaRi5GO MBKCVMEKG/hlph2hBJaqCT7jJXKlI7+UbYRzyxn9Dhg9RcY8RVzABHy2DdgU9Fh7JYs7 ipppLq5AuH/h1Ug8UG99k2DPaNUaOj3ynMRshOAuAoxy0iwpAFitw7LRNftdeg8oeLqJ Xr09hueitEfD91D4ex8Wv4h7OU7Jf3mtN3Pq+RNCyAB5xJee338fiOBEcoVL1xaq18vP UpfjOxC/LvaMqnCFc54P/PEpP0E6NTVzXcYrJuSN6RpaWztMVrWAukjSeYKsDa8A8McH dXPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XYW+mee8J4gKG0B4BKN9YdV6f8WW+oho2MMLftdhBAc=; b=VC5ga9ysHmXcmw4kBLZrglrUlVGmtPaH1oKtMpLjWZ70/xjyUZ2wqjVmG+HS232iqi YERFiyyglxwiIc9JgIERElsopBgvgDpqjswgdRkHGvAwDWY7fKwuw38ENPbFTPJS6NAQ 2CcqsxXMKuPuA0Nt9KS0fLT7Xa4nXA/f7MJVcwfFf4W4aHWXPIUAcpg5jsp0RQwc3zdg vMRtPi6IFhZeKCm52m/+wEwHTuoVtG2ZMk+ILkzGW6zNbVtgyYtmpFFQfeItmKhQ4xdq bV8TdNiUhZJvBD90D/eKRRxGo0eEzZ1vzSXeoR7PgA4TD26HB4hk4+FYsglniOWA+Sg8 MguA== X-Gm-Message-State: ACgBeo377i0PfkKgB/DXIUE0LFJPdKQuIbQapUITo88LfUUfNaBufLtp 4fg6IeW/moA6dFU4Imvx0GUofDuGs074pQ== X-Received: by 2002:a65:498b:0:b0:412:8e4:2842 with SMTP id r11-20020a65498b000000b0041208e42842mr1842580pgs.71.1659623287689; Thu, 04 Aug 2022 07:28:07 -0700 (PDT) Received: from localhost.localdomain ([122.162.196.218]) by smtp.gmail.com with ESMTPSA id h185-20020a6253c2000000b0052cdb06c125sm1013549pfb.159.2022.08.04.07.28.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 07:28:07 -0700 (PDT) From: Sumit Garg To: u-boot@lists.denx.de Cc: rfried.dev@gmail.com, jorge.ramirez.ortiz@gmail.com, sjg@chromium.org, trini@konsulko.com, stephan@gerhold.net, mario.six@gdsys.cc, dsankouski@gmail.com, robert.marko@sartura.hr, luka.kovacic@sartura.hr, luka.perkov@sartura.hr, jh80.chung@samsung.com, nicolas.dechesne@linaro.org, vinod.koul@linaro.org, mworsfold@impinj.com, lgillham@impinj.com, daniel.thompson@linaro.org, pbrobinson@gmail.com, Sumit Garg Subject: [PATCH 03/13] reset: Convert ipq4019 driver to a generic Qcom driver Date: Thu, 4 Aug 2022 19:57:11 +0530 Message-Id: <20220804142721.536556-4-sumit.garg@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804142721.536556-1-sumit.garg@linaro.org> References: <20220804142721.536556-1-sumit.garg@linaro.org> MIME-Version: 1.0 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.6 at phobos.denx.de X-Virus-Status: Clean Since the base functionality remains the same for a reset driver on Qcom SoCs, so leverage that to convert ipq4019 specific reset driver to a generic Qcom reset driver. With that one just need to provide SoC specific reset table. Signed-off-by: Sumit Garg --- drivers/reset/Kconfig | 9 ++-- drivers/reset/Makefile | 2 +- .../reset/{reset-ipq4019.c => reset-qcom.c} | 46 ++++++++++--------- 3 files changed, 30 insertions(+), 27 deletions(-) rename drivers/reset/{reset-ipq4019.c => reset-qcom.c} (79%) diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig index 69a7b4ccba..4cb0ba0850 100644 --- a/drivers/reset/Kconfig +++ b/drivers/reset/Kconfig @@ -156,13 +156,12 @@ config RESET_IMX7 help Support for reset controller on i.MX7/8 SoCs. -config RESET_IPQ419 - bool "Reset driver for Qualcomm IPQ40xx SoCs" - depends on DM_RESET && ARCH_IPQ40XX +config RESET_QCOM + bool "Reset driver for Qualcomm SoCs" + depends on DM_RESET && (ARCH_SNAPDRAGON || ARCH_IPQ40XX) default y help - Support for reset controller on Qualcomm - IPQ40xx SoCs. + Support for reset controller on Qualcomm SoCs. config RESET_SIFIVE bool "Reset Driver for SiFive SoC's" diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile index 97e3a782c0..0620b62809 100644 --- a/drivers/reset/Makefile +++ b/drivers/reset/Makefile @@ -24,7 +24,7 @@ obj-$(CONFIG_RESET_MTMIPS) += reset-mtmips.o obj-$(CONFIG_RESET_SUNXI) += reset-sunxi.o obj-$(CONFIG_RESET_HISILICON) += reset-hisilicon.o obj-$(CONFIG_RESET_IMX7) += reset-imx7.o -obj-$(CONFIG_RESET_IPQ419) += reset-ipq4019.o +obj-$(CONFIG_RESET_QCOM) += reset-qcom.o obj-$(CONFIG_RESET_SIFIVE) += reset-sifive.o obj-$(CONFIG_RESET_SYSCON) += reset-syscon.o obj-$(CONFIG_RESET_RASPBERRYPI) += reset-raspberrypi.o diff --git a/drivers/reset/reset-ipq4019.c b/drivers/reset/reset-qcom.c similarity index 79% rename from drivers/reset/reset-ipq4019.c rename to drivers/reset/reset-qcom.c index 7f0bd85ad6..40f436ede4 100644 --- a/drivers/reset/reset-ipq4019.c +++ b/drivers/reset/reset-qcom.c @@ -1,8 +1,10 @@ // SPDX-License-Identifier: GPL-2.0 /* * Copyright (c) 2020 Sartura Ltd. + * Copyright (c) 2022 Linaro Ltd. * * Author: Robert Marko + * Sumit Garg * * Based on Linux driver */ @@ -10,12 +12,11 @@ #include #include #include -#include #include #include #include -struct ipq4019_reset_priv { +struct qcom_reset_priv { phys_addr_t base; }; @@ -24,7 +25,9 @@ struct qcom_reset_map { u8 bit; }; -static const struct qcom_reset_map gcc_ipq4019_resets[] = { +#ifdef CONFIG_ARCH_IPQ40XX +#include +static const struct qcom_reset_map gcc_qcom_resets[] = { [WIFI0_CPU_INIT_RESET] = { 0x1f008, 5 }, [WIFI0_RADIO_SRIF_RESET] = { 0x1f008, 4 }, [WIFI0_RADIO_WARM_RESET] = { 0x1f008, 3 }, @@ -97,11 +100,12 @@ static const struct qcom_reset_map gcc_ipq4019_resets[] = { [GCC_MPM_BCR] = {0x24000, 0}, [GCC_SPDM_BCR] = {0x25000, 0}, }; +#endif -static int ipq4019_reset_assert(struct reset_ctl *rst) +static int qcom_reset_assert(struct reset_ctl *rst) { - struct ipq4019_reset_priv *priv = dev_get_priv(rst->dev); - const struct qcom_reset_map *reset_map = gcc_ipq4019_resets; + struct qcom_reset_priv *priv = dev_get_priv(rst->dev); + const struct qcom_reset_map *reset_map = gcc_qcom_resets; const struct qcom_reset_map *map; u32 value; @@ -114,10 +118,10 @@ static int ipq4019_reset_assert(struct reset_ctl *rst) return 0; } -static int ipq4019_reset_deassert(struct reset_ctl *rst) +static int qcom_reset_deassert(struct reset_ctl *rst) { - struct ipq4019_reset_priv *priv = dev_get_priv(rst->dev); - const struct qcom_reset_map *reset_map = gcc_ipq4019_resets; + struct qcom_reset_priv *priv = dev_get_priv(rst->dev); + const struct qcom_reset_map *reset_map = gcc_qcom_resets; const struct qcom_reset_map *map; u32 value; @@ -130,19 +134,19 @@ static int ipq4019_reset_deassert(struct reset_ctl *rst) return 0; } -static const struct reset_ops ipq4019_reset_ops = { - .rst_assert = ipq4019_reset_assert, - .rst_deassert = ipq4019_reset_deassert, +static const struct reset_ops qcom_reset_ops = { + .rst_assert = qcom_reset_assert, + .rst_deassert = qcom_reset_deassert, }; -static const struct udevice_id ipq4019_reset_ids[] = { +static const struct udevice_id qcom_reset_ids[] = { { .compatible = "qcom,gcc-reset-ipq4019" }, { } }; -static int ipq4019_reset_probe(struct udevice *dev) +static int qcom_reset_probe(struct udevice *dev) { - struct ipq4019_reset_priv *priv = dev_get_priv(dev); + struct qcom_reset_priv *priv = dev_get_priv(dev); priv->base = dev_read_addr(dev); if (priv->base == FDT_ADDR_T_NONE) @@ -151,11 +155,11 @@ static int ipq4019_reset_probe(struct udevice *dev) return 0; } -U_BOOT_DRIVER(ipq4019_reset) = { - .name = "ipq4019_reset", +U_BOOT_DRIVER(qcom_reset) = { + .name = "qcom_reset", .id = UCLASS_RESET, - .of_match = ipq4019_reset_ids, - .ops = &ipq4019_reset_ops, - .probe = ipq4019_reset_probe, - .priv_auto = sizeof(struct ipq4019_reset_priv), + .of_match = qcom_reset_ids, + .ops = &qcom_reset_ops, + .probe = qcom_reset_probe, + .priv_auto = sizeof(struct qcom_reset_priv), };