[PATCH net-next v8 2/5] net: spacemit: Add K1 Ethernet MAC

Vivian Wang wangruikang at iscas.ac.cn
Sun Aug 31 17:15:41 PDT 2025


On 8/29/25 09:51, Troy Mitchell wrote:
> On Thu, Aug 28, 2025 at 04:47:50PM +0800, Vivian Wang wrote:
>> The Ethernet MACs found on SpacemiT K1 appears to be a custom design
>> that only superficially resembles some other embedded MACs. SpacemiT
>> refers to them as "EMAC", so let's just call the driver "k1_emac".
>>
>> Supports RGMII and RMII interfaces. Includes support for MAC hardware
>> statistics counters. PTP support is not implemented.
>>
>> Signed-off-by: Vivian Wang <wangruikang at iscas.ac.cn>
>> Reviewed-by: Maxime Chevallier <maxime.chevallier at bootlin.com>
>> Reviewed-by: Vadim Fedorenko <vadim.fedorenko at linux.dev>
>> Tested-by: Junhui Liu <junhui.liu at pigmoral.tech>
>> Tested-by: Troy Mitchell <troy.mitchell at linux.spacemit.com>
>> ---
> [...]
>> diff --git a/drivers/net/ethernet/spacemit/k1_emac.c b/drivers/net/ethernet/spacemit/k1_emac.c
>> new file mode 100644
>> index 0000000000000000000000000000000000000000..49afe9312a742c27dd35a015d75a1de7ec5c7d15
>> --- /dev/null
> [...]
>> +
>> +static int emac_phy_interface_config(struct emac_priv *priv)
>> +{
>> +	u32 val = 0, mask = PHY_INTF_RGMII;
>> +
>> +	switch (priv->phy_interface) {
>> +	case PHY_INTERFACE_MODE_RMII:
>> +		mask |= REF_CLK_SEL;
> How about we move `val = 0` to here? 
> This makes it clearer that val should be 0 when PHY_INTERFACE_MODE_RMII,
> instead of being hidden in the initialization.

I'll probably just use phy_interface_mode_is_rgmii or something for val.

I will clean this up, but I'll wait for a few more changes to batch up
before sending the next version.

> Reviewed-by: Troy Mitchell <troy.mitchell at linux.spacemit.com>

Thank you!

Vivian "dramforever" Wang




More information about the linux-riscv mailing list