aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2021-05-03 13:31:39 +0200
committerPatrick Delaunay <patrick.delaunay@foss.st.com>2021-05-28 14:54:16 +0200
commit5c54260130a99601c699b447687dc5a82987c769 (patch)
treeba5e0946f5f7e978ea7abc1a4ca281d1ccf4a8e3
parent5c38c06ec09b3bad6a2c16ce2e11db18ea5d5faf (diff)
downloadu-boot-5c54260130a99601c699b447687dc5a82987c769.zip
u-boot-5c54260130a99601c699b447687dc5a82987c769.tar.gz
u-boot-5c54260130a99601c699b447687dc5a82987c769.tar.bz2
ARM: stm32: Add additional ID register check for KSZ8851 presence
Currently the code sets eth1addr only if /ethernet1 alias exists in DT, the node pointed to by the alias has "micrel,ks8851-mll" compatible string, and the KSZ8851 CCR register read indicates programmed EEPROM is not connected. This is not sufficient to detect cases where the DT still contains the KSZ8851 nodes, but the chip itself is not present. Extend the detection to handle these cases. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
-rw-r--r--board/dhelectronics/dh_stm32mp1/board.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/board/dhelectronics/dh_stm32mp1/board.c b/board/dhelectronics/dh_stm32mp1/board.c
index 49b12c4..ac1af71 100644
--- a/board/dhelectronics/dh_stm32mp1/board.c
+++ b/board/dhelectronics/dh_stm32mp1/board.c
@@ -86,6 +86,8 @@ DECLARE_GLOBAL_DATA_PTR;
#define KS_CCR_EEPROM BIT(9)
#define KS_BE0 BIT(12)
#define KS_BE1 BIT(13)
+#define KS_CIDER 0xC0
+#define CIDER_ID 0x8870
int setup_mac_address(void)
{
@@ -123,11 +125,18 @@ int setup_mac_address(void)
* is present. If EEPROM is present, it must contain valid
* MAC address.
*/
- u32 reg, ccr;
+ u32 reg, cider, ccr;
reg = fdt_get_base_address(gd->fdt_blob, off);
if (!reg)
goto out_set_ethaddr;
+ writew(KS_BE0 | KS_BE1 | KS_CIDER, reg + 2);
+ cider = readw(reg);
+ if ((cider & 0xfff0) != CIDER_ID) {
+ skip_eth1 = true;
+ goto out_set_ethaddr;
+ }
+
writew(KS_BE0 | KS_BE1 | KS_CCR, reg + 2);
ccr = readw(reg);
if (ccr & KS_CCR_EEPROM) {