[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <027eca32-3310-422d-ab52-5002af96d960@loongson.cn>
Date: Wed, 10 Apr 2024 18:03:54 +0800
From: Yanteng Si <siyanteng@...ngson.cn>
To: Huacai Chen <chenhuacai@...nel.org>
Cc: andrew@...n.ch, hkallweit1@...il.com, peppe.cavallaro@...com,
alexandre.torgue@...s.st.com, joabreu@...opsys.com, fancer.lancer@...il.com,
Jose.Abreu@...opsys.com, linux@...linux.org.uk, guyinggang@...ngson.cn,
netdev@...r.kernel.org, chris.chenfeiyang@...il.com, siyanteng01@...il.com
Subject: Re: [PATCH net-next v10 6/6] net: stmmac: dwmac-loongson: Add
Loongson GNET support
在 2024/4/10 11:15, Huacai Chen 写道:
> Hi, Yanteng,
>
>
> + * post 3.5 mode bit acts as 8*PBL.
> + */
> + if (dma_cfg->pblx8)
> + value |= DMA_BUS_MODE_MAXPBL;
> Adding a new blank line is better here.
> OK.
>> +static void loongson_phylink_get_caps(struct stmmac_priv *priv)
>> +{
>> + struct pci_dev *pdev = to_pci_dev(priv->device);
>> + struct stmmac_resources res;
>> + u32 loongson_gmac;
>> +
>> + memset(&res, 0, sizeof(res));
>> + res.addr = pcim_iomap_table(pdev)[0];
>> + loongson_gmac = readl(res.addr + GMAC_VERSION) & 0xff;
>> +
>> + /* The GMAC device with PCI ID 7a03 does not support any pause mode.
>> + * The GNET device (only LS7A2000) does not support half-duplex.
>> + */
>> + if (pdev->device == PCI_DEVICE_ID_LOONGSON_GMAC) {
>> + priv->hw->link.caps = MAC_10FD | MAC_100FD |
>> + MAC_1000FD;
>> + } else {
>> + priv->hw->link.caps = (MAC_ASYM_PAUSE |
>> + MAC_SYM_PAUSE | MAC_10FD | MAC_100FD | MAC_1000FD);
> I think some GNET support HD while others don't, so we should enable
> HD here, and clear HD only for the later 0x37 case. Otherwise you
> disable HD for all devices indeed.
Yeah, you are right. I will fix it in v11.
>> +
>> + if (loongson_gmac == DWMAC_CORE_3_70) {
>> + priv->hw->link.caps &= ~(MAC_10HD |
>> + MAC_100HD | MAC_1000HD);
> I remember that kernel code allows a line exceeding 80 columns now,
> and keeping in one line looks better at least in this case. Moreover,
> we don't need { and } here.
Networking code (still) prefers code to be 80 columns wide or less.
see https://lore.kernel.org/netdev/20240202123034.GO530335@kernel.org/
>> +static int loongson_dwmac_probe(struct pci_dev *pdev,
>> + const struct pci_device_id *id)
>> {
>> struct plat_stmmacenet_data *plat;
>> int ret, i, bus_id, phy_mode;
>> struct stmmac_pci_info *info;
>> struct stmmac_resources res;
>> + struct loongson_data *ld;
>> struct device_node *np;
>> + u32 loongson_gmac;
>>
>> plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL);
>> if (!plat)
>> @@ -87,11 +514,16 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id
>> if (!plat->mdio_bus_data)
>> return -ENOMEM;
>>
>> - plat->dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*plat->dma_cfg), GFP_KERNEL);
>> - if (!plat->dma_cfg) {
>> - ret = -ENOMEM;
>> - goto err_put_node;
>> - }
>> + plat->dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*plat->dma_cfg),
>> + GFP_KERNEL);
> This is an irrelevant modification, don't do that in this patch.
OK.
Thanks,
Yanteng
Powered by blists - more mailing lists