[PATCH 06/12] board: adi: Add SOMCRR infrastructure

Greg Malysa
2025-12-11T08:06:53Z

This adds infrastructure and shared library code for building targets
that use the ADI SOMCRR-EZKIT and SOMCRR-EZLITE carrier boards. These
are not used directly as board targets in their own right.

Co-developed-by: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
Signed-off-by: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
Signed-off-by: Vasileios Bimpikas <vasileios.bimpikas@analog.com>
Signed-off-by: Utsav Agarwal <utsav.agarwal@analog.com>
Signed-off-by: Arturs Artamonovs <arturs.artamonovs@analog.com>
Signed-off-by: Greg Malysa <malysagreg@gmail.com>

---

(no changes since v2)

Changes in v2:
- GPIO names and polarities adjusted to match logical usage

board/adi/carriers/Makefile | 8 +++++++
board/adi/carriers/somcrr.h | 14 +++++++++++
board/adi/carriers/somcrr_common.c | 19 +++++++++++++++
board/adi/carriers/somcrr_ezkit.c | 38 ++++++++++++++++++++++++++++++
board/adi/carriers/somcrr_ezlite.c | 24 +++++++++++++++++++
5 files changed, 103 insertions(+)
create mode 100644 board/adi/carriers/Makefile
create mode 100644 board/adi/carriers/somcrr.h
create mode 100644 board/adi/carriers/somcrr_common.c
create mode 100644 board/adi/carriers/somcrr_ezkit.c
create mode 100644 board/adi/carriers/somcrr_ezlite.c

diff --git a/board/adi/carriers/Makefile b/board/adi/carriers/Makefile
new file mode 100644
index 00000000000..cefd2cc837f
--- /dev/null
+++ b/board/adi/carriers/Makefile
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# (C) Copyright 2024 - Analog Devices, Inc.
+#
+
+obj-y += somcrr_common.o
+obj-$(CONFIG_ADI_CARRIER_SOMCRR_EZKIT) += somcrr_ezkit.o
+obj-$(CONFIG_ADI_CARRIER_SOMCRR_EZLITE) += somcrr_ezlite.o
diff --git a/board/adi/carriers/somcrr.h b/board/adi/carriers/somcrr.h
new file mode 100644
index 00000000000..01e908c67f8
--- /dev/null
+++ b/board/adi/carriers/somcrr.h
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * (C) Copyright 2025 - Analog Devices, Inc.
+ *
+ */
+
+#ifndef BOARD_ADI_CARRIERS_SOMCRR_H
+#define BOARD_ADI_CARRIERS_SOMCRR_H
+
+void adi_somcrr_init_ethernet(void);
+void adi_somcrr_enable_ethernet(void);
+void adi_somcrr_disable_ethernet(void);
+
+#endif
diff --git a/board/adi/carriers/somcrr_common.c b/board/adi/carriers/somcrr_common.c
new file mode 100644
index 00000000000..34ae48f31d2
--- /dev/null
+++ b/board/adi/carriers/somcrr_common.c
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * (C) Copyright 2025 - Analog Devices, Inc.
+ */
+
+#include <asm/arch-adi/sc5xx/sc5xx.h>
+#include <linux/delay.h>
+
+#include "somcrr.h"
+
+void adi_somcrr_init_ethernet(void)
+{
+ adi_somcrr_enable_ethernet();
+ mdelay(20);
+ adi_somcrr_disable_ethernet();
+ mdelay(90);
+ adi_somcrr_enable_ethernet();
+ mdelay(20);
+}
diff --git a/board/adi/carriers/somcrr_ezkit.c b/board/adi/carriers/somcrr_ezkit.c
new file mode 100644
index 00000000000..8b4d6a96c18
--- /dev/null
+++ b/board/adi/carriers/somcrr_ezkit.c
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * (C) Copyright 2025 - Analog Devices, Inc.
+ */
+
+#include <asm/gpio.h>
+
+#include "somcrr.h"
+
+void adi_somcrr_enable_ethernet(void)
+{
+ struct gpio_desc *eth1;
+ struct gpio_desc *eth1_reset;
+ struct gpio_desc *gige_reset;
+
+ gpio_hog_lookup_name("eth1-en", &eth1);
+ gpio_hog_lookup_name("eth1-reset", &eth1_reset);
+ gpio_hog_lookup_name("gige-reset", &gige_reset);
+
+ dm_gpio_set_value(eth1, 1);
+ dm_gpio_set_value(eth1_reset, 0);
+ dm_gpio_set_value(gige_reset, 0);
+}
+
+void adi_somcrr_disable_ethernet(void)
+{
+ struct gpio_desc *eth1;
+ struct gpio_desc *eth1_reset;
+ struct gpio_desc *gige_reset;
+
+ gpio_hog_lookup_name("eth1-en", &eth1);
+ gpio_hog_lookup_name("eth1-reset", &eth1_reset);
+ gpio_hog_lookup_name("gige-reset", &gige_reset);
+
+ dm_gpio_set_value(eth1, 0);
+ dm_gpio_set_value(eth1_reset, 1);
+ dm_gpio_set_value(gige_reset, 1);
+}
diff --git a/board/adi/carriers/somcrr_ezlite.c b/board/adi/carriers/somcrr_ezlite.c
new file mode 100644
index 00000000000..c0655574bab
--- /dev/null
+++ b/board/adi/carriers/somcrr_ezlite.c
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * (C) Copyright 2025 - Analog Devices, Inc.
+ */
+
+#include <asm/gpio.h>
+
+#include "somcrr.h"
+
+void adi_somcrr_enable_ethernet(void)
+{
+ struct gpio_desc *gige_reset;
+
+ gpio_hog_lookup_name("eth0-reset", &gige_reset);
+ dm_gpio_set_value(gige_reset, 0);
+}
+
+void adi_somcrr_disable_ethernet(void)
+{
+ struct gpio_desc *gige_reset;
+
+ gpio_hog_lookup_name("eth0-reset", &gige_reset);
+ dm_gpio_set_value(gige_reset, 1);
+}
--
2.49.1