net: dsa: qca8k: improve mdio master read/write by using single lo/hi
authorChristian Marangi <ansuelsmth@gmail.com>
Thu, 29 Dec 2022 16:33:36 +0000 (17:33 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sun, 1 Jan 2023 09:27:12 +0000 (09:27 +0000)
commita4165830ca237f2b3318faf62562bce8ce12a389
tree1193b7a32be05a86a438170dd699f048d1e7e44c
parentcfbd6de588ef659c198083205dc954a6d3ed2aec
net: dsa: qca8k: improve mdio master read/write by using single lo/hi

Improve mdio master read/write by using singe mii read/write lo/hi.

In a read and write we need to poll the mdio master regs in a busy loop
to check for a specific bit present in the upper half of the reg. We can
ignore the other half since it won't contain useful data. This will save
an additional useless read for each read and write operation.

In a read operation the returned data is present in the mdio master reg
lower half. We can ignore the other half since it won't contain useful
data. This will save an additional useless read for each read operation.

In a read operation it's needed to just set the hi half of the mdio
master reg as the lo half will be replaced by the result. This will save
an additional useless write for each read operation.

Tested-by: Ronald Wahl <ronald.wahl@raritan.com>
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/qca/qca8k-8xxx.c