From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f43.google.com (mail-dl1-f43.google.com [74.125.82.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2FF183612C9 for ; Tue, 20 Jan 2026 05:05:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768885553; cv=none; b=WvaHSwHIrNgHRUiT16eS9sZS8647wvD9X/voX2ymw00P73RkqNGcXN2j3yosVHTJrk5UM2wipjRH29wW/ilvr8CKAZ9yvPquGXqkRbXV9H5DHZaGJAO8Ou4wPLpd7pNgxeznqz4gjtNMi2SPX4lZ2MqpT/9R19gLIyHtxBD9kB8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768885553; c=relaxed/simple; bh=PC4UrdjLqaW0iLhVA9Sz3l4QXzyP/7m+HKjSOXpuvYc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=rJTmmZCE8jJEMyh2lbvMlaSIwZE06Iq2yaZUGLhbWnbp8VPudVGd00UN/Uuvb/9EpUJ49n5SvfbqhNUQwucHf4dkTyHmNaHnPeh7Utx1lK3imHeuzIt0z8EQUKq8G4e+9tXx3NdQ9UTmvyW08afSVmTy49e370VOd6ErHiz7Aqg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Ar9cdeXJ; arc=none smtp.client-ip=74.125.82.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ar9cdeXJ" Received: by mail-dl1-f43.google.com with SMTP id a92af1059eb24-1233c155a42so6379205c88.1 for ; Mon, 19 Jan 2026 21:05:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768885549; x=1769490349; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=gFedj4f11o/3T9vWUp8OttHw6rjgwlEi4dqKoM80zmU=; b=Ar9cdeXJXB4htFKCh+kHdDLQZF8B6yRc05KRIA9ESLIVLV35SjF7NJ0UHmPPRMnH5e 1Pn7j3eUZpb4rqg84OE4f1H6giGUsn6NH/88a16jseZ/NB5hZyRyA3CxPowQ+TQM7DcB PIGg2yDAYfgv5spq5hvHiORzuEjG4TnoBovhQV07lbrOCmam81fTSGgNeXPFZwpfqGcn N3MCh6bFf7zdVD1uU0KLVQ8vIpTHCoxbaC4A3yOOkcbi2pHHmKvxjWPJ4gQI5NETGNsk e5QGzomxi/a+BI1vvCaNQfpo0NosxIsRLo9kvg2BBhlmZRZqd4lpKlI/hax+MnSfmLae f+gQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768885549; x=1769490349; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gFedj4f11o/3T9vWUp8OttHw6rjgwlEi4dqKoM80zmU=; b=iasEqIKYdnHfCfo+Bf9W3OJOF9Ln5r0RWTdY9viA73DvDYRbh6MtHi65pGcBrxyY+s SOJ1/lJWBhCyNK5uBEYNiMu02x5g6XOg8D/BCgg8zG7YfbjbGOc1ycTb7JPvkGN7etOw dbV41kKby7GWUkMspSnMB+eVjKMsVVJAafxk9gKz9qH3L3O0+KPPapZR4rNsAVnANTMF GUKFpUnRLsAbF2U5DX24GxHwF+d9J37dl7FfHCNLQ+Neta7gEuxpnaW6ekUMhVV823CR 82QT8VZ1J+rYIu8yVLg0SsZhe4IJ3sUkynhRVZ8HUDec+A3hvGAv3Iq6ZcBEDZYTNxU6 F1Lw== X-Forwarded-Encrypted: i=1; AJvYcCVodeAPHLxiVFFxNpLGmYN1TYad5M24dqDVi5w1uSOoS/L//QYaGb9iBeo4R9eYfQajpHgnnwHP5BywBA0=@vger.kernel.org X-Gm-Message-State: AOJu0YytQRBppGuKakV+Sfp73OV8cXsBSQMaVlAUrS+g8Sx8w6pwIqgK 21X8ujqRlI9Sdd6pXV5qbl21WfO2Qvs/id7zCSV8ZQa+mXQKJaJwBN46 X-Gm-Gg: AY/fxX7kr8o+u6aEmmfI1MB0QLlANlAbAD9gXOd4BGrZL7mMKTulmW3y48ByMA7oMGj zVruL+f9gFWsO8GUjt+9MLiR4T7fEXqlvHK+TrHgnl4+UOd/tiecS30KhyFmtDd6BH91XK9yv47 2LuMd0tZhynL3hBs0G5witYD/9CiFE3nTTYjMlLYb0DlZfuGRtvimtAqmkTpXBFHOe12NYYezAn xy1q7Ss8w6PEBOTVgOKXiyp5WjrR+YPgfBxI9OWdd3OkaWyzq3kNrLP4Vlk5q9HvbfLBnSRn+f+ aLGkNVxYMETH5YJMH9MAJP5B2NdlugZBd21xBSd3RwPLmaMPCSzUQDdRJVbOyVUZyqVw5IkYmnM u/DOdFnH4+UV83svXD9ywaARZA3PYZPqJZgpbhBd48Qbb5xAKQ9VtEW6fMfLp3vt8sMZ/4wARQd NgceNIZjB64HjwVZpTwkeQ X-Received: by 2002:a05:7022:672a:b0:119:e56b:98bf with SMTP id a92af1059eb24-1246aac3151mr600082c88.38.1768885549389; Mon, 19 Jan 2026 21:05:49 -0800 (PST) Received: from localhost ([2001:19f0:ac00:4eb8:5400:5ff:fe30:7df3]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-1244af10736sm19178432c88.14.2026.01.19.21.05.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jan 2026 21:05:48 -0800 (PST) Date: Tue, 20 Jan 2026 13:05:39 +0800 From: Inochi Amaoto To: "Russell King (Oracle)" , Inochi Amaoto Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Yixun Lan , Maxime Coquelin , Alexandre Torgue , Richard Cochran , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Yanteng Si , Yao Zi , Vladimir Oltean , Lad Prabhakar , Choong Yong Liang , Maxime Chevallier , Chen-Yu Tsai , Shangjuan Wei , Boon Khai Ng , Quentin Schulz , Giuseppe Cavallaro , Jose Abreu , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, spacemit@lists.linux.dev, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Longbin Li Subject: Re: [PATCH net-next 3/3] net: stmmac: Add glue layer for Spacemit K3 SoC Message-ID: References: <20260120043609.910302-1-inochiama@gmail.com> <20260120043609.910302-4-inochiama@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Jan 20, 2026 at 04:56:32AM +0000, Russell King (Oracle) wrote: > On Tue, Jan 20, 2026 at 12:36:08PM +0800, Inochi Amaoto wrote: > > Adds Spacemit dwmac driver support on the Spacemit K3 SoC. > > Some more information would be useful. E.g. describing why you need to > fix the RGMII mode. > OK. I will add this. > > +/* ctrl register bits */ > > +#define PHY_INTF_RGMII BIT(3) > > +#define PHY_INTF_MII BIT(4) > > + > > +#define WAKE_IRQ_EN BIT(9) > > +#define PHY_IRQ_EN BIT(12) > > + > > +/* dline register bits */ > > +#define RGMII_RX_DLINE_EN BIT(0) > > +#define RGMII_RX_DLINE_STEP GENMASK(5, 4) > > +#define RGMII_RX_DLINE_CODE GENMASK(15, 8) > > +#define RGMII_TX_DLINE_EN BIT(16) > > +#define RGMII_TX_DLINE_STEP GENMASK(21, 20) > > +#define RGMII_TX_DLINE_CODE GENMASK(31, 24) > > + > > +#define MAX_DLINE_DELAY_CODE 0xff > > + > > +struct spacemit_dwmac { > > + struct device *dev; > > + struct clk *tx; > > +}; > > This structure seems unused. > Yeah, I forgot this, will remove in the next version. > > + > > +/* Note: the delay step value is at 0.1ps */ > > +static const unsigned int k3_delay_step_10x[4] = { > > + 367, 493, 559, 685 > > +}; > > + > > +static int spacemit_dwmac_set_delay(struct regmap *apmu, > > + unsigned int dline_offset, > > + unsigned int tx_code, unsigned int tx_config, > > + unsigned int rx_code, unsigned int rx_config) > > +{ > > + unsigned int mask, val; > > + > > + mask = RGMII_RX_DLINE_STEP | RGMII_TX_DLINE_CODE | RGMII_TX_DLINE_EN | > > + RGMII_TX_DLINE_STEP | RGMII_RX_DLINE_CODE | RGMII_RX_DLINE_EN; > > + val = FIELD_PREP(RGMII_TX_DLINE_CODE, tx_config) | > > + FIELD_PREP(RGMII_TX_DLINE_CODE, tx_code) | RGMII_TX_DLINE_EN | > > + FIELD_PREP(RGMII_TX_DLINE_CODE, rx_config) | > > + FIELD_PREP(RGMII_RX_DLINE_CODE, rx_code) | RGMII_RX_DLINE_EN; > > These FIELD_PREP() fields look wrong. Did you mean to use DLINE_CODE > both tx_config and tx_code, and did you mean to use TX_DLINE_CODE for > rx_config ? > This should be RGMII_TX_DLINE_CODE. This is a copy paste error, I will fix it. > > + plat_dat->clk_tx_i = devm_clk_get_enabled(&pdev->dev, "tx"); > > + if (IS_ERR(plat_dat->clk_tx_i)) > > + return dev_err_probe(&pdev->dev, PTR_ERR(plat_dat->clk_tx_i), > > + "failed to get tx clock\n"); > > You set plat_dat->clk_tx_i, but you don't point > plat_dat->set_clk_tx_rate at anything, which means the stmmac core > does nothing with this. > Yes, the vendor told me that the internal tx clock rate will be auto changed when the speed rate is changed. So no software interaction is needed. > Given the last two points, has RGMII mode been tested on this > hardware? > In fact I only tested the rgmii-id, which does not change the internal id. I will try the rgmii mode. Regards, Inochi