Module Name:    src
Committed By:   kiyohara
Date:           Tue Oct 18 15:10:35 UTC 2016

Modified Files:
        src/sys/arch/arm/omap: am335x_prcm.c am335x_prcm.h
        src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
Move set_mpu_volt() from */*_machdep.c to am335x_prcm.c.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/omap/am335x_prcm.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/omap/am335x_prcm.h
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/omap/am335x_prcm.c
diff -u src/sys/arch/arm/omap/am335x_prcm.c:1.8 src/sys/arch/arm/omap/am335x_prcm.c:1.9
--- src/sys/arch/arm/omap/am335x_prcm.c:1.8	Tue Sep 30 11:34:07 2014
+++ src/sys/arch/arm/omap/am335x_prcm.c	Tue Oct 18 15:10:35 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: am335x_prcm.c,v 1.8 2014/09/30 11:34:07 jmcneill Exp $	*/
+/*	$NetBSD: am335x_prcm.c,v 1.9 2016/10/18 15:10:35 kiyohara Exp $	*/
 
 /*
  * TI OMAP Power, Reset, and Clock Management on the AM335x
@@ -34,10 +34,13 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: am335x_prcm.c,v 1.8 2014/09/30 11:34:07 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: am335x_prcm.c,v 1.9 2016/10/18 15:10:35 kiyohara Exp $");
+
+#include "tps65217pmic.h"
 
 #include <sys/types.h>
 #include <sys/param.h>
+#include <sys/device.h>
 #include <sys/sysctl.h>
 #include <sys/pmf.h>
 
@@ -46,6 +49,8 @@ __KERNEL_RCSID(0, "$NetBSD: am335x_prcm.
 #include <arm/omap/omap2_prcm.h>
 #include <arm/omap/omap_var.h>
 
+#include <dev/i2c/tps65217pmicvar.h>
+
 #define AM335X_CLKCTRL_MODULEMODE_MASK		__BITS(0, 1)
 #define   AM335X_CLKCTRL_MODULEMODE_DISABLED	0
 #define   AM335X_CLKCTRL_MODULEMODE_ENABLE	2
@@ -161,6 +166,25 @@ prcm_mpu_pll_config(u_int mpupll_m)
 	}
 }
 
+const char *mpu_supply = NULL;
+static int
+set_mpu_volt(int mvolt)
+{
+	device_t dev;
+
+	__USE(dev);	// Simpler than complex ifdef.
+
+	if (mpu_supply == NULL)
+		return ENODEV;
+
+#if NTPS65217PMIC > 0
+	dev = device_find_by_xname("tps65217pmic0");
+	if (dev != NULL)
+		return tps65217pmic_set_volt(dev, mpu_supply, mvolt);
+#endif
+	return ENODEV;
+}
+
 static int
 mpu_current_frequency_sysctl_helper(SYSCTLFN_ARGS)
 {

Index: src/sys/arch/arm/omap/am335x_prcm.h
diff -u src/sys/arch/arm/omap/am335x_prcm.h:1.9 src/sys/arch/arm/omap/am335x_prcm.h:1.10
--- src/sys/arch/arm/omap/am335x_prcm.h:1.9	Sat Jun  6 14:00:32 2015
+++ src/sys/arch/arm/omap/am335x_prcm.h	Tue Oct 18 15:10:35 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: am335x_prcm.h,v 1.9 2015/06/06 14:00:32 jmcneill Exp $	*/
+/*	$NetBSD: am335x_prcm.h,v 1.10 2016/10/18 15:10:35 kiyohara Exp $	*/
 
 /*
  * TI OMAP Power, Reset, and Clock Management on the AM335x
@@ -150,7 +150,6 @@ struct omap_module {
 #define RST_GLOBAL_COLD_SW	__BIT(1)
 
 #ifdef _KERNEL
-int  set_mpu_volt(int);
 void am335x_sys_clk(bus_space_handle_t);
 void am335x_cpu_clk(void);
 #endif

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.65 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.66
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.65	Tue Oct 18 14:39:52 2016
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Tue Oct 18 15:10:35 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.65 2016/10/18 14:39:52 kiyohara Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.66 2016/10/18 15:10:35 kiyohara Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.65 2016/10/18 14:39:52 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.66 2016/10/18 15:10:35 kiyohara Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -141,7 +141,6 @@ __KERNEL_RCSID(0, "$NetBSD: beagle_machd
 #include "sdhc.h"
 #include "ukbd.h"
 #include "arml2cc.h"
-#include "tps65217pmic.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -191,7 +190,6 @@ __KERNEL_RCSID(0, "$NetBSD: beagle_machd
 # endif
 # include <arm/omap/am335x_prcm.h>
 # include <arm/omap/tifbvar.h>
-# include <dev/i2c/tps65217pmicvar.h>
 # if NSDHC > 0
 #  include <arm/omap/omap2_obiovar.h>
 #  include <arm/omap/omap3_sdmmcreg.h>
@@ -241,9 +239,6 @@ int use_fb_console = true;
 #ifdef CPU_CORTEXA15
 uint32_t omap5_cnt_frq;
 #endif
-#if defined(TI_AM335X)
-device_t pmic_dev = NULL;
-#endif
 
 /*
  * Macros to translate between physical and virtual for a subset of the
@@ -1153,24 +1148,9 @@ beagle_device_register(device_t self, vo
 	}
 #if defined(TI_AM335X)
 	if (device_is_a(self, "tps65217pmic")) {
-		pmic_dev = self;
-	}
-#endif
-}
-
-#if defined(TI_AM335X)
-int
-set_mpu_volt(int mvolt)
-{
-
-#if NTPS65217PMIC > 0
-	if (pmic_dev == NULL)
-		return ENODEV;
+		extern const char *mpu_supply;
 
-	/* MPU voltage is on vdcd2 */
-	return tps65217pmic_set_volt(pmic_dev, "DCDC2", mvolt);
-#else
-	return -1;
+		mpu_supply = "DCDC2";
+	}
 #endif
 }
-#endif

Reply via email to