Thread (9 messages) 9 messages, 6 authors, 2025-09-02

Re: [PATCH v4 2/2] ethernet: eswin: Add eic7700 ethernet driver

From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Date: 2025-08-27 12:43:57
Also in: linux-arm-kernel, linux-devicetree, lkml

On 27/08/2025 09:14, weishangjuan@eswincomputing.com wrote:
From: Shangjuan Wei <redacted>

Add Ethernet controller support for Eswin's eic7700 SoC. The driver
provides management and control of Ethernet signals for the eiC7700
series chips.

Signed-off-by: Zhi Li <redacted>
Signed-off-by: Shangjuan Wei <redacted>
---
[...]
+/**
+ * eic7700_apply_delay - Update TX or RX delay bits in delay parameter value.
+ * @delay_ps: Delay in picoseconds (capped at 12.7ns).
+ * @reg:      Pointer to register value to modify.
+ * @is_rx:    True for RX delay (bits 30:24), false for TX delay (bits 14:8).
+ *
+ * Converts delay to 0.1ns units, caps at 0x7F, and sets appropriate bits.
+ * Only RX or TX bits are updated; other bits remain unchanged.
+ */
+static inline void eic7700_apply_delay(u32 delay_ps, u32 *reg, bool is_rx)
inlining functions in .c files is discouraged in netdev, let the
compiler decide inlining
+{
+	if (!reg)
+		return;
please, avoid defensive programming. with this check you also mixing
code and variables..
+
+	u32 val = min(delay_ps / 100, EIC7700_MAX_DELAY_UNIT);
 > +> +	if (is_rx) {
+		*reg &= ~EIC7700_ETH_RX_ADJ_DELAY;
+		*reg |= (val << 24) & EIC7700_ETH_RX_ADJ_DELAY;
+	} else {
+		*reg &= ~EIC7700_ETH_TX_ADJ_DELAY;
+		*reg |= (val << 8) & EIC7700_ETH_TX_ADJ_DELAY;
these 2 assignments should be converted to FIELD_PREP()
+	}
+}
+
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help