]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
video: tegra: host: add DT support
authorDeepak Nibade <dnibade@nvidia.com>
Wed, 30 Oct 2013 06:26:40 +0000 (11:56 +0530)
committerTerje Bergstrom <tbergstrom@nvidia.com>
Wed, 30 Oct 2013 13:31:55 +0000 (06:31 -0700)
make necessary driver changes to enable DT support in nvhost

bug 1366383

Change-Id: I0dd98f598fda09a9a4065b54a3b37870d993fdfa
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/299484
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
drivers/video/tegra/host/bus_client.c
drivers/video/tegra/host/gk20a/gk20a.c
drivers/video/tegra/host/gk20a/gk20a.h
drivers/video/tegra/host/isp/isp.c
drivers/video/tegra/host/msenc/msenc.c
drivers/video/tegra/host/t124/t124.c

index 4b143c72c1452dc08c5e224f8095c346a6f70b1a..04eb67ddb02d6be265054c2eb91cc78da7464135 100644 (file)
@@ -1283,6 +1283,9 @@ int nvhost_client_device_init(struct platform_device *dev)
        dev_info(&dev->dev, "initialized\n");
 
        if (pdata->slave && !pdata->slave_initialized) {
+               struct nvhost_device_data *slave_pdata =
+                                       pdata->slave->dev.platform_data;
+               slave_pdata->master = dev;
                pdata->slave->dev.parent = dev->dev.parent;
                platform_device_register(pdata->slave);
                pdata->slave_initialized = 1;
index ea7dbfcac3e317835f2941ae3286fdb38368322f..2c3ef3f503d61442b9a99f87a491b9143a634c85 100644 (file)
@@ -69,6 +69,11 @@ static struct resource gk20a_intr = {
 };
 
 struct resource gk20a_resources_sim[] = {
+       {
+       .start = TEGRA_GK20A_SIM_BASE,
+       .end   = TEGRA_GK20A_SIM_BASE + TEGRA_GK20A_SIM_SIZE - 1,
+       .flags = IORESOURCE_MEM,
+       },
        {
        .start = TEGRA_GK20A_BAR0_BASE,
        .end   = TEGRA_GK20A_BAR0_BASE + TEGRA_GK20A_BAR0_SIZE - 1,
@@ -79,11 +84,6 @@ struct resource gk20a_resources_sim[] = {
        .end   = TEGRA_GK20A_BAR1_BASE + TEGRA_GK20A_BAR1_SIZE - 1,
        .flags = IORESOURCE_MEM,
        },
-       {
-       .start = TEGRA_GK20A_SIM_BASE,
-       .end   = TEGRA_GK20A_SIM_BASE + TEGRA_GK20A_SIM_SIZE - 1,
-       .flags = IORESOURCE_MEM,
-       },
 };
 
 const struct file_operations tegra_gk20a_ctrl_ops = {
index 6c3dc4aa678fd09e11c7d81585c5977618b43e9f..86c243707b0c95517a0fd877340d85436189de54 100644 (file)
@@ -268,9 +268,9 @@ extern const struct file_operations tegra_gk20a_prof_gpu_ops;
 struct nvhost_hwctx_handler *nvhost_gk20a_alloc_hwctx_handler(u32 syncpt,
                u32 waitbase, struct nvhost_channel *ch);
 
-#define GK20A_BAR0_IORESOURCE_MEM 0
-#define GK20A_BAR1_IORESOURCE_MEM 1
-#define GK20A_SIM_IORESOURCE_MEM 2
+#define GK20A_SIM_IORESOURCE_MEM 0
+#define GK20A_BAR0_IORESOURCE_MEM 1
+#define GK20A_BAR1_IORESOURCE_MEM 2
 #define TEGRA_GK20A_SIM_BASE 0x538F0000 /*tbd: get from iomap.h */
 #define TEGRA_GK20A_SIM_SIZE 0x1000     /*tbd: this is a high-side guess */
 
index 1e1d934c0c7b93fa84fa947651052119ef62dcb2..24db36634eaee291ea786c53a139b02954177180 100644 (file)
@@ -36,6 +36,7 @@
 
 #define T12_ISP_CG_CTRL                0x1d
 #define T12_CG_2ND_LEVEL_EN    1
+#define T12_ISPB_DEV_ID                1
 
 static struct of_device_id tegra_isp_of_match[] = {
 #ifdef TEGRA_11X_OR_HIGHER_CONFIG
@@ -62,6 +63,9 @@ int nvhost_isp_t124_finalize_poweron(struct platform_device *pdev)
 static int isp_probe(struct platform_device *dev)
 {
        int err = 0;
+#ifdef TEGRA_12X_OR_HIGHER_CONFIG
+       int dev_id = 0;
+#endif
        struct nvhost_device_data *pdata = NULL;
 
        if (dev->dev.of_node) {
@@ -70,6 +74,11 @@ static int isp_probe(struct platform_device *dev)
                match = of_match_device(tegra_isp_of_match, &dev->dev);
                if (match)
                        pdata = (struct nvhost_device_data *)match->data;
+#ifdef TEGRA_12X_OR_HIGHER_CONFIG
+               sscanf(dev->name, "isp.%1d", &dev_id);
+               if (dev_id == T12_ISPB_DEV_ID)
+                       pdata = &t124_ispb_info;
+#endif
        } else
                pdata = (struct nvhost_device_data *)dev->dev.platform_data;
 
index 9a91f4c0a763e822bae3343f58f0fa2bc307d7a8..a4d886da8439ee1b43592dac4e86b5b8bdab7e54 100644 (file)
@@ -397,7 +397,7 @@ static struct of_device_id tegra_msenc_of_match[] = {
 #endif
 #ifdef TEGRA_12X_OR_HIGHER_CONFIG
        { .compatible = "nvidia,tegra124-msenc",
-               .data = (struct nvhost_device_data *)&t14_msenc_info },
+               .data = (struct nvhost_device_data *)&t124_msenc_info },
 #endif
        { },
 };
index 517bcc76b49ca9f2cd28f90740c59bd965a27cfd..5af8a551419324ea194a11522065db39ea2fa21b 100644 (file)
@@ -54,6 +54,8 @@ static int t124_num_alloc_channels = 0;
 #define ISP_CLOCKGATE_DELAY 60
 #define ISP_POWERGATE_DELAY 500
 
+#define GK20A_DEV_NAME_SIZE 5
+
 #define BIT64(nr) (1ULL << (nr))
 #define NVSYNCPTS_CLIENT_MANAGED_T124 ( \
        BIT64(NVSYNCPT_DISP0_A) | BIT64(NVSYNCPT_DISP1_A) | \
@@ -510,10 +512,6 @@ struct platform_device *tegra12_register_host1x_devices(void)
 
        nvhost_dbg_fn("");
 
-       for (i = NVSYNCPT_GK20A_BASE; i <= NVSYNCPT_GK20A_LAST; i++) {
-               s_syncpt_names[i] = "gk20a";
-       }
-
        /* register host1x device first */
        platform_device_register(&tegra_host1x04_device);
        tegra_host1x04_device.dev.parent = NULL;
@@ -636,7 +634,7 @@ static struct nvhost_channel *t124_alloc_nvhost_channel(
                &t124_num_alloc_channels);
        if (ch) {
 #if defined(CONFIG_TEGRA_GK20A)
-               if (dev == &tegra_gk20a_device) {
+               if (strncmp(dev->name, "gk20a", GK20A_DEV_NAME_SIZE) == 0) {
                        ch->ops.init          = host1x_channel_ops.init;
                        ch->ops.alloc_obj     = t124_channel_alloc_obj;
                        ch->ops.free_obj      = t124_channel_free_obj;
@@ -710,9 +708,13 @@ static void t124_remove_support(struct nvhost_chip_support *op)
 int nvhost_init_t124_support(struct nvhost_master *host,
        struct nvhost_chip_support *op)
 {
+       int i = 0;
        int err;
        struct t124 *t124 = 0;
 
+       for (i = NVSYNCPT_GK20A_BASE; i <= NVSYNCPT_GK20A_LAST; i++)
+               s_syncpt_names[i] = "gk20a";
+
        /* don't worry about cleaning up on failure... "remove" does it. */
        err = nvhost_init_t124_channel_support(host, op);
        if (err)