aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorKlaus Kudielka <klaus.kudielka@gmail.com>2021-02-27 12:56:10 +0100
committerChristian Lamparter <chunkeey@gmail.com>2021-12-29 21:18:52 +0100
commit5e2a2b086cee9a7ba9f765dbf62a62f456b6713a (patch)
tree299550aec8bc854d78ff49c07f96cf500db0eed0 /target
parent24e564d327943a32181db4568fff43cc18d93b13 (diff)
downloadupstream-5e2a2b086cee9a7ba9f765dbf62a62f456b6713a.tar.gz
upstream-5e2a2b086cee9a7ba9f765dbf62a62f456b6713a.tar.bz2
upstream-5e2a2b086cee9a7ba9f765dbf62a62f456b6713a.zip
mvebu: Turris Omnia: use SFP module, if present
Follow the recommendations stated in the Turris Omnia DTS for eth2: "In case SFP module is present, U-Boot has to enable the sfp node above, remove phy-handle property, and add managed = "in-band-status" property." The boot script is written in a way, that it works for all U-Boot versions deployed by the vendor so far (2015.10-rc2, 2019.07). Reviewed-by: Noci <noci@noci.work> Reviewed-by: Justin van Steijn <jvs@fsfe.org> Reviewed-by: Nico Rikken <nico@nicorikken.eu> Reviewed-by: Julius Schwartzenberg <julius.schwartzenberg@gmail.com> Signed-off-by: Klaus Kudielka <klaus.kudielka@gmail.com> (cherry picked from commit 23d2690e5a5410576b587bc96e2c2cf5fc693927)
Diffstat (limited to 'target')
-rw-r--r--target/linux/mvebu/image/turris-omnia.bootscript17
1 files changed, 16 insertions, 1 deletions
diff --git a/target/linux/mvebu/image/turris-omnia.bootscript b/target/linux/mvebu/image/turris-omnia.bootscript
index fcec5fc1b8..9a3fc0d8cb 100644
--- a/target/linux/mvebu/image/turris-omnia.bootscript
+++ b/target/linux/mvebu/image/turris-omnia.bootscript
@@ -11,7 +11,22 @@ else
fi
setenv bootargs earlyprintk console=ttyS0,115200 root=${rootdev} rootfstype=auto rootwait
-# Load and boot
+# Load device tree and prepare for modification
load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} @DTB@.dtb
+fdt addr ${fdt_addr_r}
+fdt resize
+
+# Enable SFP cage, if module is present
+i2c dev 0
+i2c mw 0x70 0.0 0xf
+i2c read 0x71 0 1 0x00fffff1
+setexpr.b mod_def0 *0x00fffff1 \& 0x10
+if test ${mod_def0} -eq 0; then
+ fdt set /sfp status okay
+ fdt rm /soc/internal-regs/ethernet@34000 phy-handle
+ fdt set /soc/internal-regs/ethernet@34000 managed in-band-status
+fi
+
+# Load kernel and boot
load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} zImage
bootz ${kernel_addr_r} - ${fdt_addr_r}