Module Name:    src
Committed By:   skrll
Date:           Tue Jan  8 16:49:43 UTC 2013

Modified Files:
        src/sys/arch/evbarm/rpi: rpi_machdep.c
Added Files:
        src/sys/arch/evbarm/rpi: vcpm.h

Log Message:
Use the VC power manager mailbox channel to power up the devices we have
support for.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/evbarm/rpi/rpi_machdep.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/rpi/vcpm.h

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/evbarm/rpi/rpi_machdep.c
diff -u src/sys/arch/evbarm/rpi/rpi_machdep.c:1.20 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.21
--- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.20	Mon Jan  7 20:42:24 2013
+++ src/sys/arch/evbarm/rpi/rpi_machdep.c	Tue Jan  8 16:49:43 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpi_machdep.c,v 1.20 2013/01/07 20:42:24 jmcneill Exp $	*/
+/*	$NetBSD: rpi_machdep.c,v 1.21 2013/01/08 16:49:43 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,10 +30,14 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.20 2013/01/07 20:42:24 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.21 2013/01/08 16:49:43 skrll Exp $");
 
 #include "opt_evbarm_boardtype.h"
 
+#include "sdhc.h"
+#include "bcmspi.h"
+#include "bsciic.h"
+
 #include <sys/param.h>
 #include <sys/device.h>
 #include <sys/termios.h>
@@ -58,6 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: rpi_machdep.
 #include <arm/broadcom/bcm2835_mbox.h>
 
 #include <evbarm/rpi/vcio.h>
+#include <evbarm/rpi/vcpm.h>
 #include <evbarm/rpi/vcprop.h>
 
 #include <evbarm/rpi/rpi.h>
@@ -215,6 +220,23 @@ rpi_bootparams(void)
 	bus_space_handle_t ioh = BCM2835_IOPHYSTOVIRT(BCM2835_ARMMBOX_BASE);
 	uint32_t res;
 
+	bcm2835_mbox_write(iot, ioh, BCMMBOX_CHANPM, (
+#if (NSDHC > 0)
+	    (1 << VCPM_POWER_SDCARD) | 
+#endif
+#if (NPLCOM > 0)
+	    (1 << VCPM_POWER_UART0) |
+#endif
+
+#if (NBSCIIC > 0)
+	    (1 << VCPM_POWER_I2C0) | (1 << VCPM_POWER_I2C1) | 
+	/*  (1 << VCPM_POWER_I2C2) | */
+#endif
+#if (NBCMSPI > 0)
+	    (1 << VCPM_POWER_SPI) | 
+#endif
+	    0) << 4);
+
 	bcm2835_mbox_write(iot, ioh, BCMMBOX_CHANARM2VC, KERN_VTOPHYS(&vb));
 
 	bcm2835_mbox_read(iot, ioh, BCMMBOX_CHANARM2VC, &res);

Added files:

Index: src/sys/arch/evbarm/rpi/vcpm.h
diff -u /dev/null src/sys/arch/evbarm/rpi/vcpm.h:1.1
--- /dev/null	Tue Jan  8 16:49:43 2013
+++ src/sys/arch/evbarm/rpi/vcpm.h	Tue Jan  8 16:49:43 2013
@@ -0,0 +1,49 @@
+/*	$NetBSD: vcpm.h,v 1.1 2013/01/08 16:49:43 skrll Exp $	*/
+
+/*-
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Nick Hudson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Power Manager Mailbox interface
+ */
+
+#ifndef	_EVBARM_RPI_VCPM_H_
+#define	_EVBARM_RPI_VCPM_H_
+
+#define	VCPM_POWER_SDCARD	0
+#define	VCPM_POWER_UART0	1
+#define	VCPM_POWER_UART1	2
+#define	VCPM_POWER_USB		3
+#define	VCPM_POWER_I2C0		4
+#define	VCPM_POWER_I2C1		5
+#define	VCPM_POWER_I2C2		6
+#define	VCPM_POWER_SPI		7
+#define	VCPM_POWER_CCP2TX	8
+
+#endif	/* _EVBARM_RPI_VCPM_H_ */

Reply via email to