Commit 66548259 authored by Kornel Dulęba's avatar Kornel Dulęba
Browse files

e6000sw: Fix direct register write logic

When accessing a register directly from etherswitchcfg one must specify
a register group(e.g. registers of portN) and the register offset within
the group. The latter is passed as the 5 least significant bits.
Extract the former by dividing the register address by 32, not by 5.

Approved by:	mw(mentor)
Obtained from:	Semihalf
Sponsored by:	Stormshield
MFC after:	2 weeks
Differential Revision:
parent 9dbacce2
...@@ -1061,7 +1061,7 @@ e6000sw_writereg_wrapper(device_t dev, int addr_reg, int val) ...@@ -1061,7 +1061,7 @@ e6000sw_writereg_wrapper(device_t dev, int addr_reg, int val)
device_printf(dev, "Wrong register address.\n"); device_printf(dev, "Wrong register address.\n");
return (EINVAL); return (EINVAL);
} }
e6000sw_writereg(device_get_softc(dev), addr_reg / 5, e6000sw_writereg(device_get_softc(dev), addr_reg / 32,
addr_reg % 32, val); addr_reg % 32, val);
return (0); return (0);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment