Lines Matching refs:sparx5

23 int sparx5_sdlb_clk_hz_get(struct sparx5 *sparx5)  in sparx5_sdlb_clk_hz_get()  argument
28 clk_per_100ps = HSCH_SYS_CLK_PER_100PS_GET(spx5_rd(sparx5, in sparx5_sdlb_clk_hz_get()
37 static int sparx5_sdlb_pup_interval_get(struct sparx5 *sparx5, u32 max_token, in sparx5_sdlb_pup_interval_get() argument
42 clk_hz = sparx5_sdlb_clk_hz_get(sparx5); in sparx5_sdlb_pup_interval_get()
47 int sparx5_sdlb_pup_token_get(struct sparx5 *sparx5, u32 pup_interval, u64 rate) in sparx5_sdlb_pup_token_get() argument
54 clk_hz = sparx5_sdlb_clk_hz_get(sparx5); in sparx5_sdlb_pup_token_get()
59 static void sparx5_sdlb_group_disable(struct sparx5 *sparx5, u32 group) in sparx5_sdlb_group_disable() argument
62 ANA_AC_SDLB_PUP_CTRL_PUP_ENA, sparx5, in sparx5_sdlb_group_disable()
66 static void sparx5_sdlb_group_enable(struct sparx5 *sparx5, u32 group) in sparx5_sdlb_group_enable() argument
69 ANA_AC_SDLB_PUP_CTRL_PUP_ENA, sparx5, in sparx5_sdlb_group_enable()
73 static u32 sparx5_sdlb_group_get_first(struct sparx5 *sparx5, u32 group) in sparx5_sdlb_group_get_first() argument
77 val = spx5_rd(sparx5, ANA_AC_SDLB_XLB_START(group)); in sparx5_sdlb_group_get_first()
82 static u32 sparx5_sdlb_group_get_next(struct sparx5 *sparx5, u32 group, in sparx5_sdlb_group_get_next() argument
87 val = spx5_rd(sparx5, ANA_AC_SDLB_XLB_NEXT(lb)); in sparx5_sdlb_group_get_next()
92 static bool sparx5_sdlb_group_is_first(struct sparx5 *sparx5, u32 group, in sparx5_sdlb_group_is_first() argument
95 return lb == sparx5_sdlb_group_get_first(sparx5, group); in sparx5_sdlb_group_is_first()
98 static bool sparx5_sdlb_group_is_last(struct sparx5 *sparx5, u32 group, in sparx5_sdlb_group_is_last() argument
101 return lb == sparx5_sdlb_group_get_next(sparx5, group, lb); in sparx5_sdlb_group_is_last()
104 static bool sparx5_sdlb_group_is_empty(struct sparx5 *sparx5, u32 group) in sparx5_sdlb_group_is_empty() argument
108 val = spx5_rd(sparx5, ANA_AC_SDLB_PUP_CTRL(group)); in sparx5_sdlb_group_is_empty()
113 static u32 sparx5_sdlb_group_get_last(struct sparx5 *sparx5, u32 group) in sparx5_sdlb_group_get_last() argument
117 itr = sparx5_sdlb_group_get_first(sparx5, group); in sparx5_sdlb_group_get_last()
120 next = sparx5_sdlb_group_get_next(sparx5, group, itr); in sparx5_sdlb_group_get_last()
128 static bool sparx5_sdlb_group_is_singular(struct sparx5 *sparx5, u32 group) in sparx5_sdlb_group_is_singular() argument
130 if (sparx5_sdlb_group_is_empty(sparx5, group)) in sparx5_sdlb_group_is_singular()
133 return sparx5_sdlb_group_get_first(sparx5, group) == in sparx5_sdlb_group_is_singular()
134 sparx5_sdlb_group_get_last(sparx5, group); in sparx5_sdlb_group_is_singular()
137 static int sparx5_sdlb_group_get_adjacent(struct sparx5 *sparx5, u32 group, in sparx5_sdlb_group_get_adjacent() argument
143 *first = sparx5_sdlb_group_get_first(sparx5, group); in sparx5_sdlb_group_get_adjacent()
149 *next = sparx5_sdlb_group_get_next(sparx5, group, itr); in sparx5_sdlb_group_get_adjacent()
162 static int sparx5_sdlb_group_get_count(struct sparx5 *sparx5, u32 group) in sparx5_sdlb_group_get_count() argument
167 itr = sparx5_sdlb_group_get_first(sparx5, group); in sparx5_sdlb_group_get_count()
170 next = sparx5_sdlb_group_get_next(sparx5, group, itr); in sparx5_sdlb_group_get_count()
179 int sparx5_sdlb_group_get_by_rate(struct sparx5 *sparx5, u32 rate, u32 burst) in sparx5_sdlb_group_get_by_rate() argument
190 count = sparx5_sdlb_group_get_count(sparx5, i); in sparx5_sdlb_group_get_by_rate()
206 int sparx5_sdlb_group_get_by_index(struct sparx5 *sparx5, u32 idx, u32 *group) in sparx5_sdlb_group_get_by_index() argument
212 if (sparx5_sdlb_group_is_empty(sparx5, i)) in sparx5_sdlb_group_get_by_index()
215 itr = sparx5_sdlb_group_get_first(sparx5, i); in sparx5_sdlb_group_get_by_index()
218 next = sparx5_sdlb_group_get_next(sparx5, i, itr); in sparx5_sdlb_group_get_by_index()
234 static int sparx5_sdlb_group_link(struct sparx5 *sparx5, u32 group, u32 idx, in sparx5_sdlb_group_link() argument
238 sparx5_sdlb_group_disable(sparx5, group); in sparx5_sdlb_group_link()
246 sparx5, ANA_AC_SDLB_XLB_NEXT(idx)); in sparx5_sdlb_group_link()
249 spx5_wr(ANA_AC_SDLB_XLB_START_LBSET_START_SET(first), sparx5, in sparx5_sdlb_group_link()
253 sparx5_sdlb_group_enable(sparx5, group); in sparx5_sdlb_group_link()
258 int sparx5_sdlb_group_add(struct sparx5 *sparx5, u32 group, u32 idx) in sparx5_sdlb_group_add() argument
265 if (sparx5_sdlb_group_is_empty(sparx5, group)) in sparx5_sdlb_group_add()
268 next = sparx5_sdlb_group_get_first(sparx5, group); in sparx5_sdlb_group_add()
270 return sparx5_sdlb_group_link(sparx5, group, idx, first, next, false); in sparx5_sdlb_group_add()
273 int sparx5_sdlb_group_del(struct sparx5 *sparx5, u32 group, u32 idx) in sparx5_sdlb_group_del() argument
278 if (sparx5_sdlb_group_get_adjacent(sparx5, group, idx, &prev, &next, in sparx5_sdlb_group_del()
285 if (sparx5_sdlb_group_is_singular(sparx5, group)) { in sparx5_sdlb_group_del()
287 } else if (sparx5_sdlb_group_is_last(sparx5, group, idx)) { in sparx5_sdlb_group_del()
291 } else if (sparx5_sdlb_group_is_first(sparx5, group, idx)) { in sparx5_sdlb_group_del()
300 return sparx5_sdlb_group_link(sparx5, group, idx, first, next, empty); in sparx5_sdlb_group_del()
303 void sparx5_sdlb_group_init(struct sparx5 *sparx5, u64 max_rate, u32 min_burst, in sparx5_sdlb_group_init() argument
323 sparx5_sdlb_pup_interval_get(sparx5, max_token, max_rate); in sparx5_sdlb_group_init()
328 sparx5, ANA_AC_SDLB_PUP_INTERVAL(idx)); in sparx5_sdlb_group_init()
331 sparx5, ANA_AC_SDLB_FRM_RATE_TOKENS(idx)); in sparx5_sdlb_group_init()
333 spx5_wr(ANA_AC_SDLB_LBGRP_MISC_THRES_SHIFT_SET(thres_shift), sparx5, in sparx5_sdlb_group_init()