linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Osipenko <digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>,
	Thierry Reding
	<thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Jonathan Hunter
	<jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH v1 2/9] iommu/tegra: gart: Provide access to Memory Controller driver
Date: Tue,  8 May 2018 21:16:53 +0300	[thread overview]
Message-ID: <20180508181700.5169-3-digetx@gmail.com> (raw)
In-Reply-To: <20180508181700.5169-1-digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

GART contains registers needed by the Memory Controller driver. Provide
access to the MC driver by utilizing its GART-integration facility.

Signed-off-by: Dmitry Osipenko <digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/iommu/tegra-gart.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/drivers/iommu/tegra-gart.c b/drivers/iommu/tegra-gart.c
index 89ec24c6952c..de48943bf843 100644
--- a/drivers/iommu/tegra-gart.c
+++ b/drivers/iommu/tegra-gart.c
@@ -31,6 +31,8 @@
 #include <linux/iommu.h>
 #include <linux/of.h>
 
+#include <soc/tegra/mc.h>
+
 #include <asm/cacheflush.h>
 
 /* bitmap of the page sizes currently supported */
@@ -41,6 +43,8 @@
 #define GART_ENTRY_ADDR		(0x28 - GART_REG_BASE)
 #define GART_ENTRY_DATA		(0x2c - GART_REG_BASE)
 #define GART_ENTRY_PHYS_ADDR_VALID	(1 << 31)
+#define GART_ERROR_REQ		(0x30 - GART_REG_BASE)
+#define GART_ERROR_ADDR		(0x34 - GART_REG_BASE)
 
 #define GART_PAGE_SHIFT		12
 #define GART_PAGE_SIZE		(1 << GART_PAGE_SHIFT)
@@ -63,6 +67,8 @@ struct gart_device {
 	struct device		*dev;
 
 	struct iommu_device	iommu;		/* IOMMU Core handle */
+
+	struct tegra_mc_gart_handle mc_gart_handle;
 };
 
 struct gart_domain {
@@ -408,6 +414,20 @@ static int tegra_gart_resume(struct device *dev)
 	return 0;
 }
 
+static u32 tegra_gart_error_addr(struct tegra_mc_gart_handle *handle)
+{
+	struct gart_device *gart = container_of(handle, struct gart_device,
+						mc_gart_handle);
+	return readl(gart->regs + GART_ERROR_ADDR);
+}
+
+static u32 tegra_gart_error_req(struct tegra_mc_gart_handle *handle)
+{
+	struct gart_device *gart = container_of(handle, struct gart_device,
+						mc_gart_handle);
+	return readl(gart->regs + GART_ERROR_REQ);
+}
+
 static int tegra_gart_probe(struct platform_device *pdev)
 {
 	struct gart_device *gart;
@@ -464,6 +484,8 @@ static int tegra_gart_probe(struct platform_device *pdev)
 	gart->regs = gart_regs;
 	gart->iovmm_base = (dma_addr_t)res_remap->start;
 	gart->page_count = (resource_size(res_remap) >> GART_PAGE_SHIFT);
+	gart->mc_gart_handle.error_addr = tegra_gart_error_addr;
+	gart->mc_gart_handle.error_req = tegra_gart_error_req;
 
 	gart->savedata = vmalloc(sizeof(u32) * gart->page_count);
 	if (!gart->savedata) {
@@ -475,6 +497,7 @@ static int tegra_gart_probe(struct platform_device *pdev)
 	do_gart_setup(gart, NULL);
 
 	gart_handle = gart;
+	tegra_mc_register_gart(&gart->mc_gart_handle);
 
 	return 0;
 }
-- 
2.17.0

  parent reply	other threads:[~2018-05-08 18:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-08 18:16 [PATCH v1 0/9] Tegra GART driver clean up and optimization Dmitry Osipenko
     [not found] ` <20180508181700.5169-1-digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-05-08 18:16   ` [PATCH v1 1/9] memory: tegra: Provide facility for integration with the GART driver Dmitry Osipenko
2018-05-08 18:16   ` Dmitry Osipenko [this message]
2018-05-08 18:16   ` [PATCH v1 3/9] iommu/tegra: gart: Remove code related to module unloading Dmitry Osipenko
2018-05-08 18:16   ` [PATCH v1 4/9] iommu/tegra: gart: Remove pr_fmt and clean up includes Dmitry Osipenko
2018-05-08 18:16   ` [PATCH v1 5/9] iommu/tegra: gart: Clean up driver probe failure unwinding Dmitry Osipenko
2018-05-08 18:16   ` [PATCH v1 7/9] iommu/tegra: gart: Provide single domain and group for all devices Dmitry Osipenko
     [not found]     ` <20180508181700.5169-8-digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-05-11 11:12       ` Dmitry Osipenko
2018-05-11 12:32       ` Robin Murphy
     [not found]         ` <dd440bff-5bbd-e0c6-5ebb-e36b9ab5e843-5wv7dgnIgG8@public.gmane.org>
2018-05-11 20:05           ` Dmitry Osipenko
     [not found]             ` <cd04abc4-cade-b8c9-bcde-9d18e4f32519-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-05-14 18:18               ` Robin Murphy
     [not found]                 ` <56d097b0-da3f-8635-9887-64e2df496d01-5wv7dgnIgG8@public.gmane.org>
2018-05-16 13:43                   ` Dmitry Osipenko
2018-05-08 18:16   ` [PATCH v1 8/9] iommu: Introduce iotlb_sync_map callback Dmitry Osipenko
     [not found]     ` <20180508181700.5169-9-digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-05-11 13:02       ` Robin Murphy
     [not found]         ` <da823a61-5bda-042b-c61f-d0d98f9b6e6f-5wv7dgnIgG8@public.gmane.org>
2018-05-11 19:58           ` Dmitry Osipenko
2018-05-08 18:17   ` [PATCH v1 9/9] iommu/tegra: gart: Optimize mapping / unmapping performance Dmitry Osipenko
2018-05-08 18:16 ` [PATCH v1 6/9] iommu/tegra: gart: Ignore devices without IOMMU phandle in DT Dmitry Osipenko
     [not found]   ` <20180508181700.5169-7-digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-05-11 11:34     ` Robin Murphy
     [not found]       ` <a3293da9-b750-6c5c-6f84-53b1aafc5e53-5wv7dgnIgG8@public.gmane.org>
2018-05-11 15:34         ` Dmitry Osipenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180508181700.5169-3-digetx@gmail.com \
    --to=digetx-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).