Re: [PATCH net-next v7 3/7] net: ftgmac100: Add AST2700 compatible support

From: netdev-bot+sashiko

Date: Mon Nov 23 2026 - 05:13:29 EST


Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

Critical: 0 · High: 0 (1) · Medium: 1 · Low: 2

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The binding and the driver disagree on how an AST2700 PHY is
wired up.
- [Low] At this revision AST2700 gets the 32-bit Aspeed handling and
nothing more.
- [Low] Several driver comments that list which Aspeed generations share
a behaviour were not updated when this patch put AST2700 in the…

Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but this patch
extends it to AST2700.

--

net: ftgmac100: Add AST2700 compatible support

This commit adds an FTGMAC100_AST2700 mac_id with matching match data,
and adds the "aspeed,ast2700-mac" compatible to the OF match table.
AST2700 gets the same Aspeed descriptor masks and is_aspeed handling
as AST2400/2500/2600.

> diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
> index 6d2fe5c2f3903..67b1fa464a421 100644
> --- a/drivers/net/ethernet/faraday/ftgmac100.c
> +++ b/drivers/net/ethernet/faraday/ftgmac100.c
> @@ -37,7 +37,8 @@ enum ftgmac100_mac_id {
> FTGMAC100_FARADAY = 1,
> FTGMAC100_AST2400,
> FTGMAC100_AST2500,
> - FTGMAC100_AST2600
> + FTGMAC100_AST2600,
> + FTGMAC100_AST2700
> };

[Severity: Low]
This isn't a bug, but FTGMAC100_AST2700 now sits in the same class as
AST2600. Should the comments that list the Aspeed generations be updated
to match?

The rclk field in struct ftgmac100 still says:

/* AST2500/AST2600 RMII ref clock gate */
struct clk *rclk;

is_aspeed is now set for AST2700, so ftgmac100_setup_clk() fetches RCLK
for AST2700 as well.

The comment in ftgmac100_probe_dt() ("2600 has an independent MDIO
controller, not part of the MAC") and the one in ftgmac100_setup_mdio()
("The AST2600 has a separate MDIO controller") also apply to AST2700 now,
but neither mentions it.

These comments are still unchanged at the end of the series.

[ ... ]

> @@ -2017,7 +2018,8 @@ static int ftgmac100_probe(struct platform_device *pdev)
>
> if (priv->mac_id == FTGMAC100_AST2400 ||
> priv->mac_id == FTGMAC100_AST2500 ||
> - priv->mac_id == FTGMAC100_AST2600) {
> + priv->mac_id == FTGMAC100_AST2600 ||
> + priv->mac_id == FTGMAC100_AST2700) {
> priv->rxdes0_edorr_mask = BIT(30);
> priv->txdes0_edotr_mask = BIT(30);
> priv->is_aspeed = true;

[Severity: High]
This is a pre-existing issue that was not introduced by this patch, but
setting is_aspeed for AST2700 carries it over to the new compatible.

ftgmac100_reset_and_config_mac() dereferences phydev without checking
for NULL:

if (priv->is_aspeed && priv->netdev->phydev->interface == PHY_INTERFACE_MODE_RMII) {

ftgmac100_probe_dt() can return 0 with no PHY attached. This happens
when the node has no use-ncsi, no fixed-link and no phy-handle, but does
have an mdio child:

if (!ftgmac100_has_child_node(np, "mdio")) {
...
err = ftgmac100_mii_probe(netdev);
...
}

return 0;

In that case register_netdev() succeeds with netdev->phydev == NULL, and
the first open runs:

ftgmac100_open()
ftgmac100_reset_and_config_mac()
priv->netdev->phydev->interface

ftgmac100_open(), ftgmac100_stop() and ftgmac100_phy_disconnect() all
check netdev->phydev for NULL already. So a NULL phydev after probe
seems to be an expected state.

The binding accepts such a node, since an mdio child is allowed and
phy-handle is optional.

Can this oops in ndo_open, with rtnl held, for an AST2700 node like this?

There is also a later patch in the series, "net: ftgmac100: Enable
AST2700 RMII support". It says that ftgmac100_probe_dt() always attaches
a phy_device before register_netdev() can succeed, and it adds another
unguarded phydev->interface dereference in ftgmac100_start_hw(). Does
that assumption still hold given the path above?

[ ... ]

> @@ -2131,6 +2133,10 @@ static const struct ftgmac100_match_data ftgmac100_match_data_ast2600 = {
> .mac_id = FTGMAC100_AST2600
> };
>
> +static const struct ftgmac100_match_data ftgmac100_match_data_ast2700 = {
> + .mac_id = FTGMAC100_AST2700
> +};
> +

[Severity: Low]
At this revision AST2700 only gets the 32-bit Aspeed handling. The
driver never calls dma_set_mask*(). ftgmac100_init_hw() writes only the
low 32 bits of the ring bases:

iowrite32(priv->rxdes_dma, priv->base + FTGMAC100_OFFSET_RXR_BADR);

ftgmac100_alloc_rx_buf() also keeps only the low 32 bits in the
descriptor:

rxdes->rxdes3 = cpu_to_le32(map);

AST2700 DRAM starts at 0x400000000 (memory@400000000 in
ast2700-evb.dts). Would the MAC be able to DMA at all on AST2700 at this
point in the series?

A later patch in the series, "net: ftgmac100: Add AST2700 upper DMA
address support", seems to fix this. It adds FTGMAC100_QUIRK_DMA_35BIT,
the 35-bit DMA mask, the high ring base registers and the descriptor
high address bits.

The Kconfig dependencies also prevent building the driver for arm64
until "net: ftgmac100: Allow building on ARM64":

depends on ARM || COMPILE_TEST
depends on !64BIT || BROKEN

So this state probably can't be reached on real hardware during
bisection. Would it still make sense to wire up the compatible after the
DMA support lands in the series?

> static const struct ftgmac100_match_data ftgmac100_match_data_faraday = {
> .mac_id = FTGMAC100_FARADAY
> };
> @@ -2142,6 +2148,8 @@ static const struct of_device_id ftgmac100_of_match[] = {
> .data = &ftgmac100_match_data_ast2500 },
> { .compatible = "aspeed,ast2600-mac",
> .data = &ftgmac100_match_data_ast2600 },
> + { .compatible = "aspeed,ast2700-mac",
> + .data = &ftgmac100_match_data_ast2700 },

[Severity: Medium]
Do the binding and the driver agree on how an AST2700 PHY gets
connected?

ftgmac100_probe() only calls ftgmac100_setup_mdio() for FARADAY, AST2400
and AST2500. For AST2700, priv->mii_bus is therefore always NULL:

if (priv->mac_id == FTGMAC100_FARADAY ||
priv->mac_id == FTGMAC100_AST2400 ||
priv->mac_id == FTGMAC100_AST2500) {
err = ftgmac100_setup_mdio(netdev);

This means a non-NC-SI AST2700 node only probes successfully if it has
phy-handle or fixed-link. Otherwise one of two things happens.

Without an mdio child, ftgmac100_probe_dt() calls ftgmac100_mii_probe(),
which always fails here:

if (!priv->mii_bus) {
dev_err(priv->dev, "No MDIO bus available\n");
return -ENODEV;
}

With an mdio child, ftgmac100_probe_dt() returns 0 with no PHY attached.
That leads to the NULL phydev dereference described above.

At the end of the series, faraday,ftgmac100.yaml only requires one of
phy-mode or use-ncsi for aspeed,ast2700-mac. It leaves phy-handle
optional and allows an mdio child. So a node such as
compatible = "aspeed,ast2700-mac"; phy-mode = "rgmii"; passes
dt_binding_check, but then either fails to probe or binds with no PHY.

The binding patch justifies the phy-mode requirement by pointing at the
AST2700 phy-mode check in ftgmac100_mii_probe(). That check is added by
"net: ftgmac100: Require phy-mode for AST2700", and it sits after the
!priv->mii_bus guard, which always returns -ENODEV for AST2700. Can that
check ever run?

On the phy-handle/fixed-link path, of_phy_get_and_connect() already
returns NULL when of_get_phy_mode() fails.

Should the binding require phy-handle or fixed-link for AST2700 when
use-ncsi is absent?

> { .compatible = "faraday,ftgmac100",
> .data = &ftgmac100_match_data_faraday },
> { }

--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261119-support_ast2700-v7-0-33c8ca2d0dd7%40aspeedtech.com