Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
lx2160a_build
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Boxiang Sun
lx2160a_build
Commits
1fba07b9
Commit
1fba07b9
authored
Sep 18, 2023
by
Josua Mayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uboot: support cex ethernet phy address runtime patching for Linux DTB
parent
c9a2a04d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
90 additions
and
0 deletions
+90
-0
patches/u-boot-LSDK-21.08/0047-lx2160acex7-fixup-linux-dtb-for-cex-phy-address-5-if.patch
...x2160acex7-fixup-linux-dtb-for-cex-phy-address-5-if.patch
+90
-0
No files found.
patches/u-boot-LSDK-21.08/0047-lx2160acex7-fixup-linux-dtb-for-cex-phy-address-5-if.patch
0 → 100644
View file @
1fba07b9
From a6252877a2de18180c81a9424cdb03a751cc6fb7 Mon Sep 17 00:00:00 2001
From: Josua Mayer <josua@solid-run.com>
Date: Mon, 18 Sep 2023 11:13:25 +0200
Subject: [PATCH] lx2160acex7: fixup linux dtb for cex phy address 5 if
detected
It has been discovered that the cex ethernet phy activity led signal has
the wrong polarity.
It can only be corrected by removing a pull-down resistor which changes
mdio address form 1 to 5.
Add runtime detection for phy address, and patch Linux DTB accordingly.
For its own networking, U-Boot still expects phy at address 1.
Signed-off-by: Josua Mayer <josua@solid-run.com>
---
board/solidrun/lx2160a/eth_lx2160acex7.c | 52 ++++++++++++++++++++++--
1 file changed, 49 insertions(+), 3 deletions(-)
diff --git a/board/solidrun/lx2160a/eth_lx2160acex7.c b/board/solidrun/lx2160a/eth_lx2160acex7.c
index 9bc43a5ed7..b001f43737 100644
--- a/board/solidrun/lx2160a/eth_lx2160acex7.c
+++ b/board/solidrun/lx2160a/eth_lx2160acex7.c
@@ -180,13 +180,59 @@
void reset_phy(void)
}
#endif /* CONFIG_RESET_PHY_R */
+#define AR8035_PHY_ID 0x004dd072
+
+static inline int cex7_find_1g_phy() {
+ const char *mii_bus_name = "mdio@8b96000";
+ struct mii_dev *bus;
+ struct phy_device *phydev;
+
+ bus = miiphy_get_dev_by_name(mii_bus_name);
+ if (!bus) {
+ printf("Warning: Failed to get \"%s\", can't configure phy for eth0!\n", mii_bus_name);
+ return -EINVAL;
+ }
+
+ /* find PHY at addresses 0x01 or 0x05 */
+ phydev = phy_find_by_mask(bus, (1 << 1) | (1 << 5), PHY_INTERFACE_MODE_RGMII);
+ if (!phydev) {
+ printf("Warning: Failed to find phy at addresses 1,5 - can't configure phy for eth0!\n");
+ return -EINVAL;
+ }
+
+ if (phydev->phy_id == AR8035_PHY_ID) {
+ printf("found ar8035 ethernet phy at emdio1 address %d\n", phydev->addr);
+ return phydev->addr;
+ } else {
+ printf("Warning: unknown phy id 0x%x at address %xd - can't configure phy for eth0!\n", phydev->phy_id, phydev->addr);
+ return -EINVAL;
+ }
+}
+
int fdt_fixup_board_phy(void *fdt)
{
- int ret;
+ int node_phy, phy_addr;
+
+ /*
+ * fix ethernet phy address:
+ * based on assembly-option R89, PHY can be at 0x01 or 0x05.
+ * 0x01 is the default but causes wrong activity-led polarity.
+ *
+ * If:
+ * - phy is not detected at address 1
+ * - and phy is detected at address 5
+ * update address in device-tree.
+ */
+ phy_addr = cex7_find_1g_phy();
+ if (phy_addr < 0)
+ return phy_addr;
+
- ret = 0;
+ node_phy = fdt_path_offset(fdt, "/soc/mdio@8b96000/ethernet-phy@1");
+ if (node_phy < 0)
+ return node_phy;
- return ret;
+ return fdt_setprop_u32(fdt, node_phy, "reg", (u32)phy_addr);
}
--
2.35.3
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment