Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/evbarm/rpi Use the VC power manager mailbox channel...



details:   https://anonhg.NetBSD.org/src/rev/98578ff51612
branches:  trunk
changeset: 783785:98578ff51612
user:      skrll <skrll%NetBSD.org@localhost>
date:      Tue Jan 08 16:49:43 2013 +0000

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

diffstat:

 sys/arch/evbarm/rpi/rpi_machdep.c |  26 +++++++++++++++++++-
 sys/arch/evbarm/rpi/vcpm.h        |  49 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+), 2 deletions(-)

diffs (110 lines):

diff -r 26fe55a235cc -r 98578ff51612 sys/arch/evbarm/rpi/rpi_machdep.c
--- a/sys/arch/evbarm/rpi/rpi_machdep.c Tue Jan 08 16:39:28 2013 +0000
+++ b/sys/arch/evbarm/rpi/rpi_machdep.c Tue Jan 08 16:49:43 2013 +0000
@@ -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 @@
 #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 @@
        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);
diff -r 26fe55a235cc -r 98578ff51612 sys/arch/evbarm/rpi/vcpm.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/evbarm/rpi/vcpm.h        Tue Jan 08 16:49:43 2013 +0000
@@ -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_ */



Home | Main Index | Thread Index | Old Index