summaryrefslogtreecommitdiff
path: root/drivers/video/tegra/host/host1x/host1x.c
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2012-05-30 15:28:19 +0300
committerSimone Willett <swillett@nvidia.com>2012-06-14 16:29:58 -0700
commitf2dd85f69f329f372db29d2e20d71f7e0e0f85bb (patch)
tree5c5d9cc279844dc31a5b4346c4f45b9d9c9ac790 /drivers/video/tegra/host/host1x/host1x.c
parent9774bbe31a0741ad71929156f59afdb2aba4eae5 (diff)
video: tegra: host: Parametrize host1x
Add parameters in host1x nvhost_device on * number of sync points * number of wait bases * number of channels * number of mlocks * client managed bitmask * naming of sync points Add automatically generated headers and use symbols from them to access hardware. Move host1x device definition from generic host1x to SoC specific source files t20.c and t30.c. Bug 982965 Change-Id: Ibec84be22d75b363900d10bcbd59d4d8321d54a1 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/104974 Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>
Diffstat (limited to 'drivers/video/tegra/host/host1x/host1x.c')
-rw-r--r--drivers/video/tegra/host/host1x/host1x.c64
1 files changed, 19 insertions, 45 deletions
diff --git a/drivers/video/tegra/host/host1x/host1x.c b/drivers/video/tegra/host/host1x/host1x.c
index d203bc73a67d..33ebc1ff5d22 100644
--- a/drivers/video/tegra/host/host1x/host1x.c
+++ b/drivers/video/tegra/host/host1x/host1x.c
@@ -19,29 +19,20 @@
*/
#include <linux/slab.h>
-#include <linux/string.h>
-#include <linux/spinlock.h>
#include <linux/fs.h>
#include <linux/cdev.h>
#include <linux/uaccess.h>
#include <linux/file.h>
#include <linux/clk.h>
-#include <linux/hrtimer.h>
#include "dev.h"
#include "bus.h"
#include <trace/events/nvhost.h>
-#include <linux/io.h>
-
#include <linux/nvhost.h>
#include <linux/nvhost_ioctl.h>
-#include <mach/hardware.h>
-#include <mach/iomap.h>
#include "debug.h"
-#include "t20/t20.h"
-#include "t30/t30.h"
#include "bus_client.h"
#include "nvhost_acm.h"
#include "nvhost_channel.h"
@@ -49,33 +40,6 @@
#define DRIVER_NAME "host1x"
-static struct resource tegra_host1x01_resources[] = {
- {
- .start = TEGRA_HOST1X_BASE,
- .end = TEGRA_HOST1X_BASE + TEGRA_HOST1X_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_host1x01_device = {
- .name = "host1x",
- .id = -1,
- .resource = tegra_host1x01_resources,
- .num_resources = ARRAY_SIZE(tegra_host1x01_resources),
- .clocks = {{"host1x", UINT_MAX}, {} },
- NVHOST_MODULE_NO_POWERGATE_IDS,
-};
-
struct nvhost_ctrl_userctx {
struct nvhost_master *dev;
u32 *mod_locks;
@@ -91,7 +55,7 @@ static int nvhost_ctrlrelease(struct inode *inode, struct file *filp)
filp->private_data = NULL;
if (priv->mod_locks[0])
nvhost_module_idle(priv->dev->dev);
- for (i = 1; i < priv->dev->syncpt.nb_mlocks; i++)
+ for (i = 1; i < nvhost_syncpt_nb_mlocks(&priv->dev->syncpt); i++)
if (priv->mod_locks[i])
nvhost_mutex_unlock(&priv->dev->syncpt, i);
kfree(priv->mod_locks);
@@ -109,7 +73,9 @@ static int nvhost_ctrlopen(struct inode *inode, struct file *filp)
trace_nvhost_ctrlopen(host->dev->name);
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
- mod_locks = kzalloc(sizeof(u32) * host->syncpt.nb_mlocks, GFP_KERNEL);
+ mod_locks = kzalloc(sizeof(u32)
+ * nvhost_syncpt_nb_mlocks(&host->syncpt),
+ GFP_KERNEL);
if (!(priv && mod_locks)) {
kfree(priv);
@@ -126,7 +92,7 @@ static int nvhost_ctrlopen(struct inode *inode, struct file *filp)
static int nvhost_ioctl_ctrl_syncpt_read(struct nvhost_ctrl_userctx *ctx,
struct nvhost_ctrl_syncpt_read_args *args)
{
- if (args->id >= ctx->dev->syncpt.nb_pts)
+ if (args->id >= nvhost_syncpt_nb_pts(&ctx->dev->syncpt))
return -EINVAL;
args->value = nvhost_syncpt_read(&ctx->dev->syncpt, args->id);
trace_nvhost_ioctl_ctrl_syncpt_read(args->id, args->value);
@@ -136,7 +102,7 @@ static int nvhost_ioctl_ctrl_syncpt_read(struct nvhost_ctrl_userctx *ctx,
static int nvhost_ioctl_ctrl_syncpt_incr(struct nvhost_ctrl_userctx *ctx,
struct nvhost_ctrl_syncpt_incr_args *args)
{
- if (args->id >= ctx->dev->syncpt.nb_pts)
+ if (args->id >= nvhost_syncpt_nb_pts(&ctx->dev->syncpt))
return -EINVAL;
trace_nvhost_ioctl_ctrl_syncpt_incr(args->id);
nvhost_syncpt_incr(&ctx->dev->syncpt, args->id);
@@ -148,7 +114,7 @@ static int nvhost_ioctl_ctrl_syncpt_waitex(struct nvhost_ctrl_userctx *ctx,
{
u32 timeout;
int err;
- if (args->id >= ctx->dev->syncpt.nb_pts)
+ if (args->id >= nvhost_syncpt_nb_pts(&ctx->dev->syncpt))
return -EINVAL;
if (args->timeout == NVHOST_NO_TIMEOUT)
timeout = MAX_SCHEDULE_TIMEOUT;
@@ -167,7 +133,7 @@ static int nvhost_ioctl_ctrl_module_mutex(struct nvhost_ctrl_userctx *ctx,
struct nvhost_ctrl_module_mutex_args *args)
{
int err = 0;
- if (args->id >= ctx->dev->syncpt.nb_mlocks ||
+ if (args->id >= nvhost_syncpt_nb_mlocks(&ctx->dev->syncpt) ||
args->lock > 1)
return -EINVAL;
@@ -377,10 +343,10 @@ fail:
return err;
}
-struct nvhost_channel *nvhost_alloc_channel(int index)
+struct nvhost_channel *nvhost_alloc_channel(struct nvhost_device *dev)
{
BUG_ON(!host_device_op().alloc_nvhost_channel);
- return host_device_op().alloc_nvhost_channel(index);
+ return host_device_op().alloc_nvhost_channel(dev);
}
void nvhost_free_channel(struct nvhost_channel *ch)
@@ -404,7 +370,8 @@ static int __devinit nvhost_alloc_resources(struct nvhost_master *host)
return err;
host->intr.syncpt = kzalloc(sizeof(struct nvhost_intr_syncpt) *
- host->syncpt.nb_pts, GFP_KERNEL);
+ nvhost_syncpt_nb_pts(&host->syncpt),
+ GFP_KERNEL);
if (!host->intr.syncpt) {
/* frees happen in the support removal phase */
@@ -434,6 +401,13 @@ static int __devinit nvhost_probe(struct nvhost_device *dev,
if (!host)
return -ENOMEM;
+ /* Register host1x device as bus master */
+ host->dev = dev;
+
+ /* Copy host1x parameters */
+ memcpy(&host->info, dev->dev.platform_data,
+ sizeof(struct host1x_device_info));
+
host->reg_mem = request_mem_region(regs->start,
resource_size(regs), dev->name);
if (!host->reg_mem) {