From patchwork Mon Dec 9 14:35:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11279473 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 80944138D for ; Mon, 9 Dec 2019 14:35:29 +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 5ED3B2077B for ; Mon, 9 Dec 2019 14:35:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="I06Jt553"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gNRw9VDK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5ED3B2077B 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+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=mI39VwVfnGNuCU4r0345ZEm8GBLyCuy+DkPe4KxlaWE=; b=I06Jt553LbUrCT I1nL7c7jKnbRCBFxrAffJpQQtbj4bnVPox/+vNS2VshRh/HIeJpOTzZlpskPxR4NSpQvV6VXCkwkv US1qJfIeezGp2oRpwWQm1finA828mqQzmGJxVYlBk3k8z4yO+zZRk0NrGMtEZKxcY426PkdKSeHWk xGnwETnWKgHV4E6Tm+Hj2Q4XIQkeXL0hTivjtgcG3NfXZsuqrxlTD59DFZ4qnybzout+hpv2Hzw1k +EgsuaEjbI8ynhc6Oxot7Im+rQL/NpwVnkj6ZTypIdwEr2rg4rij4KS26HH8boGug+AkRb5bAx5XC QdcAlS3siyCffxyUsVyg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ieK8G-0000Eh-RD; Mon, 09 Dec 2019 14:35:28 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ieK8D-0000E0-Ez for linux-arm-kernel@lists.infradead.org; Mon, 09 Dec 2019 14:35:26 +0000 Received: by mail-wm1-x341.google.com with SMTP id p9so15722701wmc.2 for ; Mon, 09 Dec 2019 06:35:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=BBAexXy6QHb9b0LuhH81Em9Cd0EIq6JiI9qQ4hCSW+k=; b=gNRw9VDKotARI9bsXbnGcfwKOXoKZRpJkLpDbHGTHH91cb0RsiLdx7th7wIZ5ILowj vcpTphWVbfb/K32PajiDt5MNzJ+VfRGRMlsTwhAJiihkJr2HouyXmb+onQhmHyqvSPBC tSEiKhK8lx3spDOuEjRjfg4OlVnzbd247yP6KUKsB3Jr3VFifD3VhhfFHClsWCKVi6SB BTxbXbE6w/jLIirDsPi3W/5T3KrF2iw1akIV3CUV6kLice/e2NBpFYakaRqdV3+1GyTL e+jAAKG6GSMydBU05dQjc3mdnl/4NvxJGf3jVOB3KQF4m+PUcJiXveibjZmMQAn8Lhru GxRw== 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:mime-version :content-transfer-encoding; bh=BBAexXy6QHb9b0LuhH81Em9Cd0EIq6JiI9qQ4hCSW+k=; b=VDe9KWGmMfzBI+UdoaRXNCNM17YkgikEfxYSULzVXj9LrfYNEekOIP0KpL4jlW6r42 iPlOr+FOFrnHYwBfZNiacPmLuYjVBy+7Frk3CVQk8Ht1cDrCPt4E2bqrD2vkMlU1rLjU MhWRaBafxEH+82g6E+M0CztKMVePqi7+fkbrPoeCplDddRo6LxiQLjSQUaHE21wJzpBH U7WmLd2gnOoXIo5bpmar8ks+sbU9uZdJ8oFfZs3NNk8oN2rLPyq4/vJGhuqU+AhtmiXv njrcXq3sfotO+POl89s61ncMisUoB5ihwXnJvG7YtjnDLp//g2r+rF0e/N31U4CKSFOW HC8w== X-Gm-Message-State: APjAAAVYKXgoHpdIjd/NFSYHnedotNd8yKVssE/D1pfgVia57XXIUO9G fgCQbZVVA3TP67/Qy1fnitg= X-Google-Smtp-Source: APXvYqzK816vlvz/TWq9VF4WaYU3ZA5UZptXKhUdxphFLCdhJVBFTg0cVPdLNMXFPPNINd1mXAVfDQ== X-Received: by 2002:a1c:1d8:: with SMTP id 207mr22431650wmb.155.1575902123504; Mon, 09 Dec 2019 06:35:23 -0800 (PST) Received: from localhost (pD9E518ED.dip0.t-ipconnect.de. [217.229.24.237]) by smtp.gmail.com with ESMTPSA id g9sm27131800wro.67.2019.12.09.06.35.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2019 06:35:22 -0800 (PST) From: Thierry Reding To: Thierry Reding Subject: [PATCH 1/4] memory: tegra: Rename tegra_mc to tegra186_mc on Tegra186 Date: Mon, 9 Dec 2019 15:35:18 +0100 Message-Id: <20191209143521.2357178-1-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191209_063525_506712_1ACAF4D1 X-CRM114-Status: GOOD ( 12.65 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:341 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (thierry.reding[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Thierry Reding This is just for consistency with the rest of the driver. Signed-off-by: Thierry Reding --- drivers/memory/tegra/tegra186.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/memory/tegra/tegra186.c b/drivers/memory/tegra/tegra186.c index 441213a35930..f72e89877295 100644 --- a/drivers/memory/tegra/tegra186.c +++ b/drivers/memory/tegra/tegra186.c @@ -15,7 +15,7 @@ struct tegra_mc { void __iomem *regs; }; -struct tegra_mc_client { +struct tegra186_mc_client { const char *name; unsigned int sid; struct { @@ -24,7 +24,13 @@ struct tegra_mc_client { } regs; }; -static const struct tegra_mc_client tegra186_mc_clients[] = { +struct tegra186_mc { + struct memory_controller base; + struct device *dev; + void __iomem *regs; +}; + +static const struct tegra186_mc_client tegra186_mc_clients[] = { { .name = "ptcr", .sid = TEGRA186_SID_PASSTHROUGH, @@ -534,8 +540,8 @@ static const struct tegra_mc_client tegra186_mc_clients[] = { static int tegra186_mc_probe(struct platform_device *pdev) { + struct tegra186_mc *mc; struct resource *res; - struct tegra_mc *mc; unsigned int i; int err = 0; @@ -551,7 +557,7 @@ static int tegra186_mc_probe(struct platform_device *pdev) mc->dev = &pdev->dev; for (i = 0; i < ARRAY_SIZE(tegra186_mc_clients); i++) { - const struct tegra_mc_client *client = &tegra186_mc_clients[i]; + const struct tegra186_mc_client *client = &tegra186_mc_clients[i]; u32 override, security; override = readl(mc->regs + client->regs.override); From patchwork Mon Dec 9 14:35:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11279475 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 44F81138C for ; Mon, 9 Dec 2019 14:35:38 +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 06D992077B for ; Mon, 9 Dec 2019 14:35:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kaXTRte8"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="slDLM5ys" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 06D992077B 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+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0eZNRL50VsGCqWK+SPkChXpa7sBMyFnoRr8haf3HOFQ=; b=kaXTRte85xDeA1 H5mc5eKStOX74CoWVtbySR1EEgedvH0lJpoMEEwY+K+1qikwKeGvpGNwwnUA/tlFvpHw303pm1bP7 z5eKV5qkuF6R/113Jg+YYmD4S9re3XamthBXqW44P8FWvt+uOazj6REztCcIxROTvMjz67pf8gmMA NpIYAG1QMtEB+aT6HnexGqSVn48CMJw2UT2jqajKEL9/4R4CFG2lPPwMTXUfcbNOOiw6HUTn3C291 a21F1iuHGZMz0j9TPz/JYqEqBwfg9WtOjYm0eUK3JwQqFFxW4y6YLhBuzp0B5hpbvYgTgD8r+xy80 laOLA9u5m3oeKhk0HEyA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ieK8O-0000NE-2t; Mon, 09 Dec 2019 14:35:36 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ieK8F-0000EF-0h for linux-arm-kernel@lists.infradead.org; Mon, 09 Dec 2019 14:35:28 +0000 Received: by mail-wr1-x441.google.com with SMTP id c14so16447910wrn.7 for ; Mon, 09 Dec 2019 06:35:26 -0800 (PST) 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=pVJO7p0o9DPYlpTp+A/mOyMkXB2XW+/pQeD4jA/+TpU=; b=slDLM5ysQZRF/kAf091dU61vqS/sYFT6gNsGh2WEcykkjVPXwbeTsxqTNOJcE7Kmd6 r0FcyA3FvQq3Kg+1fM25y+MtJqKomOzLLMlC3DFSVay3ZXqU3Sxul/A7GmxUk165D98E 7HMoPXAA/J6Tb+uqx9bhgKyYjA4VTCZv0amIhXDroQeImV1sts1yaMvb3ysJj+Kk2z3y mlrhiGK0mY1gb05MxoY9Yaf5Hxt1Sa3rdv7BVjFz/tIbGwq8aMcg+tw4Me/ObWQXbcKC ZCCr4EDB6+c13sJy5r81ITSfDIGSDN6ZCGk7s+4klTcgFjoJs+kvyhPSSkoPz4xUBRSs cl2A== 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=pVJO7p0o9DPYlpTp+A/mOyMkXB2XW+/pQeD4jA/+TpU=; b=TwELBhbf0fLXQl+Dxu3ZsUStl9EhKCNanePOa+K6wBKHo/fDnj+nEix1qTWOpDZV3m U1FYfs6FpQQay4VHS3L0tq1NwDh6Co9qvh75DhG1op11fCMP+D2geq/TBsHVvJ8y9YiD D5hRTnn6zmW+sYvCcv30uX1JRqNLNQTL56cNssD21NRCPaPfs4b++9Cw4aF+mYS9PtWM 2oZxB2TaOqpj8mbFRrbahiQHkv7wIXBysG50OulpwuPtNkpVFessPeCePdeIb88WthkE 1zNE0ZzXw6k232eGHBDTz3VCyWm+GBYYuv2zpQCiPG642Umprb653lD8ptftlJ9f9cPV jGzg== X-Gm-Message-State: APjAAAWlxjIFadVGtaJHv1H62tkpnujYfoh+ag/1YtTeEeQZGdG8IA0G RQto6cIN983ZoHZbyEXy6wc= X-Google-Smtp-Source: APXvYqz/ajgYyuq5a7RespWFuz0Vk3jwJqQTXoyxavQFwncKJO/uP48YzzSmJTg1p52aEz3kHpcR2g== X-Received: by 2002:a5d:6406:: with SMTP id z6mr2401027wru.294.1575902125397; Mon, 09 Dec 2019 06:35:25 -0800 (PST) Received: from localhost (pD9E518ED.dip0.t-ipconnect.de. [217.229.24.237]) by smtp.gmail.com with ESMTPSA id q15sm27625737wrr.11.2019.12.09.06.35.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2019 06:35:24 -0800 (PST) From: Thierry Reding To: Thierry Reding Subject: [PATCH 2/4] memory: tegra: Add per-SoC data for Tegra186 Date: Mon, 9 Dec 2019 15:35:19 +0100 Message-Id: <20191209143521.2357178-2-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191209143521.2357178-1-thierry.reding@gmail.com> References: <20191209143521.2357178-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-20191209_063527_058168_F63DFAFF X-CRM114-Status: GOOD ( 15.69 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:441 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (thierry.reding[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Thierry Reding Instead of hard-coding the memory client table, use per-SoC data in preparation for adding support for other SoCs. Signed-off-by: Thierry Reding --- drivers/memory/tegra/tegra186.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/drivers/memory/tegra/tegra186.c b/drivers/memory/tegra/tegra186.c index f72e89877295..ad5c353dba6e 100644 --- a/drivers/memory/tegra/tegra186.c +++ b/drivers/memory/tegra/tegra186.c @@ -6,15 +6,11 @@ #include #include #include +#include #include #include -struct tegra_mc { - struct device *dev; - void __iomem *regs; -}; - struct tegra186_mc_client { const char *name; unsigned int sid; @@ -24,10 +20,16 @@ struct tegra186_mc_client { } regs; }; +struct tegra186_mc_soc { + const struct tegra186_mc_client *clients; + unsigned int num_clients; +}; + struct tegra186_mc { - struct memory_controller base; struct device *dev; void __iomem *regs; + + const struct tegra186_mc_soc *soc; }; static const struct tegra186_mc_client tegra186_mc_clients[] = { @@ -538,17 +540,24 @@ static const struct tegra186_mc_client tegra186_mc_clients[] = { }, }; +static const struct tegra186_mc_soc tegra186_mc_soc = { + .num_clients = ARRAY_SIZE(tegra186_mc_clients), + .clients = tegra186_mc_clients, +}; + static int tegra186_mc_probe(struct platform_device *pdev) { struct tegra186_mc *mc; struct resource *res; unsigned int i; - int err = 0; + int err; mc = devm_kzalloc(&pdev->dev, sizeof(*mc), GFP_KERNEL); if (!mc) return -ENOMEM; + mc->soc = of_device_get_match_data(&pdev->dev); + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); mc->regs = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(mc->regs)) @@ -556,8 +565,8 @@ static int tegra186_mc_probe(struct platform_device *pdev) mc->dev = &pdev->dev; - for (i = 0; i < ARRAY_SIZE(tegra186_mc_clients); i++) { - const struct tegra186_mc_client *client = &tegra186_mc_clients[i]; + for (i = 0; i < mc->soc->num_clients; i++) { + const struct tegra186_mc_client *client = &mc->soc->clients[i]; u32 override, security; override = readl(mc->regs + client->regs.override); @@ -583,7 +592,7 @@ static int tegra186_mc_probe(struct platform_device *pdev) } static const struct of_device_id tegra186_mc_of_match[] = { - { .compatible = "nvidia,tegra186-mc", }, + { .compatible = "nvidia,tegra186-mc", .data = &tegra186_mc_soc }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, tegra186_mc_of_match); From patchwork Mon Dec 9 14:35:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11279477 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C5164138C for ; Mon, 9 Dec 2019 14:35:49 +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 A32642077B for ; Mon, 9 Dec 2019 14:35:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="OxZjOqv8"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HNvyAgdE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A32642077B 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+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JFVoedY41hGv8ESNzOZaGZ8K9ji64M5l7MoNx9Ccb/s=; b=OxZjOqv8NoNsjn EFFOUDUHlIprFvK+RIu5Zz7AVTM1AeYmyEOH0qeA9YHpqG6tfKId1ffxEzDIDKs+b5ZAg67hJnZWw pxsEtZjdqwrIGMJsyCk0UrGhuMTZzhz6ucEO8iyCG02tJ8MyJEOHYq1w+bWuUfzHoMc8HIdQsPpTx 7q0x+Kx6zgUGNcubbdlyAdK8gk22CQyoojpok5mGoutk74C4AyMqa+Z4oRGXI5ml2jXMPKQjbdgky HoP2GwZV3R3I+6LIj3LTMHqiuAYBVKV9537dEylWWRnsIMfsvR/r2bm6T1cscFx7vZ+q4JPWpAMhv u5TTe9qQ6lReuWL1dILw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ieK8Z-0000d2-JT; Mon, 09 Dec 2019 14:35:47 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ieK8G-0000EZ-SL for linux-arm-kernel@lists.infradead.org; Mon, 09 Dec 2019 14:35:30 +0000 Received: by mail-wr1-x442.google.com with SMTP id w15so16522984wru.4 for ; Mon, 09 Dec 2019 06:35:28 -0800 (PST) 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=w+/up9hfq8p4ACSSdrH1ZXd7EiQBLXwMXcYJzFgJaOc=; b=HNvyAgdEOD2w1gDlLb7eiaFWs4FgSrRvV87ajeNqAR6zqxVbc1EtNYsigYA/Re5VyY 81BwPZ6odmVs/63pWoUXexjgYemn9M+NIaeVFVY8O11FoZQo56m9p6GU0GY/4Omh/fwW CzIV052dK4C6tpfyQxONgseQzFYtdIFGeHi0lMk8TXhJiOhep9+Lv+uPeGIiEPZg53H+ 2EGKsoz9vDoSd2sLVOxejGewI86bw2FxJXpMM3agj0W2mc7f3/qqUk7eOIWvpIUnfpKo TRMqIet8S1BNW0i06AJruQ+gp4uqhT+g15r2yjIqLh6B6Q2oHCAsaali4t+bDnd6ntrY iI5Q== 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=w+/up9hfq8p4ACSSdrH1ZXd7EiQBLXwMXcYJzFgJaOc=; b=Y9q2FD3Z6ITW6OzYGCSsv1mk6MG07ejfrl7hkVB973TT0xGRWlwWTv0mW/0Yiu/XsJ RmkZPdvLN7aso6VGVCXE3W9u/3gXfLtiT4CL5a9BG3acW1ln1E3g8hocD/GMzvWQdTzw xs925Y2fgyvhSFdAzNawjZQIY5rwAKNVad/qjif3Er4xuyQy+wBCjX9LaeDRlpHmLhIg 4HQ7L4+BvrhvqKZOZXT1kpsz+JpxgMUeMp4FrK3+GuqsEVXKK24RLfGrx3kgr9Qmfand 074KQSFe2POxrg4XucFp463+Hwdm7Zp7qZFpTfnphXprIxiiDZaZ8GSNMV3ApAlljci2 R2Dg== X-Gm-Message-State: APjAAAVvzLfxle9z7FnWPdZqiWrb9cMZSZOC3xqSQjr4Z6IRM5cnn8Lf CqiDXRTkqg1fjhPFfhm2KU5r8yBq X-Google-Smtp-Source: APXvYqyKds5tu0qb4MmQnhm021ZUXsdo14wPOu8h0clSObyGcgp7AspA9k6XyVybEIAt3zuxM5Qtsw== X-Received: by 2002:adf:e6c6:: with SMTP id y6mr2574017wrm.284.1575902127288; Mon, 09 Dec 2019 06:35:27 -0800 (PST) Received: from localhost (pD9E518ED.dip0.t-ipconnect.de. [217.229.24.237]) by smtp.gmail.com with ESMTPSA id q6sm28906963wrx.72.2019.12.09.06.35.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2019 06:35:26 -0800 (PST) From: Thierry Reding To: Thierry Reding Subject: [PATCH 3/4] memory: tegra: Extract memory client SID programming Date: Mon, 9 Dec 2019 15:35:20 +0100 Message-Id: <20191209143521.2357178-3-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191209143521.2357178-1-thierry.reding@gmail.com> References: <20191209143521.2357178-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-20191209_063528_922818_F7DA709B X-CRM114-Status: GOOD ( 13.07 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:442 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (thierry.reding[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Thierry Reding Move programming of the memory client to SID mapping into a separate function so that it can be reused from multiple call sites. Signed-off-by: Thierry Reding --- drivers/memory/tegra/tegra186.c | 49 ++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/drivers/memory/tegra/tegra186.c b/drivers/memory/tegra/tegra186.c index ad5c353dba6e..57895116c8e5 100644 --- a/drivers/memory/tegra/tegra186.c +++ b/drivers/memory/tegra/tegra186.c @@ -32,6 +32,32 @@ struct tegra186_mc { const struct tegra186_mc_soc *soc; }; +static void tegra186_mc_program_sid(struct tegra186_mc *mc) +{ + unsigned int i; + + for (i = 0; i < mc->soc->num_clients; i++) { + const struct tegra186_mc_client *client = &mc->soc->clients[i]; + u32 override, security; + + override = readl(mc->regs + client->regs.override); + security = readl(mc->regs + client->regs.security); + + dev_dbg(mc->dev, "client %s: override: %x security: %x\n", + client->name, override, security); + + dev_dbg(mc->dev, "setting SID %u for %s\n", client->sid, + client->name); + writel(client->sid, mc->regs + client->regs.override); + + override = readl(mc->regs + client->regs.override); + security = readl(mc->regs + client->regs.security); + + dev_dbg(mc->dev, "client %s: override: %x security: %x\n", + client->name, override, security); + } +} + static const struct tegra186_mc_client tegra186_mc_clients[] = { { .name = "ptcr", @@ -549,7 +575,6 @@ static int tegra186_mc_probe(struct platform_device *pdev) { struct tegra186_mc *mc; struct resource *res; - unsigned int i; int err; mc = devm_kzalloc(&pdev->dev, sizeof(*mc), GFP_KERNEL); @@ -565,28 +590,8 @@ static int tegra186_mc_probe(struct platform_device *pdev) mc->dev = &pdev->dev; - for (i = 0; i < mc->soc->num_clients; i++) { - const struct tegra186_mc_client *client = &mc->soc->clients[i]; - u32 override, security; - - override = readl(mc->regs + client->regs.override); - security = readl(mc->regs + client->regs.security); - - dev_dbg(&pdev->dev, "client %s: override: %x security: %x\n", - client->name, override, security); - - dev_dbg(&pdev->dev, "setting SID %u for %s\n", client->sid, - client->name); - writel(client->sid, mc->regs + client->regs.override); - - override = readl(mc->regs + client->regs.override); - security = readl(mc->regs + client->regs.security); - - dev_dbg(&pdev->dev, "client %s: override: %x security: %x\n", - client->name, override, security); - } - platform_set_drvdata(pdev, mc); + tegra186_mc_program_sid(mc); return err; } From patchwork Mon Dec 9 14:35:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11279479 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C9382138D for ; Mon, 9 Dec 2019 14:36:05 +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 63A7C2077B for ; Mon, 9 Dec 2019 14:36:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="h7NaNtDx"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gCjs4Ejh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 63A7C2077B 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+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SRuKKTnEs+PfjwqjbeQxzLbWzHwn4cKe4iRZ/TGdz+s=; b=h7NaNtDx0I5BBZ awYtvJq2f06nedt9u41b1afTQ3XshHn86J+mjs3De0FbFIpr5vsFjEskyGqRiGZPw3H2yrwOQU2VW ZoEGlQCDWsZ65deBuyq4+/HcFkArtFIa+Oty8cSFXj9fl1gBovfFL+a3mSZCPaHlv26XdpV5wSaBH oeA1/oH8NCWM8PZNlDaVCNOHNKfaDq9Kji7otk8E8yIYB4cRD3H5Y9a/bvL39dWLDj9rPkv59KySH fCFskrtWKgiOzf8k+BybFuUxtt2qeONIbRlqK7k9imwhFoQr1bT2QSM1eenM1nTx+Wsp7iC/mtPLT KKeJB350EZNk+gRTn5wA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ieK8p-0000vM-Cc; Mon, 09 Dec 2019 14:36:03 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ieK8I-0000G5-IU for linux-arm-kernel@lists.infradead.org; Mon, 09 Dec 2019 14:35:31 +0000 Received: by mail-wr1-x441.google.com with SMTP id c14so16448141wrn.7 for ; Mon, 09 Dec 2019 06:35:30 -0800 (PST) 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=ttm9JDpQfFdaivyu5BbcV+zimIykT6JMxYV6nznS1UA=; b=gCjs4EjhPSHYsAW88CXORy+zE44wsE1lTpQx0OWcgaWmqOXLNvziJCiN58M091OZDV yO00e7ux0J89OhF3MXEF7m36zVfOajSaxdedZKJ7CpT2aSj+MULxVucYhvARR23lpOYg T41N0lk4apBmJEvmAjP45oCVT3GfA8D+K4gGz7Ht+Sk39r9W9nRy5YuTlariruguAi9A zGSL0oEAEOwOkw8VWuF+iH+pQcaLrVL1vL/SpMhI2IM2rptnNBvgVd0z+fT5ZFuHTPeG gRMuc+rO/EqDnYee1TYVZZpd9IYaTBFv9q45wAbZOlj0bFykM+4AHk1FV55kqP45DS/y yDqg== 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=ttm9JDpQfFdaivyu5BbcV+zimIykT6JMxYV6nznS1UA=; b=MVcb7K1dGkU650VNOGf13WnZZ434CQp1jAPjJHrxbAIoPXhdhJ6DJsx9si8HMX9NwX EdyRg5qvLY0Mq9n7w78oi5yMUKkaCzufDb/wOYxy6zqZWeJbwfrZ6myTlXswPBirbZv1 xPTLu3KxUA87Sz41LqEUAZEu++am2rqgQovK1e0iNdxerpsjUSuST7biIjoAvQbUG2iG hhR+cRByle3HBlbbXaBO7ftsmz6pOTWGokDmlpwTf2SeX8LQqu+0CK2qJ+KUfpCzkHtg zFY3kIN/sCzTIUvdHc/u5VeS/LVhgflEk6XVmK11CyGHF39UAURUizBz4SGVz1kwXp9n 9mFQ== X-Gm-Message-State: APjAAAUXH5XwUDYEdbFHH3ZDnz3RZOn5JZ4bOyoGubH/ak3h0XKY09Cc ucNaIZmQB57EBg9Vnp01vnQ= X-Google-Smtp-Source: APXvYqxEVg1sv/FHoGnDe5fHFym5HGmdl2utN2KLxOQtPTp1zpgBVVbM7HzmeOIkpx8OV4eNkdzDmg== X-Received: by 2002:a05:6000:cf:: with SMTP id q15mr2417471wrx.393.1575902129270; Mon, 09 Dec 2019 06:35:29 -0800 (PST) Received: from localhost (pD9E518ED.dip0.t-ipconnect.de. [217.229.24.237]) by smtp.gmail.com with ESMTPSA id a186sm14283943wmd.41.2019.12.09.06.35.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2019 06:35:28 -0800 (PST) From: Thierry Reding To: Thierry Reding Subject: [PATCH 4/4] memory: tegra: Add system sleep support Date: Mon, 9 Dec 2019 15:35:21 +0100 Message-Id: <20191209143521.2357178-4-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191209143521.2357178-1-thierry.reding@gmail.com> References: <20191209143521.2357178-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-20191209_063530_627907_856A3C2C X-CRM114-Status: GOOD ( 11.46 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:441 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (thierry.reding[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Thierry Reding Add system suspend/resume support for the memory controller found on Tegra186 and later. This is required so that the SID registers can be reprogrammed after their content was lost during system sleep. Signed-off-by: Thierry Reding --- drivers/memory/tegra/tegra186.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/memory/tegra/tegra186.c b/drivers/memory/tegra/tegra186.c index 57895116c8e5..77a313f1bf0e 100644 --- a/drivers/memory/tegra/tegra186.c +++ b/drivers/memory/tegra/tegra186.c @@ -602,10 +602,29 @@ static const struct of_device_id tegra186_mc_of_match[] = { }; MODULE_DEVICE_TABLE(of, tegra186_mc_of_match); +static int tegra186_mc_suspend(struct device *dev) +{ + return 0; +} + +static int tegra186_mc_resume(struct device *dev) +{ + struct tegra186_mc *mc = dev_get_drvdata(dev); + + tegra186_mc_program_sid(mc); + + return 0; +} + +static const struct dev_pm_ops tegra186_mc_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(tegra186_mc_suspend, tegra186_mc_resume) +}; + static struct platform_driver tegra186_mc_driver = { .driver = { .name = "tegra186-mc", .of_match_table = tegra186_mc_of_match, + .pm = &tegra186_mc_pm_ops, .suppress_bind_attrs = true, }, .prevent_deferred_probe = true,