summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzbb <zbb@FreeBSD.org>2017-05-25 14:23:49 +0000
committerLuiz Souza <luiz@netgate.com>2017-09-06 11:38:11 -0500
commitccb49fedafb1ad914d209691f607d2a0bbd50d8a (patch)
tree899778c6371b0f9676cbaaccc422c82106ea61e7
parent5046e2bbfd4a747aef3d5da814a036f4ab405ee6 (diff)
downloadFreeBSD-src-ccb49fedafb1ad914d209691f607d2a0bbd50d8a.zip
FreeBSD-src-ccb49fedafb1ad914d209691f607d2a0bbd50d8a.tar.gz
Fix PM recognition on recent Marvell boards
PM status is only supported on Kirkwood and Disvovery. Cleanup the code to properly report its state on other platforms. Submitted by: Wojciech Macek <wma@semihalf.com> Obtained from: Semihalf Sponsored by: Stormshield Differential revision: https://reviews.freebsd.org/D10718 (cherry picked from commit 235f0e77ca3a49c7d9891ea5e571656cffc0aa30)
-rw-r--r--sys/arm/mv/mv_common.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/sys/arm/mv/mv_common.c b/sys/arm/mv/mv_common.c
index c2511d7..d3dc599 100644
--- a/sys/arm/mv/mv_common.c
+++ b/sys/arm/mv/mv_common.c
@@ -133,6 +133,16 @@ const struct decode_win *cpu_wins = cpu_win_tbl;
typedef void (*decode_win_setup_t)(u_long);
typedef void (*dump_win_t)(u_long);
+/*
+ * The power status of device feature is only supported on
+ * Kirkwood and Discovery SoCs.
+ */
+#if defined(SOC_MV_KIRKWOOD) || defined(SOC_MV_DISCOVERY)
+#define SOC_MV_POWER_STAT_SUPPORTED 1
+#else
+#define SOC_MV_POWER_STAT_SUPPORTED 0
+#endif
+
struct soc_node_spec {
const char *compat;
decode_win_setup_t decode_handler;
@@ -174,10 +184,10 @@ static struct fdt_pm_mask_entry fdt_pm_mask_table[] = {
static __inline int
pm_is_disabled(uint32_t mask)
{
-#if defined(SOC_MV_KIRKWOOD)
- return (soc_power_ctrl_get(mask) == mask);
-#else
+#if SOC_MV_POWER_STAT_SUPPORTED
return (soc_power_ctrl_get(mask) == mask ? 0 : 1);
+#else
+ return (0);
#endif
}
@@ -364,7 +374,7 @@ uint32_t
soc_power_ctrl_get(uint32_t mask)
{
-#if !defined(SOC_MV_ORION)
+#if SOC_MV_POWER_STAT_SUPPORTED
if (mask != CPU_PM_CTRL_NONE)
mask &= read_cpu_ctrl(CPU_PM_CTRL);
@@ -1178,7 +1188,6 @@ decode_win_usb_setup(u_long base)
uint32_t br, cr;
int i, j;
-
if (pm_is_disabled(CPU_PM_CTRL_USB(usb_port)))
return;
OpenPOWER on IntegriCloud