Module Name:    src
Committed By:   thorpej
Date:           Wed Jun  5 03:38:09 UTC 2019

Modified Files:
        src/sys/arch/evbarm/conf: GENERIC
Added Files:
        src/sys/arch/arm/dts: sun8i-h2-plus-bananapi-p2-zero.dts

Log Message:
Add a device tree for the Banana Pi BPI-P2 Zero.  This device is
based on the BPI-M2 Zero, with a couple of small changes:
- On-board Ethernet (with optional PoE support)
- On-board eMMC.
- Card-detect for the SD card slot is wired up a little differently.

Kindly tested by Dima Veselov.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 \
    src/sys/arch/arm/dts/sun8i-h2-plus-bananapi-p2-zero.dts
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/evbarm/conf/GENERIC

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/conf/GENERIC
diff -u src/sys/arch/evbarm/conf/GENERIC:1.35 src/sys/arch/evbarm/conf/GENERIC:1.36
--- src/sys/arch/evbarm/conf/GENERIC:1.35	Tue May 28 21:56:24 2019
+++ src/sys/arch/evbarm/conf/GENERIC	Wed Jun  5 03:38:09 2019
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC,v 1.35 2019/05/28 21:56:24 jmcneill Exp $
+#	$NetBSD: GENERIC,v 1.36 2019/06/05 03:38:09 thorpej Exp $
 #
 #	GENERIC ARM (aarch32) kernel
 #
@@ -113,6 +113,7 @@ makeoptions	DTS="
 	sun8i-a83t-tbs-a711.dts
 
 	sun8i-h2-plus-bananapi-m2-zero.dts
+	sun8i-h2-plus-bananapi-p2-zero.dts
 	sun8i-h2-plus-libretech-all-h3-cc.dts
 	sun8i-h2-plus-orangepi-r1.dts
 	sun8i-h2-plus-orangepi-zero.dts

Added files:

Index: src/sys/arch/arm/dts/sun8i-h2-plus-bananapi-p2-zero.dts
diff -u /dev/null src/sys/arch/arm/dts/sun8i-h2-plus-bananapi-p2-zero.dts:1.1
--- /dev/null	Wed Jun  5 03:38:09 2019
+++ src/sys/arch/arm/dts/sun8i-h2-plus-bananapi-p2-zero.dts	Wed Jun  5 03:38:09 2019
@@ -0,0 +1,89 @@
+/* $NetBSD: sun8i-h2-plus-bananapi-p2-zero.dts,v 1.1 2019/06/05 03:38:09 thorpej Exp $ */
+
+/*-
+ * Copyright (c) 2019 Jason R. Thorpe
+ * All rights reserved.
+ *
+ * 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 AUTHOR ``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 AUTHOR 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.
+ */
+
+/*
+ * Device tree for Banana Pi BPI-P2 Zero.  The P2 Zero is essentially an
+ * M2 Zero with the following additions:
+ *
+ * - On-board Ethernet (with PoE capability available as an
+ *   optional module).
+ * - On-board eMMC module.
+ */
+
+#include "../../../external/gpl2/dts/dist/arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts"
+
+/ {
+	model = "Banana Pi BPI-P2-Zero";
+	compatible = "sinovoip,bpi-p2-zero", "allwinner,sun8i-h2-plus";
+
+	aliases {
+		/* ethernet0 is the H3 emac, defined in sun8i-h3.dtsi */
+		ethernet0 = &emac;
+	};
+
+	leds {
+		pwr_led {
+			label = "bananapi-p2-zero:red:pwr";
+		};
+	};
+};
+
+&emac {
+	phy-handle = <&int_mii_phy>;
+	phy-mode = "mii";
+	allwinner,leds-active-low;
+	status = "okay";
+};
+
+&mmc0 {
+	/*
+	 * There seems to be a discrepancy between how the card-detect
+	 * signal is wired up between the P2 Zero and the M2 Zero, on
+	 * which the P2 Zero is based.
+	 *
+	 * The M2 Zero device tree file claims that early samples of
+	 * the M2 Zero were wired active-low, but that the production
+	 * of the board is wired active-high; as such, the M2 Zero
+	 * device tree uses an active-high signal for card-detect.
+	 *
+	 * However, the P2 Zero has been observed in the wild to have
+	 * an active-low card-detect signal.  I don't know if this is
+	 * an early-vs-late situation like the M2 Zero, but for now we
+	 * will configure the card-detect signal to active-low to match
+	 * known samples of the board that exist in the wild.
+	 */
+	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;	/* PF6 */
+};
+
+&mmc2 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&mmc2_8bit_pins>;
+	bus-width = <8>;
+	non-removable;
+	status = "okay";
+};

Reply via email to