From patchwork Wed Jun 2 16:32:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 12295275 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98BD5C47083 for ; Wed, 2 Jun 2021 16:33:58 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6585561987 for ; Wed, 2 Jun 2021 16:33:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6585561987 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OBKzc/tTe+4PHtFv/D6+1x0WC/IpJTnKB2litKleluc=; b=shf77Ic7Y/DEmO CmkHM96Tdgsocd4/UtCjFUfvq1JRODqaIZ8FwBxCIma3pklW7R1jK2G5s6BrETKViDILtGTFxfPXx H697SZ6kAA9SpyMSppIV3Y90HFjX+5+a1SgJvudtDtrM9/nLX3xvpnq9uthBp0I+JOlSTAw+DEkxp UZe7viBp1M0eY5aZ23+EAloNS23iiLbI/52ZhzQun+5+6zK/RpWJORkILhaCGyDMH52UM/iBSbXKN tqBVv39skzq8mrRrSlSIAaDbMNFMpZolPzkan2Fnpn5qG4/P0GQwG2d3EKSOZkAuKzfSuIAn5Ijxd t16ck4791i3fBgcOP2RQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1loTmw-0059Bj-F0; Wed, 02 Jun 2021 16:32:14 +0000 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1loTmP-00592G-Uc for linux-arm-kernel@lists.infradead.org; Wed, 02 Jun 2021 16:31:43 +0000 Received: by mail-ej1-x631.google.com with SMTP id ci15so4727631ejc.10 for ; Wed, 02 Jun 2021 09:31:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8NN+TALDvwE5yh3o3XqidnPVUfejMnnEQTWZAWw/3tY=; b=TAGnvEx9aPti0cHL0flhPSm88tOMJPG5DHgGo0uu2RsZlujOe8Hl2qo9eJIxLOZ6mj jf216gg/+wa5ExQtfwQ5DBp2NDsCtttIJRP3B8HewTwsd/8BVPvvvoixWwUmQJ51jjoJ Zys3m3N0d5UBtu3PUf+77ZMEBNRqWXtz0Cg/CBATDan14vmviHpTTnnX7/ZZpZE9bjD9 Db4nSk+rmjn9BBg+zTSUFPCVHytwEWYj4iFV38YuKD2tR6ig/xrHMGrdXjHMSjcwc9CB c8G9gB50QzWHADLj5M9rBcCbjzOTqR9BbySR4+/jrC/Cc/M/xDoki/4TKYOiWz657bQW 3R9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8NN+TALDvwE5yh3o3XqidnPVUfejMnnEQTWZAWw/3tY=; b=s6SwTAueLw2UzV6011pPABPdbTc+oSiMW65ZT6O2Tyw91ilmGlg4nlyQHr6ICsbPlO ocK3wPKfte/FDj0XquhAr7UScNgzcZpRCj1auqsqgcJ5KRHiCfEWEJdAfJ8jCdAJw7NC 8p0r+DBnRPjjaefrHyY7jTuDqBfISwXqtrGHENl+0nheIxNQjU9TJriNR8x3Xo9OIZmc F9bpRFUKrhKJHGeIWxmSlxQa6GMx+gn98VX56pMaFGXRwQC0vDbYlag5DB80aT6dIkWl f3CRSaEULXvU8N90DPS3AwZX9/vpyiwX/zjCagS3iFq8ysYpyqT46fUHOKMnYkZzFjm/ PtAQ== X-Gm-Message-State: AOAM533kjxN6Vs4fMKh3qPgod993vcABUmXj3JxiH91rFj6OnwsSMKHL 0SiTWBHeBtwesGT2g02rL9o= X-Google-Smtp-Source: ABdhPJwn2nIv+UtVVIsykXrsTzfP4KeySqVPaKwG5yRgbV3V5sceyVLkPRGcW0bjSYImHQMx9b6RdA== X-Received: by 2002:a17:906:6981:: with SMTP id i1mr34836728ejr.289.1622651500724; Wed, 02 Jun 2021 09:31:40 -0700 (PDT) Received: from localhost ([62.96.65.119]) by smtp.gmail.com with ESMTPSA id r4sm234717ejd.105.2021.06.02.09.31.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jun 2021 09:31:39 -0700 (PDT) From: Thierry Reding To: Thierry Reding , Krzysztof Kozlowski Cc: Jon Hunter , Dmitry Osipenko , linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 05/12] memory: tegra: Make per-SoC setup more generic Date: Wed, 2 Jun 2021 18:32:55 +0200 Message-Id: <20210602163302.120041-6-thierry.reding@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210602163302.120041-1-thierry.reding@gmail.com> References: <20210602163302.120041-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210602_093142_012480_E2521A83 X-CRM114-Status: GOOD ( 21.86 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Thierry Reding The current per-SoC setup code runs at a fairly arbitrary point during probe, thereby making it less flexible for other SoC generations. Move the call around slightly (after only the very basic, common setup that applies to all SoC generations has been performed), which will allow it to be used for other implementations. Signed-off-by: Thierry Reding --- Changes in v2: - add kerneldoc comment to clarify when the per-SoC ->probe() is called - clarify this in the commit message as well drivers/memory/tegra/mc.c | 17 ++++++++--------- drivers/memory/tegra/tegra20.c | 4 ++-- include/soc/tegra/mc.h | 6 +++++- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/memory/tegra/mc.c b/drivers/memory/tegra/mc.c index a3b7ba33b7f9..ea2142ba720a 100644 --- a/drivers/memory/tegra/mc.c +++ b/drivers/memory/tegra/mc.c @@ -784,6 +784,14 @@ static int tegra_mc_probe(struct platform_device *pdev) return PTR_ERR(mc->clk); } + mc->debugfs.root = debugfs_create_dir("mc", NULL); + + if (mc->soc->ops && mc->soc->ops->probe) { + err = mc->soc->ops->probe(mc); + if (err < 0) + return err; + } + #ifdef CONFIG_ARCH_TEGRA_2x_SOC if (mc->soc == &tegra20_mc_soc) { isr = tegra20_mc_irq; @@ -827,15 +835,6 @@ static int tegra_mc_probe(struct platform_device *pdev) return err; } - mc->debugfs.root = debugfs_create_dir("mc", NULL); - - if (mc->soc->ops && mc->soc->ops->init) { - err = mc->soc->ops->init(mc); - if (err < 0) - dev_err(&pdev->dev, "failed to initialize SoC driver: %d\n", - err); - } - err = tegra_mc_reset_setup(mc); if (err < 0) dev_err(&pdev->dev, "failed to register reset controller: %d\n", diff --git a/drivers/memory/tegra/tegra20.c b/drivers/memory/tegra/tegra20.c index a3335ad20f4d..2c86c0d70d59 100644 --- a/drivers/memory/tegra/tegra20.c +++ b/drivers/memory/tegra/tegra20.c @@ -679,7 +679,7 @@ static int tegra20_mc_stats_show(struct seq_file *s, void *unused) return 0; } -static int tegra20_mc_init(struct tegra_mc *mc) +static int tegra20_mc_probe(struct tegra_mc *mc) { debugfs_create_devm_seqfile(mc->dev, "stats", mc->debugfs.root, tegra20_mc_stats_show); @@ -714,7 +714,7 @@ static int tegra20_mc_resume(struct tegra_mc *mc) } static const struct tegra_mc_ops tegra20_mc_ops = { - .init = tegra20_mc_init, + .probe = tegra20_mc_probe, .suspend = tegra20_mc_suspend, .resume = tegra20_mc_resume, }; diff --git a/include/soc/tegra/mc.h b/include/soc/tegra/mc.h index 7c49f75087c3..00d16c356db8 100644 --- a/include/soc/tegra/mc.h +++ b/include/soc/tegra/mc.h @@ -170,7 +170,11 @@ struct tegra_mc_icc_ops { }; struct tegra_mc_ops { - int (*init)(struct tegra_mc *mc); + /* + * @probe: Callback to set up SoC-specific bits of the memory controller. This is called + * after basic, common set up that is done by the SoC-agnostic bits. + */ + int (*probe)(struct tegra_mc *mc); int (*suspend)(struct tegra_mc *mc); int (*resume)(struct tegra_mc *mc); };