Commit 883d28b2 authored by Josua Mayer's avatar Josua Mayer

uboot: lx2162-clearfog: configure retimer according to serdes

Signed-off-by: default avatarJosua Mayer <josua@solid-run.com>
parent 5bdc7de2
From d7cb8dcf124e341c9bb074ea8d183104108180b9 Mon Sep 17 00:00:00 2001
From: Josua Mayer <josua@solid-run.com>
Date: Thu, 17 Nov 2022 11:54:33 +0200
Subject: [PATCH 39/41] lx2162a-som: enable i2c2
Signed-off-by: Josua Mayer <josua@solid-run.com>
---
arch/arm/dts/fsl-lx2162a-som.dtsi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm/dts/fsl-lx2162a-som.dtsi b/arch/arm/dts/fsl-lx2162a-som.dtsi
index 8271fad8d6..f254421fae 100644
--- a/arch/arm/dts/fsl-lx2162a-som.dtsi
+++ b/arch/arm/dts/fsl-lx2162a-som.dtsi
@@ -77,6 +77,11 @@
};
};
+&i2c2 {
+ status = "okay";
+ u-boot,dm-pre-reloc;
+};
+
&i2c5 {
status = "okay";
rtc@6f {
--
2.38.1
From 26b4349025cbf4e70f2cad1b7d2b5bbd3603ced9 Mon Sep 17 00:00:00 2001
From: Josua Mayer <josua@solid-run.com>
Date: Thu, 17 Nov 2022 12:13:26 +0200
Subject: [PATCH 40/41] board: lx2160cex7: configure retimer on lx2162 clearfog
Signed-off-by: Josua Mayer <josua@solid-run.com>
---
arch/arm/dts/fsl-lx2160a-cex7.dts | 5 +++++
board/solidrun/lx2160a/eth_lx2160acex7.c | 23 +++++++++++++----------
board/solidrun/lx2160a/lx2160a.c | 14 +++++++++++---
include/configs/lx2160a_common.h | 1 +
4 files changed, 30 insertions(+), 13 deletions(-)
diff --git a/arch/arm/dts/fsl-lx2160a-cex7.dts b/arch/arm/dts/fsl-lx2160a-cex7.dts
index c8c0877e3d..f57fc87361 100644
--- a/arch/arm/dts/fsl-lx2160a-cex7.dts
+++ b/arch/arm/dts/fsl-lx2160a-cex7.dts
@@ -133,6 +133,11 @@
};
};
+&i2c2 {
+ status = "okay";
+ u-boot,dm-pre-reloc;
+};
+
&i2c4 {
status = "okay";
diff --git a/board/solidrun/lx2160a/eth_lx2160acex7.c b/board/solidrun/lx2160a/eth_lx2160acex7.c
index 6a696deafe..64ef75b27b 100644
--- a/board/solidrun/lx2160a/eth_lx2160acex7.c
+++ b/board/solidrun/lx2160a/eth_lx2160acex7.c
@@ -26,6 +26,7 @@
DECLARE_GLOBAL_DATA_PTR;
int select_i2c_ch_pca9547(u8 ch);
+int select_i2c_ch_pca9547_n(int busnum, u8 ch);
void setup_retimer_25g(int chnum)
{
@@ -115,17 +116,17 @@ void setup_retimer_25g(int chnum)
}
}
-void setup_retimer_lx2162_25g(int speed_is_25g)
+void setup_retimer_lx2162_25g(int busnum, int address, int speed_is_25g)
{
int i, ret;
u8 reg;
struct udevice *dev;
- select_i2c_ch_pca9547(0xb); /* SMB_CLK / DATA interface */
+ select_i2c_ch_pca9547_n(busnum, 0xb); /* SMB_CLK / DATA interface */
/*
* Retimer on address 0x22; first two channels are LX TX.
*/
- ret = i2c_get_chip_for_busnum(0, 0x22, 1, &dev);
+ ret = i2c_get_chip_for_busnum(busnum, address, 1, &dev);
if (ret) {
/*
* On HoneyComb and ClearFog CX ver 1.1 / 1.2 there is no retimer
@@ -329,20 +330,22 @@ int fsl_board_late_init(void) {
if (get_svr() & 0x800) { /* LX2162A SOM variants */
switch (srds_s1) {
- case 8:
- setup_retimer_lx2162_25g(0);
+ case 3:
+ case 20:
+ /* Setup retimer on lanes e,f for 10Gbps */
+ setup_retimer_lx2162_25g(0, 0x22, 0);
+ setup_retimer_lx2162_25g(1, 0x18, 0);
break;
case 15:
case 16:
case 17:
case 18:
- case 19:
- case 21:
- /* Setup 25gb retimer on lanes e,f,g,h */
- setup_retimer_lx2162_25g(1);
+ /* Setup retimer on lanes e,f for 25Gbps */
+ setup_retimer_lx2162_25g(0, 0x22, 1);
+ setup_retimer_lx2162_25g(1, 0x18, 1);
break;
default:
- printf("SerDes1 protocol 0x%x is not supported on LX2160A-SOM\n",
+ printf("SerDes1 protocol 0x%x is not supported on LX2162A-SOM\n",
srds_s1);
}
if ((srds_s1 == 18) && ((srds_s2 == 2) || (srds_s2 == 3)))
diff --git a/board/solidrun/lx2160a/lx2160a.c b/board/solidrun/lx2160a/lx2160a.c
index e078ae5c68..24930e5b6d 100644
--- a/board/solidrun/lx2160a/lx2160a.c
+++ b/board/solidrun/lx2160a/lx2160a.c
@@ -69,20 +69,28 @@ U_BOOT_DRVINFO(nxp_serial1) = {
};
int select_i2c_ch_pca9547(u8 ch)
+{
+ return select_i2c_ch_pca9547_n(0, ch);
+}
+
+int select_i2c_ch_pca9547_n(int busnum, u8 ch)
{
int ret;
#if !CONFIG_IS_ENABLED(DM_I2C)
- ret = i2c_write(I2C_MUX_PCA_ADDR_PRI, 0, 1, &ch, 1);
+ if (busnum)
+ printf("PCA: cannot configure on bus %i without DM_I2C!\n", busnum);
+ else
+ ret = i2c_write(I2C_MUX_PCA_ADDR_PRI, 0, 1, &ch, 1);
#else
struct udevice *dev;
- ret = i2c_get_chip_for_busnum(0, I2C_MUX_PCA_ADDR_PRI, 1, &dev);
+ ret = i2c_get_chip_for_busnum(busnum, I2C_MUX_PCA_ADDR_PRI, 1, &dev);
if (!ret)
ret = dm_i2c_write(dev, 0, &ch, 1);
#endif
if (ret) {
- puts("PCA: failed to select proper channel\n");
+ printf("PCA: failed to select bus %i channel %u\n", busnum, ch);
return ret;
}
diff --git a/include/configs/lx2160a_common.h b/include/configs/lx2160a_common.h
index 06057b7447..556879375a 100644
--- a/include/configs/lx2160a_common.h
+++ b/include/configs/lx2160a_common.h
@@ -179,6 +179,7 @@ unsigned long get_board_sys_clk(void);
unsigned long get_board_ddr_clk(void);
int select_i2c_ch_pca9547(unsigned char ch);
int select_i2c_ch_pca9547_sec(unsigned char ch);
+int select_i2c_ch_pca9547_n(int busnum, unsigned char ch);
#endif
#define CONFIG_SYS_CLK_FREQ get_board_sys_clk()
--
2.38.1
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment