Skip to contentSkip to conversation

arm64: mvebu: Add support for A8K community board

PATCH New kostap at marvell.com 3 participants 18 messages Feb 8, 2017 – Mar 24, 2017

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

v3 cover arm64: mvebu: Add support for A8K community board

From: Konstantin Porotchkin <[email protected]>

This patch series adds initil support for A8K community board MACCHIATOBin manufactured by SolidRun. It should be applied on top of Stefan Roese patches adding support for SD/eMMC devices on Marvell A37x0/A80x0/A70x0 SoCs. The top level patch is called:
"arm64: mvebu: Enable SDHCI/MMC support for the db-88f7040/8040"
The default board DTS file is based on the original work of Rabeeh Khory from SolidRun.

Changes for v3:
- Remove bubt command fixes - thay were already merged to the master branch
- Moved the USB VBUS control from proprietary GPIO to a fixed regulator
- Added SD and eMMC entries to the DTS
- Aligned default configutration with Armada-8040-DB
- Rebased on top of master branch

Konstantin Porotchkin (5):
arm64: mvebu: gpio: Add GPIO nodes to A8K family devices
arm64: mvebu: dts: Add i2c1 pin definitions to CPM
mvebu: pcie: Add support for GPIO reset for PCIe device
mvebu: usb: xhci: Add VBUS regulator supply to the host driver
arm64: mvebu: Add default configuraton for MACCHIATOBin board

Rabeeh Khoury (1):
arm64: mvebu: dts: Add DTS file for MACCHIATOBin board

 arch/arm/dts/Makefile                             |   1 +
 arch/arm/dts/armada-7040.dtsi                     |   1 +
 arch/arm/dts/armada-8040-mcbin.dts                | 287 ++++++++++++++++++++++
 arch/arm/dts/armada-8040.dtsi                     |   1 +
 arch/arm/dts/armada-ap806.dtsi                    |   8 +
 arch/arm/dts/armada-cp110-master.dtsi             |  22 ++
 arch/arm/dts/armada-cp110-slave.dtsi              |  18 ++
 configs/mvebu_mcbin-88f8040_defconfig             |  65 +++++
 doc/device-tree-bindings/pci/armada8k-pcie.txt    |  49 ++++
 doc/device-tree-bindings/usb/marvell.xhci-usb.txt |  28 +++
 drivers/pci/pcie_dw_mvebu.c                       |  20 ++
 drivers/usb/host/xhci-mvebu.c                     |  31 +++
 12 files changed, 531 insertions(+)
 create mode 100644 arch/arm/dts/armada-8040-mcbin.dts
 create mode 100644 configs/mvebu_mcbin-88f8040_defconfig
 create mode 100644 doc/device-tree-bindings/pci/armada8k-pcie.txt
 create mode 100644 doc/device-tree-bindings/usb/marvell.xhci-usb.txt
Signature · 1 line
2.7.4
#1 lore raw

PATCH v3 1/6 arm64: mvebu: gpio: Add GPIO nodes to A8K family devices

From: Konstantin Porotchkin <[email protected]>

Add GPIO nodes to AP-806 and CP-110-master DTSI files.

Change-Id I05958698d460cb721b7d8683d34f74a5ea32532c
Cc Stefan Roese <[email protected]>
Cc Nadav Haklai <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Haim Boot <[email protected]>

---
Changes for v3:
- Rebase on top of master branch

 arch/arm/dts/armada-7040.dtsi         |  1 +
 arch/arm/dts/armada-8040.dtsi         |  1 +
 arch/arm/dts/armada-ap806.dtsi        |  8 ++++++++
 arch/arm/dts/armada-cp110-master.dtsi | 18 ++++++++++++++++++
 arch/arm/dts/armada-cp110-slave.dtsi  | 18 ++++++++++++++++++
 5 files changed, 46 insertions(+)
arch/arm/dts/armada-7040.dtsi +1 -0
index 78d995d..b5be0c4 100644
@@ -45,6 +45,7 @@
  * one CP110.
  */
 
+#include <dt-bindings/gpio/gpio.h>
 #include "armada-ap806-quad.dtsi"
 #include "armada-cp110-master.dtsi"
 
arch/arm/dts/armada-8040.dtsi +1 -0
index 9c1b28c..96cc112 100644
@@ -45,6 +45,7 @@
  * two CP110.
  */
 
+#include <dt-bindings/gpio/gpio.h>
 #include "armada-ap806-quad.dtsi"
 #include "armada-cp110-master.dtsi"
 #include "armada-cp110-slave.dtsi"
arch/arm/dts/armada-ap806.dtsi +8 -0
index 3042cb1..e0d3016 100644
@@ -158,6 +158,14 @@
 				};
 			};
 
+			ap_gpio0: gpio at 6F5040 {
+				compatible = "marvell,orion-gpio";
+				reg = <0x6F5040 0x40>;
+				ngpios = <20>;
+				gpio-controller;
+				#gpio-cells = <2>;
+			};
+
 			xor at 400000 {
 				compatible = "marvell,mv-xor-v2";
 				reg = <0x400000 0x1000>,
arch/arm/dts/armada-cp110-master.dtsi +18 -0
index 661a696..6095609 100644
@@ -113,6 +113,24 @@
 				};
 			};
 
+			cpm_gpio0: gpio at 440100 {
+				compatible = "marvell,orion-gpio";
+				reg = <0x440100 0x40>;
+				ngpios = <32>;
+				gpiobase = <20>;
+				gpio-controller;
+				#gpio-cells = <2>;
+			};
+
+			cpm_gpio1: gpio at 440140 {
+				compatible = "marvell,orion-gpio";
+				reg = <0x440140 0x40>;
+				ngpios = <31>;
+				gpiobase = <52>;
+				gpio-controller;
+				#gpio-cells = <2>;
+			};
+
 			cpm_sata0: sata at 540000 {
 				compatible = "marvell,armada-8k-ahci";
 				reg = <0x540000 0x30000>;
arch/arm/dts/armada-cp110-slave.dtsi +18 -0
index 92ef55c..ff3fbed 100644
@@ -100,6 +100,24 @@
 				};
 			};
 
+			cps_gpio0: gpio at 440100 {
+				compatible = "marvell,orion-gpio";
+				reg = <0x440100 0x40>;
+				ngpios = <32>;
+				gpiobase = <20>;
+				gpio-controller;
+				#gpio-cells = <2>;
+			};
+
+			cps_gpio1: gpio at 440140 {
+				compatible = "marvell,orion-gpio";
+				reg = <0x440140 0x40>;
+				ngpios = <31>;
+				gpiobase = <52>;
+				gpio-controller;
+				#gpio-cells = <2>;
+			};
+
 			cps_sata0: sata at 540000 {
 				compatible = "marvell,armada-8k-ahci";
 				reg = <0x540000 0x30000>;
Signature · 1 line
2.7.4
#3 lore raw

PATCH v3 2/6 arm64: mvebu: dts: Add i2c1 pin definitions to CPM

In reply to kostap at marvell.com

From: Konstantin Porotchkin <[email protected]>

Add i2c-1 pin mappings to CP0(master) DTSI file

Change-Id I0c6e6de8a557393f518f7df8e6daa6dfce1788b0
Cc Stefan Roese <[email protected]>
Cc Nadav Haklai <[email protected]>
Cc Neta Zur Hershkovits <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Haim Boot <[email protected]>

---
Changes for v3:
- Rebase on top of master branch

 arch/arm/dts/armada-cp110-master.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/dts/armada-cp110-master.dtsi +4 -0
index 6095609..1f0edde 100644
@@ -94,6 +94,10 @@
 					marvell,pins = < 37 38 >;
 					marvell,function = <2>;
 				};
+				cpm_i2c1_pins: cpm-i2c-pins-1 {
+					marvell,pins = < 35 36 >;
+					marvell,function = <2>;
+				};
 				cpm_ge2_rgmii_pins: cpm-ge-rgmii-pins-0 {
 					marvell,pins = < 44 45 46 47 48 49 50 51
 							 52 53 54 55 >;
Signature · 1 line
2.7.4
#4 lore raw

PATCH v3 3/6 mvebu: pcie: Add support for GPIO reset for PCIe device

In reply to kostap at marvell.com

From: Konstantin Porotchkin <[email protected]>

Add support for "marvell,reset-gpio" property to mvebu DW PCIe driver.
This option is valid when CONFIG_DM_GPIO=y

Change-Id Ic17c500449050c2fbb700731f1a9ca8b83298986
Cc Stefan Roese <[email protected]>
Cc Nadav Haklai <[email protected]>
Cc Neta Zur Hershkovits <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Haim Boot <[email protected]>

---
Changes for v3:
- Rebase on top of master branch

 doc/device-tree-bindings/pci/armada8k-pcie.txt | 49 ++++++++++++++++++++++++++
 drivers/pci/pcie_dw_mvebu.c                    | 20 +++++++++++
 2 files changed, 69 insertions(+)
 create mode 100644 doc/device-tree-bindings/pci/armada8k-pcie.txt
doc/device-tree-bindings/pci/armada8k-pcie.txt new file +49 -0
new file mode 100644
index 0000000..7230f10
@@ -0,0 +1,49 @@
+Armada-8K PCIe DT details:
+==========================
+
+Armada-8k uses synopsis designware PCIe controller.
+
+Required properties:
+- compatible : should be "marvell,armada8k-pcie", "snps,dw-pcie".
+- reg: base addresses and lengths of the pcie control and global control registers.
+ "ctrl" registers points to the global control registers, while the "config" space
+ points to the pcie configuration registers as mentioned in dw-pcie dt bindings in the link below.
+- interrupt-map-mask and interrupt-map, standard PCI properties to
+  define the mapping of the PCIe interface to interrupt numbers.
+- All other definitions as per generic PCI bindings
+See Linux kernel documentation:
+"Documentation/devicetree/bindings/pci/designware-pcie.txt"
+
+Optional properties:
+PHY support is still not supported for armada-8k, once it will, the following parameters can be used:
+- phys		    : phandle to phy node associated with pcie controller.
+- phy-names	    : must be "pcie-phy"
+- marvell,reset-gpio :  specifies a gpio that needs to be activated for plug-in
+			card reset signal release.
+Example:
+
+cpm_pcie0: pcie at f2600000 {
+	compatible = "marvell,armada8k-pcie", "snps,dw-pcie";
+	reg = <0 0xf2600000 0 0x10000>,
+	      <0 0xf6f00000 0 0x80000>;
+	reg-names = "ctrl", "config";
+	#address-cells = <3>;
+	#size-cells = <2>;
+	#interrupt-cells = <1>;
+	device_type = "pci";
+	dma-coherent;
+
+	bus-range = <0 0xff>;
+	ranges =
+		/* downstream I/O */
+		<0x81000000 0 0xf9000000 0  0xf9000000 0 0x10000
+		/* non-prefetchable memory */
+		0x82000000 0 0xf6000000 0  0xf6000000 0 0xf00000>;
+	interrupt-map-mask = <0 0 0 0>;
+	interrupt-map = <0 0 0 0 &gic 0 GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
+	interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
+	num-lanes = <1>;
+	clocks = <&cpm_syscon0 1 13>;
+	marvell,reset-gpio = <&cpm_gpio1 20 GPIO_ACTIVE_HIGH>;
+	status = "disabled";
+};
drivers/pci/pcie_dw_mvebu.c +20 -0
index 17fa024..d4776a9 100644
@@ -15,6 +15,7 @@
 #include <dm.h>
 #include <pci.h>
 #include <asm/io.h>
+#include <asm-generic/gpio.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -461,6 +462,25 @@ static int pcie_dw_mvebu_probe(struct udevice *dev)
 	struct pcie_dw_mvebu *pcie = dev_get_priv(dev);
 	struct udevice *ctlr = pci_get_controller(dev);
 	struct pci_controller *hose = dev_get_uclass_priv(ctlr);
+#ifdef CONFIG_DM_GPIO
+	struct gpio_desc reset_gpio;
+
+	gpio_request_by_name(dev, "marvell,reset-gpio", 0, &reset_gpio,
+			     GPIOD_IS_OUT);
+	/*
+	 * Issue reset to add-in card trough the dedicated GPIO.
+	 * Some boards are connecting the card reset pin to common system
+	 * reset wire and others are using separate GPIO port.
+	 * In the last case we have to release a reset of the addon card
+	 * using this GPIO.
+	 */
+	if (dm_gpio_is_valid(&reset_gpio)) {
+		dm_gpio_set_value(&reset_gpio, 1);
+		mdelay(200);
+	}
+#else
+	debug("PCIE Reset on GPIO support is missing\n");
+#endif /* CONFIG_DM_GPIO */
 
 	pcie->first_busno = dev->seq;
 
Signature · 1 line
2.7.4
#5 lore raw

PATCH v3 4/6 mvebu: usb: xhci: Add VBUS regulator supply to the host driver

In reply to kostap at marvell.com

From: Konstantin Porotchkin <[email protected]>

The USB device should linked to VBUS regulator through "vbus-supply" DTS property.
This patch adds handling for "vbus-supply" property inside the USB device entry for turning on the VBUS regulator upon the host adapter probe.

Change-Id Ibcf72d82298be42353ca03fee064ae8077a7b9de
Cc Stefan Roese <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Nadav Haklai <[email protected]>
Cc Neta Zur Hershkovits <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Haim Boot <[email protected]>

---
Changes for v3:
- Moved VBUS control from private GPIO to a fixed regulator
- Rebase on top of master branch

 doc/device-tree-bindings/usb/marvell.xhci-usb.txt | 28 ++++++++++++++++++++
 drivers/usb/host/xhci-mvebu.c                     | 31 +++++++++++++++++++++++
 2 files changed, 59 insertions(+)
 create mode 100644 doc/device-tree-bindings/usb/marvell.xhci-usb.txt
doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +28 -0
new file mode 100644
index 0000000..672a829
@@ -0,0 +1,28 @@
+Marvell SOC USB controllers
+
+This controller is integrated in Armada 3700/8K.
+It uses the same properties as a generic XHCI host controller
+
+Required properties :
+ - compatible: should be one or more of:
+   - "marvell,armada3700-xhci", "generic-xhci" for Armada 37xx SoCs
+   - "marvell,armada-8k-xhci", "generic-xhci" for Armada A8K SoCs
+ - reg: should contain address and length of the standard XHCI
+   register set for the device.
+ - interrupts: one XHCI interrupt should be described here.
+
+Optional properties:
+ - clocks: reference to a clock
+ - vbus-supply : If present, specifies the fixed regulator to be turned on
+   for providing power to the USB VBUS rail.
+
+Example:
+	cpm_usb3_0: usb3 at 500000 {
+		compatible = "marvell,armada-8k-xhci",
+			     "generic-xhci";
+		reg = <0x500000 0x4000>;
+		interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&cpm_syscon0 1 22>;
+		vbus-supply = <&reg_usb3h0_vbus>;
+		status = "disabled";
+	};
drivers/usb/host/xhci-mvebu.c +31 -0
index 46eb937..149f6a4 100644
@@ -45,7 +45,38 @@ static int xhci_usb_probe(struct udevice *dev)
 	struct mvebu_xhci *ctx = dev_get_priv(dev);
 	struct xhci_hcor *hcor;
 	int len;
+#ifdef CONFIG_DM_REGULATOR_FIXED
+	const void *fdt = gd->fdt_blob;
+	int node = dev->of_offset;
+	const fdt32_t *regulator;
+	int size;
 
+	/*
+	 * The VBUS supply regulator is not probed automatically
+	 * Trigger the regulator probe upon USB port bring up
+	 */
+	regulator = fdt_getprop(fdt, node, "vbus-supply", &size);
+	if (regulator) {
+		uint32_t phandle;
+		struct udevice *config;
+		int reg_node, ret;
+
+		phandle = fdt32_to_cpu(*regulator);
+		reg_node = fdt_node_offset_by_phandle(fdt, phandle);
+		if (reg_node < 0) {
+			dev_err(dev, "vbus-supply has invalid phandle\n");
+			return -EINVAL;
+		}
+		ret = uclass_get_device_by_of_offset(UCLASS_REGULATOR,
+						     reg_node, &config);
+		if (ret) {
+			dev_err(dev, "failed to get VBUS regulator device\n");
+			return ret;
+		}
+	}
+#else
+	debug("VBUS regulator support is missing\n");
+#endif
 	ctx->hcd = (struct xhci_hccr *)plat->hcd_base;
 	len = HC_LENGTH(xhci_readl(&ctx->hcd->cr_capbase));
 	hcor = (struct xhci_hcor *)((uintptr_t)ctx->hcd + len);
Signature · 1 line
2.7.4
#16 lore raw

PATCH v3 5/6 arm64: mvebu: dts: Add DTS file for MACCHIATOBin board

In reply to kostap at marvell.com

From: Rabeeh Khoury <[email protected]>

Added A8040 dts file for community board MACCHIATIBin. The patch includes the following features:
AP - Serial console (connected to onboard FTDI usb to serial) CP0 - PCIe x4, SATA, I2C and 10G KR
(connected to Marvell 3310 10G copper / SFP+ phy)
CP1 - Boot SPI, USB3 host, 2xSATA, 10G KR
(connected to Marvell 3310 10G copper / SFP+ phy), SGMII connected to onboard 1512 1Gbps copper phy, and additional SGMII connected to SFP
(default 1Gbps can be configured to 2.5Gbps).

Network interface naming -
egiga0 - CP0 KR
egiga1 - CP1 KR
egiga2 - CP1 RJ45 1Gbps connector (recommended for TFTP boot) egiga3 - CP1 SFP default 1Gbps and can be modified to 2.5Gbps

Cc Stefan Roese <[email protected]>
Cc Nadav Haklai <[email protected]>
Cc Neta Zur Hershkovits <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Haim Boot <[email protected]>

---
Changes for v3:
- Add SD and eMMC entries
- Rebase on top of master branch

 arch/arm/dts/Makefile              |   1 +
 arch/arm/dts/armada-8040-mcbin.dts | 287 +++++++++++++++++++++++++++++++++++++
 2 files changed, 288 insertions(+)
 create mode 100644 arch/arm/dts/armada-8040-mcbin.dts
arch/arm/dts/Makefile +1 -0
index 397a0ae..a3b139b 100644
@@ -76,6 +76,7 @@ dtb-$(CONFIG_ARCH_MVEBU) +=			\
 	armada-385-amc.dtb			\
 	armada-7040-db.dtb			\
 	armada-8040-db.dtb			\
+	armada-8040-mcbin.dtb			\
 	armada-xp-gp.dtb			\
 	armada-xp-maxbcm.dtb			\
 	armada-xp-synology-ds414.dtb		\
arch/arm/dts/armada-8040-mcbin.dts new file +287 -0

287 lines not on this page · raw message

Signature · 1 line
2.7.4
#17 lore raw

PATCH v3 6/6 arm64: mvebu: Add default configuraton for MACCHIATOBin board

In reply to kostap at marvell.com

From: Konstantin Porotchkin <[email protected]>

Add default configuration for MACHHIATOBin community board based on Aramda-8040 SoC.
This config has MMC support removed, pending mainline support.

Change-Id Ic6b562065c0929ec338492452f765115c15a6188
Cc Stefan Roese <[email protected]>
Cc Nadav Haklai <[email protected]>
Cc Neta Zur Hershkovits <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Haim Boot <[email protected]>

---
Changes for v3:
- Align the configuration with Armada-8040-DB
- Rebase on top of master branch

 configs/mvebu_mcbin-88f8040_defconfig | 65 +++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 configs/mvebu_mcbin-88f8040_defconfig
configs/mvebu_mcbin-88f8040_defconfig new file +65 -0
new file mode 100644
index 0000000..000e400
@@ -0,0 +1,65 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MVEBU=y
+CONFIG_SYS_MALLOC_F_LEN=0x2000
+CONFIG_TARGET_MVEBU_ARMADA_8K=y
+CONFIG_DEFAULT_DEVICE_TREE="armada-8040-mcbin"
+CONFIG_SMBIOS_PRODUCT_NAME=""
+CONFIG_AHCI=y
+# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
+CONFIG_SYS_CONSOLE_INFO_QUIET=y
+# CONFIG_DISPLAY_CPUINFO is not set
+# CONFIG_DISPLAY_BOARDINFO is not set
+CONFIG_HUSH_PARSER=y
+# CONFIG_CMD_IMLS is not set
+# CONFIG_CMD_FLASH is not set
+CONFIG_CMD_SF=y
+CONFIG_CMD_SPI=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_USB=y
+# CONFIG_CMD_FPGA is not set
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_TFTPPUT=y
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_TIME=y
+CONFIG_CMD_MVEBU_BUBT=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_REGULATOR=y
+CONFIG_BLOCK_CACHE=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_MVTWSI=y
+CONFIG_DM_GPIO=y
+CONFIG_MVEBU_GPIO=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_MISC=y
+CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_MACRONIX=y
+CONFIG_SPI_FLASH_SPANSION=y
+CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_PHYLIB=y
+CONFIG_PCI=y
+CONFIG_DM_PCI=y
+CONFIG_PCIE_DW_MVEBU=y
+CONFIG_MVEBU_COMPHY_SUPPORT=y
+CONFIG_PINCTRL=y
+# CONFIG_SPL_SERIAL_PRESENT is not set
+CONFIG_DEBUG_UART=y
+CONFIG_DEBUG_UART_BASE=0xf0512000
+CONFIG_DEBUG_UART_CLOCK=200000000
+CONFIG_DEBUG_UART_SHIFT=2
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_SYS_NS16550=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_STORAGE=y
+CONFIG_SMBIOS_MANUFACTURER=""
Signature · 1 line
2.7.4
#6 lore raw

PATCH v3 4/6 mvebu: usb: xhci: Add VBUS regulator supply to the host driver

In reply to kostap at marvell.com
Quoted 37 lines · kostap at marvell.com

From: Konstantin Porotchkin <[email protected]>

The USB device should linked to VBUS regulator through "vbus-supply" DTS property.
This patch adds handling for "vbus-supply" property inside the USB device entry for turning on the VBUS regulator upon the host adapter probe.

Change-Id Ibcf72d82298be42353ca03fee064ae8077a7b9de
Cc Stefan Roese <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Nadav Haklai <[email protected]>
Cc Neta Zur Hershkovits <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Haim Boot <[email protected]>

---
Changes for v3:
- Moved VBUS control from private GPIO to a fixed regulator
- Rebase on top of master branch

 doc/device-tree-bindings/usb/marvell.xhci-usb.txt | 28 ++++++++++++++++++++
 drivers/usb/host/xhci-mvebu.c                     | 31 +++++++++++++++++++++++
 2 files changed, 59 insertions(+)
 create mode 100644 doc/device-tree-bindings/usb/marvell.xhci-usb.txt
doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +5 -0
new file mode 100644
index 0000000..672a829
@@ -0,0 +1,28 @@
+Marvell SOC USB controllers
+
+This controller is integrated in Armada 3700/8K.
+It uses the same properties as a generic XHCI host controller
+

doc/device-tree-bindings/usb/marvell.xhci-usb.txt line 15

Quoted 10 lines
doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +10 -0
+Required properties :
+ - compatible: should be one or more of:
+   - "marvell,armada3700-xhci", "generic-xhci" for Armada 37xx SoCs
+   - "marvell,armada-8k-xhci", "generic-xhci" for Armada A8K SoCs
+ - reg: should contain address and length of the standard XHCI
+   register set for the device.
+ - interrupts: one XHCI interrupt should be described here.
+
+Optional properties:
+ - clocks: reference to a clock

What clock ? Why are clock optional ?
This probably needs clock-names too.

Quoted 18 lines
doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +13 -0
+ - vbus-supply : If present, specifies the fixed regulator to be turned on
+   for providing power to the USB VBUS rail.
+
+Example:
+	cpm_usb3_0: usb3 at 500000 {
+		compatible = "marvell,armada-8k-xhci",
+			     "generic-xhci";
+		reg = <0x500000 0x4000>;
+		interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&cpm_syscon0 1 22>;
+		vbus-supply = <&reg_usb3h0_vbus>;
+		status = "disabled";
+	};
drivers/usb/host/xhci-mvebu.c +0 -0
index 46eb937..149f6a4 100644

drivers/usb/host/xhci-mvebu.c static int xhci_usb_probe(struct udevice *dev) · line 48

Quoted 4 lines
drivers/usb/host/xhci-mvebu.c +1 -0
@@ -45,7 +45,38 @@ static int xhci_usb_probe(struct udevice *dev)
 	struct mvebu_xhci *ctx = dev_get_priv(dev);
 	struct xhci_hcor *hcor;
 	int len;
+#ifdef CONFIG_DM_REGULATOR_FIXED

Just make the driver depend on REGULATOR_FIXED

Quoted 16 lines
drivers/usb/host/xhci-mvebu.c +15 -0
+	const void *fdt = gd->fdt_blob;
+	int node = dev->of_offset;
+	const fdt32_t *regulator;
+	int size;
 
+	/*
+	 * The VBUS supply regulator is not probed automatically
+	 * Trigger the regulator probe upon USB port bring up
+	 */
+	regulator = fdt_getprop(fdt, node, "vbus-supply", &size);
+	if (regulator) {
+		uint32_t phandle;
+		struct udevice *config;
+		int reg_node, ret;
+
+		phandle = fdt32_to_cpu(*regulator);

drivers/usb/host/xhci-mvebu.c static int xhci_usb_probe(struct udevice *dev) · line 74

Quoted 10 lines
drivers/usb/host/xhci-mvebu.c +10 -0
+		reg_node = fdt_node_offset_by_phandle(fdt, phandle);
+		if (reg_node < 0) {
+			dev_err(dev, "vbus-supply has invalid phandle\n");
+			return -EINVAL;
+		}
+		ret = uclass_get_device_by_of_offset(UCLASS_REGULATOR,
+						     reg_node, &config);
+		if (ret) {
+			dev_err(dev, "failed to get VBUS regulator device\n");
+			return ret;

Where is the regulator enabled ?

Quoted 9 lines
drivers/usb/host/xhci-mvebu.c +5 -0
+		}
+	}
+#else
+	debug("VBUS regulator support is missing\n");
+#endif
 	ctx->hcd = (struct xhci_hccr *)plat->hcd_base;
 	len = HC_LENGTH(xhci_readl(&ctx->hcd->cr_capbase));
 	hcor = (struct xhci_hcor *)((uintptr_t)ctx->hcd + len);
Signature · 2 lines
Best regards,
Marek Vasut
#7 lore raw

PATCH v3 4/6 mvebu: usb: xhci: Add VBUS regulator supply to the host driver

Hi, Marek,

Quoted 43 lines · Marek Vasut
Quoted 42 lines · kostap at marvell.com

From: Konstantin Porotchkin <[email protected]>

The USB device should linked to VBUS regulator through "vbus-supply" DTS property.
This patch adds handling for "vbus-supply" property inside the USB device entry for turning on the VBUS regulator upon the host adapter probe.

Change-Id Ibcf72d82298be42353ca03fee064ae8077a7b9de
Cc Stefan Roese <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Nadav Haklai <[email protected]>
Cc Neta Zur Hershkovits <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Haim Boot <[email protected]>

---
Changes for v3:
- Moved VBUS control from private GPIO to a fixed regulator
- Rebase on top of master branch

 doc/device-tree-bindings/usb/marvell.xhci-usb.txt | 28 ++++++++++++++++++++
 drivers/usb/host/xhci-mvebu.c                     | 31 +++++++++++++++++++++++
 2 files changed, 59 insertions(+)
 create mode 100644 doc/device-tree-bindings/usb/marvell.xhci-usb.txt
doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +10 -0
new file mode 100644
index 0000000..672a829
@@ -0,0 +1,28 @@
+Marvell SOC USB controllers
+
+This controller is integrated in Armada 3700/8K.
+It uses the same properties as a generic XHCI host controller
+
+Required properties :
+ - compatible: should be one or more of:
+   - "marvell,armada3700-xhci", "generic-xhci" for Armada 37xx SoCs
+   - "marvell,armada-8k-xhci", "generic-xhci" for Armada A8K SoCs
+ - reg: should contain address and length of the standard XHCI
Quoted 8 lines

doc/device-tree-bindings/usb/marvell.xhci-usb.txt line 15

Quoted 5 lines
doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +5 -0
+   register set for the device.
+ - interrupts: one XHCI interrupt should be described here.
+
+Optional properties:
+ - clocks: reference to a clock

What clock ? Why are clock optional ?
This probably needs clock-names too.

This is the way it defined in Linux Kernel.
I took the Documentation/devicetree/bindings/usb/usb-xhci.txt file as a base for my add-on

Quoted 17 lines
Quoted 17 lines
doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +13 -0
+ - vbus-supply : If present, specifies the fixed regulator to be turned on
+   for providing power to the USB VBUS rail.
+
+Example:
+    cpm_usb3_0: usb3 at 500000 {
+        compatible = "marvell,armada-8k-xhci",
+                 "generic-xhci";
+        reg = <0x500000 0x4000>;
+        interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&cpm_syscon0 1 22>;
+        vbus-supply = <&reg_usb3h0_vbus>;
+        status = "disabled";
+    };
drivers/usb/host/xhci-mvebu.c +0 -1
index 46eb937..149f6a4 100644
--- a/drivers/usb/host/xhci-mvebu.c
Quoted 8 lines

drivers/usb/host/xhci-mvebu.c static int xhci_usb_probe(struct udevice *dev) · line 48

Quoted 6 lines

+++ b/drivers/usb/host/xhci-mvebu.c

drivers/usb/host/xhci-mvebu.c +1 -0
@@ -45,7 +45,38 @@ static int xhci_usb_probe(struct udevice *dev)
     struct mvebu_xhci *ctx = dev_get_priv(dev);
     struct xhci_hcor *hcor;
     int len;
+#ifdef CONFIG_DM_REGULATOR_FIXED

Just make the driver depend on REGULATOR_FIXED

I think the driver can work without regulator if the VBUS rail wired to the 5V power line. We only need regulator support if this is GPIO controlled

Quoted 28 lines
Quoted 17 lines
drivers/usb/host/xhci-mvebu.c +15 -0
+    const void *fdt = gd->fdt_blob;
+    int node = dev->of_offset;
+    const fdt32_t *regulator;
+    int size;
 
+    /*
+     * The VBUS supply regulator is not probed automatically
+     * Trigger the regulator probe upon USB port bring up
+     */
+    regulator = fdt_getprop(fdt, node, "vbus-supply", &size);
+    if (regulator) {
+        uint32_t phandle;
+        struct udevice *config;
+        int reg_node, ret;
+
+        phandle = fdt32_to_cpu(*regulator);

drivers/usb/host/xhci-mvebu.c static int xhci_usb_probe(struct udevice *dev) · line 74

Quoted 10 lines
drivers/usb/host/xhci-mvebu.c +10 -0
+        reg_node = fdt_node_offset_by_phandle(fdt, phandle);
+        if (reg_node < 0) {
+            dev_err(dev, "vbus-supply has invalid phandle\n");
+            return -EINVAL;
+        }
+        ret = uclass_get_device_by_of_offset(UCLASS_REGULATOR,
+                             reg_node, &config);
+        if (ret) {
+            dev_err(dev, "failed to get VBUS regulator device\n");
+            return ret;
Quoted 1 line

Where is the regulator enabled ?

The regulator is fixed and it is "always-on", so assumed it is enough to probe it. I have found that once it probed, the USB device becomes powered.

Quoted 12 lines
Quoted 10 lines
drivers/usb/host/xhci-mvebu.c +5 -0
+        }
+    }
+#else
+    debug("VBUS regulator support is missing\n");
+#endif
     ctx->hcd = (struct xhci_hccr *)plat->hcd_base;
     len = HC_LENGTH(xhci_readl(&ctx->hcd->cr_capbase));
     hcor = (struct xhci_hcor *)((uintptr_t)ctx->hcd + len);
#8 lore raw

PATCH v3 4/6 mvebu: usb: xhci: Add VBUS regulator supply to the host driver

Quoted 58 lines · Konstantin Porotchkin

Hi, Marek,

Quoted 47 lines · Marek Vasut
Quoted 6 lines · kostap at marvell.com

From: Konstantin Porotchkin <[email protected]>

The USB device should linked to VBUS regulator through "vbus-supply" DTS property.
This patch adds handling for "vbus-supply" property inside the USB device entry for turning on the VBUS regulator upon the host adapter

probe.

Quoted 9 lines
Change-Id Ibcf72d82298be42353ca03fee064ae8077a7b9de
Cc Stefan Roese <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Nadav Haklai <[email protected]>
Cc Neta Zur Hershkovits <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Haim Boot <[email protected]>
Quoted 7 lines

---
Changes for v3:
- Moved VBUS control from private GPIO to a fixed regulator
- Rebase on top of master branch

 doc/device-tree-bindings/usb/marvell.xhci-usb.txt | 28

++++++++++++++++++++

Quoted 1 line
 drivers/usb/host/xhci-mvebu.c                     | 31

+++++++++++++++++++++++

Review

Quoted 4 lines
 2 files changed, 59 insertions(+)
 create mode 100644 doc/device-tree-bindings/usb/marvell.xhci-usb.txt
(quoted diff) +0 -0

b/doc/device-tree-bindings/usb/marvell.xhci-usb.txt

Quoted 15 lines

new file mode 100644
index 0000000..672a829

doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +10 -0
@@ -0,0 +1,28 @@
+Marvell SOC USB controllers
+
+This controller is integrated in Armada 3700/8K.
+It uses the same properties as a generic XHCI host controller
+
+Required properties :
+ - compatible: should be one or more of:
+   - "marvell,armada3700-xhci", "generic-xhci" for Armada 37xx SoCs
+   - "marvell,armada-8k-xhci", "generic-xhci" for Armada A8K SoCs
+ - reg: should contain address and length of the standard XHCI
Quoted 8 lines

doc/device-tree-bindings/usb/marvell.xhci-usb.txt line 15

Quoted 5 lines
doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +5 -0
+   register set for the device.
+ - interrupts: one XHCI interrupt should be described here.
+
+Optional properties:
+ - clocks: reference to a clock

What clock ? Why are clock optional ?
This probably needs clock-names too.

Quoted 1 line

This is the way it defined in Linux Kernel.

Then it probably could use fixing there too. Like seriously, what clock are those ? And why are they optional ? If neither you or me understand that from the documentation, then the documentation is crap and needs fixing. It being the same way in Linux is not an argument for sticking to it.

Quoted 29 lines

I took the Documentation/devicetree/bindings/usb/usb-xhci.txt file as a base for my add-on

Quoted 17 lines

doc/device-tree-bindings/usb/marvell.xhci-usb.txt line 16

Quoted 2 lines
doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +1 -0
+ - vbus-supply : If present, specifies the fixed regulator to be

turned on

Review

Quoted 13 lines
doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +12 -0
+   for providing power to the USB VBUS rail.
+
+Example:
+    cpm_usb3_0: usb3 at 500000 {
+        compatible = "marvell,armada-8k-xhci",
+                 "generic-xhci";
+        reg = <0x500000 0x4000>;
+        interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&cpm_syscon0 1 22>;
+        vbus-supply = <&reg_usb3h0_vbus>;
+        status = "disabled";
+    };
(quoted diff) +0 -0

b/drivers/usb/host/xhci-mvebu.c

Quoted 10 lines

drivers/usb/host/xhci-mvebu.c static int xhci_usb_probe(struct udevice *dev) · line 48

Quoted 8 lines

index 46eb937..149f6a4 100644

drivers/usb/host/xhci-mvebu.c +1 -0
@@ -45,7 +45,38 @@ static int xhci_usb_probe(struct udevice *dev)
     struct mvebu_xhci *ctx = dev_get_priv(dev);
     struct xhci_hcor *hcor;
     int len;
+#ifdef CONFIG_DM_REGULATOR_FIXED

Just make the driver depend on REGULATOR_FIXED

Quoted 3 lines

I think the driver can work without regulator if the VBUS rail wired to the 5V power line.
We only need regulator support if this is GPIO controlled

In that case, the regulator won't be found and the driver will ignore it. Btw I think that violates the USB spec ;-)

Quoted 10 lines
Quoted 10 lines

drivers/usb/host/xhci-mvebu.c static int xhci_usb_probe(struct udevice *dev) · line 58

Quoted 10 lines
drivers/usb/host/xhci-mvebu.c +9 -0
+    const void *fdt = gd->fdt_blob;
+    int node = dev->of_offset;
+    const fdt32_t *regulator;
+    int size;
 
+    /*
+     * The VBUS supply regulator is not probed automatically
+     * Trigger the regulator probe upon USB port bring up
+     */
+    regulator = fdt_getprop(fdt, node, "vbus-supply", &size);

I think this should use regulator_*() calls from
include/power/regulator.h

Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
drivers/usb/host/xhci-mvebu.c +16 -0
+    if (regulator) {
+        uint32_t phandle;
+        struct udevice *config;
+        int reg_node, ret;
+
+        phandle = fdt32_to_cpu(*regulator);
+        reg_node = fdt_node_offset_by_phandle(fdt, phandle);
+        if (reg_node < 0) {
+            dev_err(dev, "vbus-supply has invalid phandle\n");
+            return -EINVAL;
+        }
+        ret = uclass_get_device_by_of_offset(UCLASS_REGULATOR,
+                             reg_node, &config);
+        if (ret) {
+            dev_err(dev, "failed to get VBUS regulator device\n");
+            return ret;
Quoted 4 lines
Quoted 1 line

Where is the regulator enabled ?

The regulator is fixed and it is "always-on", so assumed it is enough to probe it.
I have found that once it probed, the USB device becomes powered.

And once someone attaches a different regulator than fixed, this will break :)

Quoted 12 lines
Quoted 11 lines
Quoted 9 lines
drivers/usb/host/xhci-mvebu.c +5 -0
+        }
+    }
+#else
+    debug("VBUS regulator support is missing\n");
+#endif
     ctx->hcd = (struct xhci_hccr *)plat->hcd_base;
     len = HC_LENGTH(xhci_readl(&ctx->hcd->cr_capbase));
     hcor = (struct xhci_hcor *)((uintptr_t)ctx->hcd + len);
Signature · 2 lines
Best regards,
Marek Vasut
#9 lore raw

PATCH v3 4/6 mvebu: usb: xhci: Add VBUS regulator supply to the host driver

Hi, Marek,

Quoted 59 lines · Marek Vasut
Quoted 58 lines · Konstantin Porotchkin

Hi, Marek,

Quoted 55 lines · Marek Vasut
Quoted 6 lines · kostap at marvell.com

From: Konstantin Porotchkin <[email protected]>

The USB device should linked to VBUS regulator through "vbus-supply" DTS property.
This patch adds handling for "vbus-supply" property inside the USB device entry for turning on the VBUS regulator upon the host adapter

probe.

Quoted 9 lines
Change-Id Ibcf72d82298be42353ca03fee064ae8077a7b9de
Cc Stefan Roese <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Nadav Haklai <[email protected]>
Cc Neta Zur Hershkovits <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Haim Boot <[email protected]>
Quoted 7 lines

---
Changes for v3:
- Moved VBUS control from private GPIO to a fixed regulator
- Rebase on top of master branch

 doc/device-tree-bindings/usb/marvell.xhci-usb.txt | 28

++++++++++++++++++++

Quoted 1 line
 drivers/usb/host/xhci-mvebu.c                     | 31

+++++++++++++++++++++++

Review

Quoted 4 lines
 2 files changed, 59 insertions(+)
 create mode 100644 doc/device-tree-bindings/usb/marvell.xhci-usb.txt
(quoted diff) +0 -0

b/doc/device-tree-bindings/usb/marvell.xhci-usb.txt

Quoted 10 lines

new file mode 100644
index 0000000..672a829

doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +5 -0
@@ -0,0 +1,28 @@
+Marvell SOC USB controllers
+
+This controller is integrated in Armada 3700/8K.
+It uses the same properties as a generic XHCI host controller
+

doc/device-tree-bindings/usb/marvell.xhci-usb.txt line 15

Quoted 10 lines
doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +10 -0
+Required properties :
+ - compatible: should be one or more of:
+   - "marvell,armada3700-xhci", "generic-xhci" for Armada 37xx SoCs
+   - "marvell,armada-8k-xhci", "generic-xhci" for Armada A8K SoCs
+ - reg: should contain address and length of the standard XHCI
+   register set for the device.
+ - interrupts: one XHCI interrupt should be described here.
+
+Optional properties:
+ - clocks: reference to a clock

What clock ? Why are clock optional ?
This probably needs clock-names too.

Quoted 7 lines
Quoted 1 line

This is the way it defined in Linux Kernel.

Then it probably could use fixing there too. Like seriously, what clock are those ? And why are they optional ? If neither you or me understand that from the documentation, then the documentation is crap and needs fixing. It being the same way in Linux is not an argument for sticking to it.

From my point of view this clock entry is optional too.
I am not handling it in any way and the core XHCI driver doesn't uses it. Should I simply remove this property from the text file?

Quoted 30 lines
Quoted 30 lines

I took the Documentation/devicetree/bindings/usb/usb-xhci.txt file as a base for my add-on

Quoted 27 lines

doc/device-tree-bindings/usb/marvell.xhci-usb.txt line 16

Quoted 2 lines
doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +1 -0
+ - vbus-supply : If present, specifies the fixed regulator to be

turned on

Review

Quoted 13 lines
doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +12 -0
+   for providing power to the USB VBUS rail.
+
+Example:
+    cpm_usb3_0: usb3 at 500000 {
+        compatible = "marvell,armada-8k-xhci",
+                 "generic-xhci";
+        reg = <0x500000 0x4000>;
+        interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&cpm_syscon0 1 22>;
+        vbus-supply = <&reg_usb3h0_vbus>;
+        status = "disabled";
+    };
(quoted diff) +0 -0

b/drivers/usb/host/xhci-mvebu.c

drivers/usb/host/xhci-mvebu.c static int xhci_usb_probe(struct udevice *dev) · line 48

Quoted 8 lines

index 46eb937..149f6a4 100644

drivers/usb/host/xhci-mvebu.c +1 -0
@@ -45,7 +45,38 @@ static int xhci_usb_probe(struct udevice *dev)
     struct mvebu_xhci *ctx = dev_get_priv(dev);
     struct xhci_hcor *hcor;
     int len;
+#ifdef CONFIG_DM_REGULATOR_FIXED

Just make the driver depend on REGULATOR_FIXED

Quoted 7 lines
Quoted 3 lines

I think the driver can work without regulator if the VBUS rail wired to the 5V power line.
We only need regulator support if this is GPIO controlled

In that case, the regulator won't be found and the driver will ignore it. Btw I think that violates the USB spec ;-)

Currently the armada-8040-DB/armada-7040-DB boards use i2c connected VBUS enable control. If I made this driver depend on REGULATOR_FIXED, it will not work for these boards. They do not have regulator support enabled so far.
I do not want to break another systems by adding support for this board.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/usb/host/xhci-mvebu.c +4 -0
+    const void *fdt = gd->fdt_blob;
+    int node = dev->of_offset;
+    const fdt32_t *regulator;
+    int size;
 
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

drivers/usb/host/xhci-mvebu.c static int xhci_usb_probe(struct udevice *dev) · line 58

Quoted 5 lines
drivers/usb/host/xhci-mvebu.c +5 -0
+    /*
+     * The VBUS supply regulator is not probed automatically
+     * Trigger the regulator probe upon USB port bring up
+     */
+    regulator = fdt_getprop(fdt, node, "vbus-supply", &size);

I think this should use regulator_*() calls from
include/power/regulator.h

I can call regulator_set_enable() at the end, but I have to locate it first and get the udev for it.
However it will be enabled already at the time I will call this function.

Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
drivers/usb/host/xhci-mvebu.c +16 -0
+    if (regulator) {
+        uint32_t phandle;
+        struct udevice *config;
+        int reg_node, ret;
+
+        phandle = fdt32_to_cpu(*regulator);
+        reg_node = fdt_node_offset_by_phandle(fdt, phandle);
+        if (reg_node < 0) {
+            dev_err(dev, "vbus-supply has invalid phandle\n");
+            return -EINVAL;
+        }
+        ret = uclass_get_device_by_of_offset(UCLASS_REGULATOR,
+                             reg_node, &config);
+        if (ret) {
+            dev_err(dev, "failed to get VBUS regulator device\n");
+            return ret;
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Where is the regulator enabled ?

The regulator is fixed and it is "always-on", so assumed it is enough to probe it.
I have found that once it probed, the USB device becomes powered.

And once someone attaches a different regulator than fixed, this will break :)

What other type of regulators can be used for powering on the USB port? I believe they are always 5V fixed, are they?

Quoted 15 lines
Quoted 13 lines
Quoted 12 lines
Quoted 10 lines
drivers/usb/host/xhci-mvebu.c +5 -0
+        }
+    }
+#else
+    debug("VBUS regulator support is missing\n");
+#endif
     ctx->hcd = (struct xhci_hccr *)plat->hcd_base;
     len = HC_LENGTH(xhci_readl(&ctx->hcd->cr_capbase));
     hcor = (struct xhci_hcor *)((uintptr_t)ctx->hcd + len);
#10 lore raw

PATCH v3 4/6 mvebu: usb: xhci: Add VBUS regulator supply to the host driver

Quoted 64 lines · Konstantin Porotchkin

Hi, Marek,

Quoted 61 lines · Marek Vasut
Quoted 59 lines · Konstantin Porotchkin

Hi, Marek,

Quoted 47 lines · Marek Vasut
Quoted 6 lines · kostap at marvell.com

From: Konstantin Porotchkin <[email protected]>

The USB device should linked to VBUS regulator through "vbus-supply" DTS property.
This patch adds handling for "vbus-supply" property inside the USB device entry for turning on the VBUS regulator upon the host adapter

probe.

Quoted 9 lines
Change-Id Ibcf72d82298be42353ca03fee064ae8077a7b9de
Cc Stefan Roese <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Nadav Haklai <[email protected]>
Cc Neta Zur Hershkovits <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Haim Boot <[email protected]>
Quoted 7 lines

---
Changes for v3:
- Moved VBUS control from private GPIO to a fixed regulator
- Rebase on top of master branch

 doc/device-tree-bindings/usb/marvell.xhci-usb.txt | 28

++++++++++++++++++++

Quoted 1 line
 drivers/usb/host/xhci-mvebu.c                     | 31

+++++++++++++++++++++++

Review

Quoted 4 lines
 2 files changed, 59 insertions(+)
 create mode 100644 doc/device-tree-bindings/usb/marvell.xhci-usb.txt
(quoted diff) +0 -0

b/doc/device-tree-bindings/usb/marvell.xhci-usb.txt

Quoted 15 lines

new file mode 100644
index 0000000..672a829

doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +10 -0
@@ -0,0 +1,28 @@
+Marvell SOC USB controllers
+
+This controller is integrated in Armada 3700/8K.
+It uses the same properties as a generic XHCI host controller
+
+Required properties :
+ - compatible: should be one or more of:
+   - "marvell,armada3700-xhci", "generic-xhci" for Armada 37xx SoCs
+   - "marvell,armada-8k-xhci", "generic-xhci" for Armada A8K SoCs
+ - reg: should contain address and length of the standard XHCI
Quoted 8 lines

doc/device-tree-bindings/usb/marvell.xhci-usb.txt line 15

Quoted 5 lines
doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +5 -0
+   register set for the device.
+ - interrupts: one XHCI interrupt should be described here.
+
+Optional properties:
+ - clocks: reference to a clock

What clock ? Why are clock optional ?
This probably needs clock-names too.

This is the way it defined in Linux Kernel.

Quoted 7 lines
Quoted 5 lines

Then it probably could use fixing there too. Like seriously, what clock are those ? And why are they optional ? If neither you or me understand that from the documentation, then the documentation is crap and needs fixing. It being the same way in Linux is not an argument for sticking to it.

From my point of view this clock entry is optional too.
I am not handling it in any way and the core XHCI driver doesn't uses it.

DT is describing the hardware, not the software that is using it. These two things are separate. If the clock are mandatory for the hardware to work, they must be mandatory in the DT.

Quoted 1 line

Should I simply remove this property from the text file?

See above.

Quoted 33 lines
Quoted 33 lines
Quoted 32 lines

I took the Documentation/devicetree/bindings/usb/usb-xhci.txt file as a base for my add-on

Quoted 17 lines

doc/device-tree-bindings/usb/marvell.xhci-usb.txt line 16

Quoted 2 lines
doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +1 -0
+ - vbus-supply : If present, specifies the fixed regulator to be

turned on

Review

Quoted 13 lines
doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +12 -0
+   for providing power to the USB VBUS rail.
+
+Example:
+    cpm_usb3_0: usb3 at 500000 {
+        compatible = "marvell,armada-8k-xhci",
+                 "generic-xhci";
+        reg = <0x500000 0x4000>;
+        interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&cpm_syscon0 1 22>;
+        vbus-supply = <&reg_usb3h0_vbus>;
+        status = "disabled";
+    };
(quoted diff) +0 -0

b/drivers/usb/host/xhci-mvebu.c

Quoted 10 lines

drivers/usb/host/xhci-mvebu.c static int xhci_usb_probe(struct udevice *dev) · line 48

Quoted 8 lines

index 46eb937..149f6a4 100644

drivers/usb/host/xhci-mvebu.c +1 -0
@@ -45,7 +45,38 @@ static int xhci_usb_probe(struct udevice *dev)
     struct mvebu_xhci *ctx = dev_get_priv(dev);
     struct xhci_hcor *hcor;
     int len;
+#ifdef CONFIG_DM_REGULATOR_FIXED

Just make the driver depend on REGULATOR_FIXED

I think the driver can work without regulator if the VBUS rail wired to the 5V power line.
We only need regulator support if this is GPIO controlled

Quoted 8 lines
Quoted 3 lines

In that case, the regulator won't be found and the driver will ignore it. Btw I think that violates the USB spec ;-)

Currently the armada-8040-DB/armada-7040-DB boards use i2c connected VBUS enable control. If I made this driver depend on REGULATOR_FIXED, it will not work for these boards. They do not have regulator support enabled so far.
I do not want to break another systems by adding support for this board.

Oh, right. Then I believe using the regulator framework will help. The driver can depend on the regulator framework, which will abstract away the used regulator.

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/usb/host/xhci-mvebu.c +9 -0
+    const void *fdt = gd->fdt_blob;
+    int node = dev->of_offset;
+    const fdt32_t *regulator;
+    int size;
 
+    /*
+     * The VBUS supply regulator is not probed automatically
+     * Trigger the regulator probe upon USB port bring up
+     */
+    regulator = fdt_getprop(fdt, node, "vbus-supply", &size);
Quoted 5 lines
Quoted 2 lines

I think this should use regulator_*() calls from
include/power/regulator.h

I can call regulator_set_enable() at the end, but I have to locate it first and get the udev for it.
However it will be enabled already at the time I will call this function.

regulator_get_by_platname("vbus-supply", &reg); doesn't work here ?

Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 6 lines
drivers/usb/host/xhci-mvebu.c +6 -0
+    if (regulator) {
+        uint32_t phandle;
+        struct udevice *config;
+        int reg_node, ret;
+
+        phandle = fdt32_to_cpu(*regulator);

drivers/usb/host/xhci-mvebu.c static int xhci_usb_probe(struct udevice *dev) · line 74

Quoted 10 lines
drivers/usb/host/xhci-mvebu.c +10 -0
+        reg_node = fdt_node_offset_by_phandle(fdt, phandle);
+        if (reg_node < 0) {
+            dev_err(dev, "vbus-supply has invalid phandle\n");
+            return -EINVAL;
+        }
+        ret = uclass_get_device_by_of_offset(UCLASS_REGULATOR,
+                             reg_node, &config);
+        if (ret) {
+            dev_err(dev, "failed to get VBUS regulator device\n");
+            return ret;

Where is the regulator enabled ?

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

The regulator is fixed and it is "always-on", so assumed it is enough to probe it.
I have found that once it probed, the USB device becomes powered.

And once someone attaches a different regulator than fixed, this will break :)

What other type of regulators can be used for powering on the USB port? I believe they are always 5V fixed, are they?

Anything which can turn 5V on/off , be it some i2c chip, spi chip, GPIO ...

Signature · 2 lines
Best regards,
Marek Vasut
#11 lore raw

PATCH v3 4/6 mvebu: usb: xhci: Add VBUS regulator supply to the host driver

Quoted 70 lines · Marek Vasut
Quoted 69 lines · Konstantin Porotchkin

Hi, Marek,

Quoted 66 lines · Marek Vasut
Quoted 58 lines · Konstantin Porotchkin

Hi, Marek,

Quoted 47 lines · Marek Vasut
Quoted 6 lines · kostap at marvell.com

From: Konstantin Porotchkin <[email protected]>

The USB device should linked to VBUS regulator through "vbus-supply" DTS property.
This patch adds handling for "vbus-supply" property inside the USB device entry for turning on the VBUS regulator upon the host adapter

probe.

Quoted 9 lines
Change-Id Ibcf72d82298be42353ca03fee064ae8077a7b9de
Cc Stefan Roese <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Nadav Haklai <[email protected]>
Cc Neta Zur Hershkovits <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Haim Boot <[email protected]>
Quoted 7 lines

---
Changes for v3:
- Moved VBUS control from private GPIO to a fixed regulator
- Rebase on top of master branch

 doc/device-tree-bindings/usb/marvell.xhci-usb.txt | 28

++++++++++++++++++++

Quoted 1 line
 drivers/usb/host/xhci-mvebu.c                     | 31

+++++++++++++++++++++++

Review

Quoted 4 lines
 2 files changed, 59 insertions(+)
 create mode 100644 doc/device-tree-bindings/usb/marvell.xhci-usb.txt
(quoted diff) +0 -0

b/doc/device-tree-bindings/usb/marvell.xhci-usb.txt

Quoted 15 lines

new file mode 100644
index 0000000..672a829

doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +10 -0
@@ -0,0 +1,28 @@
+Marvell SOC USB controllers
+
+This controller is integrated in Armada 3700/8K.
+It uses the same properties as a generic XHCI host controller
+
+Required properties :
+ - compatible: should be one or more of:
+   - "marvell,armada3700-xhci", "generic-xhci" for Armada 37xx SoCs
+   - "marvell,armada-8k-xhci", "generic-xhci" for Armada A8K SoCs
+ - reg: should contain address and length of the standard XHCI
Quoted 8 lines

doc/device-tree-bindings/usb/marvell.xhci-usb.txt line 15

Quoted 5 lines
doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +5 -0
+   register set for the device.
+ - interrupts: one XHCI interrupt should be described here.
+
+Optional properties:
+ - clocks: reference to a clock

What clock ? Why are clock optional ?
This probably needs clock-names too.

Quoted 1 line

This is the way it defined in Linux Kernel.

Then it probably could use fixing there too. Like seriously, what clock are those ? And why are they optional ? If neither you or me understand that from the documentation, then the documentation is crap and needs fixing. It being the same way in Linux is not an argument for sticking to it.

Quoted 6 lines
Quoted 2 lines

From my point of view this clock entry is optional too.
I am not handling it in any way and the core XHCI driver doesn't uses it.

DT is describing the hardware, not the software that is using it. These two things are separate. If the clock are mandatory for the hardware to work, they must be mandatory in the DT.

I see what you saying. I will move the "clocks" entry to the "mandatory" section. Please keep in mind that it will not be currently enforced by the SW. For USB 3.0 case the clock parameters are actually defined by SERDES configuration, which has a separate DTS entry.

Quoted 47 lines
Quoted 2 lines

Should I simply remove this property from the text file?

See above.

Quoted 33 lines
Quoted 33 lines
Quoted 32 lines

I took the Documentation/devicetree/bindings/usb/usb-xhci.txt file as a base for my add-on

Quoted 17 lines

doc/device-tree-bindings/usb/marvell.xhci-usb.txt line 16

Quoted 2 lines
doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +1 -0
+ - vbus-supply : If present, specifies the fixed regulator to be

turned on

Review

Quoted 13 lines
doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +12 -0
+   for providing power to the USB VBUS rail.
+
+Example:
+    cpm_usb3_0: usb3 at 500000 {
+        compatible = "marvell,armada-8k-xhci",
+                 "generic-xhci";
+        reg = <0x500000 0x4000>;
+        interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&cpm_syscon0 1 22>;
+        vbus-supply = <&reg_usb3h0_vbus>;
+        status = "disabled";
+    };
(quoted diff) +0 -0

b/drivers/usb/host/xhci-mvebu.c

Quoted 10 lines

drivers/usb/host/xhci-mvebu.c static int xhci_usb_probe(struct udevice *dev) · line 48

Quoted 8 lines

index 46eb937..149f6a4 100644

drivers/usb/host/xhci-mvebu.c +1 -0
@@ -45,7 +45,38 @@ static int xhci_usb_probe(struct udevice *dev)
     struct mvebu_xhci *ctx = dev_get_priv(dev);
     struct xhci_hcor *hcor;
     int len;
+#ifdef CONFIG_DM_REGULATOR_FIXED

Just make the driver depend on REGULATOR_FIXED

I think the driver can work without regulator if the VBUS rail wired to the 5V power line.
We only need regulator support if this is GPIO controlled

Quoted 8 lines
Quoted 3 lines

In that case, the regulator won't be found and the driver will ignore it. Btw I think that violates the USB spec ;-)

Currently the armada-8040-DB/armada-7040-DB boards use i2c connected VBUS enable control. If I made this driver depend on REGULATOR_FIXED, it will not work for these boards. They do not have regulator support enabled so far.
I do not want to break another systems by adding support for this board.

Quoted 3 lines

Oh, right. Then I believe using the regulator framework will help. The driver can depend on the regulator framework, which will abstract away the used regulator.

Got it. I will change the code for using the regulator framework in USB driver.

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
drivers/usb/host/xhci-mvebu.c +9 -0
+    const void *fdt = gd->fdt_blob;
+    int node = dev->of_offset;
+    const fdt32_t *regulator;
+    int size;
 
+    /*
+     * The VBUS supply regulator is not probed automatically
+     * Trigger the regulator probe upon USB port bring up
+     */
+    regulator = fdt_getprop(fdt, node, "vbus-supply", &size);
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

I think this should use regulator_*() calls from
include/power/regulator.h

I can call regulator_set_enable() at the end, but I have to locate it first and get the udev for it.
However it will be enabled already at the time I will call this function.

regulator_get_by_platname("vbus-supply", &reg); doesn't work here ?

Thank you for the tip! i will definitely try this. Unfortunately I am not yet fluent in all the available DM APIs.

Quoted 30 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 7 lines
drivers/usb/host/xhci-mvebu.c +6 -0
+    if (regulator) {
+        uint32_t phandle;
+        struct udevice *config;
+        int reg_node, ret;
+
+        phandle = fdt32_to_cpu(*regulator);

drivers/usb/host/xhci-mvebu.c static int xhci_usb_probe(struct udevice *dev) · line 74

Quoted 10 lines
drivers/usb/host/xhci-mvebu.c +10 -0
+        reg_node = fdt_node_offset_by_phandle(fdt, phandle);
+        if (reg_node < 0) {
+            dev_err(dev, "vbus-supply has invalid phandle\n");
+            return -EINVAL;
+        }
+        ret = uclass_get_device_by_of_offset(UCLASS_REGULATOR,
+                             reg_node, &config);
+        if (ret) {
+            dev_err(dev, "failed to get VBUS regulator device\n");
+            return ret;

Where is the regulator enabled ?

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

The regulator is fixed and it is "always-on", so assumed it is enough to probe it.
I have found that once it probed, the USB device becomes powered.

And once someone attaches a different regulator than fixed, this will break :)

What other type of regulators can be used for powering on the USB port? I believe they are always 5V fixed, are they?

Anything which can turn 5V on/off , be it some i2c chip, spi chip, GPIO ...

#12 lore raw

PATCH v3 4/6 mvebu: usb: xhci: Add VBUS regulator supply to the host driver

Quoted 78 lines · Konstantin Porotchkin
Quoted 75 lines · Marek Vasut
Quoted 73 lines · Konstantin Porotchkin

Hi, Marek,

Quoted 60 lines · Marek Vasut
Quoted 59 lines · Konstantin Porotchkin

Hi, Marek,

Quoted 56 lines · Marek Vasut
Quoted 6 lines · kostap at marvell.com

From: Konstantin Porotchkin <[email protected]>

The USB device should linked to VBUS regulator through "vbus-supply" DTS property.
This patch adds handling for "vbus-supply" property inside the USB device entry for turning on the VBUS regulator upon the host adapter

probe.

Quoted 9 lines
Change-Id Ibcf72d82298be42353ca03fee064ae8077a7b9de
Cc Stefan Roese <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Nadav Haklai <[email protected]>
Cc Neta Zur Hershkovits <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Haim Boot <[email protected]>
Quoted 7 lines

---
Changes for v3:
- Moved VBUS control from private GPIO to a fixed regulator
- Rebase on top of master branch

 doc/device-tree-bindings/usb/marvell.xhci-usb.txt | 28

++++++++++++++++++++

Quoted 1 line
 drivers/usb/host/xhci-mvebu.c                     | 31

+++++++++++++++++++++++

Review

Quoted 5 lines
 2 files changed, 59 insertions(+)
 create mode 100644

doc/device-tree-bindings/usb/marvell.xhci-usb.txt

(quoted diff) +0 -0

b/doc/device-tree-bindings/usb/marvell.xhci-usb.txt

Quoted 10 lines

new file mode 100644
index 0000000..672a829

doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +5 -0
@@ -0,0 +1,28 @@
+Marvell SOC USB controllers
+
+This controller is integrated in Armada 3700/8K.
+It uses the same properties as a generic XHCI host controller
+

doc/device-tree-bindings/usb/marvell.xhci-usb.txt line 15

Quoted 10 lines
doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +10 -0
+Required properties :
+ - compatible: should be one or more of:
+   - "marvell,armada3700-xhci", "generic-xhci" for Armada 37xx SoCs
+   - "marvell,armada-8k-xhci", "generic-xhci" for Armada A8K SoCs
+ - reg: should contain address and length of the standard XHCI
+   register set for the device.
+ - interrupts: one XHCI interrupt should be described here.
+
+Optional properties:
+ - clocks: reference to a clock

What clock ? Why are clock optional ?
This probably needs clock-names too.

Quoted 7 lines
Quoted 1 line

This is the way it defined in Linux Kernel.

Then it probably could use fixing there too. Like seriously, what clock are those ? And why are they optional ? If neither you or me understand that from the documentation, then the documentation is crap and needs fixing. It being the same way in Linux is not an argument for sticking to it.

From my point of view this clock entry is optional too.
I am not handling it in any way and the core XHCI driver doesn't uses it.

Quoted 5 lines
Quoted 3 lines

DT is describing the hardware, not the software that is using it. These two things are separate. If the clock are mandatory for the hardware to work, they must be mandatory in the DT.

I see what you saying. I will move the "clocks" entry to the "mandatory" section.

Why ? What clock are those ? Are they mandatory ?

Quoted 3 lines

Please keep in mind that it will not be currently enforced by the SW. For USB 3.0 case the clock parameters are actually defined by SERDES configuration, which has a separate DTS entry.

Then why are these clock here at all ?

Quoted 48 lines
Quoted 48 lines
Quoted 1 line

Should I simply remove this property from the text file?

See above.

Quoted 43 lines
Quoted 30 lines
Quoted 30 lines

I took the Documentation/devicetree/bindings/usb/usb-xhci.txt file as a
base for my add-on

Quoted 27 lines

doc/device-tree-bindings/usb/marvell.xhci-usb.txt line 16

Quoted 2 lines
doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +1 -0
+ - vbus-supply : If present, specifies the fixed regulator to be

turned on

Review

Quoted 13 lines
doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +12 -0
+   for providing power to the USB VBUS rail.
+
+Example:
+    cpm_usb3_0: usb3 at 500000 {
+        compatible = "marvell,armada-8k-xhci",
+                 "generic-xhci";
+        reg = <0x500000 0x4000>;
+        interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&cpm_syscon0 1 22>;
+        vbus-supply = <&reg_usb3h0_vbus>;
+        status = "disabled";
+    };
(quoted diff) +0 -0

b/drivers/usb/host/xhci-mvebu.c

drivers/usb/host/xhci-mvebu.c static int xhci_usb_probe(struct udevice *dev) · line 48

Quoted 8 lines

index 46eb937..149f6a4 100644

drivers/usb/host/xhci-mvebu.c +1 -0
@@ -45,7 +45,38 @@ static int xhci_usb_probe(struct udevice *dev)
     struct mvebu_xhci *ctx = dev_get_priv(dev);
     struct xhci_hcor *hcor;
     int len;
+#ifdef CONFIG_DM_REGULATOR_FIXED

Just make the driver depend on REGULATOR_FIXED

Quoted 8 lines
Quoted 4 lines

I think the driver can work without regulator if the VBUS rail wired to
the 5V power line.
We only need regulator support if this is GPIO controlled

In that case, the regulator won't be found and the driver will ignore it. Btw I think that violates the USB spec ;-)

Currently the armada-8040-DB/armada-7040-DB boards use i2c connected VBUS enable control. If I made this driver depend on REGULATOR_FIXED, it will not work for these boards. They do not have regulator support enabled so far.
I do not want to break another systems by adding support for this board.

Quoted 5 lines
Quoted 3 lines

Oh, right. Then I believe using the regulator framework will help. The driver can depend on the regulator framework, which will abstract away the used regulator.

Got it. I will change the code for using the regulator framework in USB driver.

Thanks :)

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 10 lines
Quoted 10 lines

drivers/usb/host/xhci-mvebu.c static int xhci_usb_probe(struct udevice *dev) · line 58

Quoted 10 lines
drivers/usb/host/xhci-mvebu.c +9 -0
+    const void *fdt = gd->fdt_blob;
+    int node = dev->of_offset;
+    const fdt32_t *regulator;
+    int size;
 
+    /*
+     * The VBUS supply regulator is not probed automatically
+     * Trigger the regulator probe upon USB port bring up
+     */
+    regulator = fdt_getprop(fdt, node, "vbus-supply", &size);

I think this should use regulator_*() calls from
include/power/regulator.h

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

I can call regulator_set_enable() at the end, but I have to locate it first and get the udev for it.
However it will be enabled already at the time I will call this function.

regulator_get_by_platname("vbus-supply", &reg); doesn't work here ?

Thank you for the tip! i will definitely try this. Unfortunately I am not yet fluent in all the available DM APIs.

That's what the review is for .

Quoted 31 lines
Quoted 31 lines
Quoted 23 lines
Quoted 23 lines
Quoted 22 lines
Quoted 17 lines
Quoted 6 lines
drivers/usb/host/xhci-mvebu.c +6 -0
+    if (regulator) {
+        uint32_t phandle;
+        struct udevice *config;
+        int reg_node, ret;
+
+        phandle = fdt32_to_cpu(*regulator);

drivers/usb/host/xhci-mvebu.c static int xhci_usb_probe(struct udevice *dev) · line 74

Quoted 10 lines
drivers/usb/host/xhci-mvebu.c +10 -0
+        reg_node = fdt_node_offset_by_phandle(fdt, phandle);
+        if (reg_node < 0) {
+            dev_err(dev, "vbus-supply has invalid phandle\n");
+            return -EINVAL;
+        }
+        ret = uclass_get_device_by_of_offset(UCLASS_REGULATOR,
+                             reg_node, &config);
+        if (ret) {
+            dev_err(dev, "failed to get VBUS regulator device\n");
+            return ret;
Quoted 1 line

Where is the regulator enabled ?

The regulator is fixed and it is "always-on", so assumed it is enough to
probe it.
I have found that once it probed, the USB device becomes powered.

Quoted 4 lines
Quoted 2 lines

And once someone attaches a different regulator than fixed, this will break :)

What other type of regulators can be used for powering on the USB port? I believe they are always 5V fixed, are they?

Anything which can turn 5V on/off , be it some i2c chip, spi chip, GPIO ...

Signature · 2 lines
Best regards,
Marek Vasut
#13 lore raw

PATCH v3 4/6 mvebu: usb: xhci: Add VBUS regulator supply to the host driver

Quoted 79 lines · Marek Vasut
Quoted 78 lines · Konstantin Porotchkin
Quoted 75 lines · Marek Vasut
Quoted 73 lines · Konstantin Porotchkin

Hi, Marek,

Quoted 60 lines · Marek Vasut
Quoted 59 lines · Konstantin Porotchkin

Hi, Marek,

Quoted 56 lines · Marek Vasut
Quoted 6 lines · kostap at marvell.com

From: Konstantin Porotchkin <[email protected]>

The USB device should linked to VBUS regulator through "vbus-supply" DTS property.
This patch adds handling for "vbus-supply" property inside the USB device entry for turning on the VBUS regulator upon the host adapter

probe.

Quoted 9 lines
Change-Id Ibcf72d82298be42353ca03fee064ae8077a7b9de
Cc Stefan Roese <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Nadav Haklai <[email protected]>
Cc Neta Zur Hershkovits <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Haim Boot <[email protected]>
Quoted 7 lines

---
Changes for v3:
- Moved VBUS control from private GPIO to a fixed regulator
- Rebase on top of master branch

 doc/device-tree-bindings/usb/marvell.xhci-usb.txt | 28

++++++++++++++++++++

Quoted 1 line
 drivers/usb/host/xhci-mvebu.c                     | 31

+++++++++++++++++++++++

Review

Quoted 5 lines
 2 files changed, 59 insertions(+)
 create mode 100644

doc/device-tree-bindings/usb/marvell.xhci-usb.txt

(quoted diff) +0 -0

b/doc/device-tree-bindings/usb/marvell.xhci-usb.txt

Quoted 10 lines

new file mode 100644
index 0000000..672a829

doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +5 -0
@@ -0,0 +1,28 @@
+Marvell SOC USB controllers
+
+This controller is integrated in Armada 3700/8K.
+It uses the same properties as a generic XHCI host controller
+

doc/device-tree-bindings/usb/marvell.xhci-usb.txt line 15

Quoted 10 lines
doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +10 -0
+Required properties :
+ - compatible: should be one or more of:
+   - "marvell,armada3700-xhci", "generic-xhci" for Armada 37xx SoCs
+   - "marvell,armada-8k-xhci", "generic-xhci" for Armada A8K SoCs
+ - reg: should contain address and length of the standard XHCI
+   register set for the device.
+ - interrupts: one XHCI interrupt should be described here.
+
+Optional properties:
+ - clocks: reference to a clock

What clock ? Why are clock optional ?
This probably needs clock-names too.

Quoted 7 lines
Quoted 1 line

This is the way it defined in Linux Kernel.

Then it probably could use fixing there too. Like seriously, what clock are those ? And why are they optional ? If neither you or me understand that from the documentation, then the documentation is crap and needs fixing. It being the same way in Linux is not an argument for sticking to it.

From my point of view this clock entry is optional too.
I am not handling it in any way and the core XHCI driver doesn't uses it.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

DT is describing the hardware, not the software that is using it. These two things are separate. If the clock are mandatory for the hardware to work, they must be mandatory in the DT.

I see what you saying. I will move the "clocks" entry to the "mandatory" section.

Why ? What clock are those ? Are they mandatory ?

They are not mandatory. This entry can be used for enabling gated clocks on a specific platform. However Kernel code does not handle missing clock entry as an error. It just assumes that the clock is not gated and therefore should not be enabled upon host controller probe. So maybe I got you wrong. My feeling was that you requested to make this entry mandatory.

Quoted 5 lines
Quoted 3 lines

Please keep in mind that it will not be currently enforced by the SW. For USB 3.0 case the clock parameters are actually defined by SERDES configuration, which has a separate DTS entry.

Then why are these clock here at all ?

Because this is an optional parameter and can be used for enabling gated clock if one is defined.

Quoted 49 lines
Quoted 49 lines
Quoted 49 lines
Quoted 2 lines

Should I simply remove this property from the text file?

See above.

Quoted 43 lines
Quoted 30 lines
Quoted 30 lines

I took the Documentation/devicetree/bindings/usb/usb-xhci.txt file as a
base for my add-on

Quoted 27 lines

doc/device-tree-bindings/usb/marvell.xhci-usb.txt line 16

Quoted 2 lines
doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +1 -0
+ - vbus-supply : If present, specifies the fixed regulator to be

turned on

Review

Quoted 13 lines
doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +12 -0
+   for providing power to the USB VBUS rail.
+
+Example:
+    cpm_usb3_0: usb3 at 500000 {
+        compatible = "marvell,armada-8k-xhci",
+                 "generic-xhci";
+        reg = <0x500000 0x4000>;
+        interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&cpm_syscon0 1 22>;
+        vbus-supply = <&reg_usb3h0_vbus>;
+        status = "disabled";
+    };
(quoted diff) +0 -0

b/drivers/usb/host/xhci-mvebu.c

drivers/usb/host/xhci-mvebu.c static int xhci_usb_probe(struct udevice *dev) · line 48

Quoted 8 lines

index 46eb937..149f6a4 100644

drivers/usb/host/xhci-mvebu.c +1 -0
@@ -45,7 +45,38 @@ static int xhci_usb_probe(struct udevice *dev)
     struct mvebu_xhci *ctx = dev_get_priv(dev);
     struct xhci_hcor *hcor;
     int len;
+#ifdef CONFIG_DM_REGULATOR_FIXED

Just make the driver depend on REGULATOR_FIXED

Quoted 8 lines
Quoted 4 lines

I think the driver can work without regulator if the VBUS rail wired to
the 5V power line.
We only need regulator support if this is GPIO controlled

In that case, the regulator won't be found and the driver will ignore it. Btw I think that violates the USB spec ;-)

Currently the armada-8040-DB/armada-7040-DB boards use i2c connected VBUS enable control. If I made this driver depend on REGULATOR_FIXED, it will not work for these boards. They do not have regulator support enabled so far.
I do not want to break another systems by adding support for this board.

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

Oh, right. Then I believe using the regulator framework will help. The driver can depend on the regulator framework, which will abstract away the used regulator.

Got it. I will change the code for using the regulator framework in USB driver.

I tried your suggestion and it works for MACCHIATOBin board. However if I not surround this new code with "ifdef CONFIG_DM_REGULATOR_FIXED", the build for other boards based on same SoC will fail.
So I have 2 possible solutions for this issue - make the mvebu_xhci driver depend on CONFIG_DM_REGULATOR_FIXED and add this configuration entry to defconfigs of all affected boards, or use the "ifdef" as in previous code. What is preferred?

Quoted 21 lines

Thanks :)

Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/usb/host/xhci-mvebu.c +4 -0
+    const void *fdt = gd->fdt_blob;
+    int node = dev->of_offset;
+    const fdt32_t *regulator;
+    int size;
 
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

drivers/usb/host/xhci-mvebu.c static int xhci_usb_probe(struct udevice *dev) · line 58

Quoted 5 lines
drivers/usb/host/xhci-mvebu.c +5 -0
+    /*
+     * The VBUS supply regulator is not probed automatically
+     * Trigger the regulator probe upon USB port bring up
+     */
+    regulator = fdt_getprop(fdt, node, "vbus-supply", &size);

I think this should use regulator_*() calls from
include/power/regulator.h

I can call regulator_set_enable() at the end, but I have to locate it first and get the udev for it.
However it will be enabled already at the time I will call this function.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

regulator_get_by_platname("vbus-supply", &reg); doesn't work here ?

Thank you for the tip! i will definitely try this. Unfortunately I am not yet fluent in all the available DM APIs.

That's what the review is for .

Yes, I understand. And thank you for the fast review! I wish all my patches get such attention :-)

Quoted 34 lines
Quoted 32 lines
Quoted 32 lines
Quoted 24 lines
Quoted 24 lines
Quoted 23 lines
Quoted 18 lines
Quoted 7 lines
drivers/usb/host/xhci-mvebu.c +6 -0
+    if (regulator) {
+        uint32_t phandle;
+        struct udevice *config;
+        int reg_node, ret;
+
+        phandle = fdt32_to_cpu(*regulator);

drivers/usb/host/xhci-mvebu.c static int xhci_usb_probe(struct udevice *dev) · line 74

Quoted 10 lines
drivers/usb/host/xhci-mvebu.c +10 -0
+        reg_node = fdt_node_offset_by_phandle(fdt, phandle);
+        if (reg_node < 0) {
+            dev_err(dev, "vbus-supply has invalid phandle\n");
+            return -EINVAL;
+        }
+        ret = uclass_get_device_by_of_offset(UCLASS_REGULATOR,
+                             reg_node, &config);
+        if (ret) {
+            dev_err(dev, "failed to get VBUS regulator device\n");
+            return ret;
Quoted 1 line

Where is the regulator enabled ?

The regulator is fixed and it is "always-on", so assumed it is enough to
probe it.
I have found that once it probed, the USB device becomes powered.

Quoted 4 lines
Quoted 2 lines

And once someone attaches a different regulator than fixed, this will break :)

What other type of regulators can be used for powering on the USB port? I believe they are always 5V fixed, are they?

Anything which can turn 5V on/off , be it some i2c chip, spi chip, GPIO ...

#14 lore raw

PATCH v3 4/6 mvebu: usb: xhci: Add VBUS regulator supply to the host driver

Quoted 94 lines · Konstantin Porotchkin
Quoted 91 lines · Marek Vasut
Quoted 89 lines · Konstantin Porotchkin
Quoted 77 lines · Marek Vasut
Quoted 76 lines · Konstantin Porotchkin

Hi, Marek,

Quoted 73 lines · Marek Vasut
Quoted 62 lines · Konstantin Porotchkin

Hi, Marek,

Quoted 51 lines · Marek Vasut
Quoted 8 lines · kostap at marvell.com

From: Konstantin Porotchkin <[email protected]>

The USB device should linked to VBUS regulator through "vbus-supply"
DTS property.
This patch adds handling for "vbus-supply" property inside the USB device entry for turning on the VBUS regulator upon the host adapter

probe.

Quoted 9 lines
Change-Id Ibcf72d82298be42353ca03fee064ae8077a7b9de
Cc Stefan Roese <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Nadav Haklai <[email protected]>
Cc Neta Zur Hershkovits <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Haim Boot <[email protected]>
Quoted 7 lines

---
Changes for v3:
- Moved VBUS control from private GPIO to a fixed regulator
- Rebase on top of master branch

 doc/device-tree-bindings/usb/marvell.xhci-usb.txt | 28

++++++++++++++++++++

Quoted 1 line
 drivers/usb/host/xhci-mvebu.c                     | 31

+++++++++++++++++++++++

Review

Quoted 5 lines
 2 files changed, 59 insertions(+)
 create mode 100644

doc/device-tree-bindings/usb/marvell.xhci-usb.txt

(quoted diff) +0 -0

b/doc/device-tree-bindings/usb/marvell.xhci-usb.txt

Quoted 16 lines

new file mode 100644
index 0000000..672a829

doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +8 -0
@@ -0,0 +1,28 @@
+Marvell SOC USB controllers
+
+This controller is integrated in Armada 3700/8K.
+It uses the same properties as a generic XHCI host controller
+
+Required properties :
+ - compatible: should be one or more of:
+   - "marvell,armada3700-xhci", "generic-xhci" for Armada 37xx

SoCs
+ - "marvell,armada-8k-xhci", "generic-xhci" for Armada A8K SoCs
+ - reg: should contain address and length of the standard XHCI

Quoted 8 lines

doc/device-tree-bindings/usb/marvell.xhci-usb.txt

Quoted 5 lines
doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +5 -0
+   register set for the device.
+ - interrupts: one XHCI interrupt should be described here.
+
+Optional properties:
+ - clocks: reference to a clock

What clock ? Why are clock optional ?
This probably needs clock-names too.

Quoted 1 line

This is the way it defined in Linux Kernel.

Then it probably could use fixing there too. Like seriously, what clock
are those ? And why are they optional ? If neither you or me understand
that from the documentation, then the documentation is crap and needs fixing. It being the same way in Linux is not an argument for sticking
to it.

Quoted 7 lines
Quoted 3 lines

From my point of view this clock entry is optional too.
I am not handling it in any way and the core XHCI driver doesn't uses it.

DT is describing the hardware, not the software that is using it. These two things are separate. If the clock are mandatory for the hardware to work, they must be mandatory in the DT.

I see what you saying. I will move the "clocks" entry to the "mandatory" section.

Quoted 8 lines
Quoted 2 lines

Why ? What clock are those ? Are they mandatory ?

They are not mandatory. This entry can be used for enabling gated clocks on a specific platform. However Kernel code does not handle missing clock entry as an error. It just assumes that the clock is not gated and therefore should not be enabled upon host controller probe. So maybe I got you wrong. My feeling was that you requested to make this entry mandatory.

I have no idea what close those are (based on the description), so I cannot decide either way. If this is something which is present only on selected platforms, then they are optional indeed.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Please keep in mind that it will not be currently enforced by the SW. For USB 3.0 case the clock parameters are actually defined by SERDES configuration, which has a separate DTS entry.

Then why are these clock here at all ?

Because this is an optional parameter and can be used for enabling gated clock if one is defined.

So these are different clock from the SERDES clock, yes ?

Quoted 54 lines
Quoted 49 lines
Quoted 49 lines
Quoted 49 lines
Quoted 1 line

Should I simply remove this property from the text file?

See above.

Quoted 44 lines
Quoted 30 lines
Quoted 30 lines

I took the Documentation/devicetree/bindings/usb/usb-xhci.txt file as a
base for my add-on

Quoted 27 lines
Quoted 2 lines

+ - vbus-supply : If present, specifies the fixed regulator to be

turned on

Review

Quoted 13 lines
doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +12 -0
+   for providing power to the USB VBUS rail.
+
+Example:
+    cpm_usb3_0: usb3 at 500000 {
+        compatible = "marvell,armada-8k-xhci",
+                 "generic-xhci";
+        reg = <0x500000 0x4000>;
+        interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&cpm_syscon0 1 22>;
+        vbus-supply = <&reg_usb3h0_vbus>;
+        status = "disabled";
+    };
(quoted diff) +0 -0

b/drivers/usb/host/xhci-mvebu.c

drivers/usb/host/xhci-mvebu.c static int xhci_usb_probe(struct udevice *dev) · line 48

Quoted 8 lines

index 46eb937..149f6a4 100644

drivers/usb/host/xhci-mvebu.c +1 -0
@@ -45,7 +45,38 @@ static int xhci_usb_probe(struct udevice *dev)
     struct mvebu_xhci *ctx = dev_get_priv(dev);
     struct xhci_hcor *hcor;
     int len;
+#ifdef CONFIG_DM_REGULATOR_FIXED

Just make the driver depend on REGULATOR_FIXED

Quoted 8 lines
Quoted 4 lines

I think the driver can work without regulator if the VBUS rail wired to
the 5V power line.
We only need regulator support if this is GPIO controlled

In that case, the regulator won't be found and the driver will ignore it. Btw I think that violates the USB spec ;-)

Currently the armada-8040-DB/armada-7040-DB boards use i2c connected VBUS enable control. If I made this driver depend on REGULATOR_FIXED, it will not work for these boards. They do not have regulator support enabled so far.
I do not want to break another systems by adding support for this board.

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

Oh, right. Then I believe using the regulator framework will help. The driver can depend on the regulator framework, which will abstract away the used regulator.

Got it. I will change the code for using the regulator framework in USB driver.

Quoted 7 lines

I tried your suggestion and it works for MACCHIATOBin board. However if I not surround this new code with "ifdef CONFIG_DM_REGULATOR_FIXED", the build for other boards based on same SoC will fail.
So I have 2 possible solutions for this issue - make the mvebu_xhci driver depend on CONFIG_DM_REGULATOR_FIXED and add this configuration entry to defconfigs of all affected boards, or use the "ifdef" as in previous code. What is preferred?

Probably just enabling the regulator framework should be enough ?

[...]

Signature · 2 lines
Best regards,
Marek Vasut
#15 lore raw

PATCH v3 4/6 mvebu: usb: xhci: Add VBUS regulator supply to the host driver

Quoted 112 lines · Marek Vasut
Quoted 94 lines · Konstantin Porotchkin
Quoted 91 lines · Marek Vasut
Quoted 89 lines · Konstantin Porotchkin
Quoted 77 lines · Marek Vasut
Quoted 76 lines · Konstantin Porotchkin

Hi, Marek,

Quoted 73 lines · Marek Vasut
Quoted 62 lines · Konstantin Porotchkin

Hi, Marek,

Quoted 51 lines · Marek Vasut
Quoted 8 lines · kostap at marvell.com

From: Konstantin Porotchkin <[email protected]>

The USB device should linked to VBUS regulator through "vbus-supply"
DTS property.
This patch adds handling for "vbus-supply" property inside the USB device entry for turning on the VBUS regulator upon the host adapter

probe.

Quoted 9 lines
Change-Id Ibcf72d82298be42353ca03fee064ae8077a7b9de
Cc Stefan Roese <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Nadav Haklai <[email protected]>
Cc Neta Zur Hershkovits <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Haim Boot <[email protected]>
Quoted 7 lines

---
Changes for v3:
- Moved VBUS control from private GPIO to a fixed regulator
- Rebase on top of master branch

 doc/device-tree-bindings/usb/marvell.xhci-usb.txt | 28

++++++++++++++++++++

Quoted 1 line
 drivers/usb/host/xhci-mvebu.c                     | 31

+++++++++++++++++++++++

Review

Quoted 5 lines
 2 files changed, 59 insertions(+)
 create mode 100644

doc/device-tree-bindings/usb/marvell.xhci-usb.txt

(quoted diff) +0 -0

b/doc/device-tree-bindings/usb/marvell.xhci-usb.txt

Quoted 16 lines

new file mode 100644
index 0000000..672a829

doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +8 -0
@@ -0,0 +1,28 @@
+Marvell SOC USB controllers
+
+This controller is integrated in Armada 3700/8K.
+It uses the same properties as a generic XHCI host controller
+
+Required properties :
+ - compatible: should be one or more of:
+   - "marvell,armada3700-xhci", "generic-xhci" for Armada 37xx

SoCs
+ - "marvell,armada-8k-xhci", "generic-xhci" for Armada A8K SoCs
+ - reg: should contain address and length of the standard XHCI

Quoted 8 lines

doc/device-tree-bindings/usb/marvell.xhci-usb.txt

Quoted 5 lines
doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +5 -0
+   register set for the device.
+ - interrupts: one XHCI interrupt should be described here.
+
+Optional properties:
+ - clocks: reference to a clock

What clock ? Why are clock optional ?
This probably needs clock-names too.

Quoted 1 line

This is the way it defined in Linux Kernel.

Then it probably could use fixing there too. Like seriously, what clock
are those ? And why are they optional ? If neither you or me understand
that from the documentation, then the documentation is crap and needs fixing. It being the same way in Linux is not an argument for sticking
to it.

Quoted 7 lines
Quoted 3 lines

From my point of view this clock entry is optional too.
I am not handling it in any way and the core XHCI driver doesn't uses it.

DT is describing the hardware, not the software that is using it. These two things are separate. If the clock are mandatory for the hardware to work, they must be mandatory in the DT.

I see what you saying. I will move the "clocks" entry to the "mandatory" section.

Quoted 8 lines
Quoted 2 lines

Why ? What clock are those ? Are they mandatory ?

They are not mandatory. This entry can be used for enabling gated clocks on a specific platform. However Kernel code does not handle missing clock entry as an error. It just assumes that the clock is not gated and therefore should not be enabled upon host controller probe. So maybe I got you wrong. My feeling was that you requested to make this entry mandatory.

I have no idea what close those are (based on the description), so I cannot decide either way. If this is something which is present only on selected platforms, then they are optional indeed.

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

Please keep in mind that it will not be currently enforced by the SW. For USB 3.0 case the clock parameters are actually defined by SERDES configuration, which has a separate DTS entry.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Then why are these clock here at all ?

Because this is an optional parameter and can be used for enabling gated clock if one is defined.

So these are different clock from the SERDES clock, yes ?

As far as I know the SERDES entry defines the clock speed, which affects the initialization flow including the clock dividers.
The clock in USb entry looks like for gating only.

Quoted 67 lines
Quoted 55 lines
Quoted 50 lines
Quoted 50 lines
Quoted 50 lines
Quoted 2 lines

Should I simply remove this property from the text file?

See above.

Quoted 44 lines
Quoted 30 lines
Quoted 30 lines

I took the Documentation/devicetree/bindings/usb/usb-xhci.txt file as a
base for my add-on

Quoted 27 lines
Quoted 2 lines

+ - vbus-supply : If present, specifies the fixed regulator to be

turned on

Review

Quoted 13 lines
doc/device-tree-bindings/usb/marvell.xhci-usb.txt new file +12 -0
+   for providing power to the USB VBUS rail.
+
+Example:
+    cpm_usb3_0: usb3 at 500000 {
+        compatible = "marvell,armada-8k-xhci",
+                 "generic-xhci";
+        reg = <0x500000 0x4000>;
+        interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&cpm_syscon0 1 22>;
+        vbus-supply = <&reg_usb3h0_vbus>;
+        status = "disabled";
+    };
(quoted diff) +0 -0

b/drivers/usb/host/xhci-mvebu.c

drivers/usb/host/xhci-mvebu.c static int xhci_usb_probe(struct udevice *dev) · line 48

Quoted 8 lines

index 46eb937..149f6a4 100644

drivers/usb/host/xhci-mvebu.c +1 -0
@@ -45,7 +45,38 @@ static int xhci_usb_probe(struct udevice *dev)
     struct mvebu_xhci *ctx = dev_get_priv(dev);
     struct xhci_hcor *hcor;
     int len;
+#ifdef CONFIG_DM_REGULATOR_FIXED

Just make the driver depend on REGULATOR_FIXED

Quoted 8 lines
Quoted 4 lines

I think the driver can work without regulator if the VBUS rail wired to
the 5V power line.
We only need regulator support if this is GPIO controlled

In that case, the regulator won't be found and the driver will ignore it. Btw I think that violates the USB spec ;-)

Currently the armada-8040-DB/armada-7040-DB boards use i2c connected VBUS enable control. If I made this driver depend on REGULATOR_FIXED, it will not work for these boards. They do not have regulator support enabled so far.
I do not want to break another systems by adding support for this board.

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

Oh, right. Then I believe using the regulator framework will help. The driver can depend on the regulator framework, which will abstract away the used regulator.

Got it. I will change the code for using the regulator framework in USB driver.

Quoted 7 lines

I tried your suggestion and it works for MACCHIATOBin board. However if I not surround this new code with "ifdef CONFIG_DM_REGULATOR_FIXED", the build for other boards based on same SoC will fail.
So I have 2 possible solutions for this issue - make the mvebu_xhci driver depend on CONFIG_DM_REGULATOR_FIXED and add this configuration entry to defconfigs of all affected boards, or use the "ifdef" as in previous code. What is preferred?

Probably just enabling the regulator framework should be enough ?

[...]

#2 lore raw

PATCH v3 1/6 arm64: mvebu: gpio: Add GPIO nodes to A8K family devices

In reply to kostap at marvell.com
Quoted 10 lines · kostap at marvell.com

From: Konstantin Porotchkin <[email protected]>

Add GPIO nodes to AP-806 and CP-110-master DTSI files.

Change-Id I05958698d460cb721b7d8683d34f74a5ea32532c
Cc Stefan Roese <[email protected]>
Cc Nadav Haklai <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Haim Boot <[email protected]>

Complete series applied to u-boot-mavell/master.

Thanks,
Stefan