Skip to contentSkip to conversation

ARM: dts: sunxi: Enable USB DRC on a bunch of boards

PATCH New Hans de Goede 3 participants 22 messages Jul 31, 2015 – Aug 2, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover ARM: dts: sunxi: Enable USB DRC on a bunch of boards

Hi Maxime,

Here is a set of patches to enable the otg on 4 more boards, and adding a dts file for the Wits a20 Pro Development kit. Most of these are the result of the devicetree workshop I organized last weekend :) All of them have been doublechecked for correctness and were tested on the actual hardware.

This set does not include some pending dts patches for enabling otg on boards which use the axp209 to do vbus-detection on the otg port, as the necessary mfd / power-supply bits are not merged yet. I'll try to get those queued up for 4.3, and when they are I'll send you another set of otg enablement patches for these boards.

Regards,

Hans

#1 lore raw

PATCH 1/5 ARM: dts: sun4i: Enable USB DRC on A10 OLinuxIno Lime

From: Remy van Elst <[email protected]>

Enable the otg/drc usb controller on the A10 OLinuxIno Lime.

---
 arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts | 32 ++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts +32 -0
index b64aa4e..28e32ad 100644
@@ -150,6 +150,10 @@
 	status = "okay";
 };
 
+&otg_sram {
+	status = "okay";
+};
+
 &pio {
 	ahci_pwr_pin_olinuxinolime: ahci_pwr_pin at 1 {
 		allwinner,pins = "PC3";
@@ -164,6 +168,20 @@
 		allwinner,drive = <SUN4I_PINCTRL_20_MA>;
 		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
 	};
+
+	usb0_id_detect_pin: usb0_id_detect_pin at 0 {
+		allwinner,pins = "PH4";
+		allwinner,function = "gpio_in";
+		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+		allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
+	};
+
+	usb0_vbus_detect_pin: usb0_vbus_detect_pin at 0 {
+		allwinner,pins = "PH5";
+		allwinner,function = "gpio_in";
+		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+		allwinner,pull = <SUN4I_PINCTRL_PULL_DOWN>;
+	};
 };
 
 &reg_ahci_5v {
@@ -172,6 +190,10 @@
 	status = "okay";
 };
 
+&reg_usb0_vbus {
+	status = "okay";
+};
+
 &reg_usb1_vbus {
 	status = "okay";
 };
@@ -186,7 +208,17 @@
 	status = "okay";
 };
 
+&usb_otg {
+	dr_mode = "otg";
+	status = "okay";
+};
+
 &usbphy {
+	pinctrl-names = "default";
+	pinctrl-0 = <&usb0_id_detect_pin>, <&usb0_vbus_detect_pin>;
+	usb0_id_det-gpio   = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
+	usb0_vbus_det-gpio = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */
+	usb0_vbus-supply   = <&reg_usb0_vbus>;
 	usb1_vbus-supply = <&reg_usb1_vbus>;
 	usb2_vbus-supply = <&reg_usb2_vbus>;
 	status = "okay";
Signature · 1 line
2.4.3
#2 lore raw

PATCH 1/5 ARM: dts: sun4i: Enable USB DRC on A10 OLinuxIno Lime

1;3803;0c

Quoted 6 lines · Hans de Goede

From: Remy van Elst <[email protected]>

Enable the otg/drc usb controller on the A10 OLinuxIno Lime.

Applied, thanks!

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150731/c9821f7c/attachment.sig>
#3 lore raw

PATCH 2/5 ARM: dts: sun5i: Enable USB DRC on A10s OLinuxIno Micro

In reply to Hans de Goede

Enable the otg/drc usb controller on the A10s OLinuxIno Micro.

Note the A10s OlinuxIno Micro always has some voltage on its otg power pin, even if the usb-vbus0-regulator is disabled, the leaked voltage is enough to make vbus-det always report 1, so we do not use vbus-det on this board.

---
 arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts | 30 +++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)
arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts +29 -1
index 7b26e17..5eebd21 100644
@@ -196,6 +196,10 @@
 	status = "okay";
 };
 
+&otg_sram {
+	status = "okay";
+};
+
 &pio {
 	mmc0_cd_pin_olinuxino_micro: mmc0_cd_pin at 0 {
 		allwinner,pins = "PG1";
@@ -224,6 +228,22 @@
 		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
 		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
 	};
+
+	usb0_vbus_pin_a: usb0_vbus_pin at 0 {
+		allwinner,pins = "PG11";
+	};
+
+	usb0_id_detect_pin: usb0_id_detect_pin at 0 {
+		allwinner,pins = "PG12";
+		allwinner,function = "gpio_in";
+		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+		allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
+	};
+};
+
+&reg_usb0_vbus {
+	gpio = <&pio 6 11 GPIO_ACTIVE_HIGH>; /* PG11 */
+	status = "okay";
 };
 
 &reg_usb1_vbus {
@@ -250,8 +270,16 @@
 	status = "okay";
 };
 
+&usb_otg {
+	dr_mode = "otg";
+	status = "okay";
+};
+
 &usbphy {
+	pinctrl-names = "default";
+	pinctrl-0 = <&usb0_id_detect_pin>;
+	usb0_id_det-gpio = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */
+	usb0_vbus-supply = <&reg_usb0_vbus>;
 	usb1_vbus-supply = <&reg_usb1_vbus>;
 	status = "okay";
 };
-
Signature · 1 line
2.4.3
#4 lore raw

PATCH 2/5 ARM: dts: sun5i: Enable USB DRC on A10s OLinuxIno Micro

Quoted 28 lines · Hans de Goede

Enable the otg/drc usb controller on the A10s OLinuxIno Micro.

Note the A10s OlinuxIno Micro always has some voltage on its otg power pin, even if the usb-vbus0-regulator is disabled, the leaked voltage is enough to make vbus-det always report 1, so we do not use vbus-det on this board.

---
 arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts | 30 +++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)
arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts +4 -0
index 7b26e17..5eebd21 100644
@@ -196,6 +196,10 @@
 	status = "okay";
 };
 
+&otg_sram {
+	status = "okay";
+};
+
 &pio {
 	mmc0_cd_pin_olinuxino_micro: mmc0_cd_pin at 0 {
 		allwinner,pins = "PG1";

arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts line 234

Quoted 7 lines
arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts +4 -0
@@ -224,6 +228,22 @@
 		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
 		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
 	};
+
+	usb0_vbus_pin_a: usb0_vbus_pin at 0 {
+		allwinner,pins = "PG11";
+	};

We usually have this as a reference, instead of doing it through the full path.

It makes it clearer that we override something, and we don't define a new node.

Thanks,
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150731/e3a5ee3e/attachment-0001.sig>
#5 lore raw

PATCH 3/5 ARM: dts: sun5i: Enable USB DRC on A13 OLinuxIno

In reply to Hans de Goede

From: Mark Janssen <[email protected]>

Enable the otg/drc usb controller on the A13 OLinuxIno.

---
 arch/arm/boot/dts/sun5i-a13-olinuxino.dts | 37 +++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
arch/arm/boot/dts/sun5i-a13-olinuxino.dts +37 -0
index 4232400..e659482 100644
@@ -159,6 +159,10 @@
 	status = "okay";
 };
 
+&otg_sram {
+	status = "okay";
+};
+
 &pio {
 	mmc0_cd_pin_olinuxino: mmc0_cd_pin at 0 {
 		allwinner,pins = "PG0";
@@ -174,6 +178,24 @@
 		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
 	};
 
+	usb0_id_detect_pin: usb0_id_detect_pin at 0 {
+		allwinner,pins = "PG2";
+		allwinner,function = "gpio_in";
+		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+		allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
+	};
+
+	usb0_vbus_detect_pin: usb0_vbus_detect_pin at 0 {
+		allwinner,pins = "PG1";
+		allwinner,function = "gpio_in";
+		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+		allwinner,pull = <SUN4I_PINCTRL_PULL_DOWN>;
+	};
+
+	usb0_vbus_pin_a: usb0_vbus_pin at 0 {
+		allwinner,pins = "PG12";
+	};
+
 	usb1_vbus_pin_olinuxino: usb1_vbus_pin at 0 {
 		allwinner,pins = "PG11";
 		allwinner,function = "gpio_out";
@@ -182,6 +204,11 @@
 	};
 };
 
+&reg_usb0_vbus {
+	status = "okay";
+	gpio = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */
+};
+
 &reg_usb1_vbus {
 	pinctrl-0 = <&usb1_vbus_pin_olinuxino>;
 	gpio = <&pio 6 11 GPIO_ACTIVE_HIGH>;
@@ -194,7 +221,17 @@
 	status = "okay";
 };
 
+&usb_otg {
+	dr_mode = "otg";
+	status = "okay";
+};
+
 &usbphy {
+	pinctrl-names = "default";
+	pinctrl-0 = <&usb0_id_detect_pin>, <&usb0_vbus_detect_pin>;
+	usb0_id_det-gpio = <&pio 6 2 GPIO_ACTIVE_HIGH>; /* PG2 */
+	usb0_vbus_det-gpio = <&pio 6 1 GPIO_ACTIVE_HIGH>; /* PG1 */
+	usb0_vbus-supply = <&reg_usb0_vbus>;
 	usb1_vbus-supply = <&reg_usb1_vbus>;
 	status = "okay";
 };
Signature · 1 line
2.4.3
#6 lore raw

PATCH 3/5 ARM: dts: sun5i: Enable USB DRC on A13 OLinuxIno

Quoted 36 lines · Hans de Goede

From: Mark Janssen <[email protected]>

Enable the otg/drc usb controller on the A13 OLinuxIno.

---
 arch/arm/boot/dts/sun5i-a13-olinuxino.dts | 37 +++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
arch/arm/boot/dts/sun5i-a13-olinuxino.dts +11 -0
index 4232400..e659482 100644
@@ -159,6 +159,10 @@
 	status = "okay";
 };
 
+&otg_sram {
+	status = "okay";
+};
+
 &pio {
 	mmc0_cd_pin_olinuxino: mmc0_cd_pin at 0 {
 		allwinner,pins = "PG0";
@@ -174,6 +178,24 @@
 		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
 	};
 
+	usb0_id_detect_pin: usb0_id_detect_pin at 0 {
+		allwinner,pins = "PG2";
+		allwinner,function = "gpio_in";
+		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+		allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
+	};
+

arch/arm/boot/dts/sun5i-a13-olinuxino.dts line 197

Quoted 10 lines
arch/arm/boot/dts/sun5i-a13-olinuxino.dts +10 -0
+	usb0_vbus_detect_pin: usb0_vbus_detect_pin at 0 {
+		allwinner,pins = "PG1";
+		allwinner,function = "gpio_in";
+		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+		allwinner,pull = <SUN4I_PINCTRL_PULL_DOWN>;
+	};
+
+	usb0_vbus_pin_a: usb0_vbus_pin at 0 {
+		allwinner,pins = "PG12";
+	};

Same thing here than in patch 2.

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150731/45dfd99e/attachment-0001.sig>
#7 lore raw

PATCH 4/5 ARM: dts: sun8i: Enable USB DRC on Ippo Q8H-A33 tablet

In reply to Hans de Goede

Enable the otg/drc usb controller on the Ippo Q8H-A33 tablet, for now it is enabled in host-only mode, because true OTG support requires support for detecting and enabling Vbus through the axp221 pmic.

For this to work the Vbus on the port must be enabled by u-boot, or a powered hub must be used.

---
 arch/arm/boot/dts/sun8i-a33-ippo-q8h-v1.2.dts | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/arm/boot/dts/sun8i-a33-ippo-q8h-v1.2.dts +9 -0
index 8bb75ee..361ddb9 100644
@@ -116,3 +116,12 @@
 	pinctrl-0 = <&r_uart_pins_a>;
 	status = "okay";
 };
+
+&usb_otg {
+	dr_mode = "host";
+	status = "okay";
+};
+
+&usbphy {
+	status = "okay";
+};
Signature · 1 line
2.4.3
#8 lore raw

PATCH 4/5 ARM: dts: sun8i: Enable USB DRC on Ippo Q8H-A33 tablet

Hi,

Quoted 6 lines · Hans de Goede

Enable the otg/drc usb controller on the Ippo Q8H-A33 tablet, for now it is enabled in host-only mode, because true OTG support requires support for detecting and enabling Vbus through the axp221 pmic.

For this to work the Vbus on the port must be enabled by u-boot, or a powered hub must be used.

A comment on top of the usb_otg node stating that would be great. It stands out more when we want to refactor stuff (with a FIXME even?).

Thanks,
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150731/89653bd6/attachment.sig>
#9 lore raw

PATCH 5/5 ARM: dts: sun7i: Add dts file for Wits Pro A20 DKT

In reply to Hans de Goede

From: Jelle de Jong <[email protected]>

The Wits Pro A20 DKT is an A20 Development KiT with 1G RAM, 4G NAND, sdio wifi, 1Gbit ethernet, 1024x768 lcd screen with ft5x_ts touchscreen and a ton of IO connectors.

Note there seem to be multiple sdcard slots on the board (4 in total), but other then mmc0 none of these are hooked up by default, there is a ton of dip-switches which likely allow hooking some of these up, but the documentation of the board only describes the use of a fraction of them, so for now we only support mmc0.

---
Also see: http://www.merrii.com/en/pla_d.asp?id=163

---
 arch/arm/boot/dts/Makefile                       |   3 +-
 arch/arm/boot/dts/sun7i-a20-wits-pro-a20-dkt.dts | 209 +++++++++++++++++++++++
 2 files changed, 211 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/sun7i-a20-wits-pro-a20-dkt.dts
arch/arm/boot/dts/Makefile +2 -1
index f830e1f..151a413 100644
@@ -595,7 +595,8 @@ dtb-$(CONFIG_MACH_SUN7I) += \
 	sun7i-a20-orangepi-mini.dtb \
 	sun7i-a20-pcduino3.dtb \
 	sun7i-a20-pcduino3-nano.dtb \
-	sun7i-a20-wexler-tab7200.dtb
+	sun7i-a20-wexler-tab7200.dtb \
+        sun7i-a20-wits-pro-a20-dkt.dtb
 dtb-$(CONFIG_MACH_SUN8I) += \
 	sun8i-a23-evb.dtb \
 	sun8i-a23-ippo-q8h-v5.dtb \
arch/arm/boot/dts/sun7i-a20-wits-pro-a20-dkt.dts new file +209 -0

209 lines not on this page · raw message

Signature · 1 line
2.4.3
#10 lore raw

PATCH 5/5 ARM: dts: sun7i: Add dts file for Wits Pro A20 DKT

Quoted 27 lines · Hans de Goede

From: Jelle de Jong <[email protected]>

The Wits Pro A20 DKT is an A20 Development KiT with 1G RAM, 4G NAND, sdio wifi, 1Gbit ethernet, 1024x768 lcd screen with ft5x_ts touchscreen and a ton of IO connectors.

Note there seem to be multiple sdcard slots on the board (4 in total), but other then mmc0 none of these are hooked up by default, there is a ton of dip-switches which likely allow hooking some of these up, but the documentation of the board only describes the use of a fraction of them, so for now we only support mmc0.

---
Also see: http://www.merrii.com/en/pla_d.asp?id=163

---
 arch/arm/boot/dts/Makefile                       |   3 +-
 arch/arm/boot/dts/sun7i-a20-wits-pro-a20-dkt.dts | 209 +++++++++++++++++++++++
 2 files changed, 211 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/sun7i-a20-wits-pro-a20-dkt.dts
arch/arm/boot/dts/Makefile +0 -0
index f830e1f..151a413 100644

arch/arm/boot/dts/Makefile dtb-$(CONFIG_MACH_SUN7I) += \ · line 599

Quoted 6 lines
arch/arm/boot/dts/Makefile +2 -1
@@ -595,7 +595,8 @@ dtb-$(CONFIG_MACH_SUN7I) += \
 	sun7i-a20-orangepi-mini.dtb \
 	sun7i-a20-pcduino3.dtb \
 	sun7i-a20-pcduino3-nano.dtb \
-	sun7i-a20-wexler-tab7200.dtb
+	sun7i-a20-wexler-tab7200.dtb \
+        sun7i-a20-wits-pro-a20-dkt.dtb

The indentation is off.

Quoted 71 lines
arch/arm/boot/dts/Makefile +0 -0
 dtb-$(CONFIG_MACH_SUN8I) += \
 	sun8i-a23-evb.dtb \
 	sun8i-a23-ippo-q8h-v5.dtb \
arch/arm/boot/dts/sun7i-a20-wits-pro-a20-dkt.dts new file +62 -0
new file mode 100644
index 0000000..db4d32c
@@ -0,0 +1,209 @@
+/*
+ * Copyright 2015 Jelle de Jong <[email protected]>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This file is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "sun7i-a20.dtsi"
+#include "sunxi-common-regulators.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+
+/ {
+	model = "Wits Pro A20 DKT";
+	compatible = "wits,pro-a20-dkt", "allwinner,sun7i-a20";
+
+	aliases {
+		serial0 = &uart0;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+

arch/arm/boot/dts/sun7i-a20-wits-pro-a20-dkt.dts line 72

Quoted 10 lines
arch/arm/boot/dts/sun7i-a20-wits-pro-a20-dkt.dts new file +10 -0
+	reg_vmmc3: vmmc3 {
+		compatible = "regulator-fixed";
+		pinctrl-names = "default";
+		pinctrl-0 = <&vmmc3_pin_ap6xxx_wl_regon>;
+		regulator-name = "vmmc3";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		enable-active-high;
+		gpio = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */
+	};

It's not really vmmc. The reg_on stuff is actually more of a reset
line: when tied to VCC, the WLAN part of the chip and its regulators are enabled, while when it's tied to ground, the WLAN is in reset, and the internal regulators disabled.

So it can be seen as either an active-low reset line, or an active-high regulator for the WiFi part, but VMMC is the power line of the MMC bus itself, which usually is provided by a regulator through the pin 22 of the AP6210, usually tied directly to the 3.3V line.

So you actually have two regulators here: one for vmmc (reg_3v3), and one for reg_on which is the one that you just defined.

Note that it's a bit of a pain for now to support such cases, as there's nothing to tie something from the DT to an SDIO device. I don't have a better solution than marking it always-on at the moment, with a big FIXME comment on top... :/

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150731/aafae621/attachment-0001.sig>
#11 lore raw

[linux-sunxi] Re: [PATCH 5/5] ARM: dts: sun7i: Add dts file for Wits Pro A20 DKT

Quoted 129 lines · Maxime Ripard
Quoted 27 lines · Hans de Goede

From: Jelle de Jong <[email protected]>

The Wits Pro A20 DKT is an A20 Development KiT with 1G RAM, 4G NAND, sdio wifi, 1Gbit ethernet, 1024x768 lcd screen with ft5x_ts touchscreen and a ton of IO connectors.

Note there seem to be multiple sdcard slots on the board (4 in total), but other then mmc0 none of these are hooked up by default, there is a ton of dip-switches which likely allow hooking some of these up, but the documentation of the board only describes the use of a fraction of them, so for now we only support mmc0.

---
Also see: http://www.merrii.com/en/pla_d.asp?id=163

---
 arch/arm/boot/dts/Makefile                       |   3 +-
 arch/arm/boot/dts/sun7i-a20-wits-pro-a20-dkt.dts | 209 +++++++++++++++++++++++
 2 files changed, 211 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/sun7i-a20-wits-pro-a20-dkt.dts
arch/arm/boot/dts/Makefile +0 -0
index f830e1f..151a413 100644

arch/arm/boot/dts/Makefile dtb-$(CONFIG_MACH_SUN7I) += \ · line 599

Quoted 6 lines
arch/arm/boot/dts/Makefile +2 -1
@@ -595,7 +595,8 @@ dtb-$(CONFIG_MACH_SUN7I) += \
      sun7i-a20-orangepi-mini.dtb \
      sun7i-a20-pcduino3.dtb \
      sun7i-a20-pcduino3-nano.dtb \
-     sun7i-a20-wexler-tab7200.dtb
+     sun7i-a20-wexler-tab7200.dtb \
+        sun7i-a20-wits-pro-a20-dkt.dtb

The indentation is off.

Quoted 71 lines
arch/arm/boot/dts/Makefile +0 -0
 dtb-$(CONFIG_MACH_SUN8I) += \
      sun8i-a23-evb.dtb \
      sun8i-a23-ippo-q8h-v5.dtb \
arch/arm/boot/dts/sun7i-a20-wits-pro-a20-dkt.dts new file +62 -0
new file mode 100644
index 0000000..db4d32c
@@ -0,0 +1,209 @@
+/*
+ * Copyright 2015 Jelle de Jong <[email protected]>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This file is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "sun7i-a20.dtsi"
+#include "sunxi-common-regulators.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+
+/ {
+     model = "Wits Pro A20 DKT";
+     compatible = "wits,pro-a20-dkt", "allwinner,sun7i-a20";
+
+     aliases {
+             serial0 = &uart0;
+     };
+
+     chosen {
+             stdout-path = "serial0:115200n8";
+     };
+

arch/arm/boot/dts/sun7i-a20-wits-pro-a20-dkt.dts line 72

Quoted 10 lines
arch/arm/boot/dts/sun7i-a20-wits-pro-a20-dkt.dts new file +10 -0
+     reg_vmmc3: vmmc3 {
+             compatible = "regulator-fixed";
+             pinctrl-names = "default";
+             pinctrl-0 = <&vmmc3_pin_ap6xxx_wl_regon>;
+             regulator-name = "vmmc3";
+             regulator-min-microvolt = <3300000>;
+             regulator-max-microvolt = <3300000>;
+             enable-active-high;
+             gpio = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */
+     };

It's not really vmmc. The reg_on stuff is actually more of a reset
line: when tied to VCC, the WLAN part of the chip and its regulators are enabled, while when it's tied to ground, the WLAN is in reset, and the internal regulators disabled.

So it can be seen as either an active-low reset line, or an active-high regulator for the WiFi part, but VMMC is the power line of the MMC bus itself, which usually is provided by a regulator through the pin 22 of the AP6210, usually tied directly to the 3.3V line.

Quoted 7 lines

So you actually have two regulators here: one for vmmc (reg_3v3), and one for reg_on which is the one that you just defined.

Note that it's a bit of a pain for now to support such cases, as there's nothing to tie something from the DT to an SDIO device. I don't have a better solution than marking it always-on at the moment, with a big FIXME comment on top... :/

One could use the mmc-pwr-seq stuff. I don't know if it has been extended for multiple GPIOs, not that you would need it in this use case.

Maybe we ought to fix up the other ones, like the CubieTruck and A31 Hummingbird?

ChenYu

#12 lore raw

[linux-sunxi] Re: [PATCH 5/5] ARM: dts: sun7i: Add dts file for Wits Pro A20 DKT

Hi,

Quoted 134 lines · Chen-Yu Tsai
Quoted 132 lines · Maxime Ripard
Quoted 27 lines · Hans de Goede

From: Jelle de Jong <[email protected]>

The Wits Pro A20 DKT is an A20 Development KiT with 1G RAM, 4G NAND, sdio wifi, 1Gbit ethernet, 1024x768 lcd screen with ft5x_ts touchscreen and a ton of IO connectors.

Note there seem to be multiple sdcard slots on the board (4 in total), but other then mmc0 none of these are hooked up by default, there is a ton of dip-switches which likely allow hooking some of these up, but the documentation of the board only describes the use of a fraction of them, so for now we only support mmc0.

---
Also see: http://www.merrii.com/en/pla_d.asp?id=163

---
  arch/arm/boot/dts/Makefile                       |   3 +-
  arch/arm/boot/dts/sun7i-a20-wits-pro-a20-dkt.dts | 209 +++++++++++++++++++++++
  2 files changed, 211 insertions(+), 1 deletion(-)

create mode 100644 arch/arm/boot/dts/sun7i-a20-wits-pro-a20-dkt.dts

arch/arm/boot/dts/Makefile +0 -0
index f830e1f..151a413 100644

arch/arm/boot/dts/Makefile dtb-$(CONFIG_MACH_SUN7I) += \ · line 599

Quoted 6 lines
arch/arm/boot/dts/Makefile +2 -1
@@ -595,7 +595,8 @@ dtb-$(CONFIG_MACH_SUN7I) += \
       sun7i-a20-orangepi-mini.dtb \
       sun7i-a20-pcduino3.dtb \
       sun7i-a20-pcduino3-nano.dtb \
-     sun7i-a20-wexler-tab7200.dtb
+     sun7i-a20-wexler-tab7200.dtb \
+        sun7i-a20-wits-pro-a20-dkt.dtb

The indentation is off.

Quoted 71 lines
arch/arm/boot/dts/Makefile +0 -0
  dtb-$(CONFIG_MACH_SUN8I) += \
       sun8i-a23-evb.dtb \
       sun8i-a23-ippo-q8h-v5.dtb \
arch/arm/boot/dts/sun7i-a20-wits-pro-a20-dkt.dts new file +62 -0
new file mode 100644
index 0000000..db4d32c
@@ -0,0 +1,209 @@
+/*
+ * Copyright 2015 Jelle de Jong <[email protected]>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This file is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "sun7i-a20.dtsi"
+#include "sunxi-common-regulators.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+
+/ {
+     model = "Wits Pro A20 DKT";
+     compatible = "wits,pro-a20-dkt", "allwinner,sun7i-a20";
+
+     aliases {
+             serial0 = &uart0;
+     };
+
+     chosen {
+             stdout-path = "serial0:115200n8";
+     };
+

arch/arm/boot/dts/sun7i-a20-wits-pro-a20-dkt.dts line 72

Quoted 10 lines
arch/arm/boot/dts/sun7i-a20-wits-pro-a20-dkt.dts new file +10 -0
+     reg_vmmc3: vmmc3 {
+             compatible = "regulator-fixed";
+             pinctrl-names = "default";
+             pinctrl-0 = <&vmmc3_pin_ap6xxx_wl_regon>;
+             regulator-name = "vmmc3";
+             regulator-min-microvolt = <3300000>;
+             regulator-max-microvolt = <3300000>;
+             enable-active-high;
+             gpio = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */
+     };

It's not really vmmc. The reg_on stuff is actually more of a reset
line: when tied to VCC, the WLAN part of the chip and its regulators are enabled, while when it's tied to ground, the WLAN is in reset, and the internal regulators disabled.

So it can be seen as either an active-low reset line, or an active-high regulator for the WiFi part, but VMMC is the power line of the MMC bus itself, which usually is provided by a regulator through the pin 22 of the AP6210, usually tied directly to the 3.3V line.

So you actually have two regulators here: one for vmmc (reg_3v3), and one for reg_on which is the one that you just defined.

Quoted 8 lines
Quoted 4 lines

Note that it's a bit of a pain for now to support such cases, as there's nothing to tie something from the DT to an SDIO device. I don't have a better solution than marking it always-on at the moment, with a big FIXME comment on top... :/

One could use the mmc-pwr-seq stuff. I don't know if it has been extended for multiple GPIOs, not that you would need it in this use case.

Yes the mmc-pwr-seq stuff seems to be the right thing to use for this, I'll try to get that to work and post a new version of this patch.

Regards,

Hans

#13 lore raw

[linux-sunxi] Re: [PATCH 5/5] ARM: dts: sun7i: Add dts file for Wits Pro A20 DKT

In reply to Chen-Yu Tsai

Hi,

Quoted 134 lines · Chen-Yu Tsai
Quoted 132 lines · Maxime Ripard
Quoted 27 lines · Hans de Goede

From: Jelle de Jong <[email protected]>

The Wits Pro A20 DKT is an A20 Development KiT with 1G RAM, 4G NAND, sdio wifi, 1Gbit ethernet, 1024x768 lcd screen with ft5x_ts touchscreen and a ton of IO connectors.

Note there seem to be multiple sdcard slots on the board (4 in total), but other then mmc0 none of these are hooked up by default, there is a ton of dip-switches which likely allow hooking some of these up, but the documentation of the board only describes the use of a fraction of them, so for now we only support mmc0.

---
Also see: http://www.merrii.com/en/pla_d.asp?id=163

---
  arch/arm/boot/dts/Makefile                       |   3 +-
  arch/arm/boot/dts/sun7i-a20-wits-pro-a20-dkt.dts | 209 +++++++++++++++++++++++
  2 files changed, 211 insertions(+), 1 deletion(-)

create mode 100644 arch/arm/boot/dts/sun7i-a20-wits-pro-a20-dkt.dts

arch/arm/boot/dts/Makefile +0 -0
index f830e1f..151a413 100644

arch/arm/boot/dts/Makefile dtb-$(CONFIG_MACH_SUN7I) += \ · line 599

Quoted 6 lines
arch/arm/boot/dts/Makefile +2 -1
@@ -595,7 +595,8 @@ dtb-$(CONFIG_MACH_SUN7I) += \
       sun7i-a20-orangepi-mini.dtb \
       sun7i-a20-pcduino3.dtb \
       sun7i-a20-pcduino3-nano.dtb \
-     sun7i-a20-wexler-tab7200.dtb
+     sun7i-a20-wexler-tab7200.dtb \
+        sun7i-a20-wits-pro-a20-dkt.dtb

The indentation is off.

Quoted 71 lines
arch/arm/boot/dts/Makefile +0 -0
  dtb-$(CONFIG_MACH_SUN8I) += \
       sun8i-a23-evb.dtb \
       sun8i-a23-ippo-q8h-v5.dtb \
arch/arm/boot/dts/sun7i-a20-wits-pro-a20-dkt.dts new file +62 -0
new file mode 100644
index 0000000..db4d32c
@@ -0,0 +1,209 @@
+/*
+ * Copyright 2015 Jelle de Jong <[email protected]>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This file is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "sun7i-a20.dtsi"
+#include "sunxi-common-regulators.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+
+/ {
+     model = "Wits Pro A20 DKT";
+     compatible = "wits,pro-a20-dkt", "allwinner,sun7i-a20";
+
+     aliases {
+             serial0 = &uart0;
+     };
+
+     chosen {
+             stdout-path = "serial0:115200n8";
+     };
+

arch/arm/boot/dts/sun7i-a20-wits-pro-a20-dkt.dts line 72

Quoted 10 lines
arch/arm/boot/dts/sun7i-a20-wits-pro-a20-dkt.dts new file +10 -0
+     reg_vmmc3: vmmc3 {
+             compatible = "regulator-fixed";
+             pinctrl-names = "default";
+             pinctrl-0 = <&vmmc3_pin_ap6xxx_wl_regon>;
+             regulator-name = "vmmc3";
+             regulator-min-microvolt = <3300000>;
+             regulator-max-microvolt = <3300000>;
+             enable-active-high;
+             gpio = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */
+     };

It's not really vmmc. The reg_on stuff is actually more of a reset
line: when tied to VCC, the WLAN part of the chip and its regulators are enabled, while when it's tied to ground, the WLAN is in reset, and the internal regulators disabled.

So it can be seen as either an active-low reset line, or an active-high regulator for the WiFi part, but VMMC is the power line of the MMC bus itself, which usually is provided by a regulator through the pin 22 of the AP6210, usually tied directly to the 3.3V line.

So you actually have two regulators here: one for vmmc (reg_3v3), and one for reg_on which is the one that you just defined.

Quoted 6 lines
Quoted 4 lines

Note that it's a bit of a pain for now to support such cases, as there's nothing to tie something from the DT to an SDIO device. I don't have a better solution than marking it always-on at the moment, with a big FIXME comment on top... :/

One could use the mmc-pwr-seq stuff.

Good idea, I've just written, tested and posted a patch for this for the cubietruck. I do not have access to the A20 Wits DKT atm, so I will post a new version of this patch with pwrseq support coming Tuesday when I have access to the board again.

Quoted 3 lines

I don't know if it has been
extended for multiple GPIOs, not that you would need it in this use case.

mmc-pwrseq-simple supports multiple reset/enable gpios (by listing them all as reset-gpios and setting GPIO_ACTIVE_LOW/HIGH depending on which value they need to be to activate things).

It also supports listing clocks which need to be enabled. I think that it may be a good idea to use this to also enable the bluetooth bits of the ap6210 module on the cubietruck. I know that the actual bt is interfaced over an uart, and we really should have a mechanism to enable/disable it separately, but for not this seems like a good way to get bluetooth to work.

We should ofcourse add a comment to the dts file that this is not a 100% ideal solution, but other then that I think this should work nicely. Maxime would enabling the bluetooth bits of this sdio module via mmc-pwrseq be acceptable to you?

ChenYu if Maxime acks this solution I hope you can write a patch for this, since you've been working on the bluetooth support before.

Quoted 2 lines

Maybe we ought to fix up the other ones, like the CubieTruck and A31 Hummingbird?

Ack, can you take care of the Hummingbird ? (I don't have one).

Regards,

Hans

#14 lore raw

[linux-sunxi] Re: [PATCH 5/5] ARM: dts: sun7i: Add dts file for Wits Pro A20 DKT

Quoted 172 lines · Hans de Goede

Hi,

Quoted 144 lines · Chen-Yu Tsai
Quoted 141 lines · Maxime Ripard
Quoted 31 lines · Hans de Goede

From: Jelle de Jong <[email protected]>

The Wits Pro A20 DKT is an A20 Development KiT with 1G RAM, 4G NAND, sdio wifi, 1Gbit ethernet, 1024x768 lcd screen with ft5x_ts touchscreen and a ton of IO connectors.

Note there seem to be multiple sdcard slots on the board (4 in total), but
other then mmc0 none of these are hooked up by default, there is a ton of
dip-switches which likely allow hooking some of these up, but the documentation of the board only describes the use of a fraction of them, so for now we only support mmc0.

---
Also see: http://www.merrii.com/en/pla_d.asp?id=163

---
  arch/arm/boot/dts/Makefile                       |   3 +-
  arch/arm/boot/dts/sun7i-a20-wits-pro-a20-dkt.dts | 209
+++++++++++++++++++++++
  2 files changed, 211 insertions(+), 1 deletion(-)

create mode 100644 arch/arm/boot/dts/sun7i-a20-wits-pro-a20-dkt.dts

arch/arm/boot/dts/Makefile +0 -0
index f830e1f..151a413 100644

arch/arm/boot/dts/Makefile dtb-$(CONFIG_MACH_SUN7I) += \ · line 599

Quoted 6 lines
arch/arm/boot/dts/Makefile +2 -1
@@ -595,7 +595,8 @@ dtb-$(CONFIG_MACH_SUN7I) += \
       sun7i-a20-orangepi-mini.dtb \
       sun7i-a20-pcduino3.dtb \
       sun7i-a20-pcduino3-nano.dtb \
-     sun7i-a20-wexler-tab7200.dtb
+     sun7i-a20-wexler-tab7200.dtb \
+        sun7i-a20-wits-pro-a20-dkt.dtb

The indentation is off.

Quoted 73 lines
arch/arm/boot/dts/Makefile +0 -0
  dtb-$(CONFIG_MACH_SUN8I) += \
       sun8i-a23-evb.dtb \
       sun8i-a23-ippo-q8h-v5.dtb \
arch/arm/boot/dts/sun7i-a20-wits-pro-a20-dkt.dts new file +11 -0
new file mode 100644
index 0000000..db4d32c
@@ -0,0 +1,209 @@
+/*
+ * Copyright 2015 Jelle de Jong <[email protected]>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of

the
+ * License, or (at your option) any later version.
+ *

+ *     This file is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.

+ *
+ * Or, alternatively,
+ *
+ * b) Permission is hereby granted, free of charge, to any person

+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:

+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *

+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.

+ */

arch/arm/boot/dts/sun7i-a20-wits-pro-a20-dkt.dts new file +21 -0
+
+/dts-v1/;
+#include "sun7i-a20.dtsi"
+#include "sunxi-common-regulators.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+
+/ {
+     model = "Wits Pro A20 DKT";
+     compatible = "wits,pro-a20-dkt", "allwinner,sun7i-a20";
+
+     aliases {
+             serial0 = &uart0;
+     };
+
+     chosen {
+             stdout-path = "serial0:115200n8";
+     };
+

arch/arm/boot/dts/sun7i-a20-wits-pro-a20-dkt.dts line 72

Quoted 10 lines
arch/arm/boot/dts/sun7i-a20-wits-pro-a20-dkt.dts new file +10 -0
+     reg_vmmc3: vmmc3 {
+             compatible = "regulator-fixed";
+             pinctrl-names = "default";
+             pinctrl-0 = <&vmmc3_pin_ap6xxx_wl_regon>;
+             regulator-name = "vmmc3";
+             regulator-min-microvolt = <3300000>;
+             regulator-max-microvolt = <3300000>;
+             enable-active-high;
+             gpio = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */
+     };

It's not really vmmc. The reg_on stuff is actually more of a reset
line: when tied to VCC, the WLAN part of the chip and its regulators are enabled, while when it's tied to ground, the WLAN is in reset, and the internal regulators disabled.

So it can be seen as either an active-low reset line, or an active-high regulator for the WiFi part, but VMMC is the power line of the MMC bus itself, which usually is provided by a regulator through the pin 22 of the AP6210, usually tied directly to the 3.3V line.

So you actually have two regulators here: one for vmmc (reg_3v3), and one for reg_on which is the one that you just defined.

Quoted 7 lines
Quoted 4 lines

Note that it's a bit of a pain for now to support such cases, as there's nothing to tie something from the DT to an SDIO device. I don't have a better solution than marking it always-on at the moment, with a big FIXME comment on top... :/

One could use the mmc-pwr-seq stuff.

Good idea, I've just written, tested and posted a patch for this for the cubietruck. I do not have access to the A20 Wits DKT atm, so I will post a new version of this patch with pwrseq support coming Tuesday when I have access to the board again.

Quoted 4 lines

I don't know if it has been

extended for multiple GPIOs, not that you would need it in this use case.

mmc-pwrseq-simple supports multiple reset/enable gpios (by listing them all as reset-gpios and setting GPIO_ACTIVE_LOW/HIGH depending on which value they need to be to activate things).

Quoted 6 lines

It also supports listing clocks which need to be enabled. I think that it may be a good idea to use this to also enable the bluetooth bits of the ap6210 module on the cubietruck. I know that the actual bt is interfaced over an uart, and we really should have a mechanism to enable/disable it separately, but for not this seems like a good way to get bluetooth to work.

It's worth a try. The bluetooth bits only require one GPIO line and the external clock. (This is mostly to ensure it powers on properly.) Though the ordering is important, too. I'll look into it.

Quoted 7 lines

We should ofcourse add a comment to the dts file that this is not a 100% ideal solution, but other then that I think this should work nicely. Maxime would enabling the bluetooth bits of this sdio module via mmc-pwrseq be acceptable to you?

ChenYu if Maxime acks this solution I hope you can write a patch for this, since you've been working on the bluetooth support before.

Sure. Might be for 4.4 though.

Quoted 5 lines
Quoted 2 lines

Maybe we ought to fix up the other ones, like the CubieTruck and A31 Hummingbird?

Ack, can you take care of the Hummingbird ? (I don't have one).

I'm off to bed for today. Only turned on my computer to answer some last minute questions from Maxime. :)

ChenYu

#15 lore raw

[linux-sunxi] Re: [PATCH 5/5] ARM: dts: sun7i: Add dts file for Wits Pro A20 DKT

In reply to Hans de Goede
Quoted 11 lines · Hans de Goede

mmc-pwrseq-simple supports multiple reset/enable gpios (by listing them all as reset-gpios and setting GPIO_ACTIVE_LOW/HIGH depending on which value they need to be to activate things).

It also supports listing clocks which need to be enabled. I think that it may be a good idea to use this to also enable the bluetooth bits of the ap6210 module on the cubietruck. I know that the actual bt is interfaced over an uart, and we really should have a mechanism to enable/disable it separately, but for not this seems like a good way to get bluetooth to work.

Quoted 4 lines

We should ofcourse add a comment to the dts file that this is not a 100% ideal solution, but other then that I think this should work nicely. Maxime would enabling the bluetooth bits of this sdio module via mmc-pwrseq be acceptable to you?

As long as we have some comment on top, yep.

Quoted 2 lines

ChenYu if Maxime acks this solution I hope you can write a patch for this, since you've been working on the bluetooth support before.

Note that I'm in holidays starting today. I plan on doing my pull-requests for 4.3 later today, and will probably not be able to merge any patches during the next two weeks, which mean that your mmc-power seq patch for the cubietruck was probably the last one I was merging for the 4.3 merge window.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150801/a03c54cf/attachment.sig>
#16 lore raw

[linux-sunxi] Re: [PATCH 5/5] ARM: dts: sun7i: Add dts file for Wits Pro A20 DKT

Hi,

Quoted 12 lines · Maxime Ripard
Quoted 11 lines · Hans de Goede

mmc-pwrseq-simple supports multiple reset/enable gpios (by listing them all as reset-gpios and setting GPIO_ACTIVE_LOW/HIGH depending on which value they need to be to activate things).

It also supports listing clocks which need to be enabled. I think that it may be a good idea to use this to also enable the bluetooth bits of the ap6210 module on the cubietruck. I know that the actual bt is interfaced over an uart, and we really should have a mechanism to enable/disable it separately, but for not this seems like a good way to get bluetooth to work.

Quoted 6 lines
Quoted 4 lines

We should ofcourse add a comment to the dts file that this is not a 100% ideal solution, but other then that I think this should work nicely. Maxime would enabling the bluetooth bits of this sdio module via mmc-pwrseq be acceptable to you?

As long as we have some comment on top, yep.

Great, thanks.

Quoted 8 lines
Quoted 2 lines

ChenYu if Maxime acks this solution I hope you can write a patch for this, since you've been working on the bluetooth support before.

Note that I'm in holidays starting today. I plan on doing my pull-requests for 4.3 later today, and will probably not be able to merge any patches during the next two weeks, which mean that your mmc-power seq patch for the cubietruck was probably the last one I was merging for the 4.3 merge window.

OK, that is good to know, thanks for the headsup and enjoy your hollidays.

Regards,

Hans

#17 lore raw

[linux-sunxi] Re: [PATCH 5/5] ARM: dts: sun7i: Add dts file for Wits Pro A20 DKT

In reply to Maxime Ripard

Hi,

Quoted 19 lines · Maxime Ripard
Quoted 11 lines · Hans de Goede

mmc-pwrseq-simple supports multiple reset/enable gpios (by listing them all as reset-gpios and setting GPIO_ACTIVE_LOW/HIGH depending on which value they need to be to activate things).

It also supports listing clocks which need to be enabled. I think that it may be a good idea to use this to also enable the bluetooth bits of the ap6210 module on the cubietruck. I know that the actual bt is interfaced over an uart, and we really should have a mechanism to enable/disable it separately, but for not this seems like a good way to get bluetooth to work.

Quoted 4 lines

We should ofcourse add a comment to the dts file that this is not a 100% ideal solution, but other then that I think this should work nicely. Maxime would enabling the bluetooth bits of this sdio module via mmc-pwrseq be acceptable to you?

As long as we have some comment on top, yep.

Quoted 8 lines
Quoted 2 lines

ChenYu if Maxime acks this solution I hope you can write a patch for this, since you've been working on the bluetooth support before.

Note that I'm in holidays starting today. I plan on doing my pull-requests for 4.3 later today, and will probably not be able to merge any patches during the next two weeks, which mean that your mmc-power seq patch for the cubietruck was probably the last one I was merging for the 4.3 merge window.

I just noticed that your last push to

https://git.kernel.org/cgit/linux/kernel/git/mripard/linux.git/log/?h=sunxi/for-next

Is not in your github sunxi-next branch, it would be good if you could merge the last changes there (when your back from your holliday).

Regards,

Hans

#18 lore raw

[linux-sunxi] Re: [PATCH 5/5] ARM: dts: sun7i: Add dts file for Wits Pro A20 DKT

In reply to Chen-Yu Tsai
Quoted 8 lines · Chen-Yu Tsai
Quoted 4 lines

Note that it's a bit of a pain for now to support such cases, as there's nothing to tie something from the DT to an SDIO device. I don't have a better solution than marking it always-on at the moment, with a big FIXME comment on top... :/

One could use the mmc-pwr-seq stuff. I don't know if it has been extended for multiple GPIOs, not that you would need it in this use case.

It doesn't really improve the situation. It doesn't handle the regulators, it doesn't allow the real driver to get its resources either, basically, it's just a hack.

Quoted 2 lines

Maybe we ought to fix up the other ones, like the CubieTruck and A31 Hummingbird?

I'll do it.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150731/f889f8e0/attachment.sig>
#19 lore raw

[linux-sunxi] Re: [PATCH 5/5] ARM: dts: sun7i: Add dts file for Wits Pro A20 DKT

Quoted 6 lines · Maxime Ripard
Quoted 5 lines · Chen-Yu Tsai
Quoted 4 lines

Note that it's a bit of a pain for now to support such cases, as there's nothing to tie something from the DT to an SDIO device. I don't have a better solution than marking it always-on at the moment, with a big FIXME comment on top... :/

Quoted 7 lines
Quoted 3 lines

One could use the mmc-pwr-seq stuff. I don't know if it has been extended for multiple GPIOs, not that you would need it in this use case.

It doesn't really improve the situation. It doesn't handle the regulators, it doesn't allow the real driver to get its resources either, basically, it's just a hack.

Yeah, it's still lacking support for upstream regulators, like LDOs from the PMICs.

Quoted 4 lines
Quoted 2 lines

Maybe we ought to fix up the other ones, like the CubieTruck and A31 Hummingbird?

I'll do it.

Thanks

ChenYu

#20 lore raw

[linux-sunxi] Re: [PATCH 5/5] ARM: dts: sun7i: Add dts file for Wits Pro A20 DKT

In reply to Maxime Ripard

Hi,

Quoted 6 lines · Maxime Ripard
Quoted 5 lines · Chen-Yu Tsai
Quoted 4 lines

Note that it's a bit of a pain for now to support such cases, as there's nothing to tie something from the DT to an SDIO device. I don't have a better solution than marking it always-on at the moment, with a big FIXME comment on top... :/

Quoted 6 lines
Quoted 3 lines

One could use the mmc-pwr-seq stuff. I don't know if it has been extended for multiple GPIOs, not that you would need it in this use case.

It doesn't really improve the situation. It doesn't handle the regulators,

The regulator(s) are already handled by the vmmc and vqmcc regulators of the mmc controller binding.

If more regulators are needed, we can easily extend mmc-pwrseq-simple to support them, or define a whole new powerseq driver.

Quoted 2 lines

it doesn't allow the real driver to get its resources either, basically, it's just a hack.

Not involving the real driver is by design really, the real driver cannot bind / have its probe function called until its sdio interface has been probed which is where the pwrseq driver comes in.

This also allows re-using existing sdio drivers without needing them to be aware of certain board perculiarities

If a special power on (or suspend) order is nescessary a custom pwrseq driver can be created for this, even one which is meant to work in tandem with a specific sdio device driver. The idea is that the device driver will ask the mmc core to powerdown the device for powersaving in certain cases (e.g. suspend) and then the mmc core will call into the powerseq driver.

Granted there may be more complex scenarios where thighter control over the resources is needed, but for now this seems to work really well and it is much better then the deadlock we had before were all solutions were shot down as not flexible enough.

Quoted 4 lines
Quoted 2 lines

Maybe we ought to fix up the other ones, like the CubieTruck and A31 Hummingbird?

I'll do it.

Thanks.

Regards,

Hans

#21 lore raw

[linux-sunxi] Re: [PATCH 5/5] ARM: dts: sun7i: Add dts file for Wits Pro A20 DKT

Quoted 13 lines · Hans de Goede

Hi,

Quoted 10 lines · Maxime Ripard
Quoted 8 lines · Chen-Yu Tsai
Quoted 4 lines

Note that it's a bit of a pain for now to support such cases, as there's nothing to tie something from the DT to an SDIO device. I don't have a better solution than marking it always-on at the moment, with a big FIXME comment on top... :/

One could use the mmc-pwr-seq stuff. I don't know if it has been extended for multiple GPIOs, not that you would need it in this use case.

Quoted 5 lines
Quoted 2 lines

It doesn't really improve the situation. It doesn't handle the regulators,

The regulator(s) are already handled by the vmmc and vqmcc regulators of the mmc controller binding.

Except that vmmc and vqmmc are regulators to power up the SD bus itself, not the chip at the other end.

Quoted 9 lines

If more regulators are needed, we can easily extend mmc-pwrseq-simple to support them, or define a whole new powerseq driver.

Quoted 2 lines

it doesn't allow the real driver to get its resources either, basically, it's just a hack.

Not involving the real driver is by design really, the real driver cannot bind / have its probe function called until its sdio interface has been probed which is where the pwrseq driver comes in.

Except that you might need to handle these resources later on, to shut down or change the voltage or current of its regulator, adjust a clock rate, whatever, which is clearly not possible right now. The only thing that it allows is to setup the resources we want beside the drivers back, even though he's the more knowledgeable about how to manage its resources.

And the fact that it doesn't enumerate until some resources have been enabled is not really an argument. Writing to memory-mapped devices without enabling the clocks or the power domain first generates aborts on some SoCs, yet the driver is still the one in charge of its resources.

Quoted 2 lines

This also allows re-using existing sdio drivers without needing them to be aware of certain board perculiarities

I don't really get what the board does here. reg-on, vbat and so on is this case are pins of the WiFi chip. It doesn't change from one board to another.

What does change is what these pins are tied to, but we do already have a way to abstract that for every devices. Only the SDIO devices seem to be special.

Quoted 6 lines

If a special power on (or suspend) order is nescessary a custom pwrseq driver can be created for this, even one which is meant to work in tandem with a specific sdio device driver. The idea is that the device driver will ask the mmc core to powerdown the device for powersaving in certain cases (e.g. suspend) and then the mmc core will call into the powerseq driver.

Which effectively duplicate the logic between the real driver and a power-seq one.

Quoted 4 lines

Granted there may be more complex scenarios where thighter control over the resources is needed, but for now this seems to work really well and it is much better then the deadlock we had before were all solutions were shot down as not flexible enough.

I know.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150801/5d0fab97/attachment.sig>