Add support for the implementation of Host1x present on the Tegra186.
The register space has been shuffled around a little bit, requiring
addition of some chip-specific code sections. Tegra186 also adds
several new features, most importantly the hypervisor, but those are
not yet supported with this commit.
Signed-off-by: Mikko Perttunen
---
drivers/gpu/host1x/Makefile| 3 +-
drivers/gpu/host1x/dev.c | 60 ++-
drivers/gpu/host1x/dev.h | 4 +
drivers/gpu/host1x/hw/cdma_hw.c| 49 +++---
drivers/gpu/host1x/hw/debug_hw.c | 137 +---
.../gpu/host1x/hw/{debug_hw.c => debug_hw_1x01.c} | 160 --
drivers/gpu/host1x/hw/debug_hw_1x06.c | 133 +++
drivers/gpu/host1x/hw/host1x01.c | 2 +
drivers/gpu/host1x/hw/host1x02.c | 2 +
drivers/gpu/host1x/hw/host1x04.c | 2 +
drivers/gpu/host1x/hw/host1x05.c | 2 +
drivers/gpu/host1x/hw/{host1x02.c => host1x06.c} | 12 +-
drivers/gpu/host1x/hw/{host1x02.c => host1x06.h} | 30 +---
drivers/gpu/host1x/hw/host1x06_hardware.h | 142
drivers/gpu/host1x/hw/hw_host1x06_hypervisor.h | 32
drivers/gpu/host1x/hw/hw_host1x06_uclass.h | 181 +
drivers/gpu/host1x/hw/hw_host1x06_vm.h | 47 ++
drivers/gpu/host1x/hw/intr_hw.c| 29 ++--
18 files changed, 670 insertions(+), 357 deletions(-)
copy drivers/gpu/host1x/hw/{debug_hw.c => debug_hw_1x01.c} (53%)
create mode 100644 drivers/gpu/host1x/hw/debug_hw_1x06.c
copy drivers/gpu/host1x/hw/{host1x02.c => host1x06.c} (84%)
copy drivers/gpu/host1x/hw/{host1x02.c => host1x06.h} (50%)
create mode 100644 drivers/gpu/host1x/hw/host1x06_hardware.h
create mode 100644 drivers/gpu/host1x/hw/hw_host1x06_hypervisor.h
create mode 100644 drivers/gpu/host1x/hw/hw_host1x06_uclass.h
create mode 100644 drivers/gpu/host1x/hw/hw_host1x06_vm.h
diff --git a/drivers/gpu/host1x/Makefile b/drivers/gpu/host1x/Makefile
index a1d9974cfcb5..4fb61bd57aee 100644
--- a/drivers/gpu/host1x/Makefile
+++ b/drivers/gpu/host1x/Makefile
@@ -11,6 +11,7 @@ host1x-y = \
hw/host1x01.o \
hw/host1x02.o \
hw/host1x04.o \
- hw/host1x05.o
+ hw/host1x05.o \
+ hw/host1x06.o
obj-$(CONFIG_TEGRA_HOST1X) += host1x.o
diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
index 2c58a390123a..6a4ff2d59496 100644
--- a/drivers/gpu/host1x/dev.c
+++ b/drivers/gpu/host1x/dev.c
@@ -39,6 +39,17 @@
#include "hw/host1x02.h"
#include "hw/host1x04.h"
#include "hw/host1x05.h"
+#include "hw/host1x06.h"
+
+void host1x_hypervisor_writel(struct host1x *host1x, u32 v, u32 r)
+{
+ writel(v, host1x->hv_regs + r);
+}
+
+u32 host1x_hypervisor_readl(struct host1x *host1x, u32 r)
+{
+ return readl(host1x->hv_regs + r);
+}
void host1x_sync_writel(struct host1x *host1x, u32 v, u32 r)
{
@@ -104,7 +115,19 @@ static const struct host1x_info host1x05_info = {
.dma_mask = DMA_BIT_MASK(34),
};
+static const struct host1x_info host1x06_info = {
+ .nb_channels = 63,
+ .nb_pts = 576,
+ .nb_mlocks = 24,
+ .nb_bases = 16,
+ .init = host1x06_init,
+ .sync_offset = 0x0,
+ .dma_mask = DMA_BIT_MASK(34),
+ .has_hypervisor = true,
+};
+
static const struct of_device_id host1x_of_match[] = {
+ { .compatible = "nvidia,tegra186-host1x", .data = &host1x06_info, },
{ .compatible = "nvidia,tegra210-host1x", .data = &host1x05_info, },
{ .compatible = "nvidia,tegra124-host1x", .data = &host1x04_info, },
{ .compatible = "nvidia,tegra114-host1x", .data = &host1x02_info, },
@@ -117,8 +140,9 @@ MODULE_DEVICE_TABLE(of, host1x_of_match);
static int host1x_probe(struct platform_device *pdev)
{
const struct of_device_id *id;
+ const struct host1x_info *info;
struct host1x *host;
- struct resource *regs;
+ struct resource *regs, *hv_regs = NULL;
int syncpt_irq;
int err;
@@ -126,10 +150,28 @@ static int host1x_probe(struct platform_device *pdev)
if (!id)
return -EINVAL;
- regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!regs) {
- dev_err(&pdev->dev, "failed to get registers\n");
- return -ENXIO;
+ info = id->data;
+
+ if (info->has_hypervisor) {
+ regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "vm");
+ if (!regs) {
+ dev_err(&pdev->dev, "failed to get vm registers\n");
+ return -ENXIO;
+ }
+
+ hv_regs = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+ "hypervisor");
+ if (!hv_regs) {
+ dev_