gpu: nvgpu: Use GPU device name in clock get operation
Alex Frid [Thu, 24 Jul 2014 07:04:05 +0000 (00:04 -0700)]
Used GPU device name in clock get operation (instead of fixed name),
to make operation is common for GK20A and GM20B. Updated clock ids
in tegra clock framework accordingly.

Bug 1450787

Change-Id: Ifd5b9c3a6fd8db5b06e6dcd989285e8410794803
Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-on: http://git-master/r/441711
Reviewed-by: Bo Yan <byan@nvidia.com>
Tested-by: Bo Yan <byan@nvidia.com>

arch/arm/mach-tegra/tegra12_clocks.c
drivers/gpu/nvgpu/gk20a/clk_gk20a.c
drivers/gpu/nvgpu/gk20a/clk_gk20a.h
drivers/platform/tegra/tegra21_clocks.c

index 44fd80d..0a116c9 100644 (file)
@@ -8437,7 +8437,7 @@ struct clk tegra_list_clks[] = {
        SHARED_LIMIT("floor.cbus", "floor.cbus",        NULL,   &tegra_clk_cbus, NULL,  0, 0),
        SHARED_CLK("override.cbus", "override.cbus",    NULL,   &tegra_clk_cbus, NULL,  0, SHARED_OVERRIDE),
 #endif
-       SHARED_CLK("gk20a.gbus",        "tegra_gk20a",  "gpu",  &tegra_clk_gbus, NULL,  0, 0),
+       SHARED_CLK("gk20a.gbus",   "tegra_gk20a.0",     "gpu",  &tegra_clk_gbus, NULL,  0, 0),
        SHARED_LIMIT("cap.gbus",        "cap.gbus",     NULL,   &tegra_clk_gbus, NULL,  0, SHARED_CEILING),
        SHARED_LIMIT("edp.gbus",        "edp.gbus",     NULL,   &tegra_clk_gbus, NULL,  0, SHARED_CEILING),
        SHARED_LIMIT("battery.gbus",    "battery_edp",  "gpu",  &tegra_clk_gbus, NULL,  0, SHARED_CEILING),
index 517e8e4..41305e3 100644 (file)
@@ -415,11 +415,15 @@ struct clk *gk20a_clk_get(struct gk20a *g)
 {
        if (!g->clk.tegra_clk) {
                struct clk *clk;
+               char clk_dev_id[32];
+               struct device *dev = dev_from_gk20a(g);
 
-               clk = clk_get_sys("tegra_gk20a", "gpu");
+               snprintf(clk_dev_id, 32, "tegra_%s", dev_name(dev));
+
+               clk = clk_get_sys(clk_dev_id, "gpu");
                if (IS_ERR(clk)) {
-                       gk20a_err(dev_from_gk20a(g),
-                               "fail to get tegra gpu clk tegra_gk20a/gpu");
+                       gk20a_err(dev, "fail to get tegra gpu clk %s/gpu\n",
+                                 clk_dev_id);
                        return NULL;
                }
                g->clk.tegra_clk = clk;
index debd6fb..e6d14f7 100644 (file)
@@ -59,13 +59,11 @@ struct clk_gk20a {
        bool debugfs_set;
 };
 
-/* APIs used for separate HAL */
-struct clk *gk20a_clk_get(struct gk20a *g);
-
 /* APIs used for both GK20A and GM20B */
 unsigned long gk20a_clk_get_rate(struct gk20a *g);
 int gk20a_clk_set_rate(struct gk20a *g, unsigned long rate);
 long gk20a_clk_round_rate(struct gk20a *g, unsigned long rate);
+struct clk *gk20a_clk_get(struct gk20a *g);
 
 #define KHZ 1000
 #define MHZ 1000000
index 0cb47fa..da10a57 100644 (file)
@@ -8726,14 +8726,14 @@ struct clk tegra_list_clks[] = {
        SHARED_LIMIT("floor.c3bus",     "floor.c3bus",          NULL,    &tegra_clk_c3bus, NULL,    0, 0),
        SHARED_CLK("override.c3bus",    "override.c3bus",       NULL,    &tegra_clk_c3bus, NULL,    0, SHARED_OVERRIDE),
 
-       SHARED_CLK("gm20b.gbus",        "tegra_gk20a",  "gpu",  &tegra_clk_gbus, NULL,  0, 0),
-       SHARED_LIMIT("cap.gbus",                "cap.gbus",     NULL,   &tegra_clk_gbus, NULL,  0, SHARED_CEILING),
-       SHARED_LIMIT("edp.gbus",                "edp.gbus",     NULL,   &tegra_clk_gbus, NULL,  0, SHARED_CEILING),
+       SHARED_CLK("gm20b.gbus",        "tegra_gm20b.0",        "gpu",  &tegra_clk_gbus, NULL,  0, 0),
+       SHARED_LIMIT("cap.gbus",        "cap.gbus",             NULL,   &tegra_clk_gbus, NULL,  0, SHARED_CEILING),
+       SHARED_LIMIT("edp.gbus",        "edp.gbus",             NULL,   &tegra_clk_gbus, NULL,  0, SHARED_CEILING),
        SHARED_LIMIT("cap.throttle.gbus", "cap_throttle",       NULL,   &tegra_clk_gbus, NULL,  0, SHARED_CEILING),
        SHARED_LIMIT("cap.profile.gbus", "profile.gbus",        "cap",  &tegra_clk_gbus, NULL,  0, SHARED_CEILING),
-       SHARED_CLK("override.gbus",     "override.gbus", NULL,  &tegra_clk_gbus, NULL,  0, SHARED_OVERRIDE),
-       SHARED_LIMIT("floor.gbus",      "floor.gbus", NULL,     &tegra_clk_gbus, NULL,  0, 0),
-       SHARED_LIMIT("floor.profile.gbus", "profile.gbus", "floor", &tegra_clk_gbus, NULL,  0, 0),
+       SHARED_CLK("override.gbus",     "override.gbus",        NULL,   &tegra_clk_gbus, NULL,  0, SHARED_OVERRIDE),
+       SHARED_LIMIT("floor.gbus",      "floor.gbus",           NULL,   &tegra_clk_gbus, NULL,  0, 0),
+       SHARED_LIMIT("floor.profile.gbus", "profile.gbus",      "floor", &tegra_clk_gbus, NULL, 0, 0),
 
        SHARED_CLK("nv.host1x", "tegra_host1x",         "host1x", &tegra_clk_host1x, NULL,  0, 0),
        SHARED_CLK("vi.host1x", "tegra_vi",             "host1x", &tegra_clk_host1x, NULL,  0, 0),