Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Move set_mpu_volt() from */*_machdep.c to am335x_pr...
details: https://anonhg.NetBSD.org/src/rev/89be41c6abc7
branches: trunk
changeset: 348434:89be41c6abc7
user: kiyohara <kiyohara%NetBSD.org@localhost>
date: Tue Oct 18 15:10:35 2016 +0000
description:
Move set_mpu_volt() from */*_machdep.c to am335x_prcm.c.
diffstat:
sys/arch/arm/omap/am335x_prcm.c | 28 ++++++++++++++++++++++++++--
sys/arch/arm/omap/am335x_prcm.h | 3 +--
sys/arch/evbarm/beagle/beagle_machdep.c | 30 +++++-------------------------
3 files changed, 32 insertions(+), 29 deletions(-)
diffs (148 lines):
diff -r 19e56973f76e -r 89be41c6abc7 sys/arch/arm/omap/am335x_prcm.c
--- a/sys/arch/arm/omap/am335x_prcm.c Tue Oct 18 15:06:17 2016 +0000
+++ b/sys/arch/arm/omap/am335x_prcm.c Tue Oct 18 15:10:35 2016 +0000
@@ -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 @@
#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 @@
}
}
+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)
{
diff -r 19e56973f76e -r 89be41c6abc7 sys/arch/arm/omap/am335x_prcm.h
--- a/sys/arch/arm/omap/am335x_prcm.h Tue Oct 18 15:06:17 2016 +0000
+++ b/sys/arch/arm/omap/am335x_prcm.h Tue Oct 18 15:10:35 2016 +0000
@@ -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 @@
#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
diff -r 19e56973f76e -r 89be41c6abc7 sys/arch/evbarm/beagle/beagle_machdep.c
--- a/sys/arch/evbarm/beagle/beagle_machdep.c Tue Oct 18 15:06:17 2016 +0000
+++ b/sys/arch/evbarm/beagle/beagle_machdep.c Tue Oct 18 15:10:35 2016 +0000
@@ -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 @@
#include "sdhc.h"
#include "ukbd.h"
#include "arml2cc.h"
-#include "tps65217pmic.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -191,7 +190,6 @@
# 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 @@
#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 @@
}
#if defined(TI_AM335X)
if (device_is_a(self, "tps65217pmic")) {
- pmic_dev = self;
+ extern const char *mpu_supply;
+
+ mpu_supply = "DCDC2";
}
#endif
}
-
-#if defined(TI_AM335X)
-int
-set_mpu_volt(int mvolt)
-{
-
-#if NTPS65217PMIC > 0
- if (pmic_dev == NULL)
- return ENODEV;
-
- /* MPU voltage is on vdcd2 */
- return tps65217pmic_set_volt(pmic_dev, "DCDC2", mvolt);
-#else
- return -1;
-#endif
-}
-#endif
Home |
Main Index |
Thread Index |
Old Index