mirror of
https://git.openwrt.org/openwrt/openwrt.git
synced 2026-01-28 01:17:30 +01:00
realtek: pcs: add helpers for even, odd, neighbor SerDes
Add dedicated helpers to get references to even, odd and neigbor SerDes
if needed. This should replace the various calculations scattered
throughout the code, providing a unified way to work with adjacent
SerDes.
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21146
Signed-off-by: Robert Marko <robimarko@gmail.com>
(cherry picked from commit 232c1fb14a)
This commit is contained in:
parent
40201e7f73
commit
01cfdb1610
1 changed files with 21 additions and 0 deletions
|
|
@ -239,6 +239,27 @@ static int rtpcs_sds_modify(struct rtpcs_ctrl *ctrl, int sds, int page, int regn
|
|||
mask, set);
|
||||
}
|
||||
|
||||
__maybe_unused
|
||||
static struct rtpcs_serdes *rtpcs_sds_get_even(struct rtpcs_serdes *sds)
|
||||
{
|
||||
u32 even_sds = sds->id & ~1;
|
||||
return &sds->ctrl->serdes[even_sds];
|
||||
}
|
||||
|
||||
__maybe_unused
|
||||
static struct rtpcs_serdes *rtpcs_sds_get_odd(struct rtpcs_serdes *sds)
|
||||
{
|
||||
u32 odd_sds = sds->id | 1;
|
||||
return &sds->ctrl->serdes[odd_sds];
|
||||
}
|
||||
|
||||
__maybe_unused
|
||||
static struct rtpcs_serdes *rtpcs_sds_get_neighbor(struct rtpcs_serdes *sds)
|
||||
{
|
||||
u32 nb_sds = sds->id ^ 1;
|
||||
return &sds->ctrl->serdes[nb_sds];
|
||||
}
|
||||
|
||||
static int rtpcs_regmap_read_bits(struct rtpcs_ctrl *ctrl, int base, int bithigh, int bitlow)
|
||||
{
|
||||
int offset = base + (bitlow / 32) * 4;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue