summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-tegra')
-rw-r--r--arch/arm/mach-tegra/pm-t3.c20
-rw-r--r--arch/arm/mach-tegra/pm.h13
-rw-r--r--arch/arm/mach-tegra/sysfs-cluster.c73
3 files changed, 74 insertions, 32 deletions
diff --git a/arch/arm/mach-tegra/pm-t3.c b/arch/arm/mach-tegra/pm-t3.c
index e37e6985e698..1ce95412dc2b 100644
--- a/arch/arm/mach-tegra/pm-t3.c
+++ b/arch/arm/mach-tegra/pm-t3.c
@@ -28,14 +28,6 @@
#include "gpio-names.h"
#include "pm.h"
-#define SUSPEND_DEBUG_PRINT 1 /* Nonzero for debug prints */
-
-#if SUSPEND_DEBUG_PRINT
-#define DEBUG_SUSPEND(x) printk x
-#else
-#define DEBUG_SUSPEND(x)
-#endif
-
#define CAR_CCLK_BURST_POLICY \
(IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x20)
@@ -185,11 +177,11 @@ static int cluster_switch_prolog_clock(unsigned int flags)
be multipled by 2 because of the LP CPU's
implied divied-by-2. */
- DEBUG_SUSPEND(("%s: G freq %lu\r\n", __func__,
+ DEBUG_CLUSTER(("%s: G freq %lu\r\n", __func__,
cur_rate));
err = clk_set_rate(c, max_rate * 2);
BUG_ON(err);
- DEBUG_SUSPEND(("%s: G freq %lu\r\n", __func__,
+ DEBUG_CLUSTER(("%s: G freq %lu\r\n", __func__,
clk_get_rate(c)));
}
}
@@ -296,10 +288,10 @@ void tegra_cluster_switch_epilog(unsigned int flags)
/* Perform post-switch clean-up of the interrupt distributor */
cluster_switch_epilog_gic();
- #if SUSPEND_DEBUG_PRINT
+ #if DEBUG_CLUSTER_SWITCH
{
struct clk *c = tegra_get_clock_by_name("cpu");
- DEBUG_SUSPEND(("%s: %s freq %lu\r\n", __func__,
+ DEBUG_CLUSTER(("%s: %s freq %lu\r\n", __func__,
is_lp_cluster() ? "LP" : "G", clk_get_rate(c)));
}
#endif
@@ -325,7 +317,7 @@ int tegra_cluster_control(unsigned int us, unsigned int flags)
if (flags & TEGRA_POWER_CLUSTER_IMMEDIATE)
us = 0;
- DEBUG_SUSPEND(("%s(LP%d): %s->%s %s %s %d\r\n", __func__,
+ DEBUG_CLUSTER(("%s(LP%d): %s->%s %s %s %d\r\n", __func__,
(flags & TEGRA_POWER_SDRAM_SELFREFRESH) ? 1 : 2,
is_lp_cluster() ? "LP" : "G",
(target_cluster == TEGRA_POWER_CLUSTER_G) ? "G" : "LP",
@@ -346,7 +338,7 @@ int tegra_cluster_control(unsigned int us, unsigned int flags)
tegra_idle_lp2_last(flags);
local_irq_enable();
- DEBUG_SUSPEND(("%s: %s\r\n", __func__, is_lp_cluster() ? "LP" : "G"));
+ DEBUG_CLUSTER(("%s: %s\r\n", __func__, is_lp_cluster() ? "LP" : "G"));
return 0;
}
diff --git a/arch/arm/mach-tegra/pm.h b/arch/arm/mach-tegra/pm.h
index eb4e24e6be81..e333cc476408 100644
--- a/arch/arm/mach-tegra/pm.h
+++ b/arch/arm/mach-tegra/pm.h
@@ -70,7 +70,8 @@ extern void (*tegra_deep_sleep)(int);
void tegra_idle_lp2_last(unsigned int flags);
#ifdef CONFIG_ARCH_TEGRA_2x_SOC
-#define INSTRUMENT_CLUSTER_SWITCH 0 /* Must be zero for ARCH_TEGRA_2x_SOC */
+#define INSTRUMENT_CLUSTER_SWITCH 0 /* Must be zero for ARCH_TEGRA_2x_SOC */
+#define DEBUG_CLUSTER_SWITCH 0 /* Must be zero for ARCH_TEGRA_2x_SOC */
static inline int tegra_cluster_control(unsigned int us, unsigned int flags)
{ return -EPERM; }
#define tegra_cluster_switch_prolog(flags) do {} while(0)
@@ -80,7 +81,8 @@ static inline unsigned int is_lp_cluster(void)
static inline unsigned long tegra_get_lpcpu_max_rate(void)
{ return 0; }
#else
-#define INSTRUMENT_CLUSTER_SWITCH 1 /* Should be zero for shipping code */
+#define INSTRUMENT_CLUSTER_SWITCH 1 /* Should be zero for shipping code */
+#define DEBUG_CLUSTER_SWITCH 1 /* Should be zero for shipping code */
int tegra_cluster_control(unsigned int us, unsigned int flags);
void tegra_cluster_switch_prolog(unsigned int flags);
void tegra_cluster_switch_epilog(unsigned int flags);
@@ -88,6 +90,13 @@ unsigned int is_lp_cluster(void);
unsigned long tegra_get_lpcpu_max_rate(void);
#endif
+#if DEBUG_CLUSTER_SWITCH
+extern unsigned int tegra_cluster_debug;
+#define DEBUG_CLUSTER(x) do { if (tegra_cluster_debug) printk x; } while (0)
+#else
+#define DEBUG_CLUSTER(x) do { } while (0)
+#endif
+
#define FLOW_CTRL_HALT_CPU(cpu) (IO_ADDRESS(TEGRA_FLOW_CTRL_BASE) + \
((cpu) == 0 ? 0x8 : (0x18 + 8 * ((cpu) - 1))))
#define FLOW_CTRL_CPU_CSR(cpu) (IO_ADDRESS(TEGRA_FLOW_CTRL_BASE) + \
diff --git a/arch/arm/mach-tegra/sysfs-cluster.c b/arch/arm/mach-tegra/sysfs-cluster.c
index 72ca344493ff..46f157cab3ff 100644
--- a/arch/arm/mach-tegra/sysfs-cluster.c
+++ b/arch/arm/mach-tegra/sysfs-cluster.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010 NVIDIA Corporation.
+ * Copyright (c) 2010-2011 NVIDIA Corporation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -89,13 +89,13 @@
#include "power.h"
#define SYSFS_CLUSTER_PRINTS 1 /* Nonzero: enable status prints */
-#define SYSFS_CLUSTER_DEBUG_PRINTS 0 /* Nonzero: enable debug prints */
+#define SYSFS_CLUSTER_TRACE_PRINTS 0 /* Nonzero: enable trace prints */
#define SYSFS_CLUSTER_POWER_MODE 0 /* Nonzero: use power modes other than LP2*/
-#if SYSFS_CLUSTER_DEBUG_PRINTS
-#define DEBUG_CLUSTER(x) printk x
+#if SYSFS_CLUSTER_TRACE_PRINTS
+#define TRACE_CLUSTER(x) printk x
#else
-#define DEBUG_CLUSTER(x)
+#define TRACE_CLUSTER(x)
#endif
#if SYSFS_CLUSTER_PRINTS
@@ -141,6 +141,12 @@ static struct kobj_attribute cluster_powermode_attr =
__ATTR(power_mode, 0640, sysfscluster_show, sysfscluster_store);
#endif
+#if DEBUG_CLUSTER_SWITCH
+unsigned int tegra_cluster_debug = 1;
+static struct kobj_attribute cluster_debug_attr =
+ __ATTR(debug, 0640, sysfscluster_show, sysfscluster_store);
+#endif
+
typedef enum
{
ClusterAttr_Invalid = 0,
@@ -149,7 +155,10 @@ typedef enum
ClusterAttr_Force,
ClusterAttr_WakeMs,
#if defined(CONFIG_PM) && SYSFS_CLUSTER_POWER_MODE
- ClusterAttr_PowerMode
+ ClusterAttr_PowerMode,
+#endif
+#if DEBUG_CLUSTER_SWITCH
+ ClusterAttr_Debug
#endif
} ClusterAttr;
@@ -167,7 +176,11 @@ static ClusterAttr GetClusterAttr(const char *name)
if (!strcmp(name, "power_mode"))
return ClusterAttr_PowerMode;
#endif
- DEBUG_CLUSTER(("GetClusterAttr(%s): invalid\n", name));
+#if DEBUG_CLUSTER_SWITCH
+ if (!strcmp(name, "debug"))
+ return ClusterAttr_Debug;
+#endif
+ TRACE_CLUSTER(("GetClusterAttr(%s): invalid\n", name));
return ClusterAttr_Invalid;
}
@@ -177,7 +190,7 @@ static ssize_t sysfscluster_show(struct kobject *kobj,
ClusterAttr type;
ssize_t len;
- DEBUG_CLUSTER(("+sysfscluster_show\n"));
+ TRACE_CLUSTER(("+sysfscluster_show\n"));
type = GetClusterAttr(attr->attr.name);
switch (type) {
@@ -205,12 +218,18 @@ static ssize_t sysfscluster_show(struct kobject *kobj,
break;
#endif
+#if DEBUG_CLUSTER_SWITCH
+ case ClusterAttr_Debug:
+ len = sprintf(buf, "%d\n", tegra_cluster_debug);
+ break;
+#endif
+
default:
len = sprintf(buf, "invalid\n");
break;
}
- DEBUG_CLUSTER(("-sysfscluster_show\n"));
+ TRACE_CLUSTER(("-sysfscluster_show\n"));
return len;
}
@@ -224,7 +243,7 @@ static ssize_t sysfscluster_store(struct kobject *kobj,
int tmp;
int cnt;
- DEBUG_CLUSTER(("+sysfscluster_store: %p, %d\n", buf, count));
+ TRACE_CLUSTER(("+sysfscluster_store: %p, %d\n", buf, count));
/* The count includes data bytes follow by a line feed character. */
if (!buf || (count < 1)) {
@@ -333,6 +352,22 @@ static ssize_t sysfscluster_store(struct kobject *kobj,
break;
#endif
+#if DEBUG_CLUSTER_SWITCH
+ case ClusterAttr_Debug:
+ if ((count == 1) && (*buf == '0'))
+ tegra_cluster_debug = 0;
+ else if ((count == 1) && (*buf == '1'))
+ tegra_cluster_debug = 1;
+ else {
+ PRINT_CLUSTER(("cluster/debug: '%*.*s' invalid, "
+ "must be 0 or 1\n", count, count, buf));
+ ret = -EINVAL;
+ break;
+ }
+ PRINT_CLUSTER(("cluster/debug -> %d\n",tegra_cluster_debug));
+ break;
+#endif
+
default:
ret = -ENOENT;
break;
@@ -341,7 +376,7 @@ static ssize_t sysfscluster_store(struct kobject *kobj,
spin_unlock(&cluster_lock);
fail:
- DEBUG_CLUSTER(("-sysfscluster_store: %d\n", count));
+ TRACE_CLUSTER(("-sysfscluster_store: %d\n", count));
return ret;
}
@@ -349,7 +384,7 @@ fail:
do { \
e = sysfs_create_file(cluster_kobj, &cluster_##x##_attr.attr); \
if (e) { \
- DEBUG_CLUSTER(("cluster/" __stringify(x) \
+ TRACE_CLUSTER(("cluster/" __stringify(x) \
": sysfs_create_file failed!\n")); \
goto fail; \
} \
@@ -359,7 +394,7 @@ static int __init sysfscluster_init(void)
{
int e;
- DEBUG_CLUSTER(("+sysfscluster_init\n"));
+ TRACE_CLUSTER(("+sysfscluster_init\n"));
spin_lock_init(&cluster_lock);
cluster_kobj = kobject_create_and_add("cluster", kernel_kobj);
@@ -371,6 +406,9 @@ static int __init sysfscluster_init(void)
#if defined(CONFIG_PM) && SYSFS_CLUSTER_POWER_MODE
CREATE_FILE(powermode);
#endif
+#if DEBUG_CLUSTER_SWITCH
+ CREATE_FILE(debug);
+#endif
spin_lock(&cluster_lock);
if (is_lp_cluster())
@@ -380,7 +418,7 @@ static int __init sysfscluster_init(void)
spin_unlock(&cluster_lock);
fail:
- DEBUG_CLUSTER(("-sysfscluster_init\n"));
+ TRACE_CLUSTER(("-sysfscluster_init\n"));
return e;
}
@@ -389,7 +427,10 @@ fail:
static void __exit sysfscluster_exit(void)
{
- DEBUG_CLUSTER(("+sysfscluster_exit\n"));
+ TRACE_CLUSTER(("+sysfscluster_exit\n"));
+#if DEBUG_CLUSTER_SWITCH
+ REMOVE_FILE(debug);
+#endif
#if defined(CONFIG_PM) && SYSFS_CLUSTER_POWER_MODE
REMOVE_FILE(powermode);
#endif
@@ -398,7 +439,7 @@ static void __exit sysfscluster_exit(void)
REMOVE_FILE(immediate);
REMOVE_FILE(active);
kobject_del(cluster_kobj);
- DEBUG_CLUSTER(("-sysfscluster_exit\n"));
+ TRACE_CLUSTER(("-sysfscluster_exit\n"));
}
module_init(sysfscluster_init);