On Mon, Oct 21, 2024 at 03:39:26PM +0200, Christian Marangi wrote: > On Mon, Oct 21, 2024 at 04:36:05PM +0300, Vladimir Oltean wrote: > > On Mon, Oct 21, 2024 at 03:01:55PM +0200, Christian Marangi wrote: > > > It's conceptually similar to mediatek switch but register and bits > > > are different. > > > > Is it impractical to use struct regmap_field to abstract those > > differences away and reuse the mt7530 driver's control flow? What is the > > relationship between the Airoha and Mediatek IP anyway? The mt7530 > > maintainers should also be consulted w.r.t. whether code sharing is in > > the common interest (I copied them). > > Some logic are similar for ATU or VLAN handling but then they added bits > in the middle of the register and moved some in other place. > > Happy of being contradicted but from what I checked adapting the mtk > code would introduce lots of condition and wrapper and I feel it would > be actually worse than keeping the 2 codebase alone. > > Would love some help by mt7530 to catch some very common case. As long as the control flow is reasonably similar, the REG_FIELD() macro is able to deal with register fields which have moved from one place to another between hardware variants.