From patchwork Tue Apr 20 16:52:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 12214767 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 1789FC433ED for ; Tue, 20 Apr 2021 16:57:46 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 662C8613AE for ; Tue, 20 Apr 2021 16:57:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 662C8613AE 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=desiato.20200630; 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=CIqI72+mK9wAxl+7XRkd4hF28qTv09CM12kNYbwVzaw=; b=LVzx7TqmDfHK7mDAV/38CsP3a 1OzKaU6gJfcdLpPVOPItCwL5pJwiX2F50F6iOWssbX+3jeurKjwOcqCzTOMUBg2CQGArND0s2sA5B g9xYa+PXVmr3tSuf+yTy956DyMvzqeiU3u1TMe3hzEPe+T6vU4jndunhlXpr/5raGhFOamX5XcgHS UhKKPZ70lMjoUnho0ZZfltKnOA6lAAHITAlT+hii98UXWLkQ/ZoZSmVMEt5fyIHAuvh6pgOEp0MTX 52SAvD+R7zj0jFMkS3FeP02QziHM63wgvyK8/k4FYt050xjWSEgv2h7QpknbHnzxkL5HbR6pQCSAd rvZazs4BA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lYteX-00CdKG-6z; Tue, 20 Apr 2021 16:55:09 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lYtbc-00CcBE-4P for linux-arm-kernel@desiato.infradead.org; Tue, 20 Apr 2021 16:52:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=7kkMf0tzfVTQj9c0zvmMyyw/HA/qWiUBXAXvW4sV/Ng=; b=jsdOIK1qJTM3fPvXBMYPuQjCJ9 bG6sjKw3vqYiN1t3VXyruEJSg/yGF3j5XGBaATlSmkp4pjX2QS2T9yZtrm45cT3iJqoGEoo5zc4SP xSCDBZnKGVFRrpljqYC4i03tOio5XAmuAvzIrnAKnrqe6ZtTJiExISe0BkFhUvbKqBd8zNDBp0vS1 5OTc7Gs7xh5J7PBrdQ5N6g7/UuHa1EdknSGquzaFmAQLGYq6M8S4oOhslSp1sdS+UiFQJbHtqMHVB 9L5mIxY/tFLjjSGKAzfKVpuz6DB2voMCx/3odn0AHS98GJnCgbDRGUVweTg/A/xJqRJn0LI3oRbn1 YRHYAngw==; Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lYtbZ-00CHxf-Cp for linux-arm-kernel@lists.infradead.org; Tue, 20 Apr 2021 16:52:06 +0000 Received: by mail-ej1-x62e.google.com with SMTP id mh2so37758308ejb.8 for ; Tue, 20 Apr 2021 09:52:04 -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=7kkMf0tzfVTQj9c0zvmMyyw/HA/qWiUBXAXvW4sV/Ng=; b=u1qEHuz9PpdCSAnk3K9sf2R9OoQv7U7j/tkHF9bJZPXaW5RywDQJOqXEpDOHz+Ml33 9CjDbRUF6bVDP0XTv42XbBEGeYjsH46frvEIr8Il+bQmYoJJdrmnnBsHJWo3S2cZINfG U9LbLXsb5uysGpRZqnjMEBZSDCbaeihIQknCuOgYBrfqhFw/x4ZezUIHeUEtBHJ5sa9q 2xwcyvtg1sDsWKAqvcvLJH8+HGnq8sn3hElRAdnVuRM10cKtNPR7POb3szy+EGyc+QCI myLythF5Z78mo/N9HF4fTmZPByBmprlmdD2pM8IpkbIoNaWF+rB/AsqZIORPnnObqzs7 mRXg== 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=7kkMf0tzfVTQj9c0zvmMyyw/HA/qWiUBXAXvW4sV/Ng=; b=LaJ5W1pYZHst2EY+VaWOJhwGDfNRVxe7tph893kFYMqwGxpizmzMPQPdut6Pm8PY2w ztXibFqrRr7ojpkSpTvTiQPgViXjrEm6qebnEe97EevbVZtVlBHD9iFbIJXYcIBaH8iW bP0QCH0cqVpiVlwYd/ADyJyw0PpYa7xrtO9ex7D7Nl7bmTkusOzVNOaW5q+HqXJ8FSO4 dw9sNf0ajvKWJMpTwxn1kvflGfIrHxEGi+n0UB1k+frW9fZxD/l6WwlQFrZXd2uyj34S HPVIUN2M+qcCJXXMfwdBssvcLH8wcSB0VNVB4IX6DlPcjPxoArIFD2+z7Q0CXE31C6dO Q7xA== X-Gm-Message-State: AOAM530QL5ip4/a/6PcEEmD00IEeWLbdTiIOCjYj4eJq4o3ZH44oarL4 AVGzlsQ4aZivaQB9HTHuCuFzPbNGo/Q= X-Google-Smtp-Source: ABdhPJyd/FvvglM0ppGZ57M+9mteR+3pHQp5FoPClf0njPn0PFZ7wM0eYGkOXC3y7Mr5EwP4AQ63Iw== X-Received: by 2002:a17:906:9385:: with SMTP id l5mr28699143ejx.32.1618937523652; Tue, 20 Apr 2021 09:52:03 -0700 (PDT) Received: from localhost ([62.96.65.119]) by smtp.gmail.com with ESMTPSA id d14sm9816519edc.11.2021.04.20.09.52.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Apr 2021 09:52:01 -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 04/10] memory: tegra: Make per-SoC setup more generic Date: Tue, 20 Apr 2021 18:52:32 +0200 Message-Id: <20210420165237.3523732-5-thierry.reding@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210420165237.3523732-1-thierry.reding@gmail.com> References: <20210420165237.3523732-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-20210420_095205_456422_8353DB5F X-CRM114-Status: GOOD ( 18.07 ) 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, which will allow it to be used for other implementations. Signed-off-by: Thierry Reding --- drivers/memory/tegra/mc.c | 17 ++++++++--------- drivers/memory/tegra/tegra20.c | 4 ++-- include/soc/tegra/mc.h | 2 +- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/memory/tegra/mc.c b/drivers/memory/tegra/mc.c index 2b21131d779c..a800982f4a94 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..fd19df3eb529 100644 --- a/include/soc/tegra/mc.h +++ b/include/soc/tegra/mc.h @@ -170,7 +170,7 @@ struct tegra_mc_icc_ops { }; struct tegra_mc_ops { - int (*init)(struct tegra_mc *mc); + int (*probe)(struct tegra_mc *mc); int (*suspend)(struct tegra_mc *mc); int (*resume)(struct tegra_mc *mc); };