Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 May 2017 14:23:49 +0000 (UTC)
From:      Zbigniew Bodek <zbb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r318877 - head/sys/arm/mv
Message-ID:  <201705251423.v4PENn1w053099@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: zbb
Date: Thu May 25 14:23:49 2017
New Revision: 318877
URL: https://svnweb.freebsd.org/changeset/base/318877

Log:
  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

Modified:
  head/sys/arm/mv/mv_common.c

Modified: head/sys/arm/mv/mv_common.c
==============================================================================
--- head/sys/arm/mv/mv_common.c	Thu May 25 14:22:00 2017	(r318876)
+++ head/sys/arm/mv/mv_common.c	Thu May 25 14:23:49 2017	(r318877)
@@ -133,6 +133,16 @@ const struct decode_win *cpu_wins = cpu_
 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_m
 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);
 
@@ -1168,7 +1178,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;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201705251423.v4PENn1w053099>