Lines Matching +full:lan966x +full:- +full:switch

1 // SPDX-License-Identifier: GPL-2.0+
12 #define LAN966X_TAPRIO_MAX_CYCLE_TIME_NS (NSEC_PER_SEC - 1)
43 return port->chip_port * LAN966X_TAPRIO_ENTRIES_PER_PORT + entry; in lan966x_taprio_list_index()
48 struct lan966x *lan966x = port->lan966x; in lan966x_taprio_list_state_get() local
51 val = lan_rd(lan966x, QSYS_TAS_LST); in lan966x_taprio_list_state_get()
58 struct lan966x *lan966x = port->lan966x; in lan966x_taprio_list_index_state_get() local
62 lan966x, QSYS_TAS_CFG_CTRL); in lan966x_taprio_list_index_state_get()
70 struct lan966x *lan966x = port->lan966x; in lan966x_taprio_list_state_set() local
74 lan966x, QSYS_TAS_LST); in lan966x_taprio_list_state_set()
80 struct lan966x *lan966x = port->lan966x; in lan966x_taprio_list_shutdown() local
137 * queues where closed, so make sure to restore "all-queues-open" in lan966x_taprio_list_shutdown()
140 lan_wr(QSYS_TAS_GS_CTRL_HSCH_POS_SET(port->chip_port), in lan966x_taprio_list_shutdown()
141 lan966x, QSYS_TAS_GS_CTRL); in lan966x_taprio_list_shutdown()
144 lan966x, QSYS_TAS_GATE_STATE); in lan966x_taprio_list_shutdown()
178 int err, oper = -1; in lan966x_taprio_find_list()
181 *new_list = -1; in lan966x_taprio_find_list()
182 *obs_list = -1; in lan966x_taprio_find_list()
203 *obs_list = (oper == -1) ? *new_list : oper; in lan966x_taprio_find_list()
211 *obs_list = (oper == -1) ? *new_list : oper; in lan966x_taprio_find_list()
216 return -ENOSPC; in lan966x_taprio_find_list()
225 if (qopt->cycle_time_extension) in lan966x_taprio_check()
226 return -EOPNOTSUPP; in lan966x_taprio_check()
231 if (qopt->num_entries > LAN966X_TAPRIO_NUM_GCL) in lan966x_taprio_check()
232 return -EINVAL; in lan966x_taprio_check()
235 if (qopt->cycle_time < LAN966X_TAPRIO_MIN_CYCLE_TIME_NS || in lan966x_taprio_check()
236 qopt->cycle_time > LAN966X_TAPRIO_MAX_CYCLE_TIME_NS) in lan966x_taprio_check()
237 return -EINVAL; in lan966x_taprio_check()
239 for (i = 0; i < qopt->num_entries; ++i) { in lan966x_taprio_check()
240 struct tc_taprio_sched_entry *entry = &qopt->entries[i]; in lan966x_taprio_check()
245 if (entry->interval < LAN966X_TAPRIO_MIN_CYCLE_TIME_NS || in lan966x_taprio_check()
246 entry->interval > LAN966X_TAPRIO_MAX_CYCLE_TIME_NS) in lan966x_taprio_check()
247 return -EINVAL; in lan966x_taprio_check()
249 if (qopt->entries[i].command != TC_TAPRIO_CMD_SET_GATES) in lan966x_taprio_check()
250 return -EINVAL; in lan966x_taprio_check()
252 total_time += qopt->entries[i].interval; in lan966x_taprio_check()
257 return -EINVAL; in lan966x_taprio_check()
262 if (qopt->cycle_time < total_time) in lan966x_taprio_check()
263 return -EINVAL; in lan966x_taprio_check()
271 struct lan966x *lan966x = port->lan966x; in lan966x_taprio_gcl_free_get() local
282 max_list = lan966x->num_phys_ports * LAN966X_TAPRIO_ENTRIES_PER_PORT; in lan966x_taprio_gcl_free_get()
288 base = lan_rd(lan966x, QSYS_TAS_LIST_CFG); in lan966x_taprio_gcl_free_get()
294 num_free--; in lan966x_taprio_gcl_free_get()
298 lan966x, QSYS_TAS_CFG_CTRL); in lan966x_taprio_gcl_free_get()
300 next = lan_rd(lan966x, QSYS_TAS_GCL_CT_CFG2); in lan966x_taprio_gcl_free_get()
312 struct lan966x *lan966x = port->lan966x; in lan966x_taprio_gcl_setup_entry() local
315 lan_wr(QSYS_TAS_GCL_CT_CFG_GATE_STATE_SET(entry->gate_mask) | in lan966x_taprio_gcl_setup_entry()
316 QSYS_TAS_GCL_CT_CFG_HSCH_POS_SET(port->chip_port) | in lan966x_taprio_gcl_setup_entry()
318 lan966x, QSYS_TAS_GCL_CT_CFG); in lan966x_taprio_gcl_setup_entry()
320 lan_wr(QSYS_TAS_GCL_CT_CFG2_PORT_PROFILE_SET(port->chip_port) | in lan966x_taprio_gcl_setup_entry()
322 lan966x, QSYS_TAS_GCL_CT_CFG2); in lan966x_taprio_gcl_setup_entry()
324 lan_wr(entry->interval, lan966x, QSYS_TAS_GCL_TM_CFG); in lan966x_taprio_gcl_setup_entry()
332 struct lan966x *lan966x = port->lan966x; in lan966x_taprio_gcl_setup() local
335 if (lan966x_taprio_gcl_free_get(port, free_list) < qopt->num_entries) in lan966x_taprio_gcl_setup()
336 return -ENOSPC; in lan966x_taprio_gcl_setup()
341 lan966x, QSYS_TAS_CFG_CTRL); in lan966x_taprio_gcl_setup()
347 lan966x, QSYS_TAS_LIST_CFG); in lan966x_taprio_gcl_setup()
351 for (i = 0; i < qopt->num_entries; ++i) { in lan966x_taprio_gcl_setup()
354 lan966x, QSYS_TAS_CFG_CTRL); in lan966x_taprio_gcl_setup()
357 if (i == qopt->num_entries - 1) in lan966x_taprio_gcl_setup()
363 lan966x_taprio_gcl_setup_entry(port, &qopt->entries[i], next); in lan966x_taprio_gcl_setup()
372 static void lan966x_taprio_new_base_time(struct lan966x *lan966x, in lan966x_taprio_new_base_time() argument
381 lan966x_ptp_gettime64(&lan966x->phc[LAN966X_PHC_PORT].info, &ts); in lan966x_taprio_new_base_time()
395 u64 tmp = current_time - org_base_time; in lan966x_taprio_new_base_time()
400 rem = cycle_time - rem; in lan966x_taprio_new_base_time()
414 struct lan966x *lan966x = port->lan966x; in lan966x_taprio_speed_set() local
417 switch (speed) { in lan966x_taprio_speed_set()
431 return -EINVAL; in lan966x_taprio_speed_set()
436 lan966x, QSYS_TAS_PROFILE_CFG(port->chip_port)); in lan966x_taprio_speed_set()
444 struct lan966x *lan966x = port->lan966x; in lan966x_taprio_add() local
461 lan966x_taprio_new_base_time(lan966x, qopt->cycle_time, in lan966x_taprio_add()
462 qopt->base_time, &base_time); in lan966x_taprio_add()
466 lan966x, QSYS_TAS_BT_NSEC); in lan966x_taprio_add()
469 lan966x, QSYS_TAS_BT_SEC_LSB); in lan966x_taprio_add()
472 lan966x, QSYS_TAS_BT_SEC_MSB); in lan966x_taprio_add()
474 lan_wr(qopt->cycle_time, lan966x, QSYS_TAS_CT_CFG); in lan966x_taprio_add()
478 lan966x, QSYS_TAS_STARTUP_CFG); in lan966x_taprio_add()
483 lan966x, QSYS_TAS_LST); in lan966x_taprio_add()
493 void lan966x_taprio_init(struct lan966x *lan966x) in lan966x_taprio_init() argument
500 lan966x, QSYS_TAS_STM_CFG); in lan966x_taprio_init()
502 num_taprio_lists = lan966x->num_phys_ports * in lan966x_taprio_init()
510 lan966x, QSYS_TAS_CFG_CTRL); in lan966x_taprio_init()
512 for (p = 0; p < lan966x->num_phys_ports; p++) in lan966x_taprio_init()
515 lan966x, QSYS_TAS_PROFILE_CFG(p)); in lan966x_taprio_init()
518 void lan966x_taprio_deinit(struct lan966x *lan966x) in lan966x_taprio_deinit() argument
522 for (p = 0; p < lan966x->num_phys_ports; ++p) { in lan966x_taprio_deinit()
523 if (!lan966x->ports[p]) in lan966x_taprio_deinit()
526 lan966x_taprio_del(lan966x->ports[p]); in lan966x_taprio_deinit()