arm: tegra: tegratab: Consider host1x register by device tree
Min-wuk Lee [Thu, 16 May 2013 07:05:50 +0000 (16:05 +0900)]
When host1x and its clients are registered by device tree,
need to skip platform_device_register way.

Bug 1240921

Change-Id: I6fe4e86cbaeeb3eef8c1d0688d97927dadd95d31
Signed-off-by: Min-wuk Lee <mlee@nvidia.com>
Reviewed-on: http://git-master/r/229239
Reviewed-by: Harshada Kale <hkale@nvidia.com>
Tested-by: Harshada Kale <hkale@nvidia.com>

arch/arm/mach-tegra/board-tegratab-panel.c
arch/arm/mach-tegra/board-tegratab.c

index 750920c..cbd080c 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/ioport.h>
 #include <linux/fb.h>
 #include <linux/nvmap.h>
+#include <linux/of.h>
 #include <linux/nvhost.h>
 #include <linux/init.h>
 #include <linux/delay.h>
@@ -452,7 +453,9 @@ int __init tegratab_panel_init(void)
 {
        int err = 0;
        struct resource __maybe_unused *res;
-       struct platform_device *phost1x;
+       struct platform_device *phost1x = NULL;
+
+       bool is_dt = of_have_populated_dt();
 
        sd_settings = tegratab_sd_settings;
 
@@ -471,7 +474,11 @@ int __init tegratab_panel_init(void)
        }
 #endif
 
-       phost1x = tegratab_host1x_init();
+       if (!is_dt)
+               phost1x = tegratab_host1x_init();
+       else
+               phost1x = to_platform_device(bus_find_device_by_name(
+                       &platform_bus_type, NULL, "host1x"));
        if (!phost1x) {
                pr_err("host1x devices registration failed\n");
                return -EINVAL;
index 2a30395..622628b 100644 (file)
@@ -680,6 +680,20 @@ static void __init tegra_tegratab_early_init(void)
 }
 
 struct of_dev_auxdata tegratab_auxdata_lookup[] __initdata = {
+       OF_DEV_AUXDATA("nvidia,tegra114-host1x", TEGRA_HOST1X_BASE, "host1x",
+                               NULL),
+       OF_DEV_AUXDATA("nvidia,tegra114-gr3d", TEGRA_GR3D_BASE, "gr3d",
+                               NULL),
+       OF_DEV_AUXDATA("nvidia,tegra114-gr2d", TEGRA_GR2D_BASE, "gr2d",
+                               NULL),
+       OF_DEV_AUXDATA("nvidia,tegra114-msenc", TEGRA_MSENC_BASE, "msenc",
+                               NULL),
+       OF_DEV_AUXDATA("nvidia,tegra114-vi", TEGRA_VI_BASE, "vi",
+                               NULL),
+       OF_DEV_AUXDATA("nvidia,tegra114-isp", TEGRA_ISP_BASE, "isp",
+                               NULL),
+       OF_DEV_AUXDATA("nvidia,tegra114-tsec", TEGRA_TSEC_BASE, "tsec",
+                               NULL),
        OF_DEV_AUXDATA("nvidia,tegra114-i2c", 0x7000c000, "tegra11-i2c.0",
                &tegratab_i2c1_platform_data),
        OF_DEV_AUXDATA("nvidia,tegra114-i2c", 0x7000c400, "tegra11-i2c.1",