From mboxrd@z Thu Jan 1 00:00:00 1970 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham 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 0153FC47080 for ; Tue, 1 Jun 2021 17:58:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DEA6B6023E for ; Tue, 1 Jun 2021 17:58:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234638AbhFASAG (ORCPT ); Tue, 1 Jun 2021 14:00:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234513AbhFASAG (ORCPT ); Tue, 1 Jun 2021 14:00:06 -0400 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7910C061574 for ; Tue, 1 Jun 2021 10:58:23 -0700 (PDT) Received: by mail-ed1-x532.google.com with SMTP id df21so18489061edb.3 for ; Tue, 01 Jun 2021 10:58:23 -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=Pamp4Obxnic+gJj1sGqJLMCM24zp5tA7UCFNs9WUURUUzHN/kz5F2SfA8AW5V1mEUG yQeQ0u+VpBuSnUJKK/RF0H8kT7HOyR3yala5Z14TgEGOXNV3n4KKJ42tJUrDDLAu1Izj EIxNI42Doa2W1DB10xVDGUaDRGpmAMcOPJTD0A0fT5yK1EWPRT4v71bvyKRjgNqvjPQY WS/YV3CVP8WytcNt1PW4USbOMWS9XLPP3IJI4NTNX94/Rew4LhhJOMELVYOahU/SIHUz dOOfx+dXDeMLNqGupVdiLx38HB3YcT4Jh8kbAfGOV7GeueWl0h3iihAMYEsows12WMzF qTAw== 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=N/TZEEfZ4uj1usqX3jiI3QZqUoV7zJbNUBr0oSLPMUPLRR84QmrstlpWjIvzxO8WSg gGjYkL5BGJewhXIhdKmNHiqU/P1ZkNDNeQy1/DmNMJHpWx5evFKms1dBeWM5aIXg5v+s 6FoYURH5NbHOZgubpRE2dn71t0ZwNTli44jtBhy1PP0b55aay5IKTUFOhNf5hya9YERL IcnpmTLTNTXuyt+DXHe3LCDiVAfOFNVrMfzjytJmOdJtaGV2rufG5jFI+7AHQzFDvE1M L/VjeAnqBPiCtvNRE3vNslNLnl/BIuV38Z5mN9q14TqZKOE7+tNVHcPJhWfOFHDYVUi4 lmVQ== X-Gm-Message-State: AOAM532YPcwWWR89fF+YICBMRiST8sHZs5eYEJjbD5U/QIEgyeGVVXeN tvcMYpVk1ruVUh/8sR6AY+M= X-Google-Smtp-Source: ABdhPJyqtmYr3VUv4afBK6eULdpaJqCDD/i5MlZ0hyan+Ufclwjg+ESQVVJGKNRKtH2DfTZ/TiFSow== X-Received: by 2002:aa7:d853:: with SMTP id f19mr34207054eds.371.1622570302600; Tue, 01 Jun 2021 10:58:22 -0700 (PDT) Received: from localhost ([62.96.65.119]) by smtp.gmail.com with ESMTPSA id d24sm3352294edp.7.2021.06.01.10.58.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Jun 2021 10:58:21 -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 v2 05/12] memory: tegra: Make per-SoC setup more generic Date: Tue, 1 Jun 2021 19:59:35 +0200 Message-Id: <20210601175942.1920588-6-thierry.reding@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210601175942.1920588-1-thierry.reding@gmail.com> References: <20210601175942.1920588-1-thierry.reding@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.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); }; -- 2.31.1 From mboxrd@z Thu Jan 1 00:00:00 1970 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,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 741FEC47080 for ; Tue, 1 Jun 2021 18:00:51 +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 3ED816023E for ; Tue, 1 Jun 2021 18:00:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3ED816023E 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=MpySlrMYXj48jF 8Efs/TIavWfeHWi9U3NAjtOh01s3AYZ2Ab+oJ5qo+SuLndR2ELfqMylY8S85FCQRfQLtjMhbj4Hjk bsaSZPXvryitwXUWLXJFgMGYdhPye0U1zCWDcNC55IWu4MzyWu/raYQSwzZ5NUfgTi0XxhKYJ/PnL 2+d45Xb2+wFTmrkAwelOUaW1sm/EcaDajGphE1uHHRndXkhw9OkriN6T/3V2jbfxjlnVC+TkkH4Nz tByASbwFCERBL/TNj2GTw6TuO+FL7qmime7jIKpCF4L6rbnGsbTOymxB25PxQon79PdRO/cYRhztJ vY2exzknkSxXnZpsNLnA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lo8fY-000CFS-Vh; Tue, 01 Jun 2021 17:59:13 +0000 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lo8em-000C3x-DU for linux-arm-kernel@lists.infradead.org; Tue, 01 Jun 2021 17:58:25 +0000 Received: by mail-ed1-x52b.google.com with SMTP id dg27so8739147edb.12 for ; Tue, 01 Jun 2021 10:58:23 -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=Pamp4Obxnic+gJj1sGqJLMCM24zp5tA7UCFNs9WUURUUzHN/kz5F2SfA8AW5V1mEUG yQeQ0u+VpBuSnUJKK/RF0H8kT7HOyR3yala5Z14TgEGOXNV3n4KKJ42tJUrDDLAu1Izj EIxNI42Doa2W1DB10xVDGUaDRGpmAMcOPJTD0A0fT5yK1EWPRT4v71bvyKRjgNqvjPQY WS/YV3CVP8WytcNt1PW4USbOMWS9XLPP3IJI4NTNX94/Rew4LhhJOMELVYOahU/SIHUz dOOfx+dXDeMLNqGupVdiLx38HB3YcT4Jh8kbAfGOV7GeueWl0h3iihAMYEsows12WMzF qTAw== 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=ke1vxjPaTmdhtN0CfvlUGf7JdwK3JKoD+zsrhu0+66MzqcbfcYvxkwh9mrXIF2UpH9 zUtdMu1fFnoeVHadPX/s5v86QSOrSt7InHYhBmEONVLmeuJbuspWRTIAE9TQBC04ha6h 2W3+7MwnrU54Cwhaq+3kEF0QRzGSZrgvq8NTx5JBFgFqA2eSsL8ZYJF6n1l64yzqt9JU Bcddgkfvx7DfXMSI/8ozWM+ir5g6GeN9GeUNJgdK2ZV38cHKBflPpPZaG5BvGnbnKLOh t9rsM8OghRBv9DcCRuehhG6dz9dTETAd9SbtF/GkSFgWoDUXO0DFHnyUT86BiZfOOFe6 Zb5g== X-Gm-Message-State: AOAM5325kw+viNi1n11y9/5jhS/je3mIP3Z5BVRWDV5/zfVL44UqVbFZ mMWIZw0dv7UHBSrmJifdNx8= X-Google-Smtp-Source: ABdhPJyqtmYr3VUv4afBK6eULdpaJqCDD/i5MlZ0hyan+Ufclwjg+ESQVVJGKNRKtH2DfTZ/TiFSow== X-Received: by 2002:aa7:d853:: with SMTP id f19mr34207054eds.371.1622570302600; Tue, 01 Jun 2021 10:58:22 -0700 (PDT) Received: from localhost ([62.96.65.119]) by smtp.gmail.com with ESMTPSA id d24sm3352294edp.7.2021.06.01.10.58.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Jun 2021 10:58:21 -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 v2 05/12] memory: tegra: Make per-SoC setup more generic Date: Tue, 1 Jun 2021 19:59:35 +0200 Message-Id: <20210601175942.1920588-6-thierry.reding@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210601175942.1920588-1-thierry.reding@gmail.com> References: <20210601175942.1920588-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-20210601_105824_507559_04D5CE78 X-CRM114-Status: GOOD ( 22.30 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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); }; -- 2.31.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel