video: tegra: host: Merge tegra_grhost and host1x devices
Mayuresh Kulkarni [Fri, 24 Feb 2012 10:16:51 +0000 (15:16 +0530)]
- tegra_grhost is a platform device that represents host1x
- nvhost has device host1x which represents the same hardware
- merge these two device structs
- as the new struct is a nvhost_device, platform_driver
is also converted into a nvhost_driver
- register nvhost device before other graphics devices.
this ensures that nvhost_probe() is called as soon as
nvhost_driver is registered with the core.
- this also ensures that nvmap is probed first, followed
by nvhost, followed by tegra-dc and nvavp (if they
are enabled).

Change-Id: Ic420a6516a9cb20d6f481692a4db10fa6053dd90
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Signed-off-by: Mayuresh Kulkarni <mkulkarni@nvidia.com>
Reviewed-on: http://git-master/r/82631
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>

19 files changed:
arch/arm/mach-tegra/board-aruba-panel.c
arch/arm/mach-tegra/board-cardhu-panel.c
arch/arm/mach-tegra/board-enterprise-panel.c
arch/arm/mach-tegra/board-harmony-panel.c
arch/arm/mach-tegra/board-kai-panel.c
arch/arm/mach-tegra/board-p1852-panel.c
arch/arm/mach-tegra/board-ventana-panel.c
arch/arm/mach-tegra/board-whistler-panel.c
arch/arm/mach-tegra/devices.c
arch/arm/mach-tegra/devices.h
arch/arm/mach-tegra/p852/board-p852-panel.c
drivers/video/tegra/host/dev.c
drivers/video/tegra/host/dev.h
drivers/video/tegra/host/host1x/host1x_cdma.c
drivers/video/tegra/host/host1x/host1x_syncpt.c
drivers/video/tegra/host/nvhost_acm.c
drivers/video/tegra/host/nvhost_channel.c
drivers/video/tegra/host/nvhost_syncpt.c
include/linux/nvhost.h

index 7524f82..92e4362 100644 (file)
@@ -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,
 };
index 90801b0..7de8476 100644 (file)
@@ -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);
index ec7eae3..0defe56 100644 (file)
@@ -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,
 };
 
index 4ea6725..d9974f1 100644 (file)
@@ -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,
 };
index 7426337..1e5c588 100644 (file)
@@ -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,
 };
index b26ff19..2386423 100644 (file)
@@ -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)
index e2a54cd..83bfb78 100644 (file)
@@ -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,
 };
index 9516a31..6fc576b 100644 (file)
@@ -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,
 };
 
index 65a5fad..202c767 100644 (file)
@@ -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,
index 5aa554f..b7fc6fd 100644 (file)
@@ -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;
index bfd35fa..3d65a61 100644 (file)
@@ -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,
 };
 
index 2b11929..fa8c617 100644 (file)
@@ -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>
 #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);
index 67d78aa..cface04 100644 (file)
@@ -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;
index 1006fbd..76d3d49 100644 (file)
@@ -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);
 }
 
index d2fe006..1cb0db5 100644 (file)
@@ -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);
 
index a2386a2..496e38b 100644 (file)
@@ -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)
index c7b0c82..51bdcb7 100644 (file)
@@ -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;
index 7172698..1686d94 100644 (file)
@@ -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);
                                }
index 55b75d0..739b6cc 100644 (file)
@@ -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);