Skip to contentSkip to conversation

Add support for DM_USB for TI's DRA7 EVMs and AM57 EVMs platforms

PATCH Superseded Jean-Jacques Hiblot 4 participants 26 messages May 4, 2018 – May 17, 2018

Subsystems (2)

v5 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

v5 cover Add support for DM_USB for TI's DRA7 EVMs and AM57 EVMs platforms

Supporting DM USB is required to support DM_ETH and USB network adapters with the same binary.
This series adds support for DM_USB for the DRA7/AM57 families. As a bonus it adds support for USB3.

limitation:
- only Host mode is supported. The Device mode can be added later.

Tested on:
- dra7 evm
- dra71 evm
- dra72 evm
- dra72 evm rev C
- dra76 evm
- AM572 evm

Changes in v5:
- Rebased on latest u-boot
- Removed patches that have already been merged

Changes in v4:
- Fix word missing in commit log
- Remove dependency on MISC
- Renamed the commit (DM_USB is already enabled, the only missing option is for the USB2 phy driver)
- Remove dependency on MISC
- Remove omap specific glue layer and use dwc3-of-simple glue layer

Changes in v3:
- in syscon_regmap_lookup_by_phandle(), use dev_dbg() instead of printf()
- added unit test for syscon_regmap_lookup_by_phandle()

Changes in v2:
- Add USB3 support to ti-pipe3-phy driver
- omap-usb2-phy: Implement power_on and power_off callbacks
- am57xx boards: when DM_USB is used, turn on the required USB clocks
- split dts changes in 2 commits: one for binding the children of ocp2scp at 4a080000, and one to disable USB1 on all DRA7 EVMs
- Instead of disabling USB1 port in dts files, use *-u-boot.dtsi files
- Enable DM_USB in am57xx_evm_defconfig. USB3 (super speed) is supported.

Jean-Jacques Hiblot (7):
syscon: dm: Add a new method to get a regmap from DTS
phy: Add a new driver for OMAP's USB2 PHYs
board: ti: dra7xx-evm: turn on USB clocks in late init stage
dts: dra7x: make ocp2scp at 4a080000 compatible with simple-bus
dts: dra7x: Disable USB1 on all evms
configs: enable OMAP_USB2_PHY for all DRA7 platforms
configs: am57xx_evm: Enable DM_USB and dependencies

Vignesh R (2):
phy: ti-pip3-phy: Add support for USB3 PHY
board; ti: am57xx: turn on USB clocks

 arch/arm/dts/dra7-evm-u-boot.dtsi       |   8 ++
 arch/arm/dts/dra71-evm-u-boot.dtsi      |   9 ++
 arch/arm/dts/dra72-evm-revc-u-boot.dtsi |   8 ++
 arch/arm/dts/dra72-evm-u-boot.dtsi      |  22 ++++
 arch/arm/dts/dra76-evm-u-boot.dtsi      |   9 ++
 arch/arm/dts/omap5-u-boot.dtsi          |   4 +
 arch/sandbox/dts/test.dts               |   6 +-
 board/ti/am57xx/board.c                 |  19 ++++
 board/ti/dra7xx/evm.c                   |  19 ++++
 configs/am57xx_evm_defconfig            |   4 +
 configs/dra7xx_evm_defconfig            |   1 +
 configs/dra7xx_hs_evm_defconfig         |   1 +
 drivers/core/syscon-uclass.c            |  23 ++++
 drivers/phy/Kconfig                     |   8 ++
 drivers/phy/Makefile                    |   1 +
 drivers/phy/omap-usb2-phy.c             | 196 ++++++++++++++++++++++++++++++++
 drivers/phy/ti-pipe3-phy.c              |  30 +++--
 include/syscon.h                        |  13 +++
 test/dm/syscon.c                        |  29 +++++
 19 files changed, 401 insertions(+), 9 deletions(-)
 create mode 100644 arch/arm/dts/dra72-evm-u-boot.dtsi
 create mode 100644 drivers/phy/omap-usb2-phy.c
Signature · 1 line
2.7.4
#1 lore raw

PATCH v5 1/9 syscon: dm: Add a new method to get a regmap from DTS

syscon_regmap_lookup_by_phandle() can be used to get the regmap of a syscon device from a reference in the DTS. It operates similarly to the linux version of the namesake function.

---

Changes in v5: None
Changes in v4:
- Fix word missing in commit log

Changes in v3:
- in syscon_regmap_lookup_by_phandle(), use dev_dbg() instead of printf()
- added unit test for syscon_regmap_lookup_by_phandle()

Changes in v2: None

 arch/sandbox/dts/test.dts    |  6 ++++--
 drivers/core/syscon-uclass.c | 23 +++++++++++++++++++++++
 include/syscon.h             | 13 +++++++++++++
 test/dm/syscon.c             | 29 +++++++++++++++++++++++++++++
 4 files changed, 69 insertions(+), 2 deletions(-)
arch/sandbox/dts/test.dts +4 -2
index 06d0e8c..369002e 100644
@@ -311,6 +311,8 @@
 
 		test4 {
 			compatible = "denx,u-boot-probe-test";
+			first-syscon = <&syscon0>;
+			second-sys-ctrl = <&another_system_controller>;
 		};
 	};
 
@@ -380,12 +382,12 @@
 		};
 	};
 
-	syscon at 0 {
+	syscon0: syscon at 0 {
 		compatible = "sandbox,syscon0";
 		reg = <0x10 4>;
 	};
 
-	syscon at 1 {
+	another_system_controller: syscon at 1 {
 		compatible = "sandbox,syscon1";
 		reg = <0x20 5
 			0x28 6
drivers/core/syscon-uclass.c +23 -0
index a69937e..739fddd 100644
@@ -45,6 +45,29 @@ static int syscon_pre_probe(struct udevice *dev)
 #endif
 }
 
+struct regmap *syscon_regmap_lookup_by_phandle(struct udevice *dev,
+					       const char *name)
+{
+	struct udevice *syscon;
+	struct regmap *r;
+	int err;
+
+	err = uclass_get_device_by_phandle(UCLASS_SYSCON, dev,
+					   name, &syscon);
+	if (err) {
+		dev_dbg(dev, "unable to find syscon device\n");
+		return ERR_PTR(err);
+	}
+
+	r = syscon_get_regmap(syscon);
+	if (!r) {
+		dev_dbg(dev, "unable to find regmap\n");
+		return ERR_PTR(-ENODEV);
+	}
+
+	return r;
+}
+
 int syscon_get_by_driver_data(ulong driver_data, struct udevice **devp)
 {
 	struct udevice *dev;
include/syscon.h +13 -0
index 5d52b1c..23d257a 100644
@@ -74,6 +74,19 @@ int syscon_get_by_driver_data(ulong driver_data, struct udevice **devp);
 struct regmap *syscon_get_regmap_by_driver_data(ulong driver_data);
 
 /**
+ * syscon_regmap_lookup_by_phandle() - Look up a controller by a phandle
+ *
+ * This operates by looking up the given name in the device (device
+ * tree property) of the device using the system controller.
+ *
+ * @dev:	Device using the system controller
+ * @name:	Name of property referring to the system controller
+ * @return	A pointer to the regmap if found, ERR_PTR(-ve) on error
+ */
+struct regmap *syscon_regmap_lookup_by_phandle(struct udevice *dev,
+					       const char *name);
+
+/**
  * syscon_get_first_range() - get the first memory range from a syscon regmap
  *
  * @driver_data:	Driver data value to look up
test/dm/syscon.c +29 -0
index 99bff96..6f15baf 100644
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <dm.h>
 #include <syscon.h>
+#include <regmap.h>
 #include <asm/test.h>
 #include <dm/test.h>
 #include <test/ut.h>
@@ -44,3 +45,31 @@ static int dm_test_syscon_by_driver_data(struct unit_test_state *uts)
 	return 0;
 }
 DM_TEST(dm_test_syscon_by_driver_data, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+/* Test system controller by phandle */
+static int dm_test_syscon_by_phandle(struct unit_test_state *uts)
+{
+	struct udevice *dev;
+	struct regmap *map;
+
+	ut_assertok(uclass_get_device_by_name(UCLASS_TEST_PROBE, "test4",
+					      &dev));
+	if (!dev || IS_ERR(dev))
+		return -ENODEV;
+
+	ut_assertok_ptr(syscon_regmap_lookup_by_phandle(dev, "first-syscon"));
+	map = syscon_regmap_lookup_by_phandle(dev, "first-syscon");
+	if (map && !IS_ERR(map))
+		ut_asserteq(1, map->range_count);
+
+	ut_assertok_ptr(syscon_regmap_lookup_by_phandle(dev,
+							"second-sys-ctrl"));
+	map = syscon_regmap_lookup_by_phandle(dev, "second-sys-controller");
+	if (map && !IS_ERR(map))
+		ut_asserteq(4, map->range_count);
+
+	ut_assert(IS_ERR(syscon_regmap_lookup_by_phandle(dev, "not-present")));
+
+	return 0;
+}
+DM_TEST(dm_test_syscon_by_phandle, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
Signature · 1 line
2.7.4
#2 lore raw

PATCH v5 1/9 syscon: dm: Add a new method to get a regmap from DTS

Quoted 1 line · Jean-Jacques Hiblot

syscon_regmap_lookup_by_phandle() can be used to get the regmap of a

syscon

Quoted 15 lines

device from a reference in the DTS. It operates similarly to the linux version of the namesake function.

---

Changes in v5: None
Changes in v4:
- Fix word missing in commit log

Changes in v3:
- in syscon_regmap_lookup_by_phandle(), use dev_dbg() instead of printf()
- added unit test for syscon_regmap_lookup_by_phandle()

Quoted 8 lines

Changes in v2: None

 arch/sandbox/dts/test.dts    |  6 ++++--
 drivers/core/syscon-uclass.c | 23 +++++++++++++++++++++++
 include/syscon.h             | 13 +++++++++++++
 test/dm/syscon.c             | 29 +++++++++++++++++++++++++++++
 4 files changed, 69 insertions(+), 2 deletions(-)
#3 lore raw

PATCH v5 2/9 phy: ti-pip3-phy: Add support for USB3 PHY

In reply to Jean-Jacques Hiblot

From: Vignesh R <[email protected]>

Add support to handle USB3 PHYs present on AM57xx/DRA7xx SoCs. This is needed to move AM57xx to DM_USB.

---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2:
- Add USB3 support to ti-pipe3-phy driver

 drivers/phy/ti-pipe3-phy.c | 30 +++++++++++++++++++++++-------
 1 file changed, 23 insertions(+), 7 deletions(-)
drivers/phy/ti-pipe3-phy.c +23 -7
index babf2ff..9fddd01 100644
@@ -266,10 +266,13 @@ static int pipe3_exit(struct phy *phy)
 		return -EBUSY;
 	}
 
-	val = readl(pipe3->pll_reset_reg);
-	writel(val | SATA_PLL_SOFT_RESET, pipe3->pll_reset_reg);
-	mdelay(1);
-	writel(val & ~SATA_PLL_SOFT_RESET, pipe3->pll_reset_reg);
+	if (pipe3->pll_reset_reg) {
+		val = readl(pipe3->pll_reset_reg);
+		writel(val | SATA_PLL_SOFT_RESET, pipe3->pll_reset_reg);
+		mdelay(1);
+		writel(val & ~SATA_PLL_SOFT_RESET, pipe3->pll_reset_reg);
+	}
+
 	return 0;
 }
 
@@ -332,9 +335,11 @@ static int pipe3_phy_probe(struct udevice *dev)
 	if (!pipe3->power_reg)
 		return -EINVAL;
 
-	pipe3->pll_reset_reg = get_reg(dev, "syscon-pllreset");
-	if (!pipe3->pll_reset_reg)
-		return -EINVAL;
+	if (device_is_compatible(dev, "ti,phy-pipe3-sata")) {
+		pipe3->pll_reset_reg = get_reg(dev, "syscon-pllreset");
+		if (!pipe3->pll_reset_reg)
+			return -EINVAL;
+	}
 
 	pipe3->dpll_map = (struct pipe3_dpll_map *)dev_get_driver_data(dev);
 
@@ -351,8 +356,19 @@ static struct pipe3_dpll_map dpll_map_sata[] = {
 	{ },                                    /* Terminator */
 };
 
+static struct pipe3_dpll_map dpll_map_usb[] = {
+	{12000000, {1250, 5, 4, 20, 0} },	/* 12 MHz */
+	{16800000, {3125, 20, 4, 20, 0} },	/* 16.8 MHz */
+	{19200000, {1172, 8, 4, 20, 65537} },	/* 19.2 MHz */
+	{20000000, {1000, 7, 4, 10, 0} },	/* 20 MHz */
+	{26000000, {1250, 12, 4, 20, 0} },	/* 26 MHz */
+	{38400000, {3125, 47, 4, 20, 92843} },	/* 38.4 MHz */
+	{ },					/* Terminator */
+};
+
 static const struct udevice_id pipe3_phy_ids[] = {
 	{ .compatible = "ti,phy-pipe3-sata", .data = (ulong)&dpll_map_sata },
+	{ .compatible = "ti,omap-usb3", .data = (ulong)&dpll_map_usb},
 	{ }
 };
 
Signature · 1 line
2.7.4
#4 lore raw

PATCH v5 3/9 phy: Add a new driver for OMAP's USB2 PHYs

In reply to Jean-Jacques Hiblot

This drivers supports the USB2 PHY found on omap5 and dra7 SOCs.

---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2:
- omap-usb2-phy: Implement power_on and power_off callbacks

 drivers/phy/Kconfig         |   8 ++
 drivers/phy/Makefile        |   1 +
 drivers/phy/omap-usb2-phy.c | 196 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 205 insertions(+)
 create mode 100644 drivers/phy/omap-usb2-phy.c
drivers/phy/Kconfig +8 -0
index 119edec..ed2b0a8 100644
@@ -118,4 +118,12 @@ config MESON_GXL_USB_PHY
 	  This is the generic phy driver for the Amlogic Meson GXL
 	  USB2 and USB3 PHYS.
 
+config OMAP_USB2_PHY
+	bool "Support OMAP's USB2 PHY"
+	depends on PHY
+	depends on SYSCON
+	help
+	  Support for the OMAP's USB2 PHY.
+	  This PHY is found on OMAP devices supporting USB2.
+
 endmenu
drivers/phy/Makefile +1 -0
index 72c1492..d440e59 100644
@@ -15,3 +15,4 @@ 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
 obj-$(CONFIG_MESON_GXL_USB_PHY) += meson-gxl-usb2.o meson-gxl-usb3.o
+obj-$(CONFIG_OMAP_USB2_PHY) += omap-usb2-phy.o
drivers/phy/omap-usb2-phy.c new file +196 -0

196 lines not on this page · raw message

Signature · 1 line
2.7.4
#5 lore raw

PATCH v5 3/9 phy: Add a new driver for OMAP's USB2 PHYs

Quoted 23 lines · Jean-Jacques Hiblot

This drivers supports the USB2 PHY found on omap5 and dra7 SOCs.

---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2:
- omap-usb2-phy: Implement power_on and power_off callbacks

 drivers/phy/Kconfig         |   8 ++
 drivers/phy/Makefile        |   1 +
 drivers/phy/omap-usb2-phy.c | 196 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 205 insertions(+)
 create mode 100644 drivers/phy/omap-usb2-phy.c
drivers/phy/Kconfig +0 -0
index 119edec..ed2b0a8 100644

drivers/phy/Kconfig config MESON_GXL_USB_PHY · line 122

Quoted 5 lines
drivers/phy/Kconfig +2 -0
@@ -118,4 +118,12 @@ config MESON_GXL_USB_PHY
 	  This is the generic phy driver for the Amlogic Meson GXL
 	  USB2 and USB3 PHYS.
 
+config OMAP_USB2_PHY
+	bool "Support OMAP's USB2 PHY"

s/OMAP's/TI OMAP/ ?
[...]

drivers/phy/Kconfig config MESON_GXL_USB_PHY

Quoted 8 lines
drivers/phy/Kconfig +8 -0
+
+#define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT	BIT(0)
+
+#define OMAP_DEV_PHY_PD		BIT(0)
+#define OMAP_USB2_PHY_PD	BIT(28)
+
+#define USB2PHY_DISCON_BYP_LATCH	BIT(31)
+#define USB2PHY_ANA_CONFIG1		(0x4c)

Parenthesis not needed

Quoted 1 line

+DECLARE_GLOBAL_DATA_PTR;

Is GD really needed for DM driver ?

[...]

drivers/phy/Kconfig

Quoted 7 lines
drivers/phy/Kconfig +7 -0
+static int omap_usb2_phy_init(struct phy *usb_phy)
+{
+	struct udevice *dev = usb_phy->dev;
+	struct omap_usb2_phy *priv = dev_get_priv(dev);
+	u32 val;
+
+	if (priv->flags & OMAP_USB2_CALIBRATE_FALSE_DISCONNECT) {

Invert the condition to reduce level of indent .

Quoted 15 lines
drivers/phy/Kconfig +15 -0
+		/*
+		 *
+		 * Reduce the sensitivity of internal PHY by enabling the
+		 * DISCON_BYP_LATCH of the USB2PHY_ANA_CONFIG1 register. This
+		 * resolves issues with certain devices which can otherwise
+		 * be prone to false disconnects.
+		 *
+		 */
+		val = readl(priv->phy_base + USB2PHY_ANA_CONFIG1);
+		val |= USB2PHY_DISCON_BYP_LATCH;
+		writel(val, priv->phy_base + USB2PHY_ANA_CONFIG1);
+	}
+
+	return 0;
+}

[...]

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

PATCH v5 4/9 board: ti: dra7xx-evm: turn on USB clocks in late init stage

In reply to Jean-Jacques Hiblot

For USB ports that use the Driver Model, turn on the clocks during the late init stage.

---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 board/ti/dra7xx/evm.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
board/ti/dra7xx/evm.c +19 -0
index 06f061c..c1e1b8e 100644
@@ -647,6 +647,19 @@ int dram_init_banksize(void)
 	return 0;
 }
 
+#if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL)
+static int device_okay(const char *path)
+{
+	int node;
+
+	node = fdt_path_offset(gd->fdt_blob, path);
+	if (node < 0)
+		return 0;
+
+	return fdtdec_get_is_enabled(gd->fdt_blob, node);
+}
+#endif
+
 int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
@@ -686,6 +699,12 @@ int board_late_init(void)
 	if (board_is_dra71x_evm())
 		palmas_i2c_write_u8(LP873X_I2C_SLAVE_ADDR, 0x9, 0x7);
 #endif
+#if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL)
+	if (device_okay("/ocp/omap_dwc3_1 at 48880000"))
+		enable_usb_clocks(0);
+	if (device_okay("/ocp/omap_dwc3_2 at 488c0000"))
+		enable_usb_clocks(1);
+#endif
 	return 0;
 }
 
Signature · 1 line
2.7.4
#7 lore raw

PATCH v5 4/9 board: ti: dra7xx-evm: turn on USB clocks in late init stage

Quoted 40 lines · Jean-Jacques Hiblot

For USB ports that use the Driver Model, turn on the clocks during the late init stage.

---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 board/ti/dra7xx/evm.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
board/ti/dra7xx/evm.c +13 -0
index 06f061c..c1e1b8e 100644
@@ -647,6 +647,19 @@ int dram_init_banksize(void)
 	return 0;
 }
 
+#if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL)
+static int device_okay(const char *path)
+{
+	int node;
+
+	node = fdt_path_offset(gd->fdt_blob, path);
+	if (node < 0)
+		return 0;
+
+	return fdtdec_get_is_enabled(gd->fdt_blob, node);
+}
+#endif
+
 int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG

board/ti/dra7xx/evm.c int board_late_init(void) · line 707

Quoted 9 lines
board/ti/dra7xx/evm.c +6 -0
@@ -686,6 +699,12 @@ int board_late_init(void)
 	if (board_is_dra71x_evm())
 		palmas_i2c_write_u8(LP873X_I2C_SLAVE_ADDR, 0x9, 0x7);
 #endif
+#if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL)
+	if (device_okay("/ocp/omap_dwc3_1 at 48880000"))
+		enable_usb_clocks(0);
+	if (device_okay("/ocp/omap_dwc3_2 at 488c0000"))
+		enable_usb_clocks(1);
+#endif

Shouldnt the driver turn this on?

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

PATCH v5 4/9 board: ti: dra7xx-evm: turn on USB clocks in late init stage

Quoted 43 lines · Marek Vasut
Quoted 42 lines · Jean-Jacques Hiblot

For USB ports that use the Driver Model, turn on the clocks during the late init stage.

---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

  board/ti/dra7xx/evm.c | 19 +++++++++++++++++++
  1 file changed, 19 insertions(+)
board/ti/dra7xx/evm.c +13 -0
index 06f061c..c1e1b8e 100644
@@ -647,6 +647,19 @@ int dram_init_banksize(void)
  	return 0;
  }
 
+#if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL)
+static int device_okay(const char *path)
+{
+	int node;
+
+	node = fdt_path_offset(gd->fdt_blob, path);
+	if (node < 0)
+		return 0;
+
+	return fdtdec_get_is_enabled(gd->fdt_blob, node);
+}
+#endif
+
  int board_late_init(void)
  {
  #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
@@ -686,6 +699,12 @@ int board_late_init(void)
  	if (board_is_dra71x_evm())
  		palmas_i2c_write_u8(LP873X_I2C_SLAVE_ADDR, 0x9, 0x7);
Quoted 8 lines

board/ti/dra7xx/evm.c int board_late_init(void) · line 707

Quoted 7 lines
board/ti/dra7xx/evm.c +6 -0
  #endif
+#if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL)
+	if (device_okay("/ocp/omap_dwc3_1 at 48880000"))
+		enable_usb_clocks(0);
+	if (device_okay("/ocp/omap_dwc3_2 at 488c0000"))
+		enable_usb_clocks(1);
+#endif

Shouldnt the driver turn this on?

AFAIK there is no clock driver for the OMAP. So we have to do it before the driver is probed.

JJ

Quoted 1 line
#9 lore raw

PATCH v5 4/9 board: ti: dra7xx-evm: turn on USB clocks in late init stage

Quoted 53 lines · Jean-Jacques Hiblot
Quoted 42 lines · Marek Vasut
Quoted 41 lines · Jean-Jacques Hiblot

For USB ports that use the Driver Model, turn on the clocks during the late init stage.

---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

  board/ti/dra7xx/evm.c | 19 +++++++++++++++++++

  1 file changed, 19 insertions(+)
board/ti/dra7xx/evm.c +12 -0
index 06f061c..c1e1b8e 100644
@@ -647,6 +647,19 @@ int dram_init_banksize(void)
       return 0;
   }
   +#if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL)
+static int device_okay(const char *path)
+{
+    int node;
+
+    node = fdt_path_offset(gd->fdt_blob, path);
+    if (node < 0)
+        return 0;
+
+    return fdtdec_get_is_enabled(gd->fdt_blob, node);
+}
+#endif
+
   int board_late_init(void)
   {
   #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
@@ -686,6 +699,12 @@ int board_late_init(void)
       if (board_is_dra71x_evm())
           palmas_i2c_write_u8(LP873X_I2C_SLAVE_ADDR, 0x9, 0x7);
Quoted 8 lines

board/ti/dra7xx/evm.c int board_late_init(void) · line 707

Quoted 7 lines
board/ti/dra7xx/evm.c +6 -0
   #endif
+#if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL)
+    if (device_okay("/ocp/omap_dwc3_1 at 48880000"))
+        enable_usb_clocks(0);
+    if (device_okay("/ocp/omap_dwc3_2 at 488c0000"))
+        enable_usb_clocks(1);
+#endif

Shouldnt the driver turn this on?

Quoted 2 lines

AFAIK there is no clock driver for the OMAP. So we have to do it before the driver is probed.

Maybe it's time to implement it instead of piling up those hacks ?

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

PATCH v5 4/9 board: ti: dra7xx-evm: turn on USB clocks in late init stage

Quoted 53 lines · Marek Vasut
Quoted 52 lines · Jean-Jacques Hiblot
Quoted 50 lines · Marek Vasut
Quoted 39 lines · Jean-Jacques Hiblot

For USB ports that use the Driver Model, turn on the clocks during the late init stage.

---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

   board/ti/dra7xx/evm.c | 19 +++++++++++++++++++
   1 file changed, 19 insertions(+)
board/ti/dra7xx/evm.c +12 -0
index 06f061c..c1e1b8e 100644
@@ -647,6 +647,19 @@ int dram_init_banksize(void)
       return 0;
   }
   +#if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL)
+static int device_okay(const char *path)
+{
+    int node;
+
+    node = fdt_path_offset(gd->fdt_blob, path);
+    if (node < 0)
+        return 0;
+
+    return fdtdec_get_is_enabled(gd->fdt_blob, node);
+}
+#endif
+
   int board_late_init(void)
   {
   #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG

board/ti/dra7xx/evm.c int board_late_init(void) · line 707

Quoted 9 lines
board/ti/dra7xx/evm.c +6 -0
@@ -686,6 +699,12 @@ int board_late_init(void)
       if (board_is_dra71x_evm())
           palmas_i2c_write_u8(LP873X_I2C_SLAVE_ADDR, 0x9, 0x7);
   #endif
+#if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL)
+    if (device_okay("/ocp/omap_dwc3_1 at 48880000"))
+        enable_usb_clocks(0);
+    if (device_okay("/ocp/omap_dwc3_2 at 488c0000"))
+        enable_usb_clocks(1);
+#endif

Shouldnt the driver turn this on?

Quoted 3 lines
Quoted 2 lines

AFAIK there is no clock driver for the OMAP. So we have to do it before the driver is probed.

Maybe it's time to implement it instead of piling up those hacks ?

I was thinking along the same lines at some point but then I realized that it will make the SPL really big. And we are already tight on some platforms like am335x.

JJ

Quoted 1 line
#11 lore raw

PATCH v5 4/9 board: ti: dra7xx-evm: turn on USB clocks in late init stage

Quoted 56 lines · Jean-Jacques Hiblot
Quoted 53 lines · Marek Vasut
Quoted 52 lines · Jean-Jacques Hiblot
Quoted 50 lines · Marek Vasut
Quoted 39 lines · Jean-Jacques Hiblot

For USB ports that use the Driver Model, turn on the clocks during the late init stage.

---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

   board/ti/dra7xx/evm.c | 19 +++++++++++++++++++

   1 file changed, 19 insertions(+)
board/ti/dra7xx/evm.c +12 -0
index 06f061c..c1e1b8e 100644
@@ -647,6 +647,19 @@ int dram_init_banksize(void)
        return 0;
    }
    +#if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL)
+static int device_okay(const char *path)
+{
+    int node;
+
+    node = fdt_path_offset(gd->fdt_blob, path);
+    if (node < 0)
+        return 0;
+
+    return fdtdec_get_is_enabled(gd->fdt_blob, node);
+}
+#endif
+
    int board_late_init(void)
    {
    #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG

board/ti/dra7xx/evm.c int board_late_init(void) · line 707

Quoted 9 lines
board/ti/dra7xx/evm.c +6 -0
@@ -686,6 +699,12 @@ int board_late_init(void)
        if (board_is_dra71x_evm())
            palmas_i2c_write_u8(LP873X_I2C_SLAVE_ADDR, 0x9, 0x7);
    #endif
+#if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL)
+    if (device_okay("/ocp/omap_dwc3_1 at 48880000"))
+        enable_usb_clocks(0);
+    if (device_okay("/ocp/omap_dwc3_2 at 488c0000"))
+        enable_usb_clocks(1);
+#endif

Shouldnt the driver turn this on?

Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

AFAIK there is no clock driver for the OMAP. So we have to do it before the driver is probed.

Maybe it's time to implement it instead of piling up those hacks ?

I was thinking along the same lines at some point but then I realized that it will make the SPL really big. And we are already tight on some platforms like am335x.

But this is not only SPL , right ? And yes, for SPL you might need to poke registers or something.

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

PATCH v5 4/9 board: ti: dra7xx-evm: turn on USB clocks in late init stage

Hi Marek,

Quoted 10 lines · Marek Vasut
Quoted 8 lines
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines

Shouldnt the driver turn this on?

AFAIK there is no clock driver for the OMAP. So we have to do it before the driver is probed.

Maybe it's time to implement it instead of piling up those hacks ?

I was thinking along the same lines at some point but then I realized that it will make the SPL really big. And we are already tight on some platforms like am335x.

But this is not only SPL , right ? And yes, for SPL you might need to poke registers or something.

IMHO having 2 different ways to enable the clocks in SPL and in u-boot is an not improvement over the current situation.
In any case, This is a subject that can be discussed.

Tom, Lokesh,  do you have an opinion on this ?

Meanwhile It would nice to have DM_USB support for the DRA7/AM57 platforms. It allows using a USB ether adapter with CONFIG_DM_ETHER enabled (default on TI's platform). And this series allows using the USB 3.0 on AM57 evm.

JJ

#13 lore raw

PATCH v5 4/9 board: ti: dra7xx-evm: turn on USB clocks in late init stage

+Lokesh

Quoted 35 lines · Jean-Jacques Hiblot

Hi Marek,

Quoted 11 lines · Marek Vasut
Quoted 9 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

Shouldnt the driver turn this on?

AFAIK there is no clock driver for the OMAP. So we have to do it before
the driver is probed.

Maybe it's time to implement it instead of piling up those hacks ?

I was thinking along the same lines at some point but then I realized that it will make the SPL really big. And we are already tight on some platforms like am335x.

But this is not only SPL , right ? And yes, for SPL you might need to poke registers or something.

IMHO having 2 different ways to enable the clocks in SPL and in u-boot is an not improvement over the current situation.
In any case, This is a subject that can be discussed.

Tom, Lokesh,  do you have an opinion on this ?

Meanwhile It would nice to have DM_USB support for the DRA7/AM57 platforms. It allows using a USB ether adapter with CONFIG_DM_ETHER enabled (default on TI's platform). And this series allows using the USB 3.0 on AM57 evm.

JJ

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

#14 lore raw

PATCH v5 4/9 board: ti: dra7xx-evm: turn on USB clocks in late init stage

In reply to Jean-Jacques Hiblot
Quoted 13 lines · Jean-Jacques Hiblot

Hi Marek,

Quoted 9 lines · Marek Vasut
Quoted 9 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

Shouldnt the driver turn this on?

AFAIK there is no clock driver for the OMAP. So we have to do it before
the driver is probed.

Maybe it's time to implement it instead of piling up those hacks ?

I was thinking along the same lines at some point but then I realized that it will make the SPL really big. And we are already tight on some platforms like am335x.

Quoted 6 lines
Quoted 2 lines

But this is not only SPL , right ? And yes, for SPL you might need to poke registers or something.

IMHO having 2 different ways to enable the clocks in SPL and in u-boot is an not improvement over the current situation.
In any case, This is a subject that can be discussed.

Do you have a better idea ?

Quoted 11 lines

Tom, Lokesh,  do you have an opinion on this ?

Meanwhile It would nice to have DM_USB support for the DRA7/AM57 platforms. It allows using a USB ether adapter with CONFIG_DM_ETHER enabled (default on TI's platform). And this series allows using the USB 3.0 on AM57 evm.

JJ

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

PATCH v5 4/9 board: ti: dra7xx-evm: turn on USB clocks in late init stage

Quoted 13 lines · Marek Vasut
Quoted 12 lines · Jean-Jacques Hiblot

Hi Marek,

Quoted 8 lines · Marek Vasut
Quoted 8 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line

Shouldnt the driver turn this on?

AFAIK there is no clock driver for the OMAP. So we have to do it before
the driver is probed.

Maybe it's time to implement it instead of piling up those hacks ?

I was thinking along the same lines at some point but then I realized that it will make the SPL really big. And we are already tight on some platforms like am335x.

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

But this is not only SPL , right ? And yes, for SPL you might need to poke registers or something.

IMHO having 2 different ways to enable the clocks in SPL and in u-boot is an not improvement over the current situation.
In any case, This is a subject that can be discussed.

Do you have a better idea ?

I would keep it as it is today.

After studying the clock management in Linux, I believe that implementing the clock drivers in u-boot won't be an easy task and moreover won't make things much cleaner.
The way clocks are handled in Linux for the omap platforms is not completely standard. There are a lot of clocks that are handled by the clock framework (pll, mux, some gates, ...) but most of the clock gating for peripherals is handled the HWMOD subsystem which automatically enables/disables the clocks of the peripherals. Parameters for this subsystem are hard-coded in platform code (in arch/arm/mach-omap2/omap-hwmod_xxx_data.c) not in the DTS. It also handle clock and power domains.
HWMOD is probably going to go away some day, I'm not sure that we want to implement it in u-boot. Until hwmod has completely replaced by more generic frameworks, I would stick to platform code to enable clocks in u-boot.

Jean-Jacques

Quoted 13 lines
Quoted 12 lines

Tom, Lokesh,  do you have an opinion on this ?

Meanwhile It would nice to have DM_USB support for the DRA7/AM57 platforms. It allows using a USB ether adapter with CONFIG_DM_ETHER enabled (default on TI's platform). And this series allows using the USB 3.0 on AM57 evm.

JJ

#16 lore raw

PATCH v5 4/9 board: ti: dra7xx-evm: turn on USB clocks in late init stage

Quoted 24 lines · Jean-Jacques Hiblot
Quoted 13 lines · Marek Vasut
Quoted 12 lines · Jean-Jacques Hiblot

Hi Marek,

Quoted 8 lines · Marek Vasut
Quoted 8 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line

Shouldnt the driver turn this on?

AFAIK there is no clock driver for the OMAP. So we have to do it before
the driver is probed.

Maybe it's time to implement it instead of piling up those hacks ?

I was thinking along the same lines at some point but then I realized that it will make the SPL really big. And we are already tight on some platforms like am335x.

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

But this is not only SPL , right ? And yes, for SPL you might need to poke registers or something.

IMHO having 2 different ways to enable the clocks in SPL and in u-boot is an not improvement over the current situation.
In any case, This is a subject that can be discussed.

Do you have a better idea ?

I would keep it as it is today.

Quoted 15 lines

After studying the clock management in Linux, I believe that implementing the clock drivers in u-boot won't be an easy task and moreover won't make things much cleaner.
The way clocks are handled in Linux for the omap platforms is not completely standard. There are a lot of clocks that are handled by the clock framework (pll, mux, some gates, ...) but most of the clock gating for peripherals is handled the HWMOD subsystem which automatically enables/disables the clocks of the peripherals. Parameters for this subsystem are hard-coded in platform code (in arch/arm/mach-omap2/omap-hwmod_xxx_data.c) not in the DTS. It also handle clock and power domains.
HWMOD is probably going to go away some day, I'm not sure that we want to implement it in u-boot. Until hwmod has completely replaced by more generic frameworks, I would stick to platform code to enable clocks in u-boot.

But if this keeps going on, eventually we will regress to where we were years ago -- having huge platform specific list of registers to poke to set a platform up and that'd be it ?

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

PATCH v5 4/9 board: ti: dra7xx-evm: turn on USB clocks in late init stage

Quoted 39 lines · Marek Vasut
Quoted 23 lines · Jean-Jacques Hiblot
Quoted 13 lines · Marek Vasut
Quoted 12 lines · Jean-Jacques Hiblot

Hi Marek,

Quoted 8 lines · Marek Vasut
Quoted 8 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line

Shouldnt the driver turn this on?

AFAIK there is no clock driver for the OMAP. So we have to do it before
the driver is probed.

Maybe it's time to implement it instead of piling up those hacks ?

I was thinking along the same lines at some point but then I realized that it will make the SPL really big. And we are already tight on some platforms like am335x.

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

But this is not only SPL , right ? And yes, for SPL you might need to poke registers or something.

IMHO having 2 different ways to enable the clocks in SPL and in u-boot is an not improvement over the current situation.
In any case, This is a subject that can be discussed.

Do you have a better idea ?

I would keep it as it is today.

Quoted 15 lines

After studying the clock management in Linux, I believe that implementing the clock drivers in u-boot won't be an easy task and moreover won't make things much cleaner.
The way clocks are handled in Linux for the omap platforms is not completely standard. There are a lot of clocks that are handled by the clock framework (pll, mux, some gates, ...) but most of the clock gating for peripherals is handled the HWMOD subsystem which automatically enables/disables the clocks of the peripherals. Parameters for this subsystem are hard-coded in platform code (in arch/arm/mach-omap2/omap-hwmod_xxx_data.c) not in the DTS. It also handle clock and power domains.
HWMOD is probably going to go away some day, I'm not sure that we want to implement it in u-boot. Until hwmod has completely replaced by more generic frameworks, I would stick to platform code to enable clocks in u-boot.

Quoted 3 lines

But if this keeps going on, eventually we will regress to where we were years ago -- having huge platform specific list of registers to poke to set a platform up and that'd be it ?

For omap clocks that would be status quo but the rest is moving toward DM

#18 lore raw

PATCH v5 4/9 board: ti: dra7xx-evm: turn on USB clocks in late init stage

In reply to Marek Vasut
Quoted 41 lines · Marek Vasut
Quoted 24 lines · Jean-Jacques Hiblot
Quoted 13 lines · Marek Vasut
Quoted 12 lines · Jean-Jacques Hiblot

Hi Marek,

Quoted 8 lines · Marek Vasut
Quoted 8 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line

Shouldnt the driver turn this on?

AFAIK there is no clock driver for the OMAP. So we have to do it before
the driver is probed.

Maybe it's time to implement it instead of piling up those hacks ?

I was thinking along the same lines at some point but then I realized that it will make the SPL really big. And we are already tight on some platforms like am335x.

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

But this is not only SPL , right ? And yes, for SPL you might need to poke registers or something.

IMHO having 2 different ways to enable the clocks in SPL and in u-boot is an not improvement over the current situation.
In any case, This is a subject that can be discussed.

Do you have a better idea ?

I would keep it as it is today.

Quoted 15 lines

After studying the clock management in Linux, I believe that implementing the clock drivers in u-boot won't be an easy task and moreover won't make things much cleaner.
The way clocks are handled in Linux for the omap platforms is not completely standard. There are a lot of clocks that are handled by the clock framework (pll, mux, some gates, ...) but most of the clock gating for peripherals is handled the HWMOD subsystem which automatically enables/disables the clocks of the peripherals. Parameters for this subsystem are hard-coded in platform code (in arch/arm/mach-omap2/omap-hwmod_xxx_data.c) not in the DTS. It also handle clock and power domains.
HWMOD is probably going to go away some day, I'm not sure that we want to implement it in u-boot. Until hwmod has completely replaced by more generic frameworks, I would stick to platform code to enable clocks in u-boot.

Quoted 3 lines

But if this keeps going on, eventually we will regress to where we were years ago -- having huge platform specific list of registers to poke to set a platform up and that'd be it ?

We should certainly re-evaluate the situation once hwmod finally gets replaced in the kernel. That's a long-standing and slowly-but-surely happening thing.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180516/1bb5801e/attachment.sig>
#19 lore raw

PATCH v5 4/9 board: ti: dra7xx-evm: turn on USB clocks in late init stage

Quoted 40 lines · Tom Rini
Quoted 39 lines · Marek Vasut
Quoted 38 lines · Jean-Jacques Hiblot
Quoted 13 lines · Marek Vasut
Quoted 12 lines · Jean-Jacques Hiblot

Hi Marek,

Quoted 8 lines · Marek Vasut
Quoted 8 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line

Shouldnt the driver turn this on?

AFAIK there is no clock driver for the OMAP. So we have to do it before
the driver is probed.

Maybe it's time to implement it instead of piling up those hacks ?

I was thinking along the same lines at some point but then I realized that it will make the SPL really big. And we are already tight on some platforms like am335x.

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

But this is not only SPL , right ? And yes, for SPL you might need to poke registers or something.

IMHO having 2 different ways to enable the clocks in SPL and in u-boot is an not improvement over the current situation.
In any case, This is a subject that can be discussed.

Do you have a better idea ?

I would keep it as it is today.

After studying the clock management in Linux, I believe that implementing the clock drivers in u-boot won't be an easy task and moreover won't make things much cleaner.
The way clocks are handled in Linux for the omap platforms is not completely standard. There are a lot of clocks that are handled by the clock framework (pll, mux, some gates, ...) but most of the clock gating for peripherals is handled the HWMOD subsystem which automatically enables/disables the clocks of the peripherals. Parameters for this subsystem are hard-coded in platform code (in arch/arm/mach-omap2/omap-hwmod_xxx_data.c) not in the DTS. It also handle clock and power domains.
HWMOD is probably going to go away some day, I'm not sure that we want to implement it in u-boot. Until hwmod has completely replaced by more generic frameworks, I would stick to platform code to enable clocks in u-boot.

Quoted 6 lines
Quoted 3 lines

But if this keeps going on, eventually we will regress to where we were years ago -- having huge platform specific list of registers to poke to set a platform up and that'd be it ?

We should certainly re-evaluate the situation once hwmod finally gets replaced in the kernel. That's a long-standing and slowly-but-surely happening thing.

I understand it is frustrating to merge this kind of platform code when a generic framework exists, but it is  one step in having DM_USB support which in the end will remove more platform code.

Quoted 1 line
#20 lore raw

PATCH v5 4/9 board: ti: dra7xx-evm: turn on USB clocks in late init stage

In reply to Jean-Jacques Hiblot
Quoted 24 lines · Jean-Jacques Hiblot
Quoted 13 lines · Marek Vasut
Quoted 12 lines · Jean-Jacques Hiblot

Hi Marek,

Quoted 8 lines · Marek Vasut
Quoted 8 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line

Shouldnt the driver turn this on?

AFAIK there is no clock driver for the OMAP. So we have to do it before
the driver is probed.

Maybe it's time to implement it instead of piling up those hacks ?

I was thinking along the same lines at some point but then I realized that it will make the SPL really big. And we are already tight on some platforms like am335x.

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

But this is not only SPL , right ? And yes, for SPL you might need to poke registers or something.

IMHO having 2 different ways to enable the clocks in SPL and in u-boot is an not improvement over the current situation.
In any case, This is a subject that can be discussed.

Do you have a better idea ?

I would keep it as it is today.

Quoted 13 lines

After studying the clock management in Linux, I believe that implementing the clock drivers in u-boot won't be an easy task and moreover won't make things much cleaner.
The way clocks are handled in Linux for the omap platforms is not completely standard. There are a lot of clocks that are handled by the clock framework (pll, mux, some gates, ...) but most of the clock gating for peripherals is handled the HWMOD subsystem which automatically enables/disables the clocks of the peripherals. Parameters for this subsystem are hard-coded in platform code (in arch/arm/mach-omap2/omap-hwmod_xxx_data.c) not in the DTS. It also handle clock and power domains.
HWMOD is probably going to go away some day, I'm not sure that we want to implement it in u-boot. Until hwmod has completely replaced by more generic frameworks, I would stick to platform code to enable clocks in u-boot.

Yes, this is an area that doesn't have a small, clean and generic solution.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180516/01c9b66d/attachment.sig>
#21 lore raw

PATCH v5 5/9 board; ti: am57xx: turn on USB clocks

In reply to Jean-Jacques Hiblot

From: Vignesh R <[email protected]>

Enable USB clocks in late init stage to support ports under DM_USB.

---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2:
- am57xx boards: when DM_USB is used, turn on the required USB clocks

 board/ti/am57xx/board.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
board/ti/am57xx/board.c +19 -0
index 5bd8778..cd53776 100644
@@ -676,6 +676,19 @@ out:
 	return;
 }
 
+#if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL)
+static int device_okay(const char *path)
+{
+	int node;
+
+	node = fdt_path_offset(gd->fdt_blob, path);
+	if (node < 0)
+		return 0;
+
+	return fdtdec_get_is_enabled(gd->fdt_blob, node);
+}
+#endif
+
 int board_late_init(void)
 {
 	setup_board_eeprom_env();
@@ -715,6 +728,12 @@ int board_late_init(void)
 	board_ti_set_ethaddr(2);
 #endif
 
+#if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL)
+	if (device_okay("/ocp/omap_dwc3_1 at 48880000"))
+		enable_usb_clocks(0);
+	if (device_okay("/ocp/omap_dwc3_2 at 488c0000"))
+		enable_usb_clocks(1);
+#endif
 	return 0;
 }
 
Signature · 1 line
2.7.4
#22 lore raw

PATCH v5 6/9 dts: dra7x: make ocp2scp@4a080000 compatible with simple-bus

In reply to Jean-Jacques Hiblot

This is required when DM_USB is used, to bind the USB phys.

---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2:
- split dts changes in 2 commits: one for binding the children of ocp2scp at 4a080000, and one to disable USB1 on all DRA7 EVMs

 arch/arm/dts/omap5-u-boot.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/dts/omap5-u-boot.dtsi +4 -0
index bf2684c..a6a7801 100644
@@ -15,6 +15,10 @@
 	ocp {
 		u-boot,dm-spl;
 
+		ocp2scp at 4a080000 {
+			compatible = "ti,omap-ocp2scp", "simple-bus";
+		};
+
 		ocp2scp at 4a090000 {
 			compatible = "ti,omap-ocp2scp", "simple-bus";
 		};
Signature · 1 line
2.7.4
#23 lore raw

PATCH v5 7/9 dts: dra7x: Disable USB1 on all evms

In reply to Jean-Jacques Hiblot

On all the EVMs featuring a SOC of the DRA7 family, the USB1 port is used as a device for DFU. This port is managed by the platform code and must not be advertised to the DWC3 DM driver.
This will be changed when/if support for the device mode is added to the dwc3-omap driver.

---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2:
- Instead of disabling USB1 port in dts files, use *-u-boot.dtsi files

 arch/arm/dts/dra7-evm-u-boot.dtsi       |  8 ++++++++
 arch/arm/dts/dra71-evm-u-boot.dtsi      |  9 +++++++++
 arch/arm/dts/dra72-evm-revc-u-boot.dtsi |  8 ++++++++
 arch/arm/dts/dra72-evm-u-boot.dtsi      | 22 ++++++++++++++++++++++
 arch/arm/dts/dra76-evm-u-boot.dtsi      |  9 +++++++++
 5 files changed, 56 insertions(+)
 create mode 100644 arch/arm/dts/dra72-evm-u-boot.dtsi
arch/arm/dts/dra7-evm-u-boot.dtsi +8 -0
index 3e7da7c..59b5643 100644
@@ -33,3 +33,11 @@
 &mmc2_iodelay_hs200_rev20_conf {
 	u-boot,dm-spl;
 };
+
+&usb1 {
+	status = "disabled";
+};
+
+&omap_dwc3_1 {
+	status = "disabled";
+};
arch/arm/dts/dra71-evm-u-boot.dtsi +9 -0
index e2ab0bb..a61fcfb 100644
@@ -45,3 +45,12 @@
 &mmc2_iodelay_hs200_rev20_conf {
 	u-boot,dm-spl;
 };
+
+&usb1 {
+	status = "disabled";
+};
+
+&omap_dwc3_1 {
+	status = "disabled";
+};
+
arch/arm/dts/dra72-evm-revc-u-boot.dtsi +8 -0
index e2ab0bb..aeca9b2 100644
@@ -45,3 +45,11 @@
 &mmc2_iodelay_hs200_rev20_conf {
 	u-boot,dm-spl;
 };
+
+&usb1 {
+	status = "disabled";
+};
+
+&omap_dwc3_1 {
+	status = "disabled";
+};
arch/arm/dts/dra72-evm-u-boot.dtsi new file +22 -0
new file mode 100644
index 0000000..3d1dd6a
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include "omap5-u-boot.dtsi"
+
+&pcf_gpio_21{
+	u-boot,i2c-offset-len = <0>;
+};
+
+&pcf_hdmi{
+	u-boot,i2c-offset-len = <0>;
+};
+
+&usb1 {
+	status = "disabled";
+};
+
+&omap_dwc3_1 {
+	status = "disabled";
+};
arch/arm/dts/dra76-evm-u-boot.dtsi +9 -0
index a5a0694..c719421 100644
@@ -25,3 +25,12 @@
 &mmc2_iodelay_hs200_conf {
 	u-boot,dm-spl;
 };
+
+&usb1 {
+	status = "disabled";
+};
+
+&omap_dwc3_1 {
+	status = "disabled";
+};
+
Signature · 1 line
2.7.4
#24 lore raw

PATCH v5 8/9 configs: enable OMAP_USB2_PHY for all DRA7 platforms

In reply to Jean-Jacques Hiblot

---

Changes in v5: None
Changes in v4:
- Remove dependency on MISC
- Renamed the commit (DM_USB is already enabled, the only missing option is for the USB2 phy driver)

Changes in v3: None
Changes in v2: None

 configs/dra7xx_evm_defconfig    | 1 +
 configs/dra7xx_hs_evm_defconfig | 1 +
 2 files changed, 2 insertions(+)
configs/dra7xx_evm_defconfig +1 -0
index 9b81b0c..562046f 100644
@@ -68,6 +68,7 @@ CONFIG_DRIVER_TI_CPSW=y
 CONFIG_PHY_GIGE=y
 CONFIG_SPL_PHY=y
 CONFIG_PIPE3_PHY=y
+CONFIG_OMAP_USB2_PHY=y
 CONFIG_PMIC_PALMAS=y
 CONFIG_PMIC_LP873X=y
 CONFIG_DM_REGULATOR_FIXED=y
configs/dra7xx_hs_evm_defconfig +1 -0
index 536946e..6375aad 100644
@@ -67,6 +67,7 @@ CONFIG_DRIVER_TI_CPSW=y
 CONFIG_PHY_GIGE=y
 CONFIG_SPL_PHY=y
 CONFIG_PIPE3_PHY=y
+CONFIG_OMAP_USB2_PHY=y
 CONFIG_PMIC_PALMAS=y
 CONFIG_PMIC_LP873X=y
 CONFIG_DM_REGULATOR_FIXED=y
Signature · 1 line
2.7.4
#25 lore raw

PATCH v5 9/9 configs: am57xx_evm: Enable DM_USB and dependencies

In reply to Jean-Jacques Hiblot

Enable DM_USB for AM57xx based boards.

---
Changes in v5: None
Changes in v4:
- Remove dependency on MISC
- Remove omap specific glue layer and use dwc3-of-simple glue layer

Changes in v3: None
Changes in v2:
- Enable DM_USB in am57xx_evm_defconfig. USB3 (super speed) is supported.

 configs/am57xx_evm_defconfig | 4 ++++
 1 file changed, 4 insertions(+)
configs/am57xx_evm_defconfig +4 -0
index 0e99268..dc2f29c 100644
@@ -79,3 +79,7 @@ CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
 CONFIG_USB_GADGET_VENDOR_NUM=0x0451
 CONFIG_USB_GADGET_PRODUCT_NUM=0xd022
+CONFIG_DM_USB=y
+CONFIG_OMAP_USB2_PHY=y
+CONFIG_PIPE3_PHY=y
+CONFIG_PHY=y
Signature · 1 line
2.7.4