Skip to contentSkip to conversation

TI/Cadence: Add Sierra/Torrent SERDES driver

PATCH Superseded Kishon Vijay Abraham I 2 participants 22 messages Apr 5, 2021 – May 4, 2021

Subsystems (6)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 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 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 (3):
drivers: reset: Handle gracefully NULL pointers
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 (6):
dm: core: Add helper to compare node names
dm: test: Add test case to check node name ignoring unit address
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

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 (3):
drivers: reset: Handle gracefully NULL pointers
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 (6):
dm: core: Add helper to compare node names
dm: test: Add test case to check node name ignoring unit address
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     | 2456 +++++++++++++++++
 drivers/phy/ti/Kconfig                        |    9 +
 drivers/phy/ti/Makefile                       |    1 +
 drivers/phy/ti/phy-j721e-wiz.c                |  985 +++++++
 drivers/reset/reset-uclass.c                  |   30 +-
 drivers/usb/cdns3/cdns3-ti.c                  |    2 +-
 include/configs/j721e_evm.h                   |   16 +-
 include/dm/ofnode.h                           |   10 +
 include/dt-bindings/phy/phy.h                 |    1 +
 test/dm/core.c                                |   14 +
 23 files changed, 4460 insertions(+), 18 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
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/17 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 fa0bd2a9c4..adc96fcaf3 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 2c0597c407..a866b9b9b8 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 1 if matches, 0 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
#2 lore raw

PATCH v2 1/17 dm: core: Add helper to compare node names

Quoted 18 lines · Kishon Vijay Abraham I

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 +1 -0
index fa0bd2a9c4..adc96fcaf3 100644
@@ -18,6 +18,19 @@
 #include <linux/ioport.h>
 #include <asm/global_data.h>
 
+bool ofnode_name_eq(ofnode node, const char *name)

drivers/core/ofnode.c line 31

Quoted 10 lines
drivers/core/ofnode.c +10 -0
+{
+       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));

drop extra brackets

Quoted 10 lines
drivers/core/ofnode.c +2 -0
+}
+
 int ofnode_read_u32(ofnode node, const char *propname, u32 *outp)
 {
        return ofnode_read_u32_index(node, propname, 0, outp);
include/dm/ofnode.h +0 -0
index 2c0597c407..a866b9b9b8 100644

include/dm/ofnode.h static inline ofnode ofnode_root(void) · line 240

Quoted 10 lines
include/dm/ofnode.h +7 -0
@@ -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 1 if matches, 0 if it doesn't match

true / false

Quoted 9 lines
include/dm/ofnode.h +3 -1
+ */
+bool ofnode_name_eq(ofnode node, const char *name);
+
 /**
  * ofnode_read_u32() - Read a 32-bit integer from a property
  *
--

2.17.1

#3 lore raw

PATCH v2 2/17 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 35ca689d64..b88b1966fd 100644
@@ -178,6 +178,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 v2 2/17 dm: test: Add test case to check node name ignoring unit address

Quoted 7 lines · Kishon Vijay Abraham I

Add test to check node name ignoring unit address.

---
 test/dm/core.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
Quoted 29 lines
test/dm/core.c +14 -1
index 35ca689d64..b88b1966fd 100644
@@ -178,6 +178,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)
 {
--

2.17.1

#5 lore raw

PATCH v2 3/17 drivers: reset: Handle gracefully NULL pointers

In reply to Kishon Vijay Abraham I

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

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 | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)
drivers/reset/reset-uclass.c +17 -13
index 071c389ca0..98304bc0ee 100644
@@ -13,9 +13,12 @@
 #include <dm/devres.h>
 #include <dm/lists.h>
 
-static inline struct reset_ops *reset_dev_ops(struct udevice *dev)
+struct reset_ops nop_reset_ops = {
+};
+
+static inline struct reset_ops *reset_dev_ops(struct reset_ctl *r)
 {
-	return (struct reset_ops *)dev->driver->ops;
+	return r ? (struct reset_ops *)r->dev->driver->ops : &nop_reset_ops;
 }
 
 static int reset_of_xlate_default(struct reset_ctl *reset_ctl,
@@ -54,9 +57,10 @@ static int reset_get_by_index_tail(int ret, ofnode node,
 		debug("%s %d\n", ofnode_get_name(args->node), args->args[0]);
 		return ret;
 	}
-	ops = reset_dev_ops(dev_reset);
 
 	reset_ctl->dev = dev_reset;
+	ops = reset_dev_ops(reset_ctl);
+
 	if (ops->of_xlate)
 		ret = ops->of_xlate(reset_ctl, args);
 	else
@@ -162,29 +166,29 @@ 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 = reset_dev_ops(reset_ctl);
 
 	debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
 
-	return ops->request(reset_ctl);
+	return ops->request ? ops->request(reset_ctl) : 0;
 }
 
 int reset_free(struct reset_ctl *reset_ctl)
 {
-	struct reset_ops *ops = reset_dev_ops(reset_ctl->dev);
+	struct reset_ops *ops = reset_dev_ops(reset_ctl);
 
 	debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
 
-	return ops->rfree(reset_ctl);
+	return ops->rfree ? ops->rfree(reset_ctl) : 0;
 }
 
 int reset_assert(struct reset_ctl *reset_ctl)
 {
-	struct reset_ops *ops = reset_dev_ops(reset_ctl->dev);
+	struct reset_ops *ops = reset_dev_ops(reset_ctl);
 
 	debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
 
-	return ops->rst_assert(reset_ctl);
+	return ops->rst_assert ? ops->rst_assert(reset_ctl) : 0;
 }
 
 int reset_assert_bulk(struct reset_ctl_bulk *bulk)
@@ -202,11 +206,11 @@ 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 = reset_dev_ops(reset_ctl);
 
 	debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
 
-	return ops->rst_deassert(reset_ctl);
+	return ops->rst_deassert ? ops->rst_deassert(reset_ctl) : 0;
 }
 
 int reset_deassert_bulk(struct reset_ctl_bulk *bulk)
@@ -224,11 +228,11 @@ 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 = reset_dev_ops(reset_ctl);
 
 	debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
 
-	return ops->rst_status(reset_ctl);
+	return ops->rst_status ? ops->rst_status(reset_ctl) : 0;
 }
 
 int reset_release_all(struct reset_ctl *reset_ctl, int count)
Signature · 1 line
2.17.1
#6 lore raw

PATCH v2 3/17 drivers: reset: Handle gracefully NULL pointers

Hi Kishon,

Quoted 21 lines · Kishon Vijay Abraham I

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

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 | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)
drivers/reset/reset-uclass.c +0 -0
index 071c389ca0..98304bc0ee 100644
@@ -13,9 +13,12 @@
 #include <dm/devres.h>

drivers/reset/reset-uclass.c line 21

Quoted 10 lines
drivers/reset/reset-uclass.c +5 -2
 #include <dm/lists.h>
 
-static inline struct reset_ops *reset_dev_ops(struct udevice *dev)
+struct reset_ops nop_reset_ops = {
+};
+
+static inline struct reset_ops *reset_dev_ops(struct reset_ctl *r)
 {
-       return (struct reset_ops *)dev->driver->ops;
+       return r ? (struct reset_ops *)r->dev->driver->ops : &nop_reset_ops;

This behaviour still seems odd to me. Why do you have a reset driver with no ops? That is not allowed.

Quoted 16 lines
drivers/reset/reset-uclass.c +2 -1
 }
 
 static int reset_of_xlate_default(struct reset_ctl *reset_ctl,
@@ -54,9 +57,10 @@ static int reset_get_by_index_tail(int ret, ofnode node,
                debug("%s %d\n", ofnode_get_name(args->node), args->args[0]);
                return ret;
        }
-       ops = reset_dev_ops(dev_reset);
 
        reset_ctl->dev = dev_reset;
+       ops = reset_dev_ops(reset_ctl);
+
        if (ops->of_xlate)
                ret = ops->of_xlate(reset_ctl, args);
        else

drivers/reset/reset-uclass.c int reset_get_by_name(struct udevice *dev, const char *name, · line 173

Quoted 10 lines
drivers/reset/reset-uclass.c +2 -2
@@ -162,29 +166,29 @@ 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 = reset_dev_ops(reset_ctl);
 
        debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
 
-       return ops->request(reset_ctl);
+       return ops->request ? ops->request(reset_ctl) : 0;

Can you check this first and return -ENOSYS ? E.g.

if (!ops->request)
return -ENOSYS;

return ops->request(reset_ctl);

Same below

Quoted 54 lines
drivers/reset/reset-uclass.c +8 -9
 }
 
 int reset_free(struct reset_ctl *reset_ctl)
 {
-       struct reset_ops *ops = reset_dev_ops(reset_ctl->dev);
+       struct reset_ops *ops = reset_dev_ops(reset_ctl);
 
        debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
 
-       return ops->rfree(reset_ctl);
+       return ops->rfree ? ops->rfree(reset_ctl) : 0;
 }
 
 int reset_assert(struct reset_ctl *reset_ctl)
 {
-       struct reset_ops *ops = reset_dev_ops(reset_ctl->dev);
+       struct reset_ops *ops = reset_dev_ops(reset_ctl);
 
        debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
 
-       return ops->rst_assert(reset_ctl);
+       return ops->rst_assert ? ops->rst_assert(reset_ctl) : 0;
 }
 
 int reset_assert_bulk(struct reset_ctl_bulk *bulk)
@@ -202,11 +206,11 @@ 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 = reset_dev_ops(reset_ctl);
 
        debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
 
-       return ops->rst_deassert(reset_ctl);
+       return ops->rst_deassert ? ops->rst_deassert(reset_ctl) : 0;
 }
 
 int reset_deassert_bulk(struct reset_ctl_bulk *bulk)
@@ -224,11 +228,11 @@ 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 = reset_dev_ops(reset_ctl);
 
        debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
 
-       return ops->rst_status(reset_ctl);
+       return ops->rst_status ? ops->rst_status(reset_ctl) : 0;
 }
 
 int reset_release_all(struct reset_ctl *reset_ctl, int count)
--
Quoted 2 lines

2.17.1

Regards,
Simon

#7 lore raw

PATCH v2 3/17 drivers: reset: Handle gracefully NULL pointers

Hi Simon,

Quoted 26 lines · Simon Glass

Hi Kishon,

Quoted 23 lines · Kishon Vijay Abraham I

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

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 | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)
drivers/reset/reset-uclass.c +0 -0
index 071c389ca0..98304bc0ee 100644
@@ -13,9 +13,12 @@
 #include <dm/devres.h>
 #include <dm/lists.h>
 
Quoted 11 lines

drivers/reset/reset-uclass.c line 21

Quoted 8 lines
drivers/reset/reset-uclass.c +5 -2
-static inline struct reset_ops *reset_dev_ops(struct udevice *dev)
+struct reset_ops nop_reset_ops = {
+};
+
+static inline struct reset_ops *reset_dev_ops(struct reset_ctl *r)
 {
-       return (struct reset_ops *)dev->driver->ops;
+       return r ? (struct reset_ops *)r->dev->driver->ops : &nop_reset_ops;

This behaviour still seems odd to me. Why do you have a reset driver with no ops? That is not allowed.

Okay. I'll re-work this patch and post a fresh series.

Thanks
Kishon

Quoted 97 lines
Quoted 17 lines
drivers/reset/reset-uclass.c +2 -1
 }
 
 static int reset_of_xlate_default(struct reset_ctl *reset_ctl,
@@ -54,9 +57,10 @@ static int reset_get_by_index_tail(int ret, ofnode node,
                debug("%s %d\n", ofnode_get_name(args->node), args->args[0]);
                return ret;
        }
-       ops = reset_dev_ops(dev_reset);
 
        reset_ctl->dev = dev_reset;
+       ops = reset_dev_ops(reset_ctl);
+
        if (ops->of_xlate)
                ret = ops->of_xlate(reset_ctl, args);
        else

drivers/reset/reset-uclass.c int reset_get_by_name(struct udevice *dev, const char *name, · line 173

Quoted 10 lines
drivers/reset/reset-uclass.c +2 -2
@@ -162,29 +166,29 @@ 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 = reset_dev_ops(reset_ctl);
 
        debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
 
-       return ops->request(reset_ctl);
+       return ops->request ? ops->request(reset_ctl) : 0;

Can you check this first and return -ENOSYS ? E.g.

if (!ops->request)
return -ENOSYS;

return ops->request(reset_ctl);

Same below

Quoted 54 lines
drivers/reset/reset-uclass.c +8 -9
 }
 
 int reset_free(struct reset_ctl *reset_ctl)
 {
-       struct reset_ops *ops = reset_dev_ops(reset_ctl->dev);
+       struct reset_ops *ops = reset_dev_ops(reset_ctl);
 
        debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
 
-       return ops->rfree(reset_ctl);
+       return ops->rfree ? ops->rfree(reset_ctl) : 0;
 }
 
 int reset_assert(struct reset_ctl *reset_ctl)
 {
-       struct reset_ops *ops = reset_dev_ops(reset_ctl->dev);
+       struct reset_ops *ops = reset_dev_ops(reset_ctl);
 
        debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
 
-       return ops->rst_assert(reset_ctl);
+       return ops->rst_assert ? ops->rst_assert(reset_ctl) : 0;
 }
 
 int reset_assert_bulk(struct reset_ctl_bulk *bulk)
@@ -202,11 +206,11 @@ 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 = reset_dev_ops(reset_ctl);
 
        debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
 
-       return ops->rst_deassert(reset_ctl);
+       return ops->rst_deassert ? ops->rst_deassert(reset_ctl) : 0;
 }
 
 int reset_deassert_bulk(struct reset_ctl_bulk *bulk)
@@ -224,11 +228,11 @@ 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 = reset_dev_ops(reset_ctl);
 
        debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
 
-       return ops->rst_status(reset_ctl);
+       return ops->rst_status ? ops->rst_status(reset_ctl) : 0;
 }
 
 int reset_release_all(struct reset_ctl *reset_ctl, int count)
--
Quoted 2 lines

2.17.1

Regards,
Simon

#8 lore raw

PATCH v2 4/17 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
#9 lore raw

PATCH v2 5/17 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
#10 lore raw

PATCH v2 6/17 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 | 2456 +++++++++++++++++++++
 3 files changed, 2463 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 +2456 -0

2,456 lines not on this page · raw message

Signature · 1 line
2.17.1
#11 lore raw

PATCH v2 7/17 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 | 985 +++++++++++++++++++++++++++++++++
 5 files changed, 997 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 +985 -0

985 lines not on this page · raw message

Signature · 1 line
2.17.1
#12 lore raw

PATCH v2 8/17 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
#13 lore raw

PATCH v2 9/17 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
#14 lore raw

PATCH v2 10/17 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
#15 lore raw

PATCH v2 11/17 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
#16 lore raw

PATCH v2 12/17 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
#17 lore raw

PATCH v2 13/17 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
#18 lore raw

PATCH v2 14/17 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
#19 lore raw

PATCH v2 15/17 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
#20 lore raw

PATCH v2 16/17 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
#21 lore raw

PATCH v2 17/17 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