]> git.baikalelectronics.ru Git - kernel.git/commit
net: ethernet: mtk_eth_soc: fix return values and refactor MDIO ops
authorDaniel Golle <daniel@makrotopia.org>
Tue, 4 Jan 2022 12:06:22 +0000 (12:06 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 5 Jan 2022 11:22:17 +0000 (11:22 +0000)
commitec253735281fb093484a9d8c10549f3b4b6b1043
treef9034126dd59b440ce8d123c5db7297748454470
parent29d1ad761d543b0b1af833ee56409b524aa9c73c
net: ethernet: mtk_eth_soc: fix return values and refactor MDIO ops

Instead of returning -1 (-EPERM) when MDIO bus is stuck busy
while writing or 0xffff if it happens while reading, return the
appropriate -ETIMEDOUT. Also fix return type to int instead of u32.
Refactor functions to use bitfield helpers instead of having various
masking and shifting constants in the code, which also results in the
register definitions in the header file being more obviously related
to what is stated in the MediaTek's Reference Manual.

Fixes: 6d4adf869443d ("net-next: mediatek: add support for MT7623 ethernet")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mediatek/mtk_eth_soc.c
drivers/net/ethernet/mediatek/mtk_eth_soc.h