Skip to content

Commit 2f5bd34

Browse files
committed
net: stmmac: dwmac-phytium: compat some FT2000
Compat with some quirk platform FT2000/4 as id "FTGM0001", use rgmii-rxid instead of rgmii (wrong ACPI DSDT), and set dma_ops and host_dma_width (fix code style). origin code in k4.19 is following: acpi_dma_configure(priv->device,DEV_DMA_COHERENT); static u64 my_mask=0xffffffff; priv->device->dma_mask = &my_mask; priv->device->coherent_dma_mask = (u32)~0; port to k5.10 add: pdev->dev.dma_ops = NULL; Signed-off-by: Caicai <[email protected]> Signed-off-by: hmy <[email protected]> Signed-off-by: wenlunpeng <[email protected]> Signed-off-by: Wentao Guan <[email protected]>
1 parent 203f542 commit 2f5bd34

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

drivers/net/ethernet/stmicro/stmmac/dwmac-phytium.c

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,21 @@ static int phytium_dwmac_probe(struct platform_device *pdev)
6565
return -ENOMEM;
6666

6767
plat->phy_interface = device_get_phy_mode(&pdev->dev);
68+
#ifdef CONFIG_ACPI
69+
static const struct acpi_device_id phytium_old_acpi_id[] = {
70+
{ .id = "FTGM0001" }, // compat FT2000/4 id
71+
{ }
72+
};
73+
/* "phy-mode" in phytium platform DSDT is not correct in some old device.
74+
* Force this PHY mode to rgmii-rxid and info of its use.
75+
* If the phy-mode rgmii is realy used, a blacklist may need to be added.
76+
*/
77+
if (acpi_match_device_ids(to_acpi_device(&pdev->dev), phytium_old_acpi_id) &&
78+
plat->phy_interface == PHY_INTERFACE_MODE_RGMII) {
79+
plat->phy_interface = PHY_INTERFACE_MODE_RGMII_RXID;
80+
dev_info(&pdev->dev, "phytium workaround: phy-mode from rgmii to rgmii-rxid\n");
81+
}
82+
#endif
6883
if (plat->phy_interface < 0)
6984
return plat->phy_interface;
7085

@@ -153,7 +168,15 @@ static int phytium_dwmac_probe(struct platform_device *pdev)
153168
plat->dma_cfg->aal = fwnode_property_read_bool(fwnode, "snps,aal");
154169
plat->dma_cfg->fixed_burst = fwnode_property_read_bool(fwnode, "snps,fixed-burst");
155170
plat->dma_cfg->mixed_burst = fwnode_property_read_bool(fwnode, "snps,mixed-burst");
156-
171+
#ifdef CONFIG_ACPI
172+
/* Some old phytium 2000/4 FTGM0001 cannot auto deferred stmmac DMA settings
173+
* show kernel error 'DMA descriptors allocation failed'
174+
*/
175+
if (acpi_match_device_ids(to_acpi_device(&pdev->dev), phytium_old_acpi_id)) {
176+
pdev->dev.dma_ops = NULL; // solved set DMA mask Failed
177+
plat->host_dma_width = 32;
178+
}
179+
#endif
157180
plat->axi->axi_lpi_en = false;
158181
plat->axi->axi_xit_frm = false;
159182
plat->axi->axi_wr_osr_lmt = 7;

0 commit comments

Comments
 (0)