From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DFA29CA0EFF for ; Wed, 27 Aug 2025 15:52:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=5XXPK9rgm6hm8EGqcOxFtZdeNx/wbCo+a/fjPKpMhLw=; b=dTOa4x9b3QOp9OFlxWR/gJzezh M1P3ZKah6aB39SazGR+dfZjX37OIxbtPyAR4ethZss2XJBABt8atIx/VKpvy89OpCY+eIh/WuDKwZ rx2SKrhSr3iQ5UTytvPcEM8uiGYFuUmKfrsD8YtVT9tikOZMTQbJNCVPs8N/dvpeUu3CBSZ8KMADf WtsS92UHVkuTdRo23hZuy7Xz1QxHm0yxoJqF8cKl5PSQZ5hsLzT5TYvZ9McQaVy6Tf9Sf6hHIfM2I MwuW1FRXKd05TD0Q0QQIAHH/jSmSTiNnrn9ebmYYF2LPD5t3fwZ+VFUSrAfBcf48GpgeqyyPBAhGz 0J8/EMFw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1urIRd-0000000G1zt-3Vxs; Wed, 27 Aug 2025 15:52:17 +0000 Received: from out-188.mta0.migadu.com ([91.218.175.188]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1urFVN-0000000FSc2-1kPS for linux-arm-kernel@lists.infradead.org; Wed, 27 Aug 2025 12:43:59 +0000 Message-ID: <228e871e-a5c7-4570-b672-a97ac3db90c5@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1756298625; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5XXPK9rgm6hm8EGqcOxFtZdeNx/wbCo+a/fjPKpMhLw=; b=hLDL+MAeFdO6S6GwZPo1qT89iojAr28gdNsifMukqxo6jLtLXLp09wsQpXUT20NMePmJzl +hexT091mG1JyUQ1gBSNCqhuFLf6zoRLv5jpZnmAONL2ZIZL/ysE7sS7x1tgJDZG900Nyw /xW7WAPkq+XrMuaOv5g9JWlqYu3+DaU= Date: Wed, 27 Aug 2025 13:43:31 +0100 MIME-Version: 1.0 Subject: Re: [PATCH v4 2/2] ethernet: eswin: Add eic7700 ethernet driver To: weishangjuan@eswincomputing.com, devicetree@vger.kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, linux-arm-kernel@lists.infradead.org, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, yong.liang.choong@linux.intel.com, vladimir.oltean@nxp.com, rmk+kernel@armlinux.org.uk, faizal.abdul.rahim@linux.intel.com, prabhakar.mahadev-lad.rj@bp.renesas.com, inochiama@gmail.com, jan.petrous@oss.nxp.com, jszhang@kernel.org, p.zabel@pengutronix.de, boon.khai.ng@altera.com, 0x1207@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com Cc: ningyu@eswincomputing.com, linmin@eswincomputing.com, lizhi2@eswincomputing.com References: <20250827081135.2243-1-weishangjuan@eswincomputing.com> <20250827081418.2347-1-weishangjuan@eswincomputing.com> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Vadim Fedorenko In-Reply-To: <20250827081418.2347-1-weishangjuan@eswincomputing.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250827_054358_199077_4C6943D4 X-CRM114-Status: GOOD ( 12.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 27/08/2025 09:14, weishangjuan@eswincomputing.com wrote: > From: Shangjuan Wei > > 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 > Signed-off-by: Shangjuan Wei > --- [...] > +/** > + * 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() > + } > +} > +