Skip to contentSkip to conversation

TI/Cadence: Add Sierra/Torrent SERDES driver

PATCH Superseded Kishon Vijay Abraham I 3 participants 36 messages May 4, 2021 – Jul 9, 2021

Subsystems (7)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v3 cover TI/Cadence: Add Sierra/Torrent SERDES driver

Patch series adds Sierra and Torrent SERDES driver for the SERDES used in TI's K3 platforms. This SERDES is used by USB3, PCIe and Ethernet. This series is mostly an adaptation of drivers added in upstream Linux kernel.

Changes from v2:
1) Re-worked "Handle gracefully NULL pointers" to fix Simons comments
2) Ported the part that allows creating clocks without explicit sub-nodes in DT from the upstream linux kernel.

Changes from v1:
1) Fixed string comparison strncmp() to remove "=="
2) Added a test for node name comparison to ignore unit address in test/dm
3) Added better commit message in "drivers: reset: Handle gracefully NULL pointers"

Alan Douglas (1):
phy: cadence: Add driver for Sierra PHY

Aswath Govindraju (7):
dt-bindings: phy: Add definitions for additional phy types
phy: cadence: Add driver for Torrent SERDES
board: ti: j721e: Add support for probing and configuring Torrent

    serdes on J7200

arm: dts: k3-j7200-main: Add DT node for torrent serdes
arm: dts: k3-j7200-common-proc-board: Enable SERDES DT
arm: dts: k3-j7200-common-proc-board-u-boot: Add u-boot tags for
torrent serdes
configs: j7200_evm_a72_defconfig: Add config for torrent serdes and
common clock framework

Jean-Jacques Hiblot (2):
phy: ti: j721e-wiz: Add support for WIZ module present in TI J721E SoC
configs: j721e_evm_a72: Enable the drivers required for the USB3
support

Kishon Vijay Abraham I (10):
dm: core: Add helper to compare node names
dm: test: Add test case to check node name ignoring unit address
drivers: reset: Handle gracefully NULL pointers
dt-bindings: phy: Add defines for AM64 SERDES Wrapper
dt-bindings: phy: cadence-torrent: Add defines for refclk driver
dt-bindings: ti-serdes-mux: Add defines for AM64 SoC
usb: cdns3: cdns3-ti: Fix clk_get_by_name() to get the correct name
ARM: dts: k3-j721e: Add the entries required for USB3 support on USB0
env: ti: j721e-evm: Add env variable to power on & reset QSGMII PHY in

    J7200 EVM

configs: j7200_evm_a72: Enhance bootcmd to configure ethernet PHY

 .../k3-j7200-common-proc-board-u-boot.dtsi    |   12 +
 arch/arm/dts/k3-j7200-common-proc-board.dts   |   23 +
 arch/arm/dts/k3-j7200-main.dtsi               |   63 +
 .../k3-j721e-common-proc-board-u-boot.dtsi    |   19 +-
 board/ti/j721e/evm.c                          |   34 +-
 configs/j7200_evm_a72_defconfig               |    9 +-
 configs/j721e_evm_a72_defconfig               |    6 +
 drivers/core/ofnode.c                         |   13 +
 drivers/phy/Kconfig                           |    3 +
 drivers/phy/Makefile                          |    2 +
 drivers/phy/cadence/Kconfig                   |   11 +
 drivers/phy/cadence/Makefile                  |    2 +
 drivers/phy/cadence/phy-cadence-sierra.c      |  757 +++++
 drivers/phy/cadence/phy-cadence-torrent.c     | 2468 +++++++++++++++++
 drivers/phy/ti/Kconfig                        |    9 +
 drivers/phy/ti/Makefile                       |    1 +
 drivers/phy/ti/phy-j721e-wiz.c                | 1154 ++++++++
 drivers/reset/reset-uclass.c                  |   35 +-
 drivers/usb/cdns3/cdns3-ti.c                  |    2 +-
 include/configs/j721e_evm.h                   |   16 +-
 include/dm/ofnode.h                           |   10 +
 include/dt-bindings/mux/ti-serdes.h           |    5 +
 include/dt-bindings/phy/phy-cadence.h         |   20 +
 include/dt-bindings/phy/phy-ti.h              |   21 +
 include/dt-bindings/phy/phy.h                 |    1 +
 test/dm/core.c                                |   14 +
 26 files changed, 4700 insertions(+), 10 deletions(-)
 create mode 100644 drivers/phy/cadence/Kconfig
 create mode 100644 drivers/phy/cadence/Makefile
 create mode 100644 drivers/phy/cadence/phy-cadence-sierra.c
 create mode 100644 drivers/phy/cadence/phy-cadence-torrent.c
 create mode 100644 drivers/phy/ti/Kconfig
 create mode 100644 drivers/phy/ti/Makefile
 create mode 100644 drivers/phy/ti/phy-j721e-wiz.c
 create mode 100644 include/dt-bindings/phy/phy-cadence.h
 create mode 100644 include/dt-bindings/phy/phy-ti.h
Signature · 1 line
2.17.1
#1 lore raw

PATCH v3 1/20 dm: core: Add helper to compare node names

Add helper to compare node names.

---
 drivers/core/ofnode.c | 13 +++++++++++++
 include/dm/ofnode.h   | 10 ++++++++++
 2 files changed, 23 insertions(+)
drivers/core/ofnode.c +13 -0
index d50533338e..2a5b12040c 100644
@@ -18,6 +18,19 @@
 #include <linux/ioport.h>
 #include <asm/global_data.h>
 
+bool ofnode_name_eq(ofnode node, const char *name)
+{
+	const char *node_name;
+	size_t len;
+
+	assert(ofnode_valid(node));
+
+	node_name = ofnode_get_name(node);
+	len = strchrnul(node_name, '@') - node_name;
+
+	return (strlen(name) == len) && !strncmp(node_name, name, len);
+}
+
 int ofnode_read_u32(ofnode node, const char *propname, u32 *outp)
 {
 	return ofnode_read_u32_index(node, propname, 0, outp);
include/dm/ofnode.h +10 -0
index 8a69fd87da..ca98f7237c 100644
@@ -231,6 +231,16 @@ static inline ofnode ofnode_root(void)
 	return node;
 }
 
+/**
+ * ofnode_name_eq() - Check if the node name is equivalent to a given name
+ *                    ignoring the unit address
+ *
+ * @node:	valid node reference that has to be compared
+ * @name:	name that has to be compared with the node name
+ * @return true if matches, false if it doesn't match
+ */
+bool ofnode_name_eq(ofnode node, const char *name);
+
 /**
  * ofnode_read_u32() - Read a 32-bit integer from a property
  *
Signature · 1 line
2.17.1
#3 lore raw

PATCH v3 2/20 dm: test: Add test case to check node name ignoring unit address

In reply to Kishon Vijay Abraham I

Add test to check node name ignoring unit address.

---
 test/dm/core.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
test/dm/core.c +14 -0
index 2210345dd1..e83f71f767 100644
@@ -177,6 +177,20 @@ static int dm_test_autobind_uclass_pdata_alloc(struct unit_test_state *uts)
 }
 DM_TEST(dm_test_autobind_uclass_pdata_alloc, UT_TESTF_SCAN_PDATA);
 
+/* compare node names ignoring the unit address */
+static int dm_test_compare_node_name(struct unit_test_state *uts)
+{
+	ofnode node;
+
+	node = ofnode_path("/mmio-bus at 0");
+	ut_assert(ofnode_valid(node));
+	ut_assert(ofnode_name_eq(node, "mmio-bus"));
+
+	return 0;
+}
+
+DM_TEST(dm_test_compare_node_name, UT_TESTF_SCAN_PDATA);
+
 /* Test that binding with uclass plat setting occurs correctly */
 static int dm_test_autobind_uclass_pdata_valid(struct unit_test_state *uts)
 {
Signature · 1 line
2.17.1
#4 lore raw

PATCH v3 3/20 drivers: reset: Handle gracefully NULL pointers

In reply to Kishon Vijay Abraham I

The reset framework provides devm_reset_control_get_optional() which can return NULL (not an error case). So all the other reset_ops should handle NULL gracefully. Prepare the way for a managed reset API by handling NULL pointers without crashing nor failing.

---
 drivers/reset/reset-uclass.c | 35 ++++++++++++++++++++++++++++++-----
 1 file changed, 30 insertions(+), 5 deletions(-)
drivers/reset/reset-uclass.c +30 -5
index ac89eaf098..18dfe06d1c 100644
@@ -162,7 +162,12 @@ int reset_get_by_name(struct udevice *dev, const char *name,
 
 int reset_request(struct reset_ctl *reset_ctl)
 {
-	struct reset_ops *ops = reset_dev_ops(reset_ctl->dev);
+	struct reset_ops *ops;
+
+	if (!reset_ctl)
+		return 0;
+
+	ops = reset_dev_ops(reset_ctl->dev);
 
 	debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
 
@@ -171,7 +176,12 @@ int reset_request(struct reset_ctl *reset_ctl)
 
 int reset_free(struct reset_ctl *reset_ctl)
 {
-	struct reset_ops *ops = reset_dev_ops(reset_ctl->dev);
+	struct reset_ops *ops;
+
+	if (!reset_ctl)
+		return 0;
+
+	ops = reset_dev_ops(reset_ctl->dev);
 
 	debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
 
@@ -180,7 +190,12 @@ int reset_free(struct reset_ctl *reset_ctl)
 
 int reset_assert(struct reset_ctl *reset_ctl)
 {
-	struct reset_ops *ops = reset_dev_ops(reset_ctl->dev);
+	struct reset_ops *ops;
+
+	if (!reset_ctl)
+		return 0;
+
+	ops = reset_dev_ops(reset_ctl->dev);
 
 	debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
 
@@ -202,7 +217,12 @@ int reset_assert_bulk(struct reset_ctl_bulk *bulk)
 
 int reset_deassert(struct reset_ctl *reset_ctl)
 {
-	struct reset_ops *ops = reset_dev_ops(reset_ctl->dev);
+	struct reset_ops *ops;
+
+	if (!reset_ctl)
+		return 0;
+
+	ops = reset_dev_ops(reset_ctl->dev);
 
 	debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
 
@@ -224,7 +244,12 @@ int reset_deassert_bulk(struct reset_ctl_bulk *bulk)
 
 int reset_status(struct reset_ctl *reset_ctl)
 {
-	struct reset_ops *ops = reset_dev_ops(reset_ctl->dev);
+	struct reset_ops *ops;
+
+	if (!reset_ctl)
+		return 0;
+
+	ops = reset_dev_ops(reset_ctl->dev);
 
 	debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
 
Signature · 1 line
2.17.1
#5 lore raw

PATCH v3 3/20 drivers: reset: Handle gracefully NULL pointers

Hi Kishon,

Quoted 11 lines · Kishon Vijay Abraham I

The reset framework provides devm_reset_control_get_optional() which can return NULL (not an error case). So all the other reset_ops should handle NULL gracefully. Prepare the way for a managed reset API by handling NULL pointers without crashing nor failing.

---
 drivers/reset/reset-uclass.c | 35 ++++++++++++++++++++++++++++++-----
 1 file changed, 30 insertions(+), 5 deletions(-)

I am still not a fan of this. There is no way to know whether the reset API call actually did anything. Normally we return -EINVAL or something like that when the value is invalid (e.g. see GPIO uclass).

The function you mention says: * Returns a struct reset_ctl or a dummy reset controller if it failed.

But it does not appear to do that?

Regards,
Simon

#6 lore raw

PATCH v3 3/20 drivers: reset: Handle gracefully NULL pointers

Hi Simon,

Quoted 15 lines · Simon Glass

Hi Kishon,

Quoted 11 lines · Kishon Vijay Abraham I

The reset framework provides devm_reset_control_get_optional() which can return NULL (not an error case). So all the other reset_ops should handle NULL gracefully. Prepare the way for a managed reset API by handling NULL pointers without crashing nor failing.

---
 drivers/reset/reset-uclass.c | 35 ++++++++++++++++++++++++++++++-----
 1 file changed, 30 insertions(+), 5 deletions(-)
Quoted 3 lines

I am still not a fan of this. There is no way to know whether the reset API call actually did anything. Normally we return -EINVAL or something like that when the value is invalid (e.g. see GPIO uclass).

The reset modification is more in-line with how clk uclass is designed.

There every API first checks if the clock is valid and returns 0 (will be the case for optional clocks)

       if (!clk_valid(clk))
                return 0;

If you don't prefer this approach, I'll drop this patch and handle it appropriately in the client driver (serdes driver). Please let me know.

Quoted 5 lines

The function you mention says: * Returns a struct reset_ctl or a dummy reset controller if it failed.

But it does not appear to do that?

Right, looks like it's incorrect from when the patch was actually introduced. It was returning "NULL" for optional resets.

commit 139e4a1cbe60de96d4febbc6db5882929801ca46

Author: Jean-Jacques Hiblot <[email protected]>
Date:   Wed Sep 9 15:37:03 2020 +0530

drivers: reset: Add a managed API to get reset controllers from the DT

Thanks
Kishon

#7 lore raw

PATCH v3 3/20 drivers: reset: Handle gracefully NULL pointers

Hi Kishon,

Quoted 25 lines · Kishon Vijay Abraham I

Hi Simon,

Quoted 15 lines · Simon Glass

Hi Kishon,

Quoted 11 lines · Kishon Vijay Abraham I

The reset framework provides devm_reset_control_get_optional() which can return NULL (not an error case). So all the other reset_ops should handle NULL gracefully. Prepare the way for a managed reset API by handling NULL pointers without crashing nor failing.

---
 drivers/reset/reset-uclass.c | 35 ++++++++++++++++++++++++++++++-----
 1 file changed, 30 insertions(+), 5 deletions(-)
Quoted 3 lines

I am still not a fan of this. There is no way to know whether the reset API call actually did anything. Normally we return -EINVAL or something like that when the value is invalid (e.g. see GPIO uclass).

The reset modification is more in-line with how clk uclass is designed.

Quoted 7 lines

There every API first checks if the clock is valid and returns 0 (will be the case for optional clocks)

       if (!clk_valid(clk))
                return 0;

If you don't prefer this approach, I'll drop this patch and handle it appropriately in the client driver (serdes driver). Please let me know.

Yes I see that with clk. IMO the return code is incorrect there also, since it should be -ENOENT or something like that, to indicate that there is actually no clock.

The clk.h header gives no indication that it accepts a NULL clock. So here is what I think:

1. Update clk_valid() to require clk to be a valid pointer, so it is considered invalid only if clk-dev.

2. Update the reset 'managed API' to return an empty reset record instead of NULL.

3. Your problem goes away, and (I think) we are still compatible with the linux API.

Quoted 7 lines
Quoted 6 lines

The function you mention says: * Returns a struct reset_ctl or a dummy reset controller if it failed.

But it does not appear to do that?

Quoted 8 lines

Right, looks like it's incorrect from when the patch was actually introduced. It was returning "NULL" for optional resets.

commit 139e4a1cbe60de96d4febbc6db5882929801ca46

Author: Jean-Jacques Hiblot <[email protected]>
Date:   Wed Sep 9 15:37:03 2020 +0530

drivers: reset: Add a managed API to get reset controllers from the DT

OK. So what should it be?

Regards,
Simon

#8 lore raw

PATCH v3 3/20 drivers: reset: Handle gracefully NULL pointers

Hi Simon,

Quoted 40 lines · Simon Glass

Hi Kishon,

Quoted 25 lines · Kishon Vijay Abraham I

Hi Simon,

Quoted 15 lines · Simon Glass

Hi Kishon,

Quoted 11 lines · Kishon Vijay Abraham I

The reset framework provides devm_reset_control_get_optional() which can return NULL (not an error case). So all the other reset_ops should handle NULL gracefully. Prepare the way for a managed reset API by handling NULL pointers without crashing nor failing.

---
 drivers/reset/reset-uclass.c | 35 ++++++++++++++++++++++++++++++-----
 1 file changed, 30 insertions(+), 5 deletions(-)
Quoted 3 lines

I am still not a fan of this. There is no way to know whether the reset API call actually did anything. Normally we return -EINVAL or something like that when the value is invalid (e.g. see GPIO uclass).

The reset modification is more in-line with how clk uclass is designed.

Quoted 7 lines

There every API first checks if the clock is valid and returns 0 (will be the case for optional clocks)

       if (!clk_valid(clk))
                return 0;

If you don't prefer this approach, I'll drop this patch and handle it appropriately in the client driver (serdes driver). Please let me know.

Yes I see that with clk. IMO the return code is incorrect there also, since it should be -ENOENT or something like that, to indicate that there is actually no clock.

Quoted 5 lines

The clk.h header gives no indication that it accepts a NULL clock. So here is what I think:

1. Update clk_valid() to require clk to be a valid pointer, so it is considered invalid only if clk-dev.

So for API's like clk_enable(), clk_disable(), should it return 0 or -ENOENT; i.e if clk is valid and clk->dev is NULL?

Quoted 3 lines

2. Update the reset 'managed API' to return an empty reset record instead of NULL.

Okay, something like below?

drivers/reset/reset-uclass.c +0 -0
@@ -326,9 +326,6 @@ struct reset_ctl

*devm_reset_control_get_optional(struct udevice *dev,

 {
        struct reset_ctl *r = devm_reset_control_get(dev, id);

- if (IS_ERR(r))
- return NULL;
-

        return r;

}

The only thing to note here is _get_optional() is a wrapper to _get() with no modification.

Quoted 14 lines

3. Your problem goes away, and (I think) we are still compatible with the linux API.

Quoted 10 lines
Quoted 6 lines

The function you mention says: * Returns a struct reset_ctl or a dummy reset controller if it failed.

But it does not appear to do that?

Right, looks like it's incorrect from when the patch was actually introduced. It was returning "NULL" for optional resets.

Quoted 7 lines
Quoted 5 lines

commit 139e4a1cbe60de96d4febbc6db5882929801ca46

Author: Jean-Jacques Hiblot <[email protected]>
Date:   Wed Sep 9 15:37:03 2020 +0530

drivers: reset: Add a managed API to get reset controllers from the DT

OK. So what should it be?

I meant the comment in header is incorrect since it was returning NULL if it failed.

Thanks,
Kishon

#9 lore raw

PATCH v3 3/20 drivers: reset: Handle gracefully NULL pointers

Hi Kishon,

Quoted 71 lines · Kishon Vijay Abraham I

Hi Simon,

Quoted 40 lines · Simon Glass

Hi Kishon,

Quoted 25 lines · Kishon Vijay Abraham I

Hi Simon,

Quoted 15 lines · Simon Glass

Hi Kishon,

Quoted 11 lines · Kishon Vijay Abraham I

The reset framework provides devm_reset_control_get_optional() which can return NULL (not an error case). So all the other reset_ops should handle NULL gracefully. Prepare the way for a managed reset API by handling NULL pointers without crashing nor failing.

---
 drivers/reset/reset-uclass.c | 35 ++++++++++++++++++++++++++++++-----
 1 file changed, 30 insertions(+), 5 deletions(-)
Quoted 3 lines

I am still not a fan of this. There is no way to know whether the reset API call actually did anything. Normally we return -EINVAL or something like that when the value is invalid (e.g. see GPIO uclass).

The reset modification is more in-line with how clk uclass is designed.

Quoted 7 lines

There every API first checks if the clock is valid and returns 0 (will be the case for optional clocks)

       if (!clk_valid(clk))
                return 0;

If you don't prefer this approach, I'll drop this patch and handle it appropriately in the client driver (serdes driver). Please let me know.

Yes I see that with clk. IMO the return code is incorrect there also, since it should be -ENOENT or something like that, to indicate that there is actually no clock.

Quoted 5 lines

The clk.h header gives no indication that it accepts a NULL clock. So here is what I think:

1. Update clk_valid() to require clk to be a valid pointer, so it is considered invalid only if clk-dev.

So for API's like clk_enable(), clk_disable(), should it return 0 or -ENOENT; i.e if clk is valid and clk->dev is NULL?

Quoted 3 lines

2. Update the reset 'managed API' to return an empty reset record instead of NULL.

Okay, something like below?

drivers/reset/reset-uclass.c +0 -3
@@ -326,9 +326,6 @@ struct reset_ctl
 *devm_reset_control_get_optional(struct udevice *dev,
 {
        struct reset_ctl *r = devm_reset_control_get(dev, id);
 
-       if (IS_ERR(r))
-               return NULL;
-
        return r;
 }
Quoted 2 lines

The only thing to note here is _get_optional() is a wrapper to _get() with no modification.

OK.

Quoted 18 lines
Quoted 18 lines

3. Your problem goes away, and (I think) we are still compatible with the linux API.

Quoted 14 lines
Quoted 6 lines

The function you mention says: * Returns a struct reset_ctl or a dummy reset controller if it failed.

But it does not appear to do that?

Right, looks like it's incorrect from when the patch was actually introduced. It was returning "NULL" for optional resets.

commit 139e4a1cbe60de96d4febbc6db5882929801ca46

Author: Jean-Jacques Hiblot <[email protected]>
Date:   Wed Sep 9 15:37:03 2020 +0530
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

drivers: reset: Add a managed API to get reset controllers from the DT

OK. So what should it be?

I meant the comment in header is incorrect since it was returning NULL if it failed.

OK, well then you could add a patch for it. The problem with a pointer value is that you cannot both communicate an error and return a valid pointer.

Regards,
Simon

#10 lore raw

PATCH v3 4/20 dt-bindings: phy: Add definitions for additional phy types

In reply to Kishon Vijay Abraham I

From: Aswath Govindraju <[email protected]>

Add definitions for additional phy types that's used specifically for Torrent SERDES.

---
 include/dt-bindings/phy/phy.h | 1 +
 1 file changed, 1 insertion(+)
include/dt-bindings/phy/phy.h +1 -0
index 7e657da454..d3714edd4b 100644
@@ -19,5 +19,6 @@
 #define PHY_TYPE_DP		6
 #define PHY_TYPE_XPCS		7
 #define PHY_TYPE_SGMII		8
+#define PHY_TYPE_QSGMII		9
 
 #endif /* _DT_BINDINGS_PHY */
Signature · 1 line
2.17.1
#11 lore raw

PATCH v3 5/20 dt-bindings: phy: Add defines for AM64 SERDES Wrapper

In reply to Kishon Vijay Abraham I

Add defines for AM64 SERDES Wrapper.

---
 include/dt-bindings/phy/phy-ti.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 include/dt-bindings/phy/phy-ti.h
include/dt-bindings/phy/phy-ti.h new file +21 -0
new file mode 100644
index 0000000000..ad955d3a56
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * This header provides constants for TI SERDES.
+ */
+
+#ifndef _DT_BINDINGS_TI_SERDES
+#define _DT_BINDINGS_TI_SERDES
+
+/* Clock index for output clocks from WIZ */
+
+/* MUX Clocks */
+#define TI_WIZ_PLL0_REFCLK	0
+#define TI_WIZ_PLL1_REFCLK	1
+#define TI_WIZ_REFCLK_DIG	2
+
+/* Reserve index here for future additions */
+
+/* MISC Clocks */
+#define TI_WIZ_PHY_EN_REFCLK	16
+
+#endif /* _DT_BINDINGS_TI_SERDES */
Signature · 1 line
2.17.1
#12 lore raw

PATCH v3 6/20 dt-bindings: phy: cadence-torrent: Add defines for refclk driver

In reply to Kishon Vijay Abraham I

Add defines for refclk driver used to route the refclk out of torrent SERDES.

---
 include/dt-bindings/phy/phy-cadence.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 include/dt-bindings/phy/phy-cadence.h
include/dt-bindings/phy/phy-cadence.h new file +20 -0
new file mode 100644
index 0000000000..4652bcb862
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * This header provides constants for Cadence SERDES.
+ */
+
+#ifndef _DT_BINDINGS_CADENCE_SERDES_H
+#define _DT_BINDINGS_CADENCE_SERDES_H
+
+/* Torrent */
+#define TORRENT_SERDES_NO_SSC		0
+#define TORRENT_SERDES_EXTERNAL_SSC	1
+#define TORRENT_SERDES_INTERNAL_SSC	2
+
+#define CDNS_TORRENT_REFCLK_DRIVER      0
+
+/* Sierra */
+#define CDNS_SIERRA_PLL_CMNLC		0
+#define CDNS_SIERRA_PLL_CMNLC1		1
+
+#endif /* _DT_BINDINGS_CADENCE_SERDES_H */
Signature · 1 line
2.17.1
#13 lore raw

PATCH v3 7/20 dt-bindings: ti-serdes-mux: Add defines for AM64 SoC

In reply to Kishon Vijay Abraham I

AM64 has a single lane SERDES which can be configured to be used with either PCIe or USB. Define the possilbe values for the SERDES function in AM64 SoC here.

---
 include/dt-bindings/mux/ti-serdes.h | 5 +++++
 1 file changed, 5 insertions(+)
include/dt-bindings/mux/ti-serdes.h +5 -0
index 9047ec6bd3..d417b9268b 100644
@@ -90,4 +90,9 @@
 #define J7200_SERDES0_LANE3_USB			0x2
 #define J7200_SERDES0_LANE3_IP4_UNUSED		0x3
 
+/* AM64 */
+
+#define AM64_SERDES0_LANE0_PCIE0		0x0
+#define AM64_SERDES0_LANE0_USB			0x1
+
 #endif /* _DT_BINDINGS_MUX_TI_SERDES */
Signature · 1 line
2.17.1
#14 lore raw

PATCH v3 8/20 phy: cadence: Add driver for Sierra PHY

In reply to Kishon Vijay Abraham I

From: Alan Douglas <[email protected]>

Add a Sierra PHY driver with PCIe and USB support. This driver is a port from the mainline linux driver.

The PHY has multiple lanes, which can be configured into groups, and a generic PHY device is created for each group.

There are two resets controlling the overall PHY block, one to enable the APB interface for programming registers, and another to enable the PHY itself. Additionally there are resets for each PHY lane.

The PHY can be configured in hardware to read register settings from ROM, or they can be written by the driver.

The sequence of operation on startup is to enable the APB bus, write the PHY registers (if required) for each lane group, and then enable the PHY. Each group of lanes can then be individually controlled using the power_on()/ power_off() function for that generic PHY

One difference with the linux driver is that the PHY is always reset after it is powered-on. This is because role switching is not supported in u-boot and the cable orientation is handled by the PHY reset.

---
 drivers/phy/Kconfig                      |   2 +
 drivers/phy/Makefile                     |   1 +
 drivers/phy/cadence/Kconfig              |   5 +
 drivers/phy/cadence/Makefile             |   1 +
 drivers/phy/cadence/phy-cadence-sierra.c | 757 +++++++++++++++++++++++
 5 files changed, 766 insertions(+)
 create mode 100644 drivers/phy/cadence/Kconfig
 create mode 100644 drivers/phy/cadence/Makefile
 create mode 100644 drivers/phy/cadence/phy-cadence-sierra.c
drivers/phy/Kconfig +2 -0
index 008186a10d..9208e430a6 100644
@@ -269,4 +269,6 @@ config PHY_MTK_TPHY
 	  so you can easily distinguish them by banks layout.
 
 source "drivers/phy/rockchip/Kconfig"
+source "drivers/phy/cadence/Kconfig"
+
 endmenu
drivers/phy/Makefile +1 -0
index 3c4a673a83..4736c5eadb 100644
@@ -31,3 +31,4 @@ obj-$(CONFIG_MT7620_USB_PHY) += mt7620-usb-phy.o
 obj-$(CONFIG_MT76X8_USB_PHY) += mt76x8-usb-phy.o
 obj-$(CONFIG_PHY_DA8XX_USB) += phy-da8xx-usb.o
 obj-$(CONFIG_PHY_MTK_TPHY) += phy-mtk-tphy.o
+obj-y += cadence/
drivers/phy/cadence/Kconfig new file +5 -0
new file mode 100644
index 0000000000..18a04819f5
@@ -0,0 +1,5 @@
+config PHY_CADENCE_SIERRA
+	tristate "Cadence Sierra PHY Driver"
+	depends on DM_RESET
+	help
+	  Enable this to support the Cadence Sierra PHY driver
drivers/phy/cadence/Makefile new file +1 -0
new file mode 100644
index 0000000000..d57856152a
@@ -0,0 +1 @@
+obj-$(CONFIG_$(SPL_)PHY_CADENCE_SIERRA)	+= phy-cadence-sierra.o
drivers/phy/cadence/phy-cadence-sierra.c new file +757 -0

757 lines not on this page · raw message

Signature · 1 line
2.17.1
#15 lore raw

PATCH v3 9/20 phy: cadence: Add driver for Torrent SERDES

In reply to Kishon Vijay Abraham I

From: Aswath Govindraju <[email protected]>

Add driver for Torrent SERDES.

---
 drivers/phy/cadence/Kconfig               |    6 +
 drivers/phy/cadence/Makefile              |    1 +
 drivers/phy/cadence/phy-cadence-torrent.c | 2468 +++++++++++++++++++++
 3 files changed, 2475 insertions(+)
 create mode 100644 drivers/phy/cadence/phy-cadence-torrent.c
drivers/phy/cadence/Kconfig +6 -0
index 18a04819f5..549ddbf504 100644
@@ -3,3 +3,9 @@ config PHY_CADENCE_SIERRA
 	depends on DM_RESET
 	help
 	  Enable this to support the Cadence Sierra PHY driver
+
+config PHY_CADENCE_TORRENT
+	tristate "Cadence Torrent PHY Driver"
+	depends on DM_RESET
+	help
+	  Enable this to support the Cadence Torrent PHY driver
drivers/phy/cadence/Makefile +1 -0
index d57856152a..af63b32d9f 100644
@@ -1 +1,2 @@
 obj-$(CONFIG_$(SPL_)PHY_CADENCE_SIERRA)	+= phy-cadence-sierra.o
+obj-$(CONFIG_$(SPL_)PHY_CADENCE_TORRENT) += phy-cadence-torrent.o
drivers/phy/cadence/phy-cadence-torrent.c new file +2468 -0

2,468 lines not on this page · raw message

Signature · 1 line
2.17.1
#16 lore raw

PATCH v3 10/20 phy: ti: j721e-wiz: Add support for WIZ module present in TI J721E SoC

In reply to Kishon Vijay Abraham I

From: Jean-Jacques Hiblot <[email protected]>

Add support for WIZ module present in TI's J721E SoC. WIZ is a SERDES wrapper used to configure some of the input signals to the SERDES. It is used with both Sierra(16G) and Torrent(10G) SERDES. This driver configures three clock selects (pll0, pll1, dig) and supports resets for each of the lanes.

This is an adaptation of the linux driver.

---
 drivers/phy/Kconfig            |    1 +
 drivers/phy/Makefile           |    1 +
 drivers/phy/ti/Kconfig         |    9 +
 drivers/phy/ti/Makefile        |    1 +
 drivers/phy/ti/phy-j721e-wiz.c | 1154 ++++++++++++++++++++++++++++++++
 5 files changed, 1166 insertions(+)
 create mode 100644 drivers/phy/ti/Kconfig
 create mode 100644 drivers/phy/ti/Makefile
 create mode 100644 drivers/phy/ti/phy-j721e-wiz.c
drivers/phy/Kconfig +1 -0
index 9208e430a6..7821161e3c 100644
@@ -270,5 +270,6 @@ config PHY_MTK_TPHY
 
 source "drivers/phy/rockchip/Kconfig"
 source "drivers/phy/cadence/Kconfig"
+source "drivers/phy/ti/Kconfig"
 
 endmenu
drivers/phy/Makefile +1 -0
index 4736c5eadb..2efaa8827b 100644
@@ -32,3 +32,4 @@ obj-$(CONFIG_MT76X8_USB_PHY) += mt76x8-usb-phy.o
 obj-$(CONFIG_PHY_DA8XX_USB) += phy-da8xx-usb.o
 obj-$(CONFIG_PHY_MTK_TPHY) += phy-mtk-tphy.o
 obj-y += cadence/
+obj-y += ti/
drivers/phy/ti/Kconfig new file +9 -0
new file mode 100644
index 0000000000..111085f235
@@ -0,0 +1,9 @@
+config PHY_J721E_WIZ
+	tristate "TI J721E WIZ (SERDES Wrapper) support"
+	depends on ARCH_K3
+	help
+	  This option enables support for WIZ module present in TI's J721E
+	  SoC. WIZ is a serdes wrapper used to configure some of the input
+	  signals to the SERDES (Sierra/Torrent). This driver configures
+	  three clock selects (pll0, pll1, dig) and resets for each of the
+	  lanes.
drivers/phy/ti/Makefile new file +1 -0
new file mode 100644
index 0000000000..873ddbf036
@@ -0,0 +1 @@
+obj-$(CONFIG_$(SPL_)PHY_J721E_WIZ)	+= phy-j721e-wiz.o
drivers/phy/ti/phy-j721e-wiz.c new file +1154 -0

1,154 lines not on this page · raw message

Signature · 1 line
2.17.1
#17 lore raw

PATCH v3 11/20 usb: cdns3: cdns3-ti: Fix clk_get_by_name() to get the correct name

In reply to Kishon Vijay Abraham I

Upstream device tree got updated to use clock name as "ref" instead of "usb2_refclk". Fix cdns3-ti.c to use the correct name.

---
 drivers/usb/cdns3/cdns3-ti.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/cdns3/cdns3-ti.c +1 -1
index 7b205c5656..43171678ee 100644
@@ -101,7 +101,7 @@ static int cdns_ti_probe(struct udevice *dev)
 	if (!data->usbss)
 		return -EINVAL;
 
-	ret = clk_get_by_name(dev, "usb2_refclk", &usb2_refclk);
+	ret = clk_get_by_name(dev, "ref", &usb2_refclk);
 	if (ret) {
 		dev_err(dev, "Failed to get usb2_refclk\n");
 		return ret;
Signature · 1 line
2.17.1
#18 lore raw

PATCH v3 12/20 board: ti: j721e: Add support for probing and configuring Torrent serdes on J7200

In reply to Kishon Vijay Abraham I

From: Aswath Govindraju <[email protected]>

Add support for probing and configuring Torrent serdes on J7200.

---
 board/ti/j721e/evm.c | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)
board/ti/j721e/evm.c +33 -1
index b9a9f19552..580f13c3ab 100644
@@ -10,6 +10,7 @@
 #include <common.h>
 #include <env.h>
 #include <fdt_support.h>
+#include <generic-phy.h>
 #include <image.h>
 #include <init.h>
 #include <log.h>
@@ -29,7 +30,8 @@
 #define board_is_j721e_som()	(board_ti_k3_is("J721EX-PM1-SOM") || \
 				 board_ti_k3_is("J721EX-PM2-SOM"))
 
-#define board_is_j7200_som()	board_ti_k3_is("J7200X-PM1-SOM")
+#define board_is_j7200_som()	(board_ti_k3_is("J7200X-PM1-SOM") || \
+				 board_ti_k3_is("J7200X-PM2-SOM"))
 
 /* Max number of MAC addresses that are parsed/processed per daughter card */
 #define DAUGHTER_CARD_NO_OF_MAC_ADDR	8
@@ -384,6 +386,33 @@ static int probe_daughtercards(void)
 }
 #endif
 
+void configure_serdes_torrent(void)
+{
+	struct udevice *dev;
+	struct phy serdes;
+	int ret;
+
+	if (!IS_ENABLED(CONFIG_PHY_CADENCE_TORRENT))
+		return;
+
+	ret = uclass_get_device_by_driver(UCLASS_PHY,
+					  DM_DRIVER_GET(torrent_phy_provider),
+					  &dev);
+	if (ret)
+		printf("Torrent init failed:%d\n", ret);
+
+	serdes.dev = dev;
+	serdes.id = 0;
+
+	ret = generic_phy_init(&serdes);
+	if (ret)
+		printf("phy_init failed!!\n");
+
+	ret = generic_phy_power_on(&serdes);
+	if (ret)
+		printf("phy_power_on failed !!\n");
+}
+
 int board_late_init(void)
 {
 	if (IS_ENABLED(CONFIG_TI_I2C_BOARD_DETECT)) {
@@ -394,6 +423,9 @@ int board_late_init(void)
 		probe_daughtercards();
 	}
 
+	if (board_is_j7200_som())
+		configure_serdes_torrent();
+
 	return 0;
 }
 
Signature · 1 line
2.17.1
#19 lore raw

PATCH v3 13/20 ARM: dts: k3-j721e: Add the entries required for USB3 support on USB0

In reply to Kishon Vijay Abraham I

Partially sync with Linux's dts to add the entries required for USB3 support on USB0.
Note that the default mode is still "peripheral" not "host". USB3 is supported only for the host mode.

---
 .../k3-j721e-common-proc-board-u-boot.dtsi    | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi +18 -1
index 3384ed9f3a..3b2e40c13d 100644
@@ -115,13 +115,17 @@
 	u-boot,dm-spl;
 };
 
+&wiz3_pll1_refclk {
+	assigned-clocks = <&wiz3_pll1_refclk>, <&wiz3_pll0_refclk>;
+	assigned-clock-parents = <&k3_clks 295 0>, <&k3_clks 295 9>;
+};
+
 &main_usbss0_pins_default {
 	u-boot,dm-spl;
 };
 
 &usbss0 {
 	u-boot,dm-spl;
-	ti,usb2-only;
 };
 
 &usb0 {
@@ -193,3 +197,16 @@
 &mcu_fss0_ospi1_pins_default {
 	u-boot,dm-spl;
 };
+
+&wiz3_pll1_refclk {
+	assigned-clocks = <&wiz3_pll1_refclk>, <&wiz3_pll0_refclk>;
+	assigned-clock-parents = <&k3_clks 295 0>, <&k3_clks 295 9>;
+};
+
+&serdes_ln_ctrl {
+	u-boot,mux-autoprobe;
+};
+
+&usb_serdes_mux {
+	u-boot,mux-autoprobe;
+};
Signature · 1 line
2.17.1
#20 lore raw

PATCH v3 13/20 ARM: dts: k3-j721e: Add the entries required for USB3 support on USB0

Quoted 11 lines · Kishon Vijay Abraham I

Partially sync with Linux's dts to add the entries required for USB3 support on USB0.
Note that the default mode is still "peripheral" not "host". USB3 is supported only for the host mode.

---
 .../k3-j721e-common-proc-board-u-boot.dtsi    | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

You're doing a partial sync with Linux in the -u-boot.dtsi file, why?

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

Re: [PATCH v3 13/20] ARM: dts: k3-j721e: Add the entries required for USB3 support on USB0

Hi Tom,

Quoted 7 lines · Tom Rini
Quoted 5 lines · Kishon Vijay Abraham I

Partially sync with Linux's dts to add the entries required for USB3 support on USB0.
Note that the default mode is still "peripheral" not "host". USB3 is supported only for the host mode.

Quoted 8 lines
Quoted 6 lines
---
 .../k3-j721e-common-proc-board-u-boot.dtsi    | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

You're doing a partial sync with Linux in the -u-boot.dtsi file, why?

This only changes the part that deals with USB. Other's will be added as when it's getting tested and verified in u-boot.

Thanks
Kishon

#22 lore raw

Re: [PATCH v3 13/20] ARM: dts: k3-j721e: Add the entries required for USB3 support on USB0

Quoted 17 lines · Kishon Vijay Abraham I

Hi Tom,

Quoted 14 lines · Tom Rini
Quoted 11 lines · Kishon Vijay Abraham I

Partially sync with Linux's dts to add the entries required for USB3 support on USB0.
Note that the default mode is still "peripheral" not "host". USB3 is supported only for the host mode.

---
 .../k3-j721e-common-proc-board-u-boot.dtsi    | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
Quoted 4 lines
Quoted 1 line

You're doing a partial sync with Linux in the -u-boot.dtsi file, why?

This only changes the part that deals with USB. Other's will be added as when it's getting tested and verified in u-boot.

I would really really like to see the files be fully re-synced. I'm not NAK'ing this, but it's also a bad idea to pass Linux old/mismatched dtb files. Which you can do trivially with bootefi. So it's a bad idea.

Signature · 1 line
Tom
#23 lore raw

PATCH v3 14/20 arm: dts: k3-j7200-main: Add DT node for torrent serdes

In reply to Kishon Vijay Abraham I

From: Aswath Govindraju <[email protected]>

Add DT node for torrent serdes.

---
 arch/arm/dts/k3-j7200-main.dtsi | 63 +++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
arch/arm/dts/k3-j7200-main.dtsi +63 -0
index 1131464075..138702cf9d 100644
@@ -5,6 +5,13 @@
  * Copyright (C) 2020 Texas Instruments Incorporated - https://www.ti.com/
  */
 
+/ {
+	serdes_refclk: serdes-refclk {
+		#clock-cells = <0>;
+		compatible = "fixed-clock";
+	};
+};
+
 &cbass_main {
 	msmc_ram: sram at 70000000 {
 		compatible = "mmio-sram";
@@ -554,6 +561,62 @@
 		clock-names = "gpio";
 	};
 
+	serdes_wiz0: wiz at 5060000 {
+		compatible = "ti,j721e-wiz-10g";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		power-domains = <&k3_pds 292 TI_SCI_PD_EXCLUSIVE>;
+		clocks = <&k3_clks 292 11>, <&k3_clks 292 85>, <&serdes_refclk>;
+		clock-names = "fck", "core_ref_clk", "ext_ref_clk";
+		num-lanes = <4>;
+		#reset-cells = <1>;
+		ranges = <0x5060000 0x0 0x5060000 0x10000>;
+
+		assigned-clocks = <&k3_clks 292 85>;
+		assigned-clock-parents = <&k3_clks 292 89>;
+
+		wiz0_pll0_refclk: pll0-refclk {
+			clocks = <&k3_clks 292 85>, <&serdes_refclk>;
+			clock-output-names = "wiz0_pll0_refclk";
+			#clock-cells = <0>;
+			assigned-clocks = <&wiz0_pll0_refclk>;
+			assigned-clock-parents = <&k3_clks 292 85>;
+		};
+
+		wiz0_pll1_refclk: pll1-refclk {
+			clocks = <&k3_clks 292 85>, <&serdes_refclk>;
+			clock-output-names = "wiz0_pll1_refclk";
+			#clock-cells = <0>;
+			assigned-clocks = <&wiz0_pll1_refclk>;
+			assigned-clock-parents = <&k3_clks 292 85>;
+		};
+
+		wiz0_refclk_dig: refclk-dig {
+			clocks = <&k3_clks 292 85>, <&serdes_refclk>;
+			clock-output-names = "wiz0_refclk_dig";
+			#clock-cells = <0>;
+			assigned-clocks = <&wiz0_refclk_dig>;
+			assigned-clock-parents = <&k3_clks 292 85>;
+		};
+
+		wiz0_cmn_refclk_dig_div: cmn-refclk-dig-div {
+			clocks = <&wiz0_refclk_dig>;
+			#clock-cells = <0>;
+		};
+
+		serdes0: serdes at 5060000 {
+			compatible = "ti,j721e-serdes-10g";
+			reg = <0x05060000 0x00010000>;
+			reg-names = "torrent_phy";
+			resets = <&serdes_wiz0 0>;
+			reset-names = "torrent_reset";
+			clocks = <&wiz0_pll0_refclk>;
+			clock-names = "refclk";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+	};
+
 	usbss0: cdns-usb at 4104000 {
 		compatible = "ti,j721e-usb";
 		reg = <0x00 0x4104000 0x00 0x100>;
Signature · 1 line
2.17.1
#24 lore raw

PATCH v3 15/20 arm: dts: k3-j7200-common-proc-board: Enable SERDES DT

In reply to Kishon Vijay Abraham I

From: Aswath Govindraju <[email protected]>

Add default lane function for torrent serdes.

---
 arch/arm/dts/k3-j7200-common-proc-board.dts | 23 +++++++++++++++++++++
 1 file changed, 23 insertions(+)
arch/arm/dts/k3-j7200-common-proc-board.dts +23 -0
index 5120711d4f..f0440cda1a 100644
@@ -9,6 +9,7 @@
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/net/ti-dp83867.h>
 #include <dt-bindings/mux/ti-serdes.h>
+#include <dt-bindings/phy/phy.h>
 
 / {
 	chosen {
@@ -281,3 +282,25 @@
 		ti,adc-channels = <0 1 2 3 4 5 6 7>;
 	};
 };
+
+&serdes_refclk {
+	clock-frequency = <100000000>;
+};
+
+&serdes0 {
+	serdes0_pcie_link: link at 0 {
+		reg = <0>;
+		cdns,num-lanes = <2>;
+		#phy-cells = <0>;
+		cdns,phy-type = <PHY_TYPE_PCIE>;
+		resets = <&serdes_wiz0 1>, <&serdes_wiz0 2>;
+	};
+
+	serdes0_qsgmii_link: link at 1 {
+		reg = <2>;
+		cdns,num-lanes = <1>;
+		#phy-cells = <0>;
+		cdns,phy-type = <PHY_TYPE_QSGMII>;
+		resets = <&serdes_wiz0 3>;
+	};
+};
Signature · 1 line
2.17.1
#25 lore raw

PATCH v3 16/20 arm: dts: k3-j7200-common-proc-board-u-boot: Add u-boot tags for torrent serdes

In reply to Kishon Vijay Abraham I

From: Aswath Govindraju <[email protected]>

Add u-boot tags for torrent serdes.

---
 arch/arm/dts/k3-j7200-common-proc-board-u-boot.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm/dts/k3-j7200-common-proc-board-u-boot.dtsi +12 -0
index bd037be350..bfe1ef5409 100644
@@ -160,3 +160,15 @@
 &hbmc_mux {
 	u-boot,dm-spl;
 };
+
+&serdes_ln_ctrl {
+	u-boot,mux-autoprobe;
+};
+
+&usb_serdes_mux {
+	u-boot,mux-autoprobe;
+};
+
+&serdes0 {
+	u-boot,dm-spl;
+};
Signature · 1 line
2.17.1
#26 lore raw

PATCH v3 17/20 configs: j721e_evm_a72: Enable the drivers required for the USB3 support

In reply to Kishon Vijay Abraham I

From: Jean-Jacques Hiblot <[email protected]>

Enable the mmio mux driver, the J721E-wiz PHy driver and the cadence sierra phy driver. All of them are required for USB3 support

---
 configs/j721e_evm_a72_defconfig | 6 ++++++
 1 file changed, 6 insertions(+)
configs/j721e_evm_a72_defconfig +6 -0
index e14005c39d..5b46f2d53f 100644
@@ -136,9 +136,15 @@ CONFIG_SPI_FLASH_STMICRO=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_SPI_FLASH_MTD=y
 CONFIG_PHY_TI_DP83867=y
+CONFIG_MULTIPLEXER=y
+CONFIG_MUX_MMIO=y
 CONFIG_PHY_FIXED=y
 CONFIG_DM_ETH=y
 CONFIG_TI_AM65_CPSW_NUSS=y
+CONFIG_PHY=y
+CONFIG_SPL_PHY=y
+CONFIG_PHY_CADENCE_SIERRA=y
+CONFIG_PHY_J721E_WIZ=y
 CONFIG_PINCTRL=y
 # CONFIG_PINCTRL_GENERIC is not set
 CONFIG_SPL_PINCTRL=y
Signature · 1 line
2.17.1
#27 lore raw

PATCH v3 18/20 configs: j7200_evm_a72_defconfig: Add config for torrent serdes and common clock framework

In reply to Kishon Vijay Abraham I

From: Aswath Govindraju <[email protected]>

Add config for torrent serdes and common clock framework.

---
 configs/j7200_evm_a72_defconfig | 7 +++++++
 1 file changed, 7 insertions(+)
configs/j7200_evm_a72_defconfig +7 -0
index 162bcc8753..bf78b36d22 100644
@@ -96,6 +96,7 @@ CONFIG_SPL_OF_TRANSLATE=y
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
 CONFIG_CLK_TI_SCI=y
+CONFIG_CLK_CCF=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DFU_SF=y
@@ -138,9 +139,15 @@ CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_SPI_FLASH_MTD=y
+CONFIG_MULTIPLEXER=y
+CONFIG_MUX_MMIO=y
 CONFIG_PHY_FIXED=y
 CONFIG_DM_ETH=y
 CONFIG_TI_AM65_CPSW_NUSS=y
+CONFIG_PHY=y
+CONFIG_SPL_PHY=y
+CONFIG_PHY_CADENCE_TORRENT=y
+CONFIG_PHY_J721E_WIZ=y
 CONFIG_PINCTRL=y
 # CONFIG_PINCTRL_GENERIC is not set
 CONFIG_SPL_PINCTRL=y
Signature · 1 line
2.17.1
#28 lore raw

PATCH v3 19/20 env: ti: j721e-evm: Add env variable to power on & reset QSGMII PHY in J7200 EVM

In reply to Kishon Vijay Abraham I

MAIN CPSW0 requires the PHY to be powered on and reset for QSGMII operation. Add a env variable to configure driving "0" on ENET_EXP_PWRDN controlled by GPIO EXPANDER2 (I2C Addr: 0x22), PIN: 17 and driving "1" on ENET_EXP_RESETZ controlled by GPIO EXPANDER2 (I2C Addr: 0x22),
PIN: 18.

---
 include/configs/j721e_evm.h | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
include/configs/j721e_evm.h +15 -1
index b707fc4e89..00d0a18a68 100644
@@ -139,11 +139,24 @@
 #endif /* CONFIG_TARGET_J721E_A72_EVM */
 
 #ifdef CONFIG_TARGET_J7200_A72_EVM
+#define EXTRA_ENV_CONFIG_MAIN_CPSW0_QSGMII_PHY				\
+	"do_main_cpsw0_qsgmii_phyinit=1\0"				\
+	"init_main_cpsw0_qsgmii_phy=gpio set gpio at 22_17;"		\
+		 "gpio clear gpio at 22_16\0"				\
+	"main_cpsw0_qsgmii_phyinit="					\
+	"if test ${do_main_cpsw0_qsgmii_phyinit} -eq 1 && test ${dorprocboot} -eq 1 && " \
+			"test ${boot} = mmc; then "			\
+		"run init_main_cpsw0_qsgmii_phy;"			\
+	"fi;\0"
 #define DEFAULT_RPROCS ""						\
 		"2 /lib/firmware/j7200-main-r5f0_0-fw "			\
 		"3 /lib/firmware/j7200-main-r5f0_1-fw "
 #endif /* CONFIG_TARGET_J7200_A72_EVM */
 
+#ifndef EXTRA_ENV_CONFIG_MAIN_CPSW0_QSGMII_PHY
+#define EXTRA_ENV_CONFIG_MAIN_CPSW0_QSGMII_PHY
+#endif
+
 /* set default dfu_bufsiz to 128KB (sector size of OSPI) */
 #define EXTRA_ENV_DFUARGS \
 	"dfu_bufsiz=0x20000\0" \
@@ -170,7 +183,8 @@
 	EXTRA_ENV_RPROC_SETTINGS					\
 	EXTRA_ENV_DFUARGS						\
 	DEFAULT_UFS_TI_ARGS						\
-	EXTRA_ENV_J721E_BOARD_SETTINGS_MTD
+	EXTRA_ENV_J721E_BOARD_SETTINGS_MTD				\
+	EXTRA_ENV_CONFIG_MAIN_CPSW0_QSGMII_PHY
 
 /* Now for the remaining common defines */
 #include <configs/ti_armv7_common.h>
Signature · 1 line
2.17.1
#29 lore raw

PATCH v3 19/20 env: ti: j721e-evm: Add env variable to power on & reset QSGMII PHY in J7200 EVM

Quoted 17 lines · Kishon Vijay Abraham I

MAIN CPSW0 requires the PHY to be powered on and reset for QSGMII operation. Add a env variable to configure driving "0" on ENET_EXP_PWRDN controlled by GPIO EXPANDER2 (I2C Addr: 0x22), PIN: 17 and driving "1" on ENET_EXP_RESETZ controlled by GPIO EXPANDER2 (I2C Addr: 0x22),
PIN: 18.

---
 include/configs/j721e_evm.h | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
include/configs/j721e_evm.h +0 -0
index b707fc4e89..00d0a18a68 100644

include/configs/j721e_evm.h line 143

Quoted 5 lines
include/configs/j721e_evm.h +2 -0
@@ -139,11 +139,24 @@
 #endif /* CONFIG_TARGET_J721E_A72_EVM */
 
 #ifdef CONFIG_TARGET_J7200_A72_EVM
+#define EXTRA_ENV_CONFIG_MAIN_CPSW0_QSGMII_PHY				\
+	"do_main_cpsw0_qsgmii_phyinit=1\0"				\

When would this be not true?

include/configs/j721e_evm.h line 148

Quoted 5 lines
include/configs/j721e_evm.h +5 -0
+	"init_main_cpsw0_qsgmii_phy=gpio set gpio at 22_17;"		\
+		 "gpio clear gpio at 22_16\0"				\
+	"main_cpsw0_qsgmii_phyinit="					\
+	"if test ${do_main_cpsw0_qsgmii_phyinit} -eq 1 && test ${dorprocboot} -eq 1 && " \
+			"test ${boot} = mmc; then "			\

And why only on mmc?

include/configs/j721e_evm.h line 150

Quoted 2 lines
include/configs/j721e_evm.h +2 -0
+		"run init_main_cpsw0_qsgmii_phy;"			\
+	"fi;\0"

Finally, this feels like something we should be doing in CONFIG_PREBOOT, so it's always done, rather than part of seemingly the bootcmd.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210507/325eadbd/attachment.sig>
#30 lore raw

PATCH v3 19/20 env: ti: j721e-evm: Add env variable to power on & reset QSGMII PHY in J7200 EVM

Hi Tom,

Quoted 21 lines · Tom Rini
Quoted 19 lines · Kishon Vijay Abraham I

MAIN CPSW0 requires the PHY to be powered on and reset for QSGMII operation. Add a env variable to configure driving "0" on ENET_EXP_PWRDN controlled by GPIO EXPANDER2 (I2C Addr: 0x22), PIN: 17 and driving "1" on ENET_EXP_RESETZ controlled by GPIO EXPANDER2 (I2C Addr: 0x22),
PIN: 18.

---
 include/configs/j721e_evm.h | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
include/configs/j721e_evm.h +0 -0
index b707fc4e89..00d0a18a68 100644
@@ -139,11 +139,24 @@
 #endif /* CONFIG_TARGET_J721E_A72_EVM */
 
Quoted 5 lines

include/configs/j721e_evm.h line 143

Quoted 3 lines
include/configs/j721e_evm.h +2 -0
 #ifdef CONFIG_TARGET_J7200_A72_EVM
+#define EXTRA_ENV_CONFIG_MAIN_CPSW0_QSGMII_PHY				\
+	"do_main_cpsw0_qsgmii_phyinit=1\0"				\

When would this be not true?

If the user don't want to use QSGMII, this could be set to false. For instance the SERDES in J7200 can be used such that it can be used with two protocols at a time. So it can be either PCIe + QSGMII or PCIe + USB. So for use cases which require PCIe + USB, this could be set to false.

Quoted 8 lines

include/configs/j721e_evm.h line 148

Quoted 6 lines
include/configs/j721e_evm.h +5 -0
+	"init_main_cpsw0_qsgmii_phy=gpio set gpio at 22_17;"		\
+		 "gpio clear gpio at 22_16\0"				\
+	"main_cpsw0_qsgmii_phyinit="					\
+	"if test ${do_main_cpsw0_qsgmii_phyinit} -eq 1 && test ${dorprocboot} -eq 1 && " \
+			"test ${boot} = mmc; then "			\

And why only on mmc?

The current J7200 u-boot code loads firmwares for remote cores only from MMC. So if it's not mmc, it's not going to load ethernet firmware and hence not required to configure the PHY.

Quoted 7 lines

include/configs/j721e_evm.h line 150

Quoted 3 lines
include/configs/j721e_evm.h +2 -0
+		"run init_main_cpsw0_qsgmii_phy;"			\
+	"fi;\0"

Finally, this feels like something we should be doing in CONFIG_PREBOOT, so it's always done, rather than part of seemingly the bootcmd.

I'll check on this.

Thanks for reviewing!

Regards
Kishon

#31 lore raw

PATCH v3 19/20 env: ti: j721e-evm: Add env variable to power on & reset QSGMII PHY in J7200 EVM

Quoted 30 lines · Kishon Vijay Abraham I

Hi Tom,

Quoted 21 lines · Tom Rini
Quoted 19 lines · Kishon Vijay Abraham I

MAIN CPSW0 requires the PHY to be powered on and reset for QSGMII operation. Add a env variable to configure driving "0" on ENET_EXP_PWRDN controlled by GPIO EXPANDER2 (I2C Addr: 0x22), PIN: 17 and driving "1" on ENET_EXP_RESETZ controlled by GPIO EXPANDER2 (I2C Addr: 0x22),
PIN: 18.

---
 include/configs/j721e_evm.h | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
include/configs/j721e_evm.h +0 -0
index b707fc4e89..00d0a18a68 100644
@@ -139,11 +139,24 @@
 #endif /* CONFIG_TARGET_J721E_A72_EVM */
 
Quoted 5 lines

include/configs/j721e_evm.h line 143

Quoted 3 lines
include/configs/j721e_evm.h +2 -0
 #ifdef CONFIG_TARGET_J7200_A72_EVM
+#define EXTRA_ENV_CONFIG_MAIN_CPSW0_QSGMII_PHY				\
+	"do_main_cpsw0_qsgmii_phyinit=1\0"				\

When would this be not true?

Quoted 4 lines

If the user don't want to use QSGMII, this could be set to false. For instance the SERDES in J7200 can be used such that it can be used with two protocols at a time. So it can be either PCIe + QSGMII or PCIe + USB. So for use cases which require PCIe + USB, this could be set to false.

Then we need to create doc/board/ti/j721e_evm.rst with some general content and then document the above in there.

Quoted 11 lines
Quoted 7 lines

include/configs/j721e_evm.h line 148

Quoted 5 lines
include/configs/j721e_evm.h +5 -0
+	"init_main_cpsw0_qsgmii_phy=gpio set gpio at 22_17;"		\
+		 "gpio clear gpio at 22_16\0"				\
+	"main_cpsw0_qsgmii_phyinit="					\
+	"if test ${do_main_cpsw0_qsgmii_phyinit} -eq 1 && test ${dorprocboot} -eq 1 && " \
+			"test ${boot} = mmc; then "			\

And why only on mmc?

The current J7200 u-boot code loads firmwares for remote cores only from MMC. So if it's not mmc, it's not going to load ethernet firmware and hence not required to configure the PHY.

OK. Please make sure this is also part of the documentation. Thanks.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210511/d9749260/attachment.sig>
#32 lore raw

Re: [PATCH v3 19/20] env: ti: j721e-evm: Add env variable to power on & reset QSGMII PHY in J7200 EVM

Hi Tom,

Quoted 31 lines · Tom Rini
Quoted 30 lines · Kishon Vijay Abraham I

Hi Tom,

Quoted 26 lines · Tom Rini
Quoted 17 lines · Kishon Vijay Abraham I

MAIN CPSW0 requires the PHY to be powered on and reset for QSGMII operation. Add a env variable to configure driving "0" on ENET_EXP_PWRDN controlled by GPIO EXPANDER2 (I2C Addr: 0x22), PIN: 17 and driving "1" on ENET_EXP_RESETZ controlled by GPIO EXPANDER2 (I2C Addr: 0x22),
PIN: 18.

---
 include/configs/j721e_evm.h | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
include/configs/j721e_evm.h +0 -0
index b707fc4e89..00d0a18a68 100644

include/configs/j721e_evm.h line 143

Quoted 5 lines
include/configs/j721e_evm.h +2 -0
@@ -139,11 +139,24 @@
 #endif /* CONFIG_TARGET_J721E_A72_EVM */
 
 #ifdef CONFIG_TARGET_J7200_A72_EVM
+#define EXTRA_ENV_CONFIG_MAIN_CPSW0_QSGMII_PHY				\
+	"do_main_cpsw0_qsgmii_phyinit=1\0"				\

When would this be not true?

Quoted 7 lines
Quoted 4 lines

If the user don't want to use QSGMII, this could be set to false. For instance the SERDES in J7200 can be used such that it can be used with two protocols at a time. So it can be either PCIe + QSGMII or PCIe + USB. So for use cases which require PCIe + USB, this could be set to false.

Then we need to create doc/board/ti/j721e_evm.rst with some general content and then document the above in there.

There is already a document @ board/ti/j721e/README which has some general information. Maybe that could be updated and moved to doc/board/ti/j721e_evm.rst?

Thanks
Kishon

Quoted 15 lines
Quoted 9 lines
Quoted 8 lines

include/configs/j721e_evm.h line 148

Quoted 6 lines
include/configs/j721e_evm.h +5 -0
+	"init_main_cpsw0_qsgmii_phy=gpio set gpio@22_17;"		\
+		 "gpio clear gpio@22_16\0"				\
+	"main_cpsw0_qsgmii_phyinit="					\
+	"if test ${do_main_cpsw0_qsgmii_phyinit} -eq 1 && test ${dorprocboot} -eq 1 && " \
+			"test ${boot} = mmc; then "			\

And why only on mmc?

Quoted 3 lines

The current J7200 u-boot code loads firmwares for remote cores only from MMC. So if it's not mmc, it's not going to load ethernet firmware and hence not required to configure the PHY.

OK. Please make sure this is also part of the documentation. Thanks.

#33 lore raw

Re: [PATCH v3 19/20] env: ti: j721e-evm: Add env variable to power on & reset QSGMII PHY in J7200 EVM

Quoted 39 lines · Kishon Vijay Abraham I

Hi Tom,

Quoted 36 lines · Tom Rini
Quoted 34 lines · Kishon Vijay Abraham I

Hi Tom,

Quoted 21 lines · Tom Rini
Quoted 19 lines · Kishon Vijay Abraham I

MAIN CPSW0 requires the PHY to be powered on and reset for QSGMII operation. Add a env variable to configure driving "0" on ENET_EXP_PWRDN controlled by GPIO EXPANDER2 (I2C Addr: 0x22), PIN: 17 and driving "1" on ENET_EXP_RESETZ controlled by GPIO EXPANDER2 (I2C Addr: 0x22),
PIN: 18.

---
 include/configs/j721e_evm.h | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
include/configs/j721e_evm.h +0 -0
index b707fc4e89..00d0a18a68 100644
@@ -139,11 +139,24 @@
 #endif /* CONFIG_TARGET_J721E_A72_EVM */
 
Quoted 5 lines

include/configs/j721e_evm.h line 143

Quoted 3 lines
include/configs/j721e_evm.h +2 -0
 #ifdef CONFIG_TARGET_J7200_A72_EVM
+#define EXTRA_ENV_CONFIG_MAIN_CPSW0_QSGMII_PHY				\
+	"do_main_cpsw0_qsgmii_phyinit=1\0"				\

When would this be not true?

If the user don't want to use QSGMII, this could be set to false. For instance the SERDES in J7200 can be used such that it can be used with two protocols at a time. So it can be either PCIe + QSGMII or PCIe + USB. So for use cases which require PCIe + USB, this could be set to false.

Quoted 6 lines
Quoted 2 lines

Then we need to create doc/board/ti/j721e_evm.rst with some general content and then document the above in there.

There is already a document @ board/ti/j721e/README which has some general information. Maybe that could be updated and moved to doc/board/ti/j721e_evm.rst?

Yes, board/*/boardname/README should be converted to doc/board/*/boardname.rst in geneal.

Signature · 1 line
Tom
#34 lore raw

PATCH v3 20/20 configs: j7200_evm_a72: Enhance bootcmd to configure ethernet PHY

In reply to Kishon Vijay Abraham I

Update the default BOOTCOMMAND to provide an automatic and easier way to configure ethernet PHY before loading the firmware.

---
 configs/j7200_evm_a72_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configs/j7200_evm_a72_defconfig +1 -1
index bf78b36d22..5929bba82a 100644
@@ -30,7 +30,7 @@ CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000
 # CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
-CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run boot_rprocs; run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern"
+CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run main_cpsw0_qsgmii_phyinit; run boot_rprocs; run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern"
 CONFIG_LOGLEVEL=7
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
Signature · 1 line
2.17.1
#35 lore raw

v3 cover TI/Cadence: Add Sierra/Torrent SERDES driver

In reply to Kishon Vijay Abraham I
Quoted 4 lines · Kishon Vijay Abraham I

Patch series adds Sierra and Torrent SERDES driver for the SERDES used in TI's K3 platforms. This SERDES is used by USB3, PCIe and Ethernet. This series is mostly an adaptation of drivers added in upstream Linux kernel.

Aside from specific comments I've already made, in general there's a lot of dt/binding updates that don't say what Linux kernel rev they're from, and need to. Thanks.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210507/2eea676a/attachment.sig>