summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-tegra/board-aruba-panel.c5
-rw-r--r--arch/arm/mach-tegra/board-cardhu-panel.c7
-rw-r--r--arch/arm/mach-tegra/board-enterprise-panel.c5
-rw-r--r--arch/arm/mach-tegra/board-harmony-panel.c3
-rw-r--r--arch/arm/mach-tegra/board-kai-panel.c3
-rw-r--r--arch/arm/mach-tegra/board-p1852-panel.c1
-rw-r--r--arch/arm/mach-tegra/board-ventana-panel.c5
-rw-r--r--arch/arm/mach-tegra/board-whistler-panel.c5
-rw-r--r--arch/arm/mach-tegra/devices.c50
-rw-r--r--arch/arm/mach-tegra/devices.h1
-rw-r--r--arch/arm/mach-tegra/p852/board-p852-panel.c3
-rw-r--r--drivers/video/tegra/host/dev.c146
-rw-r--r--drivers/video/tegra/host/dev.h3
-rw-r--r--drivers/video/tegra/host/host1x/host1x_cdma.c28
-rw-r--r--drivers/video/tegra/host/host1x/host1x_syncpt.c11
-rw-r--r--drivers/video/tegra/host/nvhost_acm.c10
-rw-r--r--drivers/video/tegra/host/nvhost_channel.c2
-rw-r--r--drivers/video/tegra/host/nvhost_syncpt.c6
-rw-r--r--include/linux/nvhost.h8
19 files changed, 142 insertions, 160 deletions
diff --git a/arch/arm/mach-tegra/board-aruba-panel.c b/arch/arm/mach-tegra/board-aruba-panel.c
index 7524f821f359..92e43626a5f9 100644
--- a/arch/arm/mach-tegra/board-aruba-panel.c
+++ b/arch/arm/mach-tegra/board-aruba-panel.c
@@ -1,7 +1,7 @@
/*
* arch/arm/mach-tegra/board-aruba-panel.c
*
- * Copyright (c) 2010-2011, NVIDIA Corporation.
+ * Copyright (c) 2010-2012, NVIDIA Corporation.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -213,9 +213,6 @@ static struct platform_device *aruba_gfx_devices[] __initdata = {
#if defined(CONFIG_TEGRA_NVMAP)
&aruba_nvmap_device,
#endif
-#ifdef CONFIG_TEGRA_GRHOST
- &tegra_grhost_device,
-#endif
&tegra_pwfm2_device,
&aruba_backlight_device,
};
diff --git a/arch/arm/mach-tegra/board-cardhu-panel.c b/arch/arm/mach-tegra/board-cardhu-panel.c
index 90801b0e610d..7de847695f60 100644
--- a/arch/arm/mach-tegra/board-cardhu-panel.c
+++ b/arch/arm/mach-tegra/board-cardhu-panel.c
@@ -1,7 +1,7 @@
/*
* arch/arm/mach-tegra/board-cardhu-panel.c
*
- * Copyright (c) 2010-2011, NVIDIA Corporation.
+ * Copyright (c) 2010-2012, NVIDIA Corporation.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1097,9 +1097,6 @@ static struct platform_device *cardhu_gfx_devices[] __initdata = {
#if defined(CONFIG_ION_TEGRA)
&tegra_ion_device,
#endif
-#ifdef CONFIG_TEGRA_GRHOST
- &tegra_grhost_device,
-#endif
&tegra_pwfm0_device,
&cardhu_backlight_device,
};
@@ -1113,8 +1110,6 @@ struct early_suspend cardhu_panel_early_suspender;
static void cardhu_panel_early_suspend(struct early_suspend *h)
{
- unsigned i;
-
/* power down LCD, add use a black screen for HDMI */
if (num_registered_fb > 0)
fb_blank(registered_fb[0], FB_BLANK_POWERDOWN);
diff --git a/arch/arm/mach-tegra/board-enterprise-panel.c b/arch/arm/mach-tegra/board-enterprise-panel.c
index ec7eae3b365d..0defe56a7bc7 100644
--- a/arch/arm/mach-tegra/board-enterprise-panel.c
+++ b/arch/arm/mach-tegra/board-enterprise-panel.c
@@ -1,7 +1,7 @@
/*
* arch/arm/mach-tegra/board-enterprise-panel.c
*
- * Copyright (c) 2011, NVIDIA Corporation.
+ * Copyright (c) 2011-2012, NVIDIA Corporation.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -694,9 +694,6 @@ static struct platform_device *enterprise_gfx_devices[] __initdata = {
#if defined(CONFIG_TEGRA_NVMAP)
&enterprise_nvmap_device,
#endif
-#ifdef CONFIG_TEGRA_GRHOST
- &tegra_grhost_device,
-#endif
&tegra_pwfm0_device,
};
diff --git a/arch/arm/mach-tegra/board-harmony-panel.c b/arch/arm/mach-tegra/board-harmony-panel.c
index 4ea6725101ee..d9974f1b1caa 100644
--- a/arch/arm/mach-tegra/board-harmony-panel.c
+++ b/arch/arm/mach-tegra/board-harmony-panel.c
@@ -1,7 +1,7 @@
/*
* arch/arm/mach-tegra/board-harmony-panel.c
*
- * Copyright (c) 2010-2011, NVIDIA Corporation.
+ * Copyright (c) 2010-2012, NVIDIA Corporation.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
@@ -325,7 +325,6 @@ static struct platform_device *harmony_gfx_devices[] __initdata = {
#if defined(CONFIG_TEGRA_NVMAP)
&harmony_nvmap_device,
#endif
- &tegra_grhost_device,
&tegra_pwfm0_device,
&harmony_backlight_device,
};
diff --git a/arch/arm/mach-tegra/board-kai-panel.c b/arch/arm/mach-tegra/board-kai-panel.c
index 742633735071..1e5c588d6065 100644
--- a/arch/arm/mach-tegra/board-kai-panel.c
+++ b/arch/arm/mach-tegra/board-kai-panel.c
@@ -602,9 +602,6 @@ static struct platform_device *kai_gfx_devices[] __initdata = {
#if defined(CONFIG_TEGRA_NVMAP)
&kai_nvmap_device,
#endif
-#ifdef CONFIG_TEGRA_GRHOST
- &tegra_grhost_device,
-#endif
&tegra_pwfm0_device,
&kai_backlight_device,
};
diff --git a/arch/arm/mach-tegra/board-p1852-panel.c b/arch/arm/mach-tegra/board-p1852-panel.c
index b26ff19e87be..238642380e72 100644
--- a/arch/arm/mach-tegra/board-p1852-panel.c
+++ b/arch/arm/mach-tegra/board-p1852-panel.c
@@ -104,7 +104,6 @@ static struct nvmap_platform_data p1852_nvmap_data = {
static struct platform_device *p1852_gfx_devices[] __initdata = {
&tegra_nvmap_device,
- &tegra_grhost_device
};
int __init p1852_panel_init(void)
diff --git a/arch/arm/mach-tegra/board-ventana-panel.c b/arch/arm/mach-tegra/board-ventana-panel.c
index e2a54cdb2a68..83bfb7822357 100644
--- a/arch/arm/mach-tegra/board-ventana-panel.c
+++ b/arch/arm/mach-tegra/board-ventana-panel.c
@@ -1,7 +1,7 @@
/*
* arch/arm/mach-tegra/board-ventana-panel.c
*
- * Copyright (c) 2010-2011, NVIDIA Corporation.
+ * Copyright (c) 2010-2012, NVIDIA Corporation.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -337,9 +337,6 @@ static struct platform_device *ventana_gfx_devices[] __initdata = {
#if defined(CONFIG_TEGRA_NVMAP)
&ventana_nvmap_device,
#endif
-#ifdef CONFIG_TEGRA_GRHOST
- &tegra_grhost_device,
-#endif
&tegra_pwfm2_device,
&ventana_backlight_device,
};
diff --git a/arch/arm/mach-tegra/board-whistler-panel.c b/arch/arm/mach-tegra/board-whistler-panel.c
index 9516a315c912..6fc576b3607e 100644
--- a/arch/arm/mach-tegra/board-whistler-panel.c
+++ b/arch/arm/mach-tegra/board-whistler-panel.c
@@ -1,7 +1,7 @@
/*
* arch/arm/mach-tegra/board-whistler-panel.c
*
- * Copyright (c) 2010-2011, NVIDIA Corporation.
+ * Copyright (c) 2010-2012, NVIDIA Corporation.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -300,9 +300,6 @@ static struct platform_device *whistler_gfx_devices[] __initdata = {
#if defined(CONFIG_TEGRA_NVMAP)
&whistler_nvmap_device,
#endif
-#ifdef CONFIG_TEGRA_GRHOST
- &tegra_grhost_device,
-#endif
&whistler_disp1_backlight_device,
};
diff --git a/arch/arm/mach-tegra/devices.c b/arch/arm/mach-tegra/devices.c
index 65a5fadefad5..202c767550e8 100644
--- a/arch/arm/mach-tegra/devices.c
+++ b/arch/arm/mach-tegra/devices.c
@@ -1478,56 +1478,6 @@ struct platform_device tegra_pwfm3_device = {
.resource = &tegra_pwfm3_resource,
};
-static struct resource tegra_grhost_resources[] = {
- {
- .start = TEGRA_HOST1X_BASE,
- .end = TEGRA_HOST1X_BASE + TEGRA_HOST1X_SIZE - 1,
- .flags = IORESOURCE_MEM,
- },
- {
- .start = TEGRA_DISPLAY_BASE,
- .end = TEGRA_DISPLAY_BASE + TEGRA_DISPLAY_SIZE - 1,
- .flags = IORESOURCE_MEM,
- },
- {
- .start = TEGRA_DISPLAY2_BASE,
- .end = TEGRA_DISPLAY2_BASE + TEGRA_DISPLAY2_SIZE - 1,
- .flags = IORESOURCE_MEM,
- },
- {
- .start = TEGRA_VI_BASE,
- .end = TEGRA_VI_BASE + TEGRA_VI_SIZE - 1,
- .flags = IORESOURCE_MEM,
- },
- {
- .start = TEGRA_ISP_BASE,
- .end = TEGRA_ISP_BASE + TEGRA_ISP_SIZE - 1,
- .flags = IORESOURCE_MEM,
- },
- {
- .start = TEGRA_MPE_BASE,
- .end = TEGRA_MPE_BASE + TEGRA_MPE_SIZE - 1,
- .flags = IORESOURCE_MEM,
- },
- {
- .start = INT_SYNCPT_THRESH_BASE,
- .end = INT_SYNCPT_THRESH_BASE + INT_SYNCPT_THRESH_NR - 1,
- .flags = IORESOURCE_IRQ,
- },
- {
- .start = INT_HOST1X_MPCORE_GENERAL,
- .end = INT_HOST1X_MPCORE_GENERAL,
- .flags = IORESOURCE_IRQ,
- },
-};
-
-struct platform_device tegra_grhost_device = {
- .name = "tegra_grhost",
- .id = -1,
- .resource = tegra_grhost_resources,
- .num_resources = ARRAY_SIZE(tegra_grhost_resources),
-};
-
static struct tegra_avp_platform_data tegra_avp_pdata = {
#ifdef CONFIG_ARCH_TEGRA_2x_SOC
.emc_clk_rate = ULONG_MAX,
diff --git a/arch/arm/mach-tegra/devices.h b/arch/arm/mach-tegra/devices.h
index 5aa554ffe8df..b7fc6fdd655c 100644
--- a/arch/arm/mach-tegra/devices.h
+++ b/arch/arm/mach-tegra/devices.h
@@ -107,7 +107,6 @@ extern struct platform_device tegra_uartb_device;
extern struct platform_device tegra_uartc_device;
extern struct platform_device tegra_uartd_device;
extern struct platform_device tegra_uarte_device;
-extern struct platform_device tegra_grhost_device;
extern struct platform_device tegra_avp_device;
extern struct nvhost_device nvavp_device;
extern struct platform_device tegra_aes_device;
diff --git a/arch/arm/mach-tegra/p852/board-p852-panel.c b/arch/arm/mach-tegra/p852/board-p852-panel.c
index bfd35fa5da53..3d65a61adecb 100644
--- a/arch/arm/mach-tegra/p852/board-p852-panel.c
+++ b/arch/arm/mach-tegra/p852/board-p852-panel.c
@@ -1,7 +1,7 @@
/*
* arch/arm/mach-tegra/board-p852-panel.c
*
- * Copyright (c) 2010-2011, NVIDIA Corporation.
+ * Copyright (c) 2010-2012, NVIDIA Corporation.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -157,7 +157,6 @@ static struct platform_device p852_nvmap_device = {
};
static struct platform_device *p852_gfx_devices[] __initdata = {
- &tegra_grhost_device,
&tegra_pwfm2_device,
};
diff --git a/drivers/video/tegra/host/dev.c b/drivers/video/tegra/host/dev.c
index 2b11929dab3c..fa8c6176fcbc 100644
--- a/drivers/video/tegra/host/dev.c
+++ b/drivers/video/tegra/host/dev.c
@@ -28,7 +28,6 @@
#include <linux/spinlock.h>
#include <linux/fs.h>
#include <linux/cdev.h>
-#include <linux/platform_device.h>
#include <linux/uaccess.h>
#include <linux/file.h>
#include <linux/clk.h>
@@ -43,15 +42,16 @@
#include <mach/nvmap.h>
#include <mach/gpufuse.h>
#include <mach/hardware.h>
+#include <mach/iomap.h>
#include "debug.h"
#include "nvhost_job.h"
#include "t20/t20.h"
#include "t30/t30.h"
-#define DRIVER_NAME "tegra_grhost"
-#define IFACE_NAME "nvhost"
-#define TRACE_MAX_LENGTH 128U
+#define DRIVER_NAME "host1x"
+#define IFACE_NAME "nvhost"
+#define TRACE_MAX_LENGTH 128U
static int nvhost_major = NVHOST_MAJOR;
static int nvhost_minor;
@@ -788,7 +788,7 @@ static int __devinit nvhost_user_init(struct nvhost_master *host)
host->nvhost_class = class_create(THIS_MODULE, IFACE_NAME);
if (IS_ERR(host->nvhost_class)) {
err = PTR_ERR(host->nvhost_class);
- dev_err(&host->pdev->dev, "failed to create class\n");
+ dev_err(&host->dev->dev, "failed to create class\n");
goto fail;
}
@@ -796,7 +796,7 @@ static int __devinit nvhost_user_init(struct nvhost_master *host)
host->nb_channels + 1, IFACE_NAME);
nvhost_major = MAJOR(devno);
if (err < 0) {
- dev_err(&host->pdev->dev, "failed to reserve chrdev region\n");
+ dev_err(&host->dev->dev, "failed to reserve chrdev region\n");
goto fail;
}
@@ -809,14 +809,14 @@ static int __devinit nvhost_user_init(struct nvhost_master *host)
devno = MKDEV(nvhost_major, nvhost_minor + i);
err = cdev_add(&ch->cdev, devno, 1);
if (err < 0) {
- dev_err(&host->pdev->dev, "failed to add chan %i cdev\n", i);
+ dev_err(&host->dev->dev, "failed to add chan %i cdev\n", i);
goto fail;
}
ch->node = device_create(host->nvhost_class, NULL, devno, NULL,
IFACE_NAME "-%s", ch->dev->name);
if (IS_ERR(ch->node)) {
err = PTR_ERR(ch->node);
- dev_err(&host->pdev->dev, "failed to create chan %i device\n", i);
+ dev_err(&host->dev->dev, "failed to create chan %i device\n", i);
goto fail;
}
}
@@ -831,7 +831,7 @@ static int __devinit nvhost_user_init(struct nvhost_master *host)
IFACE_NAME "-ctrl");
if (IS_ERR(host->ctrl)) {
err = PTR_ERR(host->ctrl);
- dev_err(&host->pdev->dev, "failed to create ctrl device\n");
+ dev_err(&host->dev->dev, "failed to create ctrl device\n");
goto fail;
}
@@ -909,27 +909,72 @@ static int __devinit nvhost_init_chip_support(struct nvhost_master *host)
return 0;
}
-struct nvhost_device hostdev = {
- .name = "host1x",
+static struct resource tegra_grhost_resources[] = {
+ {
+ .start = TEGRA_HOST1X_BASE,
+ .end = TEGRA_HOST1X_BASE + TEGRA_HOST1X_SIZE - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = TEGRA_DISPLAY_BASE,
+ .end = TEGRA_DISPLAY_BASE + TEGRA_DISPLAY_SIZE - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = TEGRA_DISPLAY2_BASE,
+ .end = TEGRA_DISPLAY2_BASE + TEGRA_DISPLAY2_SIZE - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = TEGRA_VI_BASE,
+ .end = TEGRA_VI_BASE + TEGRA_VI_SIZE - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = TEGRA_ISP_BASE,
+ .end = TEGRA_ISP_BASE + TEGRA_ISP_SIZE - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = TEGRA_MPE_BASE,
+ .end = TEGRA_MPE_BASE + TEGRA_MPE_SIZE - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = INT_SYNCPT_THRESH_BASE,
+ .end = INT_SYNCPT_THRESH_BASE + INT_SYNCPT_THRESH_NR - 1,
+ .flags = IORESOURCE_IRQ,
+ },
+ {
+ .start = INT_HOST1X_MPCORE_GENERAL,
+ .end = INT_HOST1X_MPCORE_GENERAL,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct nvhost_device tegra_grhost_device = {
+ .name = DRIVER_NAME,
.id = -1,
+ .resource = tegra_grhost_resources,
+ .num_resources = ARRAY_SIZE(tegra_grhost_resources),
.finalize_poweron = power_on_host,
.prepare_poweroff = power_off_host,
.clocks = {{"host1x", UINT_MAX}, {} },
NVHOST_MODULE_NO_POWERGATE_IDS,
};
-static int __devinit nvhost_probe(struct platform_device *pdev)
+static int __devinit nvhost_probe(struct nvhost_device *dev)
{
struct nvhost_master *host;
struct resource *regs, *intr0, *intr1;
int i, err;
- regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- intr0 = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
- intr1 = platform_get_resource(pdev, IORESOURCE_IRQ, 1);
+ regs = nvhost_get_resource(dev, IORESOURCE_MEM, 0);
+ intr0 = nvhost_get_resource(dev, IORESOURCE_IRQ, 0);
+ intr1 = nvhost_get_resource(dev, IORESOURCE_IRQ, 1);
if (!regs || !intr0 || !intr1) {
- dev_err(&pdev->dev, "missing required platform resources\n");
+ dev_err(&dev->dev, "missing required platform resources\n");
return -ENXIO;
}
@@ -937,42 +982,41 @@ static int __devinit nvhost_probe(struct platform_device *pdev)
if (!host)
return -ENOMEM;
- host->pdev = pdev;
-
host->nvmap = nvmap_create_client(nvmap_dev, "nvhost");
if (!host->nvmap) {
- dev_err(&pdev->dev, "unable to create nvmap client\n");
+ dev_err(&dev->dev, "unable to create nvmap client\n");
err = -EIO;
goto fail;
}
host->reg_mem = request_mem_region(regs->start,
- resource_size(regs), pdev->name);
+ resource_size(regs), dev->name);
if (!host->reg_mem) {
- dev_err(&pdev->dev, "failed to get host register memory\n");
+ dev_err(&dev->dev, "failed to get host register memory\n");
err = -ENXIO;
goto fail;
}
+
host->aperture = ioremap(regs->start, resource_size(regs));
if (!host->aperture) {
- dev_err(&pdev->dev, "failed to remap host registers\n");
+ dev_err(&dev->dev, "failed to remap host registers\n");
err = -ENXIO;
goto fail;
}
err = nvhost_init_chip_support(host);
if (err) {
- dev_err(&pdev->dev, "failed to init chip support\n");
+ dev_err(&dev->dev, "failed to init chip support\n");
goto fail;
}
/* Register host1x device as bus master */
- nvhost_device_register(&hostdev);
- host->dev = &hostdev;
- nvhost_bus_add_host(host);
+ host->dev = dev;
/* Give pointer to host1x via driver */
- nvhost_set_drvdata(&hostdev, host);
+ nvhost_set_drvdata(dev, host);
+
+ nvhost_bus_add_host(host);
BUG_ON(!host_channel_op(host).init);
for (i = 0; i < host->nb_channels; i++) {
@@ -990,7 +1034,7 @@ static int __devinit nvhost_probe(struct platform_device *pdev)
if (err)
goto fail;
- err = nvhost_module_init(&hostdev);
+ err = nvhost_module_init(&tegra_grhost_device);
if (err)
goto fail;
@@ -999,15 +1043,15 @@ static int __devinit nvhost_probe(struct platform_device *pdev)
nvhost_module_init(ch->dev);
}
- platform_set_drvdata(pdev, host);
-
- clk_enable(host->dev->clk[0]);
+ for (i = 0; i < host->dev->num_clks; i++)
+ clk_enable(host->dev->clk[i]);
nvhost_syncpt_reset(&host->syncpt);
- clk_disable(host->dev->clk[0]);
+ for (i = 0; i < host->dev->num_clks; i++)
+ clk_disable(host->dev->clk[0]);
nvhost_debug_init(host);
- dev_info(&pdev->dev, "initialized\n");
+ dev_info(&dev->dev, "initialized\n");
return 0;
fail:
@@ -1018,18 +1062,18 @@ fail:
return err;
}
-static int __exit nvhost_remove(struct platform_device *pdev)
+static int __exit nvhost_remove(struct nvhost_device *dev)
{
- struct nvhost_master *host = platform_get_drvdata(pdev);
+ struct nvhost_master *host = nvhost_get_drvdata(dev);
nvhost_remove_chip_support(host);
return 0;
}
-static int nvhost_suspend(struct platform_device *pdev, pm_message_t state)
+static int nvhost_suspend(struct nvhost_device *dev, pm_message_t state)
{
- struct nvhost_master *host = platform_get_drvdata(pdev);
+ struct nvhost_master *host = nvhost_get_drvdata(dev);
int i, ret;
- dev_info(&pdev->dev, "suspending\n");
+ dev_info(&dev->dev, "suspending\n");
for (i = 0; i < host->nb_channels; i++) {
ret = nvhost_channel_suspend(&host->channels[i]);
@@ -1038,17 +1082,18 @@ static int nvhost_suspend(struct platform_device *pdev, pm_message_t state)
}
ret = nvhost_module_suspend(host->dev, true);
- dev_info(&pdev->dev, "suspend status: %d\n", ret);
+ dev_info(&dev->dev, "suspend status: %d\n", ret);
return ret;
}
-static int nvhost_resume(struct platform_device *pdev)
+static int nvhost_resume(struct nvhost_device *dev)
{
- dev_info(&pdev->dev, "resuming\n");
+ dev_info(&dev->dev, "resuming\n");
return 0;
}
-static struct platform_driver nvhost_driver = {
+static struct nvhost_driver nvhost_driver = {
+ .probe = nvhost_probe,
.remove = __exit_p(nvhost_remove),
.suspend = nvhost_suspend,
.resume = nvhost_resume,
@@ -1060,16 +1105,27 @@ static struct platform_driver nvhost_driver = {
static int __init nvhost_mod_init(void)
{
+ int err;
+
register_sets = tegra_gpu_register_sets();
- return platform_driver_probe(&nvhost_driver, nvhost_probe);
+
+ err = nvhost_device_register(&tegra_grhost_device);
+ if (err)
+ return err;
+
+ return nvhost_driver_register(&nvhost_driver);
}
static void __exit nvhost_mod_exit(void)
{
- platform_driver_unregister(&nvhost_driver);
+ nvhost_driver_unregister(&nvhost_driver);
}
-module_init(nvhost_mod_init);
+/* host1x master device needs nvmap to be instantiated first.
+ * nvmap is instantiated via fs_initcall.
+ * Hence instantiate host1x master device using rootfs_initcall
+ * which is one level after fs_initcall. */
+rootfs_initcall(nvhost_mod_init);
module_exit(nvhost_mod_exit);
module_param_call(register_sets, NULL, param_get_uint, &register_sets, 0444);
diff --git a/drivers/video/tegra/host/dev.h b/drivers/video/tegra/host/dev.h
index 67d78aabfa6a..cface049166e 100644
--- a/drivers/video/tegra/host/dev.h
+++ b/drivers/video/tegra/host/dev.h
@@ -3,7 +3,7 @@
*
* Tegra Graphics Host Driver Entrypoint
*
- * Copyright (c) 2010-2011, NVIDIA Corporation.
+ * Copyright (c) 2010-2012, NVIDIA Corporation.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -36,7 +36,6 @@ struct nvhost_master {
void __iomem *aperture;
void __iomem *sync_aperture;
struct resource *reg_mem;
- struct platform_device *pdev;
struct class *nvhost_class;
struct cdev cdev;
struct device *ctrl;
diff --git a/drivers/video/tegra/host/host1x/host1x_cdma.c b/drivers/video/tegra/host/host1x/host1x_cdma.c
index 1006fbd90f88..76d3d49d4159 100644
--- a/drivers/video/tegra/host/host1x/host1x_cdma.c
+++ b/drivers/video/tegra/host/host1x/host1x_cdma.c
@@ -226,7 +226,7 @@ static int cdma_timeout_init(struct nvhost_cdma *cdma,
goto fail;
}
- dev_dbg(&dev->pdev->dev, "%s: SYNCPT_INCR buffer at 0x%x\n",
+ dev_dbg(&dev->dev->dev, "%s: SYNCPT_INCR buffer at 0x%x\n",
__func__, sb->phys);
sb->words_per_incr = (syncpt_id == NVSYNCPT_3D) ? 5 : 3;
@@ -318,7 +318,7 @@ static void cdma_timeout_cpu_incr(struct nvhost_cdma *cdma, u32 getptr,
u32 *p = (u32 *)((u32)pb->mapped + getidx);
*(p++) = NVHOST_OPCODE_NOOP;
*(p++) = NVHOST_OPCODE_NOOP;
- dev_dbg(&dev->pdev->dev, "%s: NOP at 0x%x\n",
+ dev_dbg(&dev->dev->dev, "%s: NOP at 0x%x\n",
__func__, pb->phys + getidx);
getidx = (getidx + 8) & (PUSH_BUFFER_SIZE - 1);
}
@@ -353,7 +353,7 @@ static void cdma_timeout_pb_incr(struct nvhost_cdma *cdma, u32 getptr,
getidx += (hwctx->save_slots * 8);
getidx &= (PUSH_BUFFER_SIZE - 1);
- dev_dbg(&dev->pdev->dev,
+ dev_dbg(&dev->dev->dev,
"%s: exec CTXSAVE of prev ctx (slots %d, incrs %d)\n",
__func__, nr_slots, syncpt_incrs);
}
@@ -369,7 +369,7 @@ static void cdma_timeout_pb_incr(struct nvhost_cdma *cdma, u32 getptr,
*(p++) = nvhost_opcode_gather(count);
*(p++) = sb->phys;
- dev_dbg(&dev->pdev->dev,
+ dev_dbg(&dev->dev->dev,
"%s: GATHER at 0x%x, from 0x%x, dcount = %d\n",
__func__,
pb->phys + getidx, sb->phys,
@@ -385,7 +385,7 @@ static void cdma_timeout_pb_incr(struct nvhost_cdma *cdma, u32 getptr,
p = (u32 *)((u32)pb->mapped + getidx);
*(p++) = NVHOST_OPCODE_NOOP;
*(p++) = NVHOST_OPCODE_NOOP;
- dev_dbg(&dev->pdev->dev, "%s: NOP at 0x%x\n",
+ dev_dbg(&dev->dev->dev, "%s: NOP at 0x%x\n",
__func__, pb->phys + getidx);
getidx = (getidx + 8) & (PUSH_BUFFER_SIZE - 1);
}
@@ -452,7 +452,7 @@ static void cdma_timeout_restart(struct nvhost_cdma *cdma, u32 getptr)
writel(host1x_channel_dmactrl(true, true, true),
chan_regs + HOST1X_CHANNEL_DMACTRL);
- dev_dbg(&dev->pdev->dev,
+ dev_dbg(&dev->dev->dev,
"%s: DMA GET 0x%x, PUT HW 0x%x / shadow 0x%x\n",
__func__,
readl(chan_regs + HOST1X_CHANNEL_DMAGET),
@@ -529,14 +529,14 @@ void cdma_timeout_teardown_begin(struct nvhost_cdma *cdma)
BUG_ON(cdma->torndown);
- dev_dbg(&dev->pdev->dev,
+ dev_dbg(&dev->dev->dev,
"begin channel teardown (channel id %d)\n", ch->chid);
cmdproc_stop = readl(dev->sync_aperture + HOST1X_SYNC_CMDPROC_STOP);
cmdproc_stop |= BIT(ch->chid);
writel(cmdproc_stop, dev->sync_aperture + HOST1X_SYNC_CMDPROC_STOP);
- dev_dbg(&dev->pdev->dev,
+ dev_dbg(&dev->dev->dev,
"%s: DMA GET 0x%x, PUT HW 0x%x / shadow 0x%x\n",
__func__,
readl(ch->aperture + HOST1X_CHANNEL_DMAGET),
@@ -561,7 +561,7 @@ void cdma_timeout_teardown_end(struct nvhost_cdma *cdma, u32 getptr)
BUG_ON(!cdma->torndown || cdma->running);
- dev_dbg(&dev->pdev->dev,
+ dev_dbg(&dev->dev->dev,
"end channel teardown (id %d, DMAGET restart = 0x%x)\n",
ch->chid, getptr);
@@ -598,7 +598,7 @@ static void cdma_timeout_handler(struct work_struct *work)
mutex_lock(&cdma->lock);
if (!cdma->timeout.clientid) {
- dev_dbg(&dev->pdev->dev,
+ dev_dbg(&dev->dev->dev,
"cdma_timeout: expired, but has no clientid\n");
mutex_unlock(&cdma->lock);
return;
@@ -609,7 +609,7 @@ static void cdma_timeout_handler(struct work_struct *work)
cmdproc_stop = prev_cmdproc | BIT(ch->chid);
writel(cmdproc_stop, dev->sync_aperture + HOST1X_SYNC_CMDPROC_STOP);
- dev_dbg(&dev->pdev->dev, "cdma_timeout: cmdproc was 0x%x is 0x%x\n",
+ dev_dbg(&dev->dev->dev, "cdma_timeout: cmdproc was 0x%x is 0x%x\n",
prev_cmdproc, cmdproc_stop);
syncpt_val = nvhost_syncpt_update_min(&dev->syncpt,
@@ -617,7 +617,7 @@ static void cdma_timeout_handler(struct work_struct *work)
/* has buffer actually completed? */
if ((s32)(syncpt_val - cdma->timeout.syncpt_val) >= 0) {
- dev_dbg(&dev->pdev->dev,
+ dev_dbg(&dev->dev->dev,
"cdma_timeout: expired, but buffer had completed\n");
/* restore */
cmdproc_stop = prev_cmdproc & ~(BIT(ch->chid));
@@ -627,7 +627,7 @@ static void cdma_timeout_handler(struct work_struct *work)
return;
}
- dev_warn(&dev->pdev->dev,
+ dev_warn(&dev->dev->dev,
"%s: timeout: %d (%s) ctx 0x%p, HW thresh %d, done %d\n",
__func__,
cdma->timeout.syncpt_id,
@@ -638,7 +638,7 @@ static void cdma_timeout_handler(struct work_struct *work)
/* stop HW, resetting channel/module */
cdma_op(cdma).timeout_teardown_begin(cdma);
- nvhost_cdma_update_sync_queue(cdma, sp, &dev->pdev->dev);
+ nvhost_cdma_update_sync_queue(cdma, sp, &dev->dev->dev);
mutex_unlock(&cdma->lock);
}
diff --git a/drivers/video/tegra/host/host1x/host1x_syncpt.c b/drivers/video/tegra/host/host1x/host1x_syncpt.c
index d2fe006ec85a..1cb0db5b428c 100644
--- a/drivers/video/tegra/host/host1x/host1x_syncpt.c
+++ b/drivers/video/tegra/host/host1x/host1x_syncpt.c
@@ -73,10 +73,11 @@ static u32 t20_syncpt_update_min(struct nvhost_syncpt *sp, u32 id)
} while ((u32)atomic_cmpxchg(&sp->min_val[id], old, live) != old);
if (!nvhost_syncpt_check_max(sp, id, live))
- dev_err(&syncpt_to_dev(sp)->pdev->dev,
+ dev_err(&syncpt_to_dev(sp)->dev->dev,
"%s failed: id=%u\n",
__func__,
id);
+
return live;
}
@@ -89,7 +90,7 @@ static void t20_syncpt_cpu_incr(struct nvhost_syncpt *sp, u32 id)
struct nvhost_master *dev = syncpt_to_dev(sp);
BUG_ON(!nvhost_module_powered(dev->dev));
if (!client_managed(id) && nvhost_syncpt_min_eq_max(sp, id)) {
- dev_err(&syncpt_to_dev(sp)->pdev->dev,
+ dev_err(&syncpt_to_dev(sp)->dev->dev,
"Trying to increment syncpoint id %d beyond max\n",
id);
nvhost_debug_dump(syncpt_to_dev(sp));
@@ -146,7 +147,7 @@ static int t20_syncpt_wait_check(struct nvhost_syncpt *sp,
* syncpt with a matching threshold value of 0, so
* is guaranteed to be popped by the host HW.
*/
- dev_dbg(&syncpt_to_dev(sp)->pdev->dev,
+ dev_dbg(&syncpt_to_dev(sp)->dev->dev,
"drop WAIT id %d (%s) thresh 0x%x, syncpt 0x%x\n",
wait->syncpt_id,
syncpt_op(sp).name(sp, wait->syncpt_id),
@@ -200,7 +201,7 @@ static void t20_syncpt_debug(struct nvhost_syncpt *sp)
u32 min = nvhost_syncpt_update_min(sp, i);
if (!max && !min)
continue;
- dev_info(&syncpt_to_dev(sp)->pdev->dev,
+ dev_info(&syncpt_to_dev(sp)->dev->dev,
"id %d (%s) min %d max %d\n",
i, syncpt_op(sp).name(sp, i),
min, max);
@@ -212,7 +213,7 @@ static void t20_syncpt_debug(struct nvhost_syncpt *sp)
t20_syncpt_read_wait_base(sp, i);
base_val = sp->base_val[i];
if (base_val)
- dev_info(&syncpt_to_dev(sp)->pdev->dev,
+ dev_info(&syncpt_to_dev(sp)->dev->dev,
"waitbase id %d val %d\n",
i, base_val);
diff --git a/drivers/video/tegra/host/nvhost_acm.c b/drivers/video/tegra/host/nvhost_acm.c
index a2386a257c8f..496e38b962a2 100644
--- a/drivers/video/tegra/host/nvhost_acm.c
+++ b/drivers/video/tegra/host/nvhost_acm.c
@@ -400,23 +400,23 @@ static void debug_not_idle(struct nvhost_master *host)
struct nvhost_device *dev = host->channels[i].dev;
mutex_lock(&dev->lock);
if (dev->name)
- dev_warn(&host->pdev->dev,
- "tegra_grhost: %s: refcnt %d\n",
- dev->name, dev->refcount);
+ dev_warn(&host->dev->dev,
+ "tegra_grhost: %s: refcnt %d\n", dev->name,
+ dev->refcount);
mutex_unlock(&dev->lock);
}
for (i = 0; i < host->syncpt.nb_mlocks; i++) {
int c = atomic_read(&host->syncpt.lock_counts[i]);
if (c) {
- dev_warn(&host->pdev->dev,
+ dev_warn(&host->dev->dev,
"tegra_grhost: lock id %d: refcnt %d\n",
i, c);
lock_released = false;
}
}
if (lock_released)
- dev_dbg(&host->pdev->dev, "tegra_grhost: all locks released\n");
+ dev_dbg(&host->dev->dev, "tegra_grhost: all locks released\n");
}
int nvhost_module_suspend(struct nvhost_device *dev, bool system_suspend)
diff --git a/drivers/video/tegra/host/nvhost_channel.c b/drivers/video/tegra/host/nvhost_channel.c
index c7b0c82b3e45..51bdcb73f1af 100644
--- a/drivers/video/tegra/host/nvhost_channel.c
+++ b/drivers/video/tegra/host/nvhost_channel.c
@@ -54,7 +54,7 @@ int nvhost_channel_init(struct nvhost_channel *ch,
/* Map IO memory related to nvhost_device */
if (ndev->moduleid != NVHOST_MODULE_NONE) {
/* First one is host1x - skip that */
- r = platform_get_resource(dev->pdev,
+ r = nvhost_get_resource(dev->dev,
IORESOURCE_MEM, ndev->moduleid + 1);
if (!r)
goto fail;
diff --git a/drivers/video/tegra/host/nvhost_syncpt.c b/drivers/video/tegra/host/nvhost_syncpt.c
index 7172698e06ca..1686d94fb571 100644
--- a/drivers/video/tegra/host/nvhost_syncpt.c
+++ b/drivers/video/tegra/host/nvhost_syncpt.c
@@ -136,7 +136,7 @@ int nvhost_syncpt_wait_timeout(struct nvhost_syncpt *sp, u32 id,
BUG_ON(!syncpt_op(sp).update_min);
if (!nvhost_syncpt_check_max(sp, id, thresh)) {
- dev_warn(&syncpt_to_dev(sp)->pdev->dev,
+ dev_warn(&syncpt_to_dev(sp)->dev->dev,
"wait %d (%s) for (%d) wouldn't be met (max %d)\n",
id, syncpt_op(sp).name(sp, id), thresh,
nvhost_syncpt_read_max(sp, id));
@@ -208,14 +208,14 @@ int nvhost_syncpt_wait_timeout(struct nvhost_syncpt *sp, u32 id,
timeout -= check;
}
if (timeout) {
- dev_warn(&syncpt_to_dev(sp)->pdev->dev,
+ dev_warn(&syncpt_to_dev(sp)->dev->dev,
"%s: syncpoint id %d (%s) stuck waiting %d, timeout=%d\n",
current->comm, id, syncpt_op(sp).name(sp, id),
thresh, timeout);
syncpt_op(sp).debug(sp);
if (check_count > MAX_STUCK_CHECK_COUNT) {
if (low_timeout) {
- dev_warn(&syncpt_to_dev(sp)->pdev->dev,
+ dev_warn(&syncpt_to_dev(sp)->dev->dev,
"is timeout %d too low?\n",
low_timeout);
}
diff --git a/include/linux/nvhost.h b/include/linux/nvhost.h
index 55b75d048791..739b6cc1c9ec 100644
--- a/include/linux/nvhost.h
+++ b/include/linux/nvhost.h
@@ -126,10 +126,10 @@ extern int nvhost_get_irq_byname(struct nvhost_device *, const char *);
#define to_nvhost_driver(drv) (container_of((drv), struct nvhost_driver, \
driver))
-#define nvhost_get_drvdata(_dev) dev_get_drvdata(&(_dev)->dev)
-#define nvhost_set_drvdata(_dev, data) dev_set_drvdata(&(_dev)->dev, (data))
-#define nvhost_get_host(_dev) ((struct nvhost_master *) \
- dev_get_drvdata((_dev)->dev.parent))
+#define nvhost_get_drvdata(_dev) dev_get_drvdata(&(_dev)->dev)
+#define nvhost_set_drvdata(_dev, data) dev_set_drvdata(&(_dev)->dev, (data))
+#define nvhost_get_host(_dev) ((struct nvhost_master *) \
+ dev_get_drvdata((_dev)->dev.parent))
int nvhost_bus_add_host(struct nvhost_master *host);