Lines Matching +full:1 +full:- +full:lane

1 // SPDX-License-Identifier: GPL-2.0
12 * tb_lc_read_uuid() - Read switch UUID from link controller common register
18 if (!sw->cap_lc) in tb_lc_read_uuid()
19 return -EINVAL; in tb_lc_read_uuid()
20 return tb_sw_read(sw, uuid, TB_CFG_SWITCH, sw->cap_lc + TB_LC_FUSE, 4); in tb_lc_read_uuid()
25 if (!sw->cap_lc) in read_lc_desc()
26 return -EINVAL; in read_lc_desc()
27 return tb_sw_read(sw, desc, TB_CFG_SWITCH, sw->cap_lc + TB_LC_DESC, 1); in read_lc_desc()
32 struct tb_switch *sw = port->sw; in find_port_lc_cap()
43 phys = tb_phy_port_from_link(port->port); in find_port_lc_cap()
45 return sw->cap_lc + start + phys * size; in find_port_lc_cap()
51 struct tb_switch *sw = port->sw; in tb_lc_set_port_configured()
52 u32 ctrl, lane; in tb_lc_set_port_configured() local
55 if (sw->generation < 2) in tb_lc_set_port_configured()
62 ret = tb_sw_read(sw, &ctrl, TB_CFG_SWITCH, cap + TB_LC_SX_CTRL, 1); in tb_lc_set_port_configured()
66 /* Resolve correct lane */ in tb_lc_set_port_configured()
67 if (port->port % 2) in tb_lc_set_port_configured()
68 lane = TB_LC_SX_CTRL_L1C; in tb_lc_set_port_configured()
70 lane = TB_LC_SX_CTRL_L2C; in tb_lc_set_port_configured()
73 ctrl |= lane; in tb_lc_set_port_configured()
77 ctrl &= ~lane; in tb_lc_set_port_configured()
82 return tb_sw_write(sw, &ctrl, TB_CFG_SWITCH, cap + TB_LC_SX_CTRL, 1); in tb_lc_set_port_configured()
86 * tb_lc_configure_port() - Let LC know about configured port
97 * tb_lc_unconfigure_port() - Let LC know about unconfigured port
109 struct tb_switch *sw = port->sw; in tb_lc_set_xdomain_configured()
110 u32 ctrl, lane; in tb_lc_set_xdomain_configured() local
113 if (sw->generation < 2) in tb_lc_set_xdomain_configured()
120 ret = tb_sw_read(sw, &ctrl, TB_CFG_SWITCH, cap + TB_LC_SX_CTRL, 1); in tb_lc_set_xdomain_configured()
124 /* Resolve correct lane */ in tb_lc_set_xdomain_configured()
125 if (port->port % 2) in tb_lc_set_xdomain_configured()
126 lane = TB_LC_SX_CTRL_L1D; in tb_lc_set_xdomain_configured()
128 lane = TB_LC_SX_CTRL_L2D; in tb_lc_set_xdomain_configured()
131 ctrl |= lane; in tb_lc_set_xdomain_configured()
133 ctrl &= ~lane; in tb_lc_set_xdomain_configured()
135 return tb_sw_write(sw, &ctrl, TB_CFG_SWITCH, cap + TB_LC_SX_CTRL, 1); in tb_lc_set_xdomain_configured()
139 * tb_lc_configure_xdomain() - Inform LC that the link is XDomain
142 * Sets the lane configured for XDomain accordingly so that the LC knows
151 * tb_lc_unconfigure_xdomain() - Unconfigure XDomain from port
154 * Unsets the lane XDomain configuration.
162 * tb_lc_start_lane_initialization() - Start lane initialization
163 * @port: Device router lane 0 adapter
165 * Starts lane initialization for @port after the router resumed from
166 * sleep. Should be called for those downstream lane adapters that were
173 struct tb_switch *sw = port->sw; in tb_lc_start_lane_initialization()
180 if (sw->generation < 2) in tb_lc_start_lane_initialization()
187 ret = tb_sw_read(sw, &ctrl, TB_CFG_SWITCH, cap + TB_LC_SX_CTRL, 1); in tb_lc_start_lane_initialization()
193 return tb_sw_write(sw, &ctrl, TB_CFG_SWITCH, cap + TB_LC_SX_CTRL, 1); in tb_lc_start_lane_initialization()
197 * tb_lc_is_clx_supported() - Check whether CLx is supported by the lane adapter
198 * @port: Lane adapter
205 struct tb_switch *sw = port->sw; in tb_lc_is_clx_supported()
213 ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, cap + TB_LC_LINK_ATTR, 1); in tb_lc_is_clx_supported()
221 * tb_lc_is_usb_plugged() - Is there USB device connected to port
222 * @port: Device router lane 0 adapter
224 * Returns true if the @port has USB type-C device connected.
228 struct tb_switch *sw = port->sw; in tb_lc_is_usb_plugged()
232 if (sw->generation != 3) in tb_lc_is_usb_plugged()
239 ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, cap + TB_LC_CS_42, 1); in tb_lc_is_usb_plugged()
247 * tb_lc_is_xhci_connected() - Is the internal xHCI connected
248 * @port: Device router lane 0 adapter
254 struct tb_switch *sw = port->sw; in tb_lc_is_xhci_connected()
258 if (sw->generation != 3) in tb_lc_is_xhci_connected()
265 ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, cap + TB_LC_LINK_REQ, 1); in tb_lc_is_xhci_connected()
274 struct tb_switch *sw = port->sw; in __tb_lc_xhci_connect()
278 if (sw->generation != 3) in __tb_lc_xhci_connect()
279 return -EINVAL; in __tb_lc_xhci_connect()
285 ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, cap + TB_LC_LINK_REQ, 1); in __tb_lc_xhci_connect()
294 return tb_sw_write(sw, &val, TB_CFG_SWITCH, cap + TB_LC_LINK_REQ, 1); in __tb_lc_xhci_connect()
298 * tb_lc_xhci_connect() - Connect internal xHCI
299 * @port: Device router lane 0 adapter
318 * tb_lc_xhci_disconnect() - Disconnect internal xHCI
319 * @port: Device router lane 0 adapter
341 offset + TB_LC_SX_CTRL, 1); in tb_lc_set_wake_one()
357 return tb_sw_write(sw, &ctrl, TB_CFG_SWITCH, offset + TB_LC_SX_CTRL, 1); in tb_lc_set_wake_one()
361 * tb_lc_set_wake() - Enable/disable wake
372 if (sw->generation < 2) in tb_lc_set_wake()
389 unsigned int offset = sw->cap_lc + start + i * size; in tb_lc_set_wake()
400 * tb_lc_set_sleep() - Inform LC that the switch is going to sleep
411 if (sw->generation < 2) in tb_lc_set_sleep()
425 unsigned int offset = sw->cap_lc + start + i * size; in tb_lc_set_sleep()
429 offset + TB_LC_SX_CTRL, 1); in tb_lc_set_sleep()
435 offset + TB_LC_SX_CTRL, 1); in tb_lc_set_sleep()
444 * tb_lc_lane_bonding_possible() - Is lane bonding possible towards switch
447 * Checks whether conditions for lane bonding from parent to @sw are
456 if (sw->generation < 2) in tb_lc_lane_bonding_possible()
464 ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, cap + TB_LC_PORT_ATTR, 1); in tb_lc_lane_bonding_possible()
476 /* The first DP IN port is sink 0 and second is sink 1 */ in tb_lc_dp_sink_from_port()
482 return -EINVAL; in tb_lc_dp_sink_from_port()
491 sw->cap_lc + TB_LC_SNK_ALLOCATION, 1); in tb_lc_dp_sink_available()
497 * either 0 or 1. in tb_lc_dp_sink_available()
510 return -EBUSY; in tb_lc_dp_sink_available()
514 * tb_lc_dp_sink_query() - Is DP sink available for DP IN port
529 if (sw->generation < 3) in tb_lc_dp_sink_query()
540 * tb_lc_dp_sink_alloc() - Allocate DP sink
546 * other cases returs negative errno. In particular %-EBUSY is returned if
554 if (sw->generation < 3) in tb_lc_dp_sink_alloc()
566 sw->cap_lc + TB_LC_SNK_ALLOCATION, 1); in tb_lc_dp_sink_alloc()
580 sw->cap_lc + TB_LC_SNK_ALLOCATION, 1); in tb_lc_dp_sink_alloc()
590 * tb_lc_dp_sink_dealloc() - De-allocate DP sink
591 * @sw: Switch whose DP sink is de-allocated
592 * @in: DP IN port whose DP sink is de-allocated
594 * De-allocate DP sink from @in using LC SNK_ALLOCATION registers.
601 if (sw->generation < 3) in tb_lc_dp_sink_dealloc()
614 sw->cap_lc + TB_LC_SNK_ALLOCATION, 1); in tb_lc_dp_sink_dealloc()
624 sw->cap_lc + TB_LC_SNK_ALLOCATION, 1); in tb_lc_dp_sink_dealloc()
628 tb_port_dbg(in, "sink %d de-allocated\n", sink); in tb_lc_dp_sink_dealloc()
633 * tb_lc_force_power() - Forces LC to be powered on
643 return tb_sw_write(sw, &in, TB_CFG_SWITCH, TB_LC_POWER, 1); in tb_lc_force_power()