-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
uboot: lx2162: support mac addresses from tlv eeprom
- Loading branch information
Showing
3 changed files
with
187 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
patches/u-boot/0011-board-solidrun-lx2160acex7-allocate-memory-before-pa.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
From bcabe078a2a27eecaa592e1f2ea640a5f1fc6cda Mon Sep 17 00:00:00 2001 | ||
From: Josua Mayer <[email protected]> | ||
Date: Mon, 4 Nov 2024 15:16:27 +0100 | ||
Subject: [PATCH 11/13] board: solidrun: lx2160acex7: allocate memory before | ||
patching lx2162 fdt | ||
|
||
Update of second usb controller fdt node during board_fix_fdt fails due | ||
to lack of space in the fdt. | ||
|
||
Explicitly allocate some extra bytes before to repair this fixup on | ||
lx2162 som. | ||
|
||
Signed-off-by: Josua Mayer <[email protected]> | ||
--- | ||
board/solidrun/lx2160acex7/lx2160a.c | 7 ++++++- | ||
1 file changed, 6 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/board/solidrun/lx2160acex7/lx2160a.c b/board/solidrun/lx2160acex7/lx2160a.c | ||
index e0a9e6c51eb..17160d13154 100644 | ||
--- a/board/solidrun/lx2160acex7/lx2160a.c | ||
+++ b/board/solidrun/lx2160acex7/lx2160a.c | ||
@@ -81,8 +81,13 @@ int board_fix_fdt(void *fdt) | ||
int off = -1, i = 0; | ||
u32 is_lx2162 = get_svr() & 0x800; | ||
|
||
- if (is_lx2162) | ||
+ if (is_lx2162) { | ||
+ /* allocate space for changes */ | ||
+ fdt_increase_size(fdt, 32); | ||
+ | ||
+ /* LX2162 does not have second USB controller, disable */ | ||
do_fixup_by_path_string(fdt, "/usb3@3110000", "status", "disabled"); | ||
+ } | ||
|
||
board_fix_fdt_eth(fdt); | ||
|
||
-- | ||
2.43.0 | ||
|
58 changes: 58 additions & 0 deletions
58
patches/u-boot/0012-cmd-tlv_eeprom-support-specifying-tlv-eeprom-in-DT-a.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
From bc8a68d153dcfd75153d81c52531743e43f23983 Mon Sep 17 00:00:00 2001 | ||
From: Josua Mayer <[email protected]> | ||
Date: Mon, 4 Nov 2024 15:08:01 +0100 | ||
Subject: [PATCH 12/13] cmd: tlv_eeprom: support specifying tlv eeprom in DT | ||
alias tlv[0-255] | ||
|
||
Systems might have many eeproms of which only some might be used for TLV | ||
data. | ||
If present, use aliases tlv0, tlv1, ... for finding tlv eeproms. | ||
|
||
If no eeproms are found by alias, fall back to current logic if using | ||
first eeproms in the system. | ||
|
||
Signed-off-by: Josua Mayer <[email protected]> | ||
--- | ||
cmd/tlv_eeprom.c | 23 +++++++++++++++++++++++ | ||
1 file changed, 23 insertions(+) | ||
|
||
diff --git a/cmd/tlv_eeprom.c b/cmd/tlv_eeprom.c | ||
index cbc11ebf421..546ede2dda2 100644 | ||
--- a/cmd/tlv_eeprom.c | ||
+++ b/cmd/tlv_eeprom.c | ||
@@ -899,9 +899,32 @@ static void show_tlv_devices(void) | ||
static int find_tlv_devices(struct udevice **tlv_devices_p) | ||
{ | ||
int ret; | ||
+ char alias_name[7]; | ||
int count_dev = 0; | ||
+ int i; | ||
+ ofnode node; | ||
struct udevice *dev; | ||
|
||
+ /* find by alias */ | ||
+ for (int i = 0; i < ARRAY_SIZE(tlv_devices_p); i++) { | ||
+ snprintf(alias_name, sizeof(alias_name), "tlv%d", i); | ||
+ node = ofnode_get_aliases_node(alias_name); | ||
+ if (!ofnode_valid(node)) | ||
+ continue; | ||
+ | ||
+ ret = uclass_get_device_by_ofnode(UCLASS_I2C_EEPROM, node, &dev); | ||
+ if (ret) { | ||
+ debug("get device \"%s\" failed with %d\n", alias_name, ret); | ||
+ continue; | ||
+ } | ||
+ | ||
+ tlv_devices_p[i] = dev; | ||
+ count_dev++; | ||
+ } | ||
+ if (count_dev) | ||
+ return 0; | ||
+ | ||
+ /* fall-back: find among all eeproms */ | ||
for (ret = uclass_first_device_check(UCLASS_I2C_EEPROM, &dev); | ||
dev; | ||
ret = uclass_next_device_check(&dev)) { | ||
-- | ||
2.43.0 | ||
|
90 changes: 90 additions & 0 deletions
90
patches/u-boot/0013-board-solidrun-lx2160acex7-use-dt-alias-for-tlv-eepr.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
From 38e36f6ceec2ecccc97369bec7e2589933001359 Mon Sep 17 00:00:00 2001 | ||
From: Josua Mayer <[email protected]> | ||
Date: Mon, 4 Nov 2024 15:12:04 +0100 | ||
Subject: [PATCH 13/13] board: solidrun: lx2160acex7: use dt alias for tlv | ||
eeprom | ||
|
||
LX2160A CEX-7 (and LX2162A SoM) have various eeproms competing for | ||
tlv_eeprom command. | ||
|
||
Add tlv0 alias to u-boot dts identifying the correct eeprom. | ||
|
||
On LX2162 SoM the eeprom is directly on the bus without a mux. | ||
Add dt patching logic fixing the alias and eeprom nodes when running on | ||
lx2162 soc. | ||
|
||
Signed-off-by: Josua Mayer <[email protected]> | ||
--- | ||
arch/arm/dts/fsl-lx2160a-cex7-u-boot.dtsi | 19 +++++++++---------- | ||
arch/arm/dts/fsl-lx2160a-cex7.dtsi | 2 +- | ||
board/solidrun/lx2160acex7/lx2160a.c | 5 +++++ | ||
3 files changed, 15 insertions(+), 11 deletions(-) | ||
|
||
diff --git a/arch/arm/dts/fsl-lx2160a-cex7-u-boot.dtsi b/arch/arm/dts/fsl-lx2160a-cex7-u-boot.dtsi | ||
index 9855fcb31cc..5909af2b1b9 100644 | ||
--- a/arch/arm/dts/fsl-lx2160a-cex7-u-boot.dtsi | ||
+++ b/arch/arm/dts/fsl-lx2160a-cex7-u-boot.dtsi | ||
@@ -1,6 +1,10 @@ | ||
// SPDX-License-Identifier: GPL-2.0+ | ||
|
||
/ { | ||
+ aliases { | ||
+ tlv0 = &com_eeprom; | ||
+ }; | ||
+ | ||
fanctrl-override { | ||
compatible = "solidrun,lx2160acex7-fanctrl-override"; | ||
override-gpios = <&gpio2 2 0>; | ||
@@ -8,15 +12,10 @@ | ||
}; | ||
|
||
&i2c0 { | ||
- u-boot,dm-pre-reloc; | ||
- | ||
- i2c-mux@77 { | ||
- u-boot,dm-pre-reloc; | ||
- | ||
- i2c@0 { | ||
- eeprom@57 { | ||
- u-boot,dm-pre-reloc; | ||
- }; | ||
- }; | ||
+ /* for LX2162 SoM */ | ||
+ eeprom@57 { | ||
+ compatible = "st,24c02", "atmel,24c02"; | ||
+ reg = <0x57>; | ||
+ status = "disabled"; | ||
}; | ||
}; | ||
diff --git a/arch/arm/dts/fsl-lx2160a-cex7.dtsi b/arch/arm/dts/fsl-lx2160a-cex7.dtsi | ||
index d32a52ab00a..ca87a21aaee 100644 | ||
--- a/arch/arm/dts/fsl-lx2160a-cex7.dtsi | ||
+++ b/arch/arm/dts/fsl-lx2160a-cex7.dtsi | ||
@@ -80,7 +80,7 @@ | ||
reg = <0x53>; | ||
}; | ||
|
||
- eeprom@57 { | ||
+ com_eeprom: eeprom@57 { | ||
compatible = "atmel,24c02"; | ||
reg = <0x57>; | ||
}; | ||
diff --git a/board/solidrun/lx2160acex7/lx2160a.c b/board/solidrun/lx2160acex7/lx2160a.c | ||
index 17160d13154..dcd8d63ddf8 100644 | ||
--- a/board/solidrun/lx2160acex7/lx2160a.c | ||
+++ b/board/solidrun/lx2160acex7/lx2160a.c | ||
@@ -87,6 +87,11 @@ int board_fix_fdt(void *fdt) | ||
|
||
/* LX2162 does not have second USB controller, disable */ | ||
do_fixup_by_path_string(fdt, "/usb3@3110000", "status", "disabled"); | ||
+ | ||
+ /* LX2162 SoM has different tlv eeprom - enable and patch alias */ | ||
+ do_fixup_by_path_string(fdt, "/aliases", "tlv0", "/i2c@2000000/eeprom@57"); | ||
+ do_fixup_by_path_string(fdt, "/i2c@2000000/eeprom@57", "status", "okay"); | ||
+ do_fixup_by_path_string(fdt, "/i2c@2000000/i2c-mux@77/i2c@0/eeprom@57", "status", "disabled"); | ||
} | ||
|
||
board_fix_fdt_eth(fdt); | ||
-- | ||
2.43.0 | ||
|