You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/07/04 05:36:26 UTC
[incubator-nuttx] 13/13: arch: cxd56x: Add support for power
management debug output
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit b3389cf751a1254e274135cbed4797c41cdc0fac
Author: SPRESENSE <41...@users.noreply.github.com>
AuthorDate: Sun Jul 4 12:55:27 2021 +0900
arch: cxd56x: Add support for power management debug output
Add support for power management debug output.
---
arch/arm/include/cxd56xx/pm.h | 3 +-
arch/arm/src/cxd56xx/cxd56_clock.c | 82 +++++++++++++++-------------
arch/arm/src/cxd56xx/cxd56_powermgr.c | 22 +++++---
arch/arm/src/cxd56xx/cxd56_powermgr_procfs.c | 52 ++++++++++--------
4 files changed, 92 insertions(+), 67 deletions(-)
diff --git a/arch/arm/include/cxd56xx/pm.h b/arch/arm/include/cxd56xx/pm.h
index fe3ab71..40506db 100644
--- a/arch/arm/include/cxd56xx/pm.h
+++ b/arch/arm/include/cxd56xx/pm.h
@@ -25,6 +25,7 @@
* Included Files
****************************************************************************/
+#include <nuttx/config.h>
#include <queue.h>
/****************************************************************************
@@ -161,7 +162,7 @@ extern "C"
int up_pmramctrl(int cmd, uintptr_t addr, size_t size);
-#ifdef CONFIG_DEBUG_PM
+#ifdef CONFIG_CXD56_PM_DEBUG_INFO
/****************************************************************************
* Name: up_pmstatdump
*
diff --git a/arch/arm/src/cxd56xx/cxd56_clock.c b/arch/arm/src/cxd56xx/cxd56_clock.c
index 491dea7..7a05641 100644
--- a/arch/arm/src/cxd56xx/cxd56_clock.c
+++ b/arch/arm/src/cxd56xx/cxd56_clock.c
@@ -45,14 +45,22 @@
* Pre-processor Definitions
****************************************************************************/
-#ifdef CONFIG_DEBUG_PM
-# define pmerr(fmt, ...) logerr(fmt, ## __VA_ARGS__)
-# define pminfo(fmt, ...) loginfo(fmt, ## __VA_ARGS__)
-# define pmdbg(fmt, ...) logdebug(fmt, ## __VA_ARGS__)
+/* Debug */
+
+#ifdef CONFIG_CXD56_PM_DEBUG_ERROR
+# define pmerr(format, ...) _err(format, ##__VA_ARGS__)
+#else
+# define pmerr(x, ...)
+#endif
+#ifdef CONFIG_CXD56_PM_DEBUG_WARN
+# define pmwarn(format, ...) _warn(format, ##__VA_ARGS__)
+#else
+# define pmwarn(x, ...)
+#endif
+#ifdef CONFIG_CXD56_PM_DEBUG_INFO
+# define pminfo(format, ...) _info(format, ##__VA_ARGS__)
#else
-# define pmerr(fmt, ...)
-# define pminfo(fmt, ...)
-# define pmdbg(fmt, ...)
+# define pminfo(x, ...)
#endif
/* For enable_pwd, disable_pwd (digital domain) */
@@ -2489,8 +2497,8 @@ int up_pmramctrl(int cmd, uintptr_t addr, size_t size)
endidx = TILEALIGNIDX(TILEALIGN(addr + size));
DEBUGASSERT(startidx < 12 && endidx <= 12);
- pmdbg("%x (size: %x) [%d:%d] -> %d\n", addr, size,
- startidx, endidx, cmd);
+ pminfo("%x (size: %x) [%d:%d] -> %d\n", addr, size,
+ startidx, endidx, cmd);
/* Make controls bits for RAM power control */
@@ -2555,7 +2563,7 @@ int up_pmramctrl(int cmd, uintptr_t addr, size_t size)
return OK;
}
-#ifdef CONFIG_DEBUG_PM
+#ifdef CONFIG_CXD56_PM_DEBUG_INFO
/****************************************************************************
* Name: up_pmstatdump
*
@@ -2574,34 +2582,34 @@ void up_pmstatdump(void)
stat0 = getreg32(CXD56_TOPREG_APPDSP_RAMMODE_STAT0);
stat1 = getreg32(CXD56_TOPREG_APPDSP_RAMMODE_STAT1);
- pmdbg(" 0 1 2 3 4 5 6 7 8 9 A B\n");
- pmdbg("DSP RAM stat: %c %c %c %c %c %c %c %c %c %c %c %c\n",
- statch[(stat0 >> 0) & 3],
- statch[(stat0 >> 2) & 3],
- statch[(stat0 >> 4) & 3],
- statch[(stat0 >> 6) & 3],
- statch[(stat0 >> 8) & 3],
- statch[(stat0 >> 10) & 3],
- statch[(stat1 >> 0) & 3],
- statch[(stat1 >> 2) & 3],
- statch[(stat1 >> 4) & 3],
- statch[(stat1 >> 6) & 3],
- statch[(stat1 >> 8) & 3],
- statch[(stat1 >> 10) & 3]);
+ pminfo(" 0 1 2 3 4 5 6 7 8 9 A B\n");
+ pminfo("DSP RAM stat: %c %c %c %c %c %c %c %c %c %c %c %c\n",
+ statch[(stat0 >> 0) & 3],
+ statch[(stat0 >> 2) & 3],
+ statch[(stat0 >> 4) & 3],
+ statch[(stat0 >> 6) & 3],
+ statch[(stat0 >> 8) & 3],
+ statch[(stat0 >> 10) & 3],
+ statch[(stat1 >> 0) & 3],
+ statch[(stat1 >> 2) & 3],
+ statch[(stat1 >> 4) & 3],
+ statch[(stat1 >> 6) & 3],
+ statch[(stat1 >> 8) & 3],
+ statch[(stat1 >> 10) & 3]);
stat0 = getreg32(CXD56_CRG_APP_TILE_CLK_GATING_ENB);
- pmdbg("Clock gating: %c %c %c %c %c %c %c %c %c %c %c %c\n",
- gatech[(stat0 >> 0) & 1],
- gatech[(stat0 >> 1) & 1],
- gatech[(stat0 >> 2) & 1],
- gatech[(stat0 >> 3) & 1],
- gatech[(stat0 >> 4) & 1],
- gatech[(stat0 >> 5) & 1],
- gatech[(stat0 >> 6) & 1],
- gatech[(stat0 >> 7) & 1],
- gatech[(stat0 >> 8) & 1],
- gatech[(stat0 >> 9) & 1],
- gatech[(stat0 >> 10) & 1],
- gatech[(stat0 >> 11) & 1]);
+ pminfo("Clock gating: %c %c %c %c %c %c %c %c %c %c %c %c\n",
+ gatech[(stat0 >> 0) & 1],
+ gatech[(stat0 >> 1) & 1],
+ gatech[(stat0 >> 2) & 1],
+ gatech[(stat0 >> 3) & 1],
+ gatech[(stat0 >> 4) & 1],
+ gatech[(stat0 >> 5) & 1],
+ gatech[(stat0 >> 6) & 1],
+ gatech[(stat0 >> 7) & 1],
+ gatech[(stat0 >> 8) & 1],
+ gatech[(stat0 >> 9) & 1],
+ gatech[(stat0 >> 10) & 1],
+ gatech[(stat0 >> 11) & 1]);
}
#endif
diff --git a/arch/arm/src/cxd56xx/cxd56_powermgr.c b/arch/arm/src/cxd56xx/cxd56_powermgr.c
index c27d6a6..2c71c4a 100644
--- a/arch/arm/src/cxd56xx/cxd56_powermgr.c
+++ b/arch/arm/src/cxd56xx/cxd56_powermgr.c
@@ -84,14 +84,22 @@
#define PM_CPUFREQLOCK_FLAG_INITIALIZED (0x8000)
-#ifdef CONFIG_CXD56_PM_DEBUG
-# define pmerr(format, ...) _err(format, ##__VA_ARGS__)
-# define pmwarn(format, ...) _warn(format, ##__VA_ARGS__)
-# define pminfo(format, ...) _info(format, ##__VA_ARGS__)
+/* Debug */
+
+#ifdef CONFIG_CXD56_PM_DEBUG_ERROR
+# define pmerr(format, ...) _err(format, ##__VA_ARGS__)
+#else
+# define pmerr(x, ...)
+#endif
+#ifdef CONFIG_CXD56_PM_DEBUG_WARN
+# define pmwarn(format, ...) _warn(format, ##__VA_ARGS__)
+#else
+# define pmwarn(x, ...)
+#endif
+#ifdef CONFIG_CXD56_PM_DEBUG_INFO
+# define pminfo(format, ...) _info(format, ##__VA_ARGS__)
#else
-# define pmerr(x...)
-# define pmwarn(x...)
-# define pminfo(x...)
+# define pminfo(x, ...)
#endif
void up_cpuctxload(void);
diff --git a/arch/arm/src/cxd56xx/cxd56_powermgr_procfs.c b/arch/arm/src/cxd56xx/cxd56_powermgr_procfs.c
index 09bdc68..6f5549a 100644
--- a/arch/arm/src/cxd56xx/cxd56_powermgr_procfs.c
+++ b/arch/arm/src/cxd56xx/cxd56_powermgr_procfs.c
@@ -46,14 +46,22 @@
* Pre-processor Definitions
****************************************************************************/
-#ifdef CONFIG_CXD56_PM_DEBUG
-# define pmerr(format, ...) _err(format, ##__VA_ARGS__)
-# define pmwarn(format, ...) _warn(format, ##__VA_ARGS__)
-# define pminfo(format, ...) _info(format, ##__VA_ARGS__)
+/* Debug */
+
+#ifdef CONFIG_CXD56_PM_DEBUG_ERROR
+# define pmerr(format, ...) _err(format, ##__VA_ARGS__)
+#else
+# define pmerr(x, ...)
+#endif
+#ifdef CONFIG_CXD56_PM_DEBUG_WARN
+# define pmwarn(format, ...) _warn(format, ##__VA_ARGS__)
+#else
+# define pmwarn(x, ...)
+#endif
+#ifdef CONFIG_CXD56_PM_DEBUG_INFO
+# define pminfo(format, ...) _info(format, ##__VA_ARGS__)
#else
-# define pmerr(x...)
-# define pmwarn(x...)
-# define pminfo(x...)
+# define pminfo(x, ...)
#endif
#define PWD_STAT(val, shift) ((val >> shift) & 0x1)
@@ -280,21 +288,21 @@ static void cxd56_powermgr_procfs_clock(void)
len = snprintf(g_powermg_procfs_buffer + g_powermg_procfs_len,
g_powermg_procfs_size - g_powermg_procfs_len,
"Clock Status [Hz]\n"
- " |-RTC : %9d"" |-APP : %9d\n"
- " |-RCOSC : %9d"" ||-DSP0 : %9d\n"
- " |-XOSC : %9d"" ||-DSP1 : %9d\n"
- " |-SYSPLL : %9d"" ||-DSP2 : %9d\n"
- " |-M0P : %9d"" ||-DSP3 : %9d\n"
- " ||-AHB : %9d"" ||-DSP4 : %9d\n"
- " | |-APB : %9d"" ||-DSP5 : %9d\n"
- " |-UART1 : %9d"" ||-UART2 : %9d\n"
- " |-SFC : %9d"" ||-SPI4 : %9d\n"
- " |-SCU : %9d"" ||-SPI5 : %9d\n"
- " ||-LPADC : %9d"" ||-USB : %9d\n"
- " ||-HPADC : %9d"" ||-EMMC : %9d\n"
- " |-I2C4 : %9d"" ||-SDIO : %9d\n"
- " |-GPS : %9d"" ||-VSYNC : %9d\n"
- " ||-AHB : %9d\n",
+ " |-RTC : %9ld"" |-APP : %9ld\n"
+ " |-RCOSC : %9ld"" ||-DSP0 : %9ld\n"
+ " |-XOSC : %9ld"" ||-DSP1 : %9ld\n"
+ " |-SYSPLL : %9ld"" ||-DSP2 : %9ld\n"
+ " |-M0P : %9ld"" ||-DSP3 : %9ld\n"
+ " ||-AHB : %9ld"" ||-DSP4 : %9ld\n"
+ " | |-APB : %9ld"" ||-DSP5 : %9ld\n"
+ " |-UART1 : %9ld"" ||-UART2 : %9ld\n"
+ " |-SFC : %9ld"" ||-SPI4 : %9ld\n"
+ " |-SCU : %9ld"" ||-SPI5 : %9ld\n"
+ " ||-LPADC : %9ld"" ||-USB : %9ld\n"
+ " ||-HPADC : %9ld"" ||-EMMC : %9ld\n"
+ " |-I2C4 : %9ld"" ||-SDIO : %9ld\n"
+ " |-GPS : %9ld"" ||-VSYNC : %9ld\n"
+ " ||-AHB : %9ld\n",
cxd56_get_rtc_clock(), cxd56_get_appsmp_baseclock(),
cxd56_get_rcosc_clock(), dsptabl[0],
cxd56_get_xosc_clock(), dsptabl[1],