net: mscc: ocelot: extend watermark encoding function
The ocelot_wm_encode function deals with setting thresholds for pause frame start and stop. In Ocelot and Felix the register layout is the same, but for Seville, it isn't. The easiest way to accommodate Seville hardware configuration is to introduce a function pointer for setting this up. Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
541132f096
commit
aa92d836d5
@@ -1149,8 +1149,21 @@ static int vsc9959_prevalidate_phy_mode(struct ocelot *ocelot, int port,
|
||||
}
|
||||
}
|
||||
|
||||
/* Watermark encode
|
||||
* Bit 8: Unit; 0:1, 1:16
|
||||
* Bit 7-0: Value to be multiplied with unit
|
||||
*/
|
||||
static u16 vsc9959_wm_enc(u16 value)
|
||||
{
|
||||
if (value >= BIT(8))
|
||||
return BIT(8) | (value / 16);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
static const struct ocelot_ops vsc9959_ops = {
|
||||
.reset = vsc9959_reset,
|
||||
.wm_enc = vsc9959_wm_enc,
|
||||
};
|
||||
|
||||
static int vsc9959_mdio_bus_alloc(struct ocelot *ocelot)
|
||||
|
Reference in New Issue
Block a user