[PATCH net-next 14/15] net: dsa: mt7530: introduce driver for MT7988 built-in switch

Andrew Lunn andrew at lunn.ch
Fri Mar 31 05:45:01 PDT 2023


> Firstly, all of the functions on the mt7530-mmio driver should be changed
> from mt7988_* to mt7530_mmio_*. Same goes for the mt7530-mdio driver too as
> some of the functions don't start with mt7530_mdio_*. The MDIO and MMIO
> drivers are supposed to be used for the switches the MT7530 DSA driver
> supports. The mt7530_ prefix is derived from that. The mmio_ or mdio_ prefix
> is derived from, well, the driver itself.

There are examples of similar naming schemes in other DSA drivers. For
the marvell mv88e6xxx driver, all generic functions use the mv88e6xxx_
prefix. For functions which are specific to a family of marvell
switches, we use a prefix for when the feature was introduced. So for
example we have mv88e6352_g1_reset(), where that method of resetting
the devices was introduced in the mv88e6352. This also gives us some
namespace space, so we can also have mv88e6185_g1_reset() which is
used for a different family.

So i personally don't have a problem using different prefixes within
one driver, if it helps with understanding and name space issues.

> What I'm going to say next depends on how generic the MMIO and MDIO drivers
> are so that they can be used on all MediaTek architecture switches. Let's
> say, a new MediaTek switch is introduced. It seems likely that either the
> MMIO or MDIO driver will be used to control the switch. Maybe the driver for
> this new switch won't be under mt7530.c, like on Realtek, but that doesn't
> change the outcome.

My experience with silicon vendors is that they like to change the
hardware in none backwards compatible ways. So i would actually avoid
generic names, it makes it harder to deal with different variants.

	Andrew



More information about the Linux-mediatek mailing list