ARM: tegra: clock: Show ISO/BW marginal rates in clock tree
Alex Frid [Thu, 23 May 2013 02:35:53 +0000 (19:35 -0700)]
Change-Id: I8b1b55dc5684e95d7074f84f667d4242410a29f2
Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-on: http://git-master/r/238750
(cherry-picked from commit a8556ee16c8da597a399fb592f41c4b3ba7f5c8f)
Reviewed-on: http://git-master/r/258271
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>

arch/arm/mach-tegra/clock.c
arch/arm/mach-tegra/tegra_emc.c
arch/arm/mach-tegra/tegra_emc.h

index 4478808..dca70ca 100644 (file)
@@ -45,6 +45,7 @@
 #include "dvfs.h"
 #include "iomap.h"
 #include "timer.h"
+#include "tegra_emc.h"
 
 /* Global data of Tegra CPU CAR ops */
 struct tegra_cpu_car_ops *tegra_cpu_car_ops;
@@ -1321,11 +1322,26 @@ static void clock_tree_show_one(struct seq_file *s, struct clk *c, int level)
                state, c->refcnt, div, rate);
        if (c->parent && !list_empty(&c->parent->shared_bus_list)) {
                enum shared_bus_users_mode mode = c->u.shared_bus_user.mode;
-               seq_printf(s, " (%lu%s)", c->u.shared_bus_user.rate,
-                          mode == SHARED_CEILING_BUT_ISO ? "^" :
-                          mode == SHARED_CEILING ? "^" :
-                          mode == SHARED_ISO_BW ? "+" :
-                          mode == SHARED_BW ? "+" : "");
+               unsigned long request = c->u.shared_bus_user.rate;
+               seq_printf(s, " (%lu", request);
+
+               switch (mode) {
+               case SHARED_BW:
+                       seq_printf(s, " / %lu+)",
+                                  request / tegra_emc_bw_efficiency * 100);
+                       break;
+               case SHARED_ISO_BW:
+                       seq_printf(s, " / %lu / %lu+)",
+                                  request / tegra_emc_bw_efficiency * 100,
+                                  request / tegra_emc_iso_share * 100);
+                       break;
+               case SHARED_CEILING_BUT_ISO:
+               case SHARED_CEILING:
+                       seq_printf(s, "%s)", "^");
+                       break;
+               default:
+                       seq_printf(s, ")");
+               }
        }
        seq_printf(s, "\n");
 
@@ -1343,8 +1359,8 @@ static void clock_tree_show_one(struct seq_file *s, struct clk *c, int level)
 static int clock_tree_show(struct seq_file *s, void *data)
 {
        struct clk *c;
-       seq_printf(s, "   clock                               state  ref div      rate       (shared rate)\n");
-       seq_printf(s, "-----------------------------------------------------------------------------------\n");
+       seq_printf(s, "   clock                               state  ref div      rate       (shared req / bw_margin / iso_margin)\n");
+       seq_printf(s, "-----------------------------------------------------------------------------------------------------------\n");
 
        mutex_lock(&clock_list_lock);
        if (!tegra_platform_is_fpga())
index 9a89f52..1fad973 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "tegra_emc.h"
 
-static u8 emc_iso_share = 100;
+u8 tegra_emc_iso_share = 100;
 static unsigned long emc_iso_allocation;
 static unsigned long last_iso_bw;
 
@@ -72,7 +72,7 @@ static u8 tegra_emc_get_iso_share(u32 usage_flags, unsigned long iso_bw)
                }
        }
        last_iso_bw = iso_bw;
-       emc_iso_share = iso_share;
+       tegra_emc_iso_share = iso_share;
        return iso_share;
 }
 
@@ -174,7 +174,7 @@ int __init tegra_emc_iso_usage_debugfs_init(struct dentry *emc_debugfs_root)
                return -ENOMEM;
 
        d = debugfs_create_u8("emc_iso_share", S_IRUGO, emc_debugfs_root,
-                             &emc_iso_share);
+                             &tegra_emc_iso_share);
        if (!d)
                return -ENOMEM;
 
index 5710daa..c529cf5 100644 (file)
@@ -24,6 +24,7 @@
 #define TEGRA_EMC_ISO_USE_CASES_MAX_NUM                8
 
 extern u8 tegra_emc_bw_efficiency;
+extern u8 tegra_emc_iso_share;
 
 enum {
        DRAM_OVER_TEMP_NONE = 0,