Lines Matching +full:2 +full:- +full:lane
1 // SPDX-License-Identifier: GPL-2.0
14 * tb_lc_read_uuid() - Read switch UUID from link controller common register
20 if (!sw->cap_lc) in tb_lc_read_uuid()
21 return -EINVAL; in tb_lc_read_uuid()
22 return tb_sw_read(sw, uuid, TB_CFG_SWITCH, sw->cap_lc + TB_LC_FUSE, 4); in tb_lc_read_uuid()
27 if (!sw->cap_lc) in read_lc_desc()
28 return -EINVAL; in read_lc_desc()
29 return tb_sw_read(sw, desc, TB_CFG_SWITCH, sw->cap_lc + TB_LC_DESC, 1); in read_lc_desc()
34 struct tb_switch *sw = port->sw; in find_port_lc_cap()
45 phys = tb_phy_port_from_link(port->port); in find_port_lc_cap()
47 return sw->cap_lc + start + phys * size; in find_port_lc_cap()
51 * tb_lc_reset_port() - Trigger downstream port reset through LC
56 * non-USB4 routers with link controller (that's Thunderbolt 2 and
61 struct tb_switch *sw = port->sw; in tb_lc_reset_port()
65 if (sw->generation < 2) in tb_lc_reset_port()
66 return -EINVAL; in tb_lc_reset_port()
96 struct tb_switch *sw = port->sw; in tb_lc_set_port_configured()
97 u32 ctrl, lane; in tb_lc_set_port_configured() local
100 if (sw->generation < 2) in tb_lc_set_port_configured()
111 /* Resolve correct lane */ in tb_lc_set_port_configured()
112 if (port->port % 2) in tb_lc_set_port_configured()
113 lane = TB_LC_SX_CTRL_L1C; in tb_lc_set_port_configured()
115 lane = TB_LC_SX_CTRL_L2C; in tb_lc_set_port_configured()
118 ctrl |= lane; in tb_lc_set_port_configured()
122 ctrl &= ~lane; in tb_lc_set_port_configured()
131 * tb_lc_configure_port() - Let LC know about configured port
142 * tb_lc_unconfigure_port() - Let LC know about unconfigured port
154 struct tb_switch *sw = port->sw; in tb_lc_set_xdomain_configured()
155 u32 ctrl, lane; in tb_lc_set_xdomain_configured() local
158 if (sw->generation < 2) in tb_lc_set_xdomain_configured()
169 /* Resolve correct lane */ in tb_lc_set_xdomain_configured()
170 if (port->port % 2) in tb_lc_set_xdomain_configured()
171 lane = TB_LC_SX_CTRL_L1D; in tb_lc_set_xdomain_configured()
173 lane = TB_LC_SX_CTRL_L2D; in tb_lc_set_xdomain_configured()
176 ctrl |= lane; in tb_lc_set_xdomain_configured()
178 ctrl &= ~lane; in tb_lc_set_xdomain_configured()
184 * tb_lc_configure_xdomain() - Inform LC that the link is XDomain
187 * Sets the lane configured for XDomain accordingly so that the LC knows
196 * tb_lc_unconfigure_xdomain() - Unconfigure XDomain from port
199 * Unsets the lane XDomain configuration.
207 * tb_lc_start_lane_initialization() - Start lane initialization
208 * @port: Device router lane 0 adapter
210 * Starts lane initialization for @port after the router resumed from
211 * sleep. Should be called for those downstream lane adapters that were
218 struct tb_switch *sw = port->sw; in tb_lc_start_lane_initialization()
225 if (sw->generation < 2) in tb_lc_start_lane_initialization()
242 * tb_lc_is_clx_supported() - Check whether CLx is supported by the lane adapter
243 * @port: Lane adapter
250 struct tb_switch *sw = port->sw; in tb_lc_is_clx_supported()
266 * tb_lc_is_usb_plugged() - Is there USB device connected to port
267 * @port: Device router lane 0 adapter
269 * Returns true if the @port has USB type-C device connected.
273 struct tb_switch *sw = port->sw; in tb_lc_is_usb_plugged()
277 if (sw->generation != 3) in tb_lc_is_usb_plugged()
292 * tb_lc_is_xhci_connected() - Is the internal xHCI connected
293 * @port: Device router lane 0 adapter
299 struct tb_switch *sw = port->sw; in tb_lc_is_xhci_connected()
303 if (sw->generation != 3) in tb_lc_is_xhci_connected()
319 struct tb_switch *sw = port->sw; in __tb_lc_xhci_connect()
323 if (sw->generation != 3) in __tb_lc_xhci_connect()
324 return -EINVAL; in __tb_lc_xhci_connect()
343 * tb_lc_xhci_connect() - Connect internal xHCI
344 * @port: Device router lane 0 adapter
363 * tb_lc_xhci_disconnect() - Disconnect internal xHCI
364 * @port: Device router lane 0 adapter
406 * tb_lc_set_wake() - Enable/disable wake
417 if (sw->generation < 2) in tb_lc_set_wake()
434 unsigned int offset = sw->cap_lc + start + i * size; in tb_lc_set_wake()
445 * tb_lc_set_sleep() - Inform LC that the switch is going to sleep
456 if (sw->generation < 2) in tb_lc_set_sleep()
470 unsigned int offset = sw->cap_lc + start + i * size; in tb_lc_set_sleep()
489 * tb_lc_lane_bonding_possible() - Is lane bonding possible towards switch
492 * Checks whether conditions for lane bonding from parent to @sw are
501 if (sw->generation < 2) in tb_lc_lane_bonding_possible()
527 return -EINVAL; in tb_lc_dp_sink_from_port()
536 sw->cap_lc + TB_LC_SNK_ALLOCATION, 1); in tb_lc_dp_sink_available()
555 return -EBUSY; in tb_lc_dp_sink_available()
559 * tb_lc_dp_sink_query() - Is DP sink available for DP IN port
574 if (sw->generation < 3) in tb_lc_dp_sink_query()
585 * tb_lc_dp_sink_alloc() - Allocate DP sink
591 * other cases returs negative errno. In particular %-EBUSY is returned if
599 if (sw->generation < 3) in tb_lc_dp_sink_alloc()
611 sw->cap_lc + TB_LC_SNK_ALLOCATION, 1); in tb_lc_dp_sink_alloc()
625 sw->cap_lc + TB_LC_SNK_ALLOCATION, 1); in tb_lc_dp_sink_alloc()
635 * tb_lc_dp_sink_dealloc() - De-allocate DP sink
636 * @sw: Switch whose DP sink is de-allocated
637 * @in: DP IN port whose DP sink is de-allocated
639 * De-allocate DP sink from @in using LC SNK_ALLOCATION registers.
646 if (sw->generation < 3) in tb_lc_dp_sink_dealloc()
659 sw->cap_lc + TB_LC_SNK_ALLOCATION, 1); in tb_lc_dp_sink_dealloc()
669 sw->cap_lc + TB_LC_SNK_ALLOCATION, 1); in tb_lc_dp_sink_dealloc()
673 tb_port_dbg(in, "sink %d de-allocated\n", sink); in tb_lc_dp_sink_dealloc()
678 * tb_lc_force_power() - Forces LC to be powered on