Skip to contentSkip to conversation

STiH410-B2260: add reset, usb and fastboot support

PATCH Superseded patrice.chotard at st.com 2 participants 15 messages Jul 18, 2017 – Sep 5, 2017

Subsystems (4)

v9 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#0 lore raw

v9 cover STiH410-B2260: add reset, usb and fastboot support

From: Patrice Chotard <[email protected]>

This series adds :
_ update existing sdhci driver to use reset framework _ add usb phy driver
_ add fastboot support

With all this feature enable, it's now possible to
_ boot on usb mass storage device
_ boot from kernel image and dtb previously loaded using tftp _ update mmc partiton using fastboot

v9: _ update doc/device-tree-bindings/phy/phy-stih407-usb.txt requested by
Marek Vasut in patch 4
_ move inclusion of linux/usb/otg.h from include/dwc3-sti-glue.h to drivers/usb/host/dwc3-sti-glue.c
requested by Marek Vasut in patch 7

v8: _ update failpath label names in path 7 requested by Marek Vasut

v7: _ rebase on top of dm/master to use last livetree update
_ replace fdtdec_parse_phandle_with_args() by dev_read_phandle_with_args() in patch 4 _ replace uclass_get_device_by_of_offset() by uclass_get_device_by_ofnode() in patch 4

v6: _ generic ehci/ohci drivers extension has been send separately
_ add reviewed-by Simon Glass

v5: _ extend generic ehci with phy
_ extend generic ohci with clock, reset and phy
_ remove specifi STi ehci and ohci drivers and use generic ohci/ehci
ones
_ update stih410-b2260 device tree to use ehci and ohci generic
drivers

v4: _ use PHY uclass currently available on dm-next branch,
update sti ehci, ohci and xhci drivers to use new PHY uclass.

v3: _ remove reset driver (already applied on u-boot-dm tree by Simon
Glass)
_ patch 4: add new USB PHY uclass requested by Simon Glass
_ patch 5: convert STi usb phy driver to new USB PHY uclass
_ patch 6/7: update echi/ohci drivers to use USB PHY uclass
_ patch 8/9: rework xhci-sti.c and dwc3-sti.c. Previously, xhci-sti driver binded
dwc3-sti (STi glue driver) which was not correct. Now we respect the device tree hierarchy, ie the STi dwc3 glue driver is first probed, then bind the xhci-sti driver.

v2: _ add Reviewed-by: Jaehoon Chung <[email protected]> in patches 2,3 and 4
_ fix remarks done by Marek Vasut :
_ patch 5 : replace bitfield_replace() by clrsetbits_le32() _ patch 6 : update error messages and add remove callback _ patch 8 : put board specific defines in a separate patch _ patch 7: use setbits_le32() instead of read, modify, write
sequence and add missing parenthesis
_ squash previous patches 7,9,11,12,14,16,17,18,19,20 and 21
in patch 14

Patrice Chotard (8):
Patrice Chotard (10):
mmc: sti_sdhci: Rework sti_mmc_core_config()
ARM: dts: stih410-family: Add missing reset_names for mmc1 node
mmc: sti_sdhci: Use reset framework
usb: phy: Add STi USB2 PHY
STiH410-B2260: enable USB Host Networking
STiH410-B2260: enable USB, fastboot, reset, PHY related flags
usb: dwc3: Add dwc3 glue driver support for STi
ARM: dts: STiH410: set DWC3 dual role mode to peripheral
ARM: dts: STiH410: update ehci and ohci compatible
board: STiH410-B2260: add fastboot support

 arch/arm/dts/stih407-family.dtsi                 |   3 +-
 arch/arm/dts/stih410.dtsi                        |  11 +-
 arch/arm/include/asm/arch-stih410/sys_proto.h    |  11 +
 board/st/stih410-b2260/board.c                   |  42 ++++
 configs/stih410-b2260_defconfig                  |  39 +++-
 doc/device-tree-bindings/phy/phy-stih407-usb.txt |  24 +++
 doc/device-tree-bindings/usb/dwc3-st.txt         |  60 ++++++
 drivers/mmc/sti_sdhci.c                          |  62 +++---
 drivers/phy/Kconfig                              |   8 +
 drivers/phy/Makefile                             |   1 +
 drivers/phy/sti_usb_phy.c                        | 181 ++++++++++++++++
 drivers/usb/host/Kconfig                         |   9 +
 drivers/usb/host/Makefile                        |   1 +
 drivers/usb/host/dwc3-sti-glue.c                 | 257 +++++++++++++++++++++++
 include/configs/stih410-b2260.h                  |  16 ++
 include/dwc3-sti-glue.h                          |  41 ++++
 16 files changed, 730 insertions(+), 36 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-stih410/sys_proto.h
 create mode 100644 doc/device-tree-bindings/phy/phy-stih407-usb.txt
 create mode 100644 doc/device-tree-bindings/usb/dwc3-st.txt
 create mode 100644 drivers/phy/sti_usb_phy.c
 create mode 100644 drivers/usb/host/dwc3-sti-glue.c
 create mode 100644 include/dwc3-sti-glue.h
Signature · 1 line
1.9.1
#1 lore raw

PATCH v9 1/10 mmc: sti_sdhci: Rework sti_mmc_core_config()

From: Patrice Chotard <[email protected]>

Use struct udevice* as input parameter. Previous parameters are retrieved through plat and priv data.

This to prepare to use the reset framework.

---
v9: _ none
v8: _ none
v7: _ none
v6: _ add reviewed-by Simon Glass
v5: _ none
v4: _ none
v3: _ none
v2: _ none

 drivers/mmc/sti_sdhci.c | 33 ++++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)
drivers/mmc/sti_sdhci.c +18 -15
index f85f6b4..714afd9 100644
@@ -16,6 +16,7 @@ DECLARE_GLOBAL_DATA_PTR;
 struct sti_sdhci_plat {
 	struct mmc_config cfg;
 	struct mmc mmc;
+	int instance;
 };
 
 /*
@@ -26,8 +27,8 @@ struct sti_sdhci_plat {
 
 /**
  * sti_mmc_core_config: configure the Arasan HC
- * @regbase: base address
- * @mmc_instance: mmc instance id
+ * @dev : udevice
+ *
  * Description: this function is to configure the Arasan MMC HC.
  * This should be called when the system starts in case of, on the SoC,
  * it is needed to configure the host controller.
@@ -36,33 +37,35 @@ struct sti_sdhci_plat {
  * W/o these settings the SDHCI could configure and use the embedded controller
  * with limited features.
  */
-static void sti_mmc_core_config(const u32 regbase, int mmc_instance)
+static void sti_mmc_core_config(struct udevice *dev)
 {
+	struct sti_sdhci_plat *plat = dev_get_platdata(dev);
+	struct sdhci_host *host = dev_get_priv(dev);
 	unsigned long *sysconf;
 
 	/* only MMC1 has a reset line */
-	if (mmc_instance) {
+	if (plat->instance) {
 		sysconf = (unsigned long *)(STIH410_SYSCONF5_BASE +
 			  ST_MMC_CCONFIG_REG_5);
 		generic_set_bit(SYSCONF_MMC1_ENABLE_BIT, sysconf);
 	}
 
 	writel(STI_FLASHSS_MMC_CORE_CONFIG_1,
-	       regbase + FLASHSS_MMC_CORE_CONFIG_1);
+	       host->ioaddr + FLASHSS_MMC_CORE_CONFIG_1);
 
-	if (mmc_instance) {
+	if (plat->instance) {
 		writel(STI_FLASHSS_MMC_CORE_CONFIG2,
-		       regbase + FLASHSS_MMC_CORE_CONFIG_2);
+		       host->ioaddr + FLASHSS_MMC_CORE_CONFIG_2);
 		writel(STI_FLASHSS_MMC_CORE_CONFIG3,
-		       regbase + FLASHSS_MMC_CORE_CONFIG_3);
+		       host->ioaddr + FLASHSS_MMC_CORE_CONFIG_3);
 	} else {
 		writel(STI_FLASHSS_SDCARD_CORE_CONFIG2,
-		       regbase + FLASHSS_MMC_CORE_CONFIG_2);
+		       host->ioaddr + FLASHSS_MMC_CORE_CONFIG_2);
 		writel(STI_FLASHSS_SDCARD_CORE_CONFIG3,
-		       regbase + FLASHSS_MMC_CORE_CONFIG_3);
+		       host->ioaddr + FLASHSS_MMC_CORE_CONFIG_3);
 	}
 	writel(STI_FLASHSS_MMC_CORE_CONFIG4,
-	       regbase + FLASHSS_MMC_CORE_CONFIG_4);
+	       host->ioaddr + FLASHSS_MMC_CORE_CONFIG_4);
 }
 
 static int sti_sdhci_probe(struct udevice *dev)
@@ -70,7 +73,7 @@ static int sti_sdhci_probe(struct udevice *dev)
 	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
 	struct sti_sdhci_plat *plat = dev_get_platdata(dev);
 	struct sdhci_host *host = dev_get_priv(dev);
-	int ret, mmc_instance;
+	int ret;
 
 	/*
 	 * identify current mmc instance, mmc1 has a reset, not mmc0
@@ -79,11 +82,11 @@ static int sti_sdhci_probe(struct udevice *dev)
 	 */
 
 	if (fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "resets", NULL))
-		mmc_instance = 1;
+		plat->instance = 1;
 	else
-		mmc_instance = 0;
+		plat->instance = 0;
 
-	sti_mmc_core_config((const u32) host->ioaddr, mmc_instance);
+	sti_mmc_core_config(dev);
 
 	host->quirks = SDHCI_QUIRK_WAIT_SEND_CMD |
 		       SDHCI_QUIRK_32BIT_DMA_ADDR |
Signature · 1 line
1.9.1
#2 lore raw

PATCH v9 2/10 ARM: dts: stih410-family: Add missing reset_names for mmc1 node

In reply to patrice.chotard at st.com

From: Patrice Chotard <[email protected]>

reset-names property is needed to use the reset API for STi sdhci driver.

---

v9: _ none
v8: _ none
v7: _ none
v6: _ add reviewed-by Simon Glass
v5: _ none
v4: _ none
v3: _ none
v2: _ none

 arch/arm/dts/stih407-family.dtsi | 1 +
 1 file changed, 1 insertion(+)
arch/arm/dts/stih407-family.dtsi +1 -0
index af66b53..452ac1c 100644
@@ -563,6 +563,7 @@
 			clocks = <&clk_s_c0_flexgen CLK_MMC_1>,
 				 <&clk_s_c0_flexgen CLK_RX_ICN_HVA>;
 			resets = <&softreset STIH407_MMC1_SOFTRESET>;
+			reset-names = "softreset";
 			bus-width = <4>;
 		};
 
Signature · 1 line
1.9.1
#3 lore raw

PATCH v9 3/10 mmc: sti_sdhci: Use reset framework

In reply to patrice.chotard at st.com

From: Patrice Chotard <[email protected]>

---
v9: _ none
v8: _ none
v7: _ none
v6: _ add reviewed-by Simon Glass
v5: _ none
v4: _ none
v3: _ none
v2: _ none

 drivers/mmc/sti_sdhci.c | 35 ++++++++++++++++++++---------------
 1 file changed, 20 insertions(+), 15 deletions(-)
drivers/mmc/sti_sdhci.c +20 -15
index 714afd9..d8b5888 100644
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <dm.h>
 #include <mmc.h>
+#include <reset-uclass.h>
 #include <sdhci.h>
 #include <asm/arch/sdhci.h>
 
@@ -16,15 +17,10 @@ DECLARE_GLOBAL_DATA_PTR;
 struct sti_sdhci_plat {
 	struct mmc_config cfg;
 	struct mmc mmc;
+	struct reset_ctl reset;
 	int instance;
 };
 
-/*
- * used to get access to MMC1 reset,
- * will be removed when STi reset driver will be available
- */
-#define STIH410_SYSCONF5_BASE		0x092b0000
-
 /**
  * sti_mmc_core_config: configure the Arasan HC
  * @dev : udevice
@@ -37,17 +33,19 @@ struct sti_sdhci_plat {
  * W/o these settings the SDHCI could configure and use the embedded controller
  * with limited features.
  */
-static void sti_mmc_core_config(struct udevice *dev)
+static int sti_mmc_core_config(struct udevice *dev)
 {
 	struct sti_sdhci_plat *plat = dev_get_platdata(dev);
 	struct sdhci_host *host = dev_get_priv(dev);
-	unsigned long *sysconf;
+	int ret;
 
 	/* only MMC1 has a reset line */
 	if (plat->instance) {
-		sysconf = (unsigned long *)(STIH410_SYSCONF5_BASE +
-			  ST_MMC_CCONFIG_REG_5);
-		generic_set_bit(SYSCONF_MMC1_ENABLE_BIT, sysconf);
+		ret = reset_deassert(&plat->reset);
+		if (ret < 0) {
+			error("MMC1 deassert failed: %d", ret);
+			return ret;
+		}
 	}
 
 	writel(STI_FLASHSS_MMC_CORE_CONFIG_1,
@@ -66,6 +64,8 @@ static void sti_mmc_core_config(struct udevice *dev)
 	}
 	writel(STI_FLASHSS_MMC_CORE_CONFIG4,
 	       host->ioaddr + FLASHSS_MMC_CORE_CONFIG_4);
+
+	return 0;
 }
 
 static int sti_sdhci_probe(struct udevice *dev)
@@ -80,13 +80,18 @@ static int sti_sdhci_probe(struct udevice *dev)
 	 * MMC0 is wired to the SD slot,
 	 * MMC1 is wired on the high speed connector
 	 */
-
-	if (fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "resets", NULL))
+	ret = reset_get_by_index(dev, 0, &plat->reset);
+	if (!ret)
 		plat->instance = 1;
 	else
-		plat->instance = 0;
+		if (ret == -ENOENT)
+			plat->instance = 0;
+		else
+			return ret;
 
-	sti_mmc_core_config(dev);
+	ret = sti_mmc_core_config(dev);
+	if (ret)
+		return ret;
 
 	host->quirks = SDHCI_QUIRK_WAIT_SEND_CMD |
 		       SDHCI_QUIRK_32BIT_DMA_ADDR |
Signature · 1 line
1.9.1
#4 lore raw

PATCH v9 4/10 usb: phy: Add STi USB2 PHY

In reply to patrice.chotard at st.com

From: Patrice Chotard <[email protected]>

This is the generic phy driver for the picoPHY ports used by USB2/1.1 controllers. It is found on STiH407 SoC family from STMicroelectronics.

---
v9: _ update doc/device-tree-bindings/phy/phy-stih407-usb.txt requested by
Marek Vasut
v8: _ add Reviewed-by Simon Glass
v7: _ replace fdtdec_parse_phandle_with_args() by dev_read_phandle_with_args()
_ replace uclass_get_device_by_of_offset() by uclass_get_device_by_ofnode()
v6: _ none
v5: _ add Reviewed-by: Marek Vasut <[email protected]>
v4: _ update to use the new PHY uclass currently available on dm-next branch
v3: _ convert driver to USB PHY uclass
v2: _ replace bitfield_replace() by clrsetbits_le32()

 doc/device-tree-bindings/phy/phy-stih407-usb.txt |  24 +++
 drivers/phy/Kconfig                              |   8 +
 drivers/phy/Makefile                             |   1 +
 drivers/phy/sti_usb_phy.c                        | 181 +++++++++++++++++++++++
 4 files changed, 214 insertions(+)
 create mode 100644 doc/device-tree-bindings/phy/phy-stih407-usb.txt
 create mode 100644 drivers/phy/sti_usb_phy.c
doc/device-tree-bindings/phy/phy-stih407-usb.txt new file +24 -0
new file mode 100644
index 0000000..371a7fe
@@ -0,0 +1,24 @@
+ST STiH407 USB PHY controller
+
+This file documents the dt bindings for the usb picoPHY driver which is the PHY for both USB2 and USB3
+host controllers (when controlling usb2/1.1 devices) available on STiH407 SoC family from STMicroelectronics.
+
+Required properties:
+- compatible		: should be "st,stih407-usb2-phy"
+- st,syscfg		: phandle of sysconfig bank plus integer array containing phyparam and phyctrl register offsets
+- resets		: list of phandle and reset specifier pairs. There should be two entries, one
+			  for the whole phy and one for the port
+- reset-names		: list of reset signal names. Should be "global" and "port"
+See: Documentation/devicetree/bindings/reset/st,sti-powerdown.txt
+See: Documentation/devicetree/bindings/reset/reset.txt
+
+Example:
+
+usb2_picophy0: usbpicophy {
+	compatible	= "st,stih407-usb2-phy";
+	#phy-cells	= <0>;
+	st,syscfg	= <&syscfg_core 0x100 0xf4>;
+	resets		= <&softreset STIH407_PICOPHY_SOFTRESET>,
+			  <&picophyreset STIH407_PICOPHY0_RESET>;
+	reset-names	= "global", "port";
+};
drivers/phy/Kconfig +8 -0
index 7841554..38fcc0b 100644
@@ -59,4 +59,12 @@ config SPL_PIPE3_PHY
 	  This PHY is found on omap devices supporting SATA such as dra7, am57x
 	  and omap5
 
+config STI_USB_PHY
+	bool "STMicroelectronics USB2 picoPHY driver for STiH407 family"
+	depends on PHY && ARCH_STI
+	help
+	  This is the generic phy driver for the picoPHY ports
+	  used by USB2 and USB3 Host controllers available on
+	  STiH407 SoC families.
+
 endmenu
drivers/phy/Makefile +1 -0
index 6ce96d2..22d92d3 100644
@@ -8,3 +8,4 @@
 obj-$(CONFIG_$(SPL_)PHY) += phy-uclass.o
 obj-$(CONFIG_PHY_SANDBOX) += sandbox-phy.o
 obj-$(CONFIG_$(SPL_)PIPE3_PHY) += ti-pipe3-phy.o
+obj-$(CONFIG_STI_USB_PHY) += sti_usb_phy.o
drivers/phy/sti_usb_phy.c new file +181 -0

181 lines not on this page · raw message

Signature · 1 line
1.9.1
#5 lore raw

PATCH v9 4/10 usb: phy: Add STi USB2 PHY

Quoted 19 lines · On 18 July 2017 at 06:31, <[email protected]> wrote:

From: Patrice Chotard <[email protected]>

This is the generic phy driver for the picoPHY ports used by USB2/1.1 controllers. It is found on STiH407 SoC family from STMicroelectronics.

---
v9: _ update doc/device-tree-bindings/phy/phy-stih407-usb.txt requested by
Marek Vasut

v8:     _ add Reviewed-by Simon Glass
v7:     _ replace fdtdec_parse_phandle_with_args() by dev_read_phandle_with_args()
        _ replace uclass_get_device_by_of_offset() by uclass_get_device_by_ofnode()
v6:     _ none
v5:     _ add Reviewed-by: Marek Vasut <[email protected]>
v4:     _ update to use the new PHY uclass currently available on dm-next branch
v3:     _ convert driver to USB PHY uclass
v2:     _ replace bitfield_replace() by clrsetbits_le32()
Quoted 7 lines
 doc/device-tree-bindings/phy/phy-stih407-usb.txt |  24 +++
 drivers/phy/Kconfig                              |   8 +
 drivers/phy/Makefile                             |   1 +
 drivers/phy/sti_usb_phy.c                        | 181 +++++++++++++++++++++++
 4 files changed, 214 insertions(+)
 create mode 100644 doc/device-tree-bindings/phy/phy-stih407-usb.txt
 create mode 100644 drivers/phy/sti_usb_phy.c
#6 lore raw

PATCH v9 5/10 STiH410-B2260: enable USB Host Networking

In reply to patrice.chotard at st.com

From: Patrice Chotard <[email protected]>

Enable USB Host Networking support by enabling Ethernet/USB adaptors support and by enabling some BOOTP flags

---

v9: _ none
v8: _ none
v7: _ none
v6: _ add reviewed-by Simon Glass
_ add missing comment in commit message
v5: _ none
v4: _ none
v3: _ none
v2: _ none

 include/configs/stih410-b2260.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
include/configs/stih410-b2260.h +16 -0
index 6f4070f..6c84e9b 100644
@@ -52,4 +52,20 @@
 
 #define CONFIG_SKIP_LOWLEVEL_INIT
 
+/* USB Configs */
+#define CONFIG_USB_OHCI_NEW
+#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS	2
+#define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS	2
+
+#define CONFIG_USB_HOST_ETHER
+#define CONFIG_USB_ETHER_ASIX
+#define CONFIG_USB_ETHER_MCS7830
+#define CONFIG_USB_ETHER_SMSC95XX
+
+/* NET Configs */
+#define CONFIG_BOOTP_SUBNETMASK
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_HOSTNAME
+#define CONFIG_BOOTP_BOOTPATH
+
 #endif /* __CONFIG_H */
Signature · 1 line
1.9.1
#7 lore raw

PATCH v9 6/10 STiH410-B2260: enable USB, fastboot, reset, PHY related flags

In reply to patrice.chotard at st.com

From: Patrice Chotard <[email protected]>

---
v9: _ none
v8: _ none
v7: _ none
v6: _ add reviewed-by Simon Glass
v5: _ remove CONFIG_USB_OHCI_STI and CONFIG_USB_EHCI_STI
: _ enable CONFIG_USB_EHCI_GENERIC and CONFIG_USB_OHCI_GENERIC
v4: _ enable CONFIG_PHY and CONFIG_STI_USB_PHY
v3: _ none
v2: _ none

 configs/stih410-b2260_defconfig | 39 +++++++++++++++++++++++++++++++++++----
 1 file changed, 35 insertions(+), 4 deletions(-)
configs/stih410-b2260_defconfig +35 -4
index 4e6942f..0107c4f 100644
@@ -2,25 +2,56 @@ CONFIG_ARM=y
 CONFIG_ARCH_STI=y
 CONFIG_IDENT_STRING="STMicroelectronics STiH410-B2260"
 CONFIG_DEFAULT_DEVICE_TREE="stih410-b2260"
+CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_SYS_PROMPT="stih410-b2260 => "
+CONFIG_FASTBOOT=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_CMD_FASTBOOT=y
+CONFIG_ANDROID_BOOT_IMAGE=y
+CONFIG_FASTBOOT_BUF_ADDR=0x40000000
+CONFIG_FASTBOOT_BUF_SIZE=0x3DF00000
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 # CONFIG_CMD_IMLS is not set
+CONFIG_CMD_GPT=y
 CONFIG_CMD_MMC=y
+CONFIG_CMD_USB=y
 CONFIG_CMD_TIME=y
 CONFIG_CMD_TIMER=y
-CONFIG_CMD_EXT2=y
-CONFIG_CMD_EXT4=y
-CONFIG_CMD_FAT=y
-CONFIG_CMD_FS_GENERIC=y
+CONFIG_CMD_EXT4_WRITE=y
+# CONFIG_ISO_PARTITION is not set
 CONFIG_OF_CONTROL=y
 CONFIG_REGMAP=y
 CONFIG_SYSCON=y
+CONFIG_CLK=y
+CONFIG_MISC=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_STI=y
+CONFIG_PHY=y
+CONFIG_STI_USB_PHY=y
 CONFIG_PINCTRL=y
+CONFIG_STI_RESET=y
 CONFIG_STI_ASC_SERIAL=y
 CONFIG_SYSRESET=y
 CONFIG_TIMER=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_GENERIC=y
+CONFIG_USB_OHCI_HCD=y
+CONFIG_USB_OHCI_GENERIC=y
+CONFIG_USB_DWC3=y
+CONFIG_USB_DWC3_GADGET=y
+CONFIG_USB_STORAGE=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_G_DNL_MANUFACTURER="STMicroelectronics"
+CONFIG_G_DNL_VENDOR_NUM=0x483
+CONFIG_G_DNL_PRODUCT_NUM=0x7270
+CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_SPL_OF_LIBFDT=y
Signature · 1 line
1.9.1
#8 lore raw

PATCH v9 7/10 usb: dwc3: Add dwc3 glue driver support for STi

In reply to patrice.chotard at st.com

From: Patrice Chotard <[email protected]>

This patch adds the ST glue logic to manage the DWC3 HC on STiH407 SoC family. It configures the internal glue logic and syscfg registers.

Part of this code been extracted from kernel.org driver (drivers/usb/dwc3/dwc3-st.c)

---

v9: _ move inclusion of linux/usb/otg.h from include/dwc3-sti-glue.h to
drivers/usb/host/dwc3-sti-glue.c requested by Marek Vasut
v8: _ update failpath label names in sti_dwc3_glue_probe()
v7: _ none
v6: _ add reviewed-by Simon Glass
_ put #define <common.h> first
v5: _ none
v4: _ none
v3: _ rename dwc3-sti.c to dwc3-sti-glue.c
respect device tree hierarchy, this driver is now responsible
: for xhci-sti binding (done in sti_dwc3_glue_bind())
v2: _ use setbits_le32() instead of read, modify, write sequence
add missing parenthesis

 arch/arm/include/asm/arch-stih410/sys_proto.h |  11 ++
 doc/device-tree-bindings/usb/dwc3-st.txt      |  60 ++++++
 drivers/usb/host/Kconfig                      |   9 +
 drivers/usb/host/Makefile                     |   1 +
 drivers/usb/host/dwc3-sti-glue.c              | 257 ++++++++++++++++++++++++++
 include/dwc3-sti-glue.h                       |  41 ++++
 6 files changed, 379 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-stih410/sys_proto.h
 create mode 100644 doc/device-tree-bindings/usb/dwc3-st.txt
 create mode 100644 drivers/usb/host/dwc3-sti-glue.c
 create mode 100644 include/dwc3-sti-glue.h
arch/arm/include/asm/arch-stih410/sys_proto.h new file +11 -0
new file mode 100644
index 0000000..5c40d3b
@@ -0,0 +1,11 @@
+/*
+ * Copyright (c) 2017
+ * Patrice Chotard <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _ASM_ARCH_SYS_PROTO_H
+#define _ASM_ARCH_SYS_PROTO_H
+
+#endif /* _ASM_ARCH_SYS_PROTO_H */
doc/device-tree-bindings/usb/dwc3-st.txt new file +60 -0

60 lines not on this page · raw message

drivers/usb/host/Kconfig +9 -0
index bc2c1f1..d17c0cb 100644
@@ -40,6 +40,15 @@ config USB_XHCI_ROCKCHIP
 	help
 	  Enables support for the on-chip xHCI controller on Rockchip SoCs.
 
+config USB_XHCI_STI
+	bool "Support for STMicroelectronics STiH407 family on-chip xHCI USB controller"
+	depends on ARCH_STI
+	default y
+	help
+	  Enables support for the on-chip xHCI controller on STMicroelectronics
+	  STiH407 family SoCs. This is a driver for the dwc3 to provide the glue logic
+	  to configure the controller.
+
 config USB_XHCI_ZYNQMP
 	bool "Support for Xilinx ZynqMP on-chip xHCI USB controller"
 	depends on ARCH_ZYNQMP
drivers/usb/host/Makefile +1 -0
index ab5a99f..29afb7c 100644
@@ -60,6 +60,7 @@ obj-$(CONFIG_USB_XHCI_FSL) += xhci-fsl.o
 obj-$(CONFIG_USB_XHCI_MVEBU) += xhci-mvebu.o
 obj-$(CONFIG_USB_XHCI_OMAP) += xhci-omap.o
 obj-$(CONFIG_USB_XHCI_PCI) += xhci-pci.o
+obj-$(CONFIG_USB_XHCI_STI) += dwc3-sti-glue.o
 
 # designware
 obj-$(CONFIG_USB_DWC2) += dwc2.o
drivers/usb/host/dwc3-sti-glue.c new file +257 -0

257 lines not on this page · raw message

include/dwc3-sti-glue.h new file +41 -0

41 lines not on this page · raw message

Signature · 1 line
1.9.1
#9 lore raw

PATCH v9 7/10 usb: dwc3: Add dwc3 glue driver support for STi

Quoted 26 lines · On 18 July 2017 at 06:31, <[email protected]> wrote:

From: Patrice Chotard <[email protected]>

This patch adds the ST glue logic to manage the DWC3 HC on STiH407 SoC family. It configures the internal glue logic and syscfg registers.

Part of this code been extracted from kernel.org driver (drivers/usb/dwc3/dwc3-st.c)

---

v9: _ move inclusion of linux/usb/otg.h from include/dwc3-sti-glue.h to
drivers/usb/host/dwc3-sti-glue.c requested by Marek Vasut

v8:     _ update failpath label names in sti_dwc3_glue_probe()
v7:     _ none
v6:     _ add reviewed-by Simon Glass
        _ put #define <common.h> first
v5:     _ none
v4:     _ none
v3:     _ rename dwc3-sti.c to dwc3-sti-glue.c

respect device tree hierarchy, this driver is now responsible
: for xhci-sti binding (done in sti_dwc3_glue_bind())
v2: _ use setbits_le32() instead of read, modify, write sequence
add missing parenthesis

Quoted 11 lines
 arch/arm/include/asm/arch-stih410/sys_proto.h |  11 ++
 doc/device-tree-bindings/usb/dwc3-st.txt      |  60 ++++++
 drivers/usb/host/Kconfig                      |   9 +
 drivers/usb/host/Makefile                     |   1 +
 drivers/usb/host/dwc3-sti-glue.c              | 257 ++++++++++++++++++++++++++
 include/dwc3-sti-glue.h                       |  41 ++++
 6 files changed, 379 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-stih410/sys_proto.h
 create mode 100644 doc/device-tree-bindings/usb/dwc3-st.txt
 create mode 100644 drivers/usb/host/dwc3-sti-glue.c
 create mode 100644 include/dwc3-sti-glue.h
#10 lore raw

PATCH v9 8/10 ARM: dts: STiH410: set DWC3 dual role mode to peripheral

In reply to patrice.chotard at st.com

From: Patrice Chotard <[email protected]>

On STi 96boards, configure by default the micro USB connector (managed by DWC3 hardware block) in peripheral mode. This will allow to use fastboot feature.

---
v9: _ none
v8: _ add Reviewed-by: Simon Glass
v7: _ none

 arch/arm/dts/stih407-family.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/dts/stih407-family.dtsi +1 -1
index 452ac1c..6c6de58 100644
@@ -655,7 +655,7 @@
 				compatible	= "snps,dwc3";
 				reg		= <0x09900000 0x100000>;
 				interrupts	= <GIC_SPI 155 IRQ_TYPE_NONE>;
-				dr_mode		= "host";
+				dr_mode		= "peripheral";
 				phy-names	= "usb2-phy", "usb3-phy";
 				phys		= <&usb2_picophy0>,
 						  <&phy_port2 PHY_TYPE_USB3>;
Signature · 1 line
1.9.1
#11 lore raw

PATCH v9 9/10 ARM: dts: STiH410: update ehci and ohci compatible

In reply to patrice.chotard at st.com

From: Patrice Chotard <[email protected]>

Update ehci and ohci node's compatible string in order to use ehci-generic and ohci-generic drivers.

---

v9: _ none
v8: _ add Reviewed-by: Simon Glass
v7: _ none

 arch/arm/dts/stih410.dtsi | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
arch/arm/dts/stih410.dtsi +7 -4
index f118a9e..b59b110 100644
@@ -83,7 +83,7 @@
 		};
 
 		ohci0: usb at 9a03c00 {
-			compatible = "st,st-ohci-300x";
+			compatible = "generic-ohci";
 			reg = <0x9a03c00 0x100>;
 			interrupts = <GIC_SPI 180 IRQ_TYPE_NONE>;
 			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>,
@@ -91,6 +91,7 @@
 			resets = <&powerdown STIH407_USB2_PORT0_POWERDOWN>,
 				 <&softreset STIH407_USB2_PORT0_SOFTRESET>;
 			reset-names = "power", "softreset";
+
 			phys = <&usb2_picophy1>;
 			phy-names = "usb";
 
@@ -98,7 +99,7 @@
 		};
 
 		ehci0: usb at 9a03e00 {
-			compatible = "st,st-ehci-300x";
+			compatible = "generic-ehci";
 			reg = <0x9a03e00 0x100>;
 			interrupts = <GIC_SPI 151 IRQ_TYPE_NONE>;
 			pinctrl-names = "default";
@@ -115,7 +116,7 @@
 		};
 
 		ohci1: usb at 9a83c00 {
-			compatible = "st,st-ohci-300x";
+			compatible = "generic-ohci";
 			reg = <0x9a83c00 0x100>;
 			interrupts = <GIC_SPI 181 IRQ_TYPE_NONE>;
 			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>,
@@ -123,6 +124,7 @@
 			resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>,
 				 <&softreset STIH407_USB2_PORT1_SOFTRESET>;
 			reset-names = "power", "softreset";
+
 			phys = <&usb2_picophy2>;
 			phy-names = "usb";
 
@@ -130,7 +132,7 @@
 		};
 
 		ehci1: usb at 9a83e00 {
-			compatible = "st,st-ehci-300x";
+			compatible = "generic-ehci";
 			reg = <0x9a83e00 0x100>;
 			interrupts = <GIC_SPI 153 IRQ_TYPE_NONE>;
 			pinctrl-names = "default";
@@ -140,6 +142,7 @@
 			resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>,
 				 <&softreset STIH407_USB2_PORT1_SOFTRESET>;
 			reset-names = "power", "softreset";
+
 			phys = <&usb2_picophy2>;
 			phy-names = "usb";
 
Signature · 1 line
1.9.1
#12 lore raw

PATCH v9 10/10 board: STiH410-B2260: add fastboot support

In reply to patrice.chotard at st.com

From: Patrice Chotard <[email protected]>

Add usb_gadget_handle_interrupts(), board_usb_init(), board_usb_cleanup() and g_dnl_board_usb_cable_connected() callbacks needed for FASTBOOT support

---
v9: _ none
v8: _ none
v7: _ none
v6: _ add reviewed-by Simon Glass
v5: _ none
v4: _ none
v3: _ none
v2: _ none

 board/st/stih410-b2260/board.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
board/st/stih410-b2260/board.c +42 -0
index 92b0695..d6cbbb8 100644
@@ -7,6 +7,10 @@
  */
 
 #include <common.h>
+#include <linux/usb/otg.h>
+#include <dwc3-sti-glue.h>
+#include <dwc3-uboot.h>
+#include <usb.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -36,3 +40,41 @@ int board_init(void)
 {
 	return 0;
 }
+
+#ifdef CONFIG_USB_DWC3
+static struct dwc3_device dwc3_device_data = {
+	.maximum_speed = USB_SPEED_HIGH,
+	.dr_mode = USB_DR_MODE_PERIPHERAL,
+	.index = 0,
+};
+
+int usb_gadget_handle_interrupts(int index)
+{
+	dwc3_uboot_handle_interrupt(index);
+	return 0;
+}
+
+int board_usb_init(int index, enum usb_init_type init)
+{
+	int node;
+	const void *blob = gd->fdt_blob;
+
+	/* find the snps,dwc3 node */
+	node = fdt_node_offset_by_compatible(blob, -1, "snps,dwc3");
+
+	dwc3_device_data.base = fdtdec_get_addr(blob, node, "reg");
+
+	return dwc3_uboot_init(&dwc3_device_data);
+}
+
+int board_usb_cleanup(int index, enum usb_init_type init)
+{
+	dwc3_uboot_exit(index);
+	return 0;
+}
+
+int g_dnl_board_usb_cable_connected(void)
+{
+	return 1;
+}
+#endif
Signature · 1 line
1.9.1
#13 lore raw

v9 cover STiH410-B2260: add reset, usb and fastboot support

In reply to patrice.chotard at st.com

Hi

Just a gentle reminder to not forget this series

Thanks

Quoted 95 lines · patrice.chotard at st.com

From: Patrice Chotard <[email protected]>

This series adds :
_ update existing sdhci driver to use reset framework _ add usb phy driver
_ add fastboot support

With all this feature enable, it's now possible to
_ boot on usb mass storage device
_ boot from kernel image and dtb previously loaded using tftp _ update mmc partiton using fastboot

v9: _ update doc/device-tree-bindings/phy/phy-stih407-usb.txt requested by
Marek Vasut in patch 4
_ move inclusion of linux/usb/otg.h from include/dwc3-sti-glue.h to drivers/usb/host/dwc3-sti-glue.c
requested by Marek Vasut in patch 7

v8: _ update failpath label names in path 7 requested by Marek Vasut

v7: _ rebase on top of dm/master to use last livetree update
_ replace fdtdec_parse_phandle_with_args() by dev_read_phandle_with_args() in patch 4 _ replace uclass_get_device_by_of_offset() by uclass_get_device_by_ofnode() in patch 4

v6: _ generic ehci/ohci drivers extension has been send separately
_ add reviewed-by Simon Glass

v5: _ extend generic ehci with phy
_ extend generic ohci with clock, reset and phy
_ remove specifi STi ehci and ohci drivers and use generic ohci/ehci
ones
_ update stih410-b2260 device tree to use ehci and ohci generic
drivers

v4: _ use PHY uclass currently available on dm-next branch,
update sti ehci, ohci and xhci drivers to use new PHY uclass.

v3: _ remove reset driver (already applied on u-boot-dm tree by Simon
Glass)
_ patch 4: add new USB PHY uclass requested by Simon Glass
_ patch 5: convert STi usb phy driver to new USB PHY uclass
_ patch 6/7: update echi/ohci drivers to use USB PHY uclass
_ patch 8/9: rework xhci-sti.c and dwc3-sti.c. Previously, xhci-sti driver binded
dwc3-sti (STi glue driver) which was not correct. Now we respect the device tree hierarchy, ie the STi dwc3 glue driver is first probed, then bind the xhci-sti driver.

v2: _ add Reviewed-by: Jaehoon Chung <[email protected]> in patches 2,3 and 4
_ fix remarks done by Marek Vasut :
_ patch 5 : replace bitfield_replace() by clrsetbits_le32() _ patch 6 : update error messages and add remove callback _ patch 8 : put board specific defines in a separate patch _ patch 7: use setbits_le32() instead of read, modify, write
sequence and add missing parenthesis
_ squash previous patches 7,9,11,12,14,16,17,18,19,20 and 21
in patch 14

Patrice Chotard (8):
Patrice Chotard (10):
mmc: sti_sdhci: Rework sti_mmc_core_config()
ARM: dts: stih410-family: Add missing reset_names for mmc1 node
mmc: sti_sdhci: Use reset framework
usb: phy: Add STi USB2 PHY
STiH410-B2260: enable USB Host Networking
STiH410-B2260: enable USB, fastboot, reset, PHY related flags
usb: dwc3: Add dwc3 glue driver support for STi
ARM: dts: STiH410: set DWC3 dual role mode to peripheral
ARM: dts: STiH410: update ehci and ohci compatible
board: STiH410-B2260: add fastboot support

  arch/arm/dts/stih407-family.dtsi                 |   3 +-
  arch/arm/dts/stih410.dtsi                        |  11 +-
  arch/arm/include/asm/arch-stih410/sys_proto.h    |  11 +
  board/st/stih410-b2260/board.c                   |  42 ++++
  configs/stih410-b2260_defconfig                  |  39 +++-
  doc/device-tree-bindings/phy/phy-stih407-usb.txt |  24 +++
  doc/device-tree-bindings/usb/dwc3-st.txt         |  60 ++++++
  drivers/mmc/sti_sdhci.c                          |  62 +++---
  drivers/phy/Kconfig                              |   8 +
  drivers/phy/Makefile                             |   1 +
  drivers/phy/sti_usb_phy.c                        | 181 ++++++++++++++++
  drivers/usb/host/Kconfig                         |   9 +
  drivers/usb/host/Makefile                        |   1 +
  drivers/usb/host/dwc3-sti-glue.c                 | 257 +++++++++++++++++++++++
  include/configs/stih410-b2260.h                  |  16 ++
  include/dwc3-sti-glue.h                          |  41 ++++
  16 files changed, 730 insertions(+), 36 deletions(-)

create mode 100644 arch/arm/include/asm/arch-stih410/sys_proto.h create mode 100644 doc/device-tree-bindings/phy/phy-stih407-usb.txt create mode 100644 doc/device-tree-bindings/usb/dwc3-st.txt create mode 100644 drivers/phy/sti_usb_phy.c
create mode 100644 drivers/usb/host/dwc3-sti-glue.c create mode 100644 include/dwc3-sti-glue.h

#14 lore raw

v9 cover STiH410-B2260: add reset, usb and fastboot support

Hi

I just noticed that this series need to be reworked as some update has been merged on mainline since this series has been submitted on mailing list.

A v10 will be pushed today.

Sorry

Patrice

Quoted 107 lines · Patrice CHOTARD

Hi

Just a gentle reminder to not forget this series

Thanks

Quoted 88 lines · patrice.chotard at st.com

From: Patrice Chotard <[email protected]>

This series adds :
_ update existing sdhci driver to use reset framework _ add usb phy driver
_ add fastboot support

With all this feature enable, it's now possible to
_ boot on usb mass storage device
_ boot from kernel image and dtb previously loaded using tftp _ update mmc partiton using fastboot

v9: _ update doc/device-tree-bindings/phy/phy-stih407-usb.txt requested by
Marek Vasut in patch 4
_ move inclusion of linux/usb/otg.h from include/dwc3-sti-glue.h to drivers/usb/host/dwc3-sti-glue.c
requested by Marek Vasut in patch 7

v8: _ update failpath label names in path 7 requested by Marek Vasut

v7: _ rebase on top of dm/master to use last livetree update
_ replace fdtdec_parse_phandle_with_args() by dev_read_phandle_with_args() in patch 4 _ replace uclass_get_device_by_of_offset() by uclass_get_device_by_ofnode() in patch 4

v6: _ generic ehci/ohci drivers extension has been send separately
_ add reviewed-by Simon Glass

v5: _ extend generic ehci with phy
_ extend generic ohci with clock, reset and phy
_ remove specifi STi ehci and ohci drivers and use generic ohci/ehci
ones
_ update stih410-b2260 device tree to use ehci and ohci generic
drivers

v4: _ use PHY uclass currently available on dm-next branch,
update sti ehci, ohci and xhci drivers to use new PHY uclass.

v3: _ remove reset driver (already applied on u-boot-dm tree by Simon
Glass)
_ patch 4: add new USB PHY uclass requested by Simon Glass
_ patch 5: convert STi usb phy driver to new USB PHY uclass
_ patch 6/7: update echi/ohci drivers to use USB PHY uclass
_ patch 8/9: rework xhci-sti.c and dwc3-sti.c. Previously, xhci-sti driver binded
dwc3-sti (STi glue driver) which was not correct. Now we respect the device tree hierarchy, ie the STi dwc3 glue driver is first probed, then bind the xhci-sti driver.

v2: _ add Reviewed-by: Jaehoon Chung <[email protected]> in patches 2,3 and 4
_ fix remarks done by Marek Vasut :
_ patch 5 : replace bitfield_replace() by clrsetbits_le32() _ patch 6 : update error messages and add remove callback _ patch 8 : put board specific defines in a separate patch _ patch 7: use setbits_le32() instead of read, modify, write
sequence and add missing parenthesis
_ squash previous patches 7,9,11,12,14,16,17,18,19,20 and 21
in patch 14

Patrice Chotard (8):
Patrice Chotard (10):
mmc: sti_sdhci: Rework sti_mmc_core_config()
ARM: dts: stih410-family: Add missing reset_names for mmc1 node
mmc: sti_sdhci: Use reset framework
usb: phy: Add STi USB2 PHY
STiH410-B2260: enable USB Host Networking
STiH410-B2260: enable USB, fastboot, reset, PHY related flags
usb: dwc3: Add dwc3 glue driver support for STi
ARM: dts: STiH410: set DWC3 dual role mode to peripheral
ARM: dts: STiH410: update ehci and ohci compatible
board: STiH410-B2260: add fastboot support

   arch/arm/dts/stih407-family.dtsi                 |   3 +-
   arch/arm/dts/stih410.dtsi                        |  11 +-
   arch/arm/include/asm/arch-stih410/sys_proto.h    |  11 +
   board/st/stih410-b2260/board.c                   |  42 ++++
   configs/stih410-b2260_defconfig                  |  39 +++-
   doc/device-tree-bindings/phy/phy-stih407-usb.txt |  24 +++
   doc/device-tree-bindings/usb/dwc3-st.txt         |  60 ++++++
   drivers/mmc/sti_sdhci.c                          |  62 +++---
   drivers/phy/Kconfig                              |   8 +
   drivers/phy/Makefile                             |   1 +
   drivers/phy/sti_usb_phy.c                        | 181 ++++++++++++++++
   drivers/usb/host/Kconfig                         |   9 +
   drivers/usb/host/Makefile                        |   1 +
   drivers/usb/host/dwc3-sti-glue.c                 | 257 +++++++++++++++++++++++
   include/configs/stih410-b2260.h                  |  16 ++
   include/dwc3-sti-glue.h                          |  41 ++++
   16 files changed, 730 insertions(+), 36 deletions(-)
Quoted 7 lines

create mode 100644 arch/arm/include/asm/arch-stih410/sys_proto.h create mode 100644 doc/device-tree-bindings/phy/phy-stih407-usb.txt create mode 100644 doc/device-tree-bindings/usb/dwc3-st.txt create mode 100644 drivers/phy/sti_usb_phy.c
create mode 100644 drivers/usb/host/dwc3-sti-glue.c create mode 100644 include/dwc3-sti-glue.h

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot