Lines Matching +full:port +full:- +full:1
1 // SPDX-License-Identifier: GPL-2.0
64 ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, offset, 1); in usb4_switch_wait_for_bit()
74 return -ETIMEDOUT; in usb4_switch_wait_for_bit()
81 return -EINVAL; in usb4_switch_op_read_data()
90 return -EINVAL; in usb4_switch_op_write_data()
97 return tb_sw_read(sw, metadata, TB_CFG_SWITCH, ROUTER_CS_25, 1); in usb4_switch_op_read_metadata()
102 return tb_sw_write(sw, &metadata, TB_CFG_SWITCH, ROUTER_CS_25, 1); in usb4_switch_op_write_metadata()
125 if (ret != -ENODEV && retries--) in usb4_do_read_data()
130 nbytes -= offset; in usb4_do_read_data()
133 size -= nbytes; in usb4_do_read_data()
159 if (ret == -ETIMEDOUT) { in usb4_do_write_data()
160 if (retries--) in usb4_do_write_data()
162 ret = -EIO; in usb4_do_write_data()
167 size -= nbytes; in usb4_do_write_data()
181 ret = tb_sw_write(sw, &val, TB_CFG_SWITCH, ROUTER_CS_26, 1); in usb4_switch_op()
189 ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, ROUTER_CS_26, 1); in usb4_switch_op()
194 return -EOPNOTSUPP; in usb4_switch_op()
202 struct tb_port *port; in usb4_switch_check_wakes() local
206 if (!device_may_wakeup(&sw->dev)) in usb4_switch_check_wakes()
210 if (tb_sw_read(sw, &val, TB_CFG_SWITCH, ROUTER_CS_6, 1)) in usb4_switch_check_wakes()
221 tb_switch_for_each_port(sw, port) { in usb4_switch_check_wakes()
222 if (!tb_port_has_remote(port)) in usb4_switch_check_wakes()
225 if (tb_port_read(port, &val, TB_CFG_PORT, in usb4_switch_check_wakes()
226 port->cap_usb4 + PORT_CS_18, 1)) in usb4_switch_check_wakes()
229 tb_port_dbg(port, "USB4 wake: %s\n", in usb4_switch_check_wakes()
237 pm_wakeup_event(&sw->dev, 0); in usb4_switch_check_wakes()
240 static bool link_is_usb4(struct tb_port *port) in link_is_usb4() argument
244 if (!port->cap_usb4) in link_is_usb4()
247 if (tb_port_read(port, &val, TB_CFG_PORT, in link_is_usb4()
248 port->cap_usb4 + PORT_CS_18, 1)) in link_is_usb4()
255 * usb4_switch_setup() - Additional setup for USB4 device
278 ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, ROUTER_CS_6, 1); in usb4_switch_setup()
284 sw->link_usb4 = link_is_usb4(downstream_port); in usb4_switch_setup()
285 tb_sw_dbg(sw, "link: %s\n", sw->link_usb4 ? "USB4" : "TBT3"); in usb4_switch_setup()
293 ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, ROUTER_CS_5, 1); in usb4_switch_setup()
297 if (sw->link_usb4 && tb_switch_find_port(parent, TB_TYPE_USB3_DOWN)) { in usb4_switch_setup()
319 ret = tb_sw_write(sw, &val, TB_CFG_SWITCH, ROUTER_CS_5, 1); in usb4_switch_setup()
328 * usb4_switch_read_uid() - Read UID from USB4 router
332 * Reads 64-bit UID from USB4 router config space.
361 return -EIO; in usb4_switch_drom_read_block()
367 * usb4_switch_drom_read() - Read arbitrary bytes from USB4 router DROM
374 * should always work but for hosts it may return %-EOPNOTSUPP in which
385 * usb4_switch_lane_bonding_possible() - Are conditions met for lane bonding
398 ret = tb_port_read(up, &val, TB_CFG_PORT, up->cap_usb4 + PORT_CS_18, 1); in usb4_switch_lane_bonding_possible()
406 * usb4_switch_set_wake() - Enabled/disable wake
414 struct tb_port *port; in usb4_switch_set_wake() local
422 * upstream USB4 port. in usb4_switch_set_wake()
424 tb_switch_for_each_port(sw, port) { in usb4_switch_set_wake()
425 if (!tb_port_is_null(port)) in usb4_switch_set_wake()
427 if (!route && tb_is_upstream_port(port)) in usb4_switch_set_wake()
429 if (!port->cap_usb4) in usb4_switch_set_wake()
432 ret = tb_port_read(port, &val, TB_CFG_PORT, in usb4_switch_set_wake()
433 port->cap_usb4 + PORT_CS_19, 1); in usb4_switch_set_wake()
446 ret = tb_port_write(port, &val, TB_CFG_PORT, in usb4_switch_set_wake()
447 port->cap_usb4 + PORT_CS_19, 1); in usb4_switch_set_wake()
457 ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, ROUTER_CS_5, 1); in usb4_switch_set_wake()
467 ret = tb_sw_write(sw, &val, TB_CFG_SWITCH, ROUTER_CS_5, 1); in usb4_switch_set_wake()
476 * usb4_switch_set_sleep() - Prepare the router to enter sleep
488 ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, ROUTER_CS_5, 1); in usb4_switch_set_sleep()
494 ret = tb_sw_write(sw, &val, TB_CFG_SWITCH, ROUTER_CS_5, 1); in usb4_switch_set_sleep()
503 * usb4_switch_nvm_sector_size() - Return router NVM sector size
508 * %-EOPNOTSUPP.
521 return status == 0x2 ? -EOPNOTSUPP : -EIO; in usb4_switch_nvm_sector_size()
552 return -EIO; in usb4_switch_nvm_read_block()
558 * usb4_switch_nvm_read() - Read arbitrary bytes from router NVM
565 * %-EOPNOTSUPP.
593 return status ? -EIO : 0; in usb4_switch_nvm_set_offset()
611 return status ? -EIO : 0; in usb4_switch_nvm_write_next_block()
615 * usb4_switch_nvm_write() - Write to the router NVM
622 * write is not supported returns %-EOPNOTSUPP.
638 * usb4_switch_nvm_authenticate() - Authenticate new NVM
660 return -EINVAL; in usb4_switch_nvm_authenticate()
662 return -EAGAIN; in usb4_switch_nvm_authenticate()
664 return -EOPNOTSUPP; in usb4_switch_nvm_authenticate()
666 return -EIO; in usb4_switch_nvm_authenticate()
671 * usb4_switch_query_dp_resource() - Query availability of DP IN resource
684 ret = usb4_switch_op_write_metadata(sw, in->port); in usb4_switch_query_dp_resource()
693 if (ret == -EOPNOTSUPP) in usb4_switch_query_dp_resource()
702 * usb4_switch_alloc_dp_resource() - Allocate DP IN resource
708 * returns negative errno, in particular %-EBUSY if the resource is
716 ret = usb4_switch_op_write_metadata(sw, in->port); in usb4_switch_alloc_dp_resource()
721 if (ret == -EOPNOTSUPP) in usb4_switch_alloc_dp_resource()
726 return status ? -EBUSY : 0; in usb4_switch_alloc_dp_resource()
730 * usb4_switch_dealloc_dp_resource() - Releases allocated DP IN resource
741 ret = usb4_switch_op_write_metadata(sw, in->port); in usb4_switch_dealloc_dp_resource()
746 if (ret == -EOPNOTSUPP) in usb4_switch_dealloc_dp_resource()
751 return status ? -EIO : 0; in usb4_switch_dealloc_dp_resource()
754 static int usb4_port_idx(const struct tb_switch *sw, const struct tb_port *port) in usb4_port_idx() argument
759 /* Assume port is primary */ in usb4_port_idx()
765 if (!p->link_nr) { in usb4_port_idx()
766 if (p == port) in usb4_port_idx()
776 * usb4_switch_map_pcie_down() - Map USB4 port to a PCIe downstream adapter
778 * @port: USB4 port
786 const struct tb_port *port) in usb4_switch_map_pcie_down() argument
788 int usb4_idx = usb4_port_idx(sw, port); in usb4_switch_map_pcie_down()
792 /* Find PCIe down port matching usb4_port */ in usb4_switch_map_pcie_down()
807 * usb4_switch_map_usb3_down() - Map USB4 port to a USB3 downstream adapter
809 * @port: USB4 port
817 const struct tb_port *port) in usb4_switch_map_usb3_down() argument
819 int usb4_idx = usb4_port_idx(sw, port); in usb4_switch_map_usb3_down()
823 /* Find USB3 down port matching usb4_port */ in usb4_switch_map_usb3_down()
838 * usb4_port_unlock() - Unlock USB4 downstream port
839 * @port: USB4 port to unlock
841 * Unlocks USB4 downstream port so that the connection manager can
842 * access the router below this port.
844 int usb4_port_unlock(struct tb_port *port) in usb4_port_unlock() argument
849 ret = tb_port_read(port, &val, TB_CFG_PORT, ADP_CS_4, 1); in usb4_port_unlock()
854 return tb_port_write(port, &val, TB_CFG_PORT, ADP_CS_4, 1); in usb4_port_unlock()
857 static int usb4_port_set_configured(struct tb_port *port, bool configured) in usb4_port_set_configured() argument
862 if (!port->cap_usb4) in usb4_port_set_configured()
863 return -EINVAL; in usb4_port_set_configured()
865 ret = tb_port_read(port, &val, TB_CFG_PORT, in usb4_port_set_configured()
866 port->cap_usb4 + PORT_CS_19, 1); in usb4_port_set_configured()
875 return tb_port_write(port, &val, TB_CFG_PORT, in usb4_port_set_configured()
876 port->cap_usb4 + PORT_CS_19, 1); in usb4_port_set_configured()
880 * usb4_port_configure() - Set USB4 port configured
881 * @port: USB4 router
885 int usb4_port_configure(struct tb_port *port) in usb4_port_configure() argument
887 return usb4_port_set_configured(port, true); in usb4_port_configure()
891 * usb4_port_unconfigure() - Set USB4 port unconfigured
892 * @port: USB4 router
896 void usb4_port_unconfigure(struct tb_port *port) in usb4_port_unconfigure() argument
898 usb4_port_set_configured(port, false); in usb4_port_unconfigure()
901 static int usb4_set_xdomain_configured(struct tb_port *port, bool configured) in usb4_set_xdomain_configured() argument
906 if (!port->cap_usb4) in usb4_set_xdomain_configured()
907 return -EINVAL; in usb4_set_xdomain_configured()
909 ret = tb_port_read(port, &val, TB_CFG_PORT, in usb4_set_xdomain_configured()
910 port->cap_usb4 + PORT_CS_19, 1); in usb4_set_xdomain_configured()
919 return tb_port_write(port, &val, TB_CFG_PORT, in usb4_set_xdomain_configured()
920 port->cap_usb4 + PORT_CS_19, 1); in usb4_set_xdomain_configured()
924 * usb4_port_configure_xdomain() - Configure port for XDomain
925 * @port: USB4 port connected to another host
927 * Marks the USB4 port as being connected to another host. Returns %0 in
930 int usb4_port_configure_xdomain(struct tb_port *port) in usb4_port_configure_xdomain() argument
932 return usb4_set_xdomain_configured(port, true); in usb4_port_configure_xdomain()
936 * usb4_port_unconfigure_xdomain() - Unconfigure port for XDomain
937 * @port: USB4 port that was connected to another host
939 * Clears USB4 port from being marked as XDomain.
941 void usb4_port_unconfigure_xdomain(struct tb_port *port) in usb4_port_unconfigure_xdomain() argument
943 usb4_set_xdomain_configured(port, false); in usb4_port_unconfigure_xdomain()
946 static int usb4_port_wait_for_bit(struct tb_port *port, u32 offset, u32 bit, in usb4_port_wait_for_bit() argument
955 ret = tb_port_read(port, &val, TB_CFG_PORT, offset, 1); in usb4_port_wait_for_bit()
965 return -ETIMEDOUT; in usb4_port_wait_for_bit()
968 static int usb4_port_read_data(struct tb_port *port, void *data, size_t dwords) in usb4_port_read_data() argument
971 return -EINVAL; in usb4_port_read_data()
973 return tb_port_read(port, data, TB_CFG_PORT, port->cap_usb4 + PORT_CS_2, in usb4_port_read_data()
977 static int usb4_port_write_data(struct tb_port *port, const void *data, in usb4_port_write_data() argument
981 return -EINVAL; in usb4_port_write_data()
983 return tb_port_write(port, data, TB_CFG_PORT, port->cap_usb4 + PORT_CS_2, in usb4_port_write_data()
987 static int usb4_port_sb_read(struct tb_port *port, enum usb4_sb_target target, in usb4_port_sb_read() argument
994 if (!port->cap_usb4) in usb4_port_sb_read()
995 return -EINVAL; in usb4_port_sb_read()
1004 ret = tb_port_write(port, &val, TB_CFG_PORT, in usb4_port_sb_read()
1005 port->cap_usb4 + PORT_CS_1, 1); in usb4_port_sb_read()
1009 ret = usb4_port_wait_for_bit(port, port->cap_usb4 + PORT_CS_1, in usb4_port_sb_read()
1014 ret = tb_port_read(port, &val, TB_CFG_PORT, in usb4_port_sb_read()
1015 port->cap_usb4 + PORT_CS_1, 1); in usb4_port_sb_read()
1020 return -ENODEV; in usb4_port_sb_read()
1022 return -EIO; in usb4_port_sb_read()
1024 return buf ? usb4_port_read_data(port, buf, dwords) : 0; in usb4_port_sb_read()
1027 static int usb4_port_sb_write(struct tb_port *port, enum usb4_sb_target target, in usb4_port_sb_write() argument
1034 if (!port->cap_usb4) in usb4_port_sb_write()
1035 return -EINVAL; in usb4_port_sb_write()
1038 ret = usb4_port_write_data(port, buf, dwords); in usb4_port_sb_write()
1051 ret = tb_port_write(port, &val, TB_CFG_PORT, in usb4_port_sb_write()
1052 port->cap_usb4 + PORT_CS_1, 1); in usb4_port_sb_write()
1056 ret = usb4_port_wait_for_bit(port, port->cap_usb4 + PORT_CS_1, in usb4_port_sb_write()
1061 ret = tb_port_read(port, &val, TB_CFG_PORT, in usb4_port_sb_write()
1062 port->cap_usb4 + PORT_CS_1, 1); in usb4_port_sb_write()
1067 return -ENODEV; in usb4_port_sb_write()
1069 return -EIO; in usb4_port_sb_write()
1074 static int usb4_port_sb_op(struct tb_port *port, enum usb4_sb_target target, in usb4_port_sb_op() argument
1082 ret = usb4_port_sb_write(port, target, index, USB4_SB_OPCODE, &val, in usb4_port_sb_op()
1091 ret = usb4_port_sb_read(port, target, index, USB4_SB_OPCODE, in usb4_port_sb_op()
1101 return -EAGAIN; in usb4_port_sb_op()
1104 return -EOPNOTSUPP; in usb4_port_sb_op()
1108 return -EIO; in usb4_port_sb_op()
1113 return -ETIMEDOUT; in usb4_port_sb_op()
1117 * usb4_port_enumerate_retimers() - Send RT broadcast transaction
1118 * @port: USB4 port
1120 * This forces the USB4 port to send broadcast RT transaction which
1124 int usb4_port_enumerate_retimers(struct tb_port *port) in usb4_port_enumerate_retimers() argument
1129 return usb4_port_sb_write(port, USB4_SB_TARGET_ROUTER, 0, in usb4_port_enumerate_retimers()
1133 static inline int usb4_port_retimer_op(struct tb_port *port, u8 index, in usb4_port_retimer_op() argument
1137 return usb4_port_sb_op(port, USB4_SB_TARGET_RETIMER, index, opcode, in usb4_port_retimer_op()
1142 * usb4_port_retimer_read() - Read from retimer sideband registers
1143 * @port: USB4 port
1150 * retimer is connected to @port at @index. Returns %0 in case of
1152 * present at given @index returns %-ENODEV. In any other failure
1155 int usb4_port_retimer_read(struct tb_port *port, u8 index, u8 reg, void *buf, in usb4_port_retimer_read() argument
1158 return usb4_port_sb_read(port, USB4_SB_TARGET_RETIMER, index, reg, buf, in usb4_port_retimer_read()
1163 * usb4_port_retimer_write() - Write to retimer sideband registers
1164 * @port: USB4 port
1171 * connected to @port at @index. Returns %0 in case of success. If there
1172 * is no retimer present at given @index returns %-ENODEV. In any other
1175 int usb4_port_retimer_write(struct tb_port *port, u8 index, u8 reg, in usb4_port_retimer_write() argument
1178 return usb4_port_sb_write(port, USB4_SB_TARGET_RETIMER, index, reg, buf, in usb4_port_retimer_write()
1183 * usb4_port_retimer_is_last() - Is the retimer last on-board retimer
1184 * @port: USB4 port
1188 * Type-C port) this function returns %1. If it is not returns %0. If
1189 * the retimer is not present returns %-ENODEV. Otherwise returns
1192 int usb4_port_retimer_is_last(struct tb_port *port, u8 index) in usb4_port_retimer_is_last() argument
1197 ret = usb4_port_retimer_op(port, index, USB4_SB_OPCODE_QUERY_LAST_RETIMER, in usb4_port_retimer_is_last()
1202 ret = usb4_port_retimer_read(port, index, USB4_SB_METADATA, &metadata, in usb4_port_retimer_is_last()
1204 return ret ? ret : metadata & 1; in usb4_port_retimer_is_last()
1208 * usb4_port_retimer_nvm_sector_size() - Read retimer NVM sector size
1209 * @port: USB4 port
1215 * in case of error. Specifically returns %-ENODEV if there is no
1218 int usb4_port_retimer_nvm_sector_size(struct tb_port *port, u8 index) in usb4_port_retimer_nvm_sector_size() argument
1223 ret = usb4_port_retimer_op(port, index, USB4_SB_OPCODE_GET_NVM_SECTOR_SIZE, in usb4_port_retimer_nvm_sector_size()
1228 ret = usb4_port_retimer_read(port, index, USB4_SB_METADATA, &metadata, in usb4_port_retimer_nvm_sector_size()
1233 static int usb4_port_retimer_nvm_set_offset(struct tb_port *port, u8 index, in usb4_port_retimer_nvm_set_offset() argument
1243 ret = usb4_port_retimer_write(port, index, USB4_SB_METADATA, &metadata, in usb4_port_retimer_nvm_set_offset()
1248 return usb4_port_retimer_op(port, index, USB4_SB_OPCODE_NVM_SET_OFFSET, in usb4_port_retimer_nvm_set_offset()
1253 struct tb_port *port; member
1262 struct tb_port *port = info->port; in usb4_port_retimer_nvm_write_next_block() local
1263 u8 index = info->index; in usb4_port_retimer_nvm_write_next_block()
1266 ret = usb4_port_retimer_write(port, index, USB4_SB_DATA, in usb4_port_retimer_nvm_write_next_block()
1271 return usb4_port_retimer_op(port, index, in usb4_port_retimer_nvm_write_next_block()
1276 * usb4_port_retimer_nvm_write() - Write to retimer NVM
1277 * @port: USB4 port
1285 * errno in case of failure. Specifically returns %-ENODEV if there is
1288 int usb4_port_retimer_nvm_write(struct tb_port *port, u8 index, unsigned int address, in usb4_port_retimer_nvm_write() argument
1291 struct retimer_info info = { .port = port, .index = index }; in usb4_port_retimer_nvm_write()
1294 ret = usb4_port_retimer_nvm_set_offset(port, index, address); in usb4_port_retimer_nvm_write()
1303 * usb4_port_retimer_nvm_authenticate() - Start retimer NVM upgrade
1304 * @port: USB4 port
1313 int usb4_port_retimer_nvm_authenticate(struct tb_port *port, u8 index) in usb4_port_retimer_nvm_authenticate() argument
1323 return usb4_port_sb_write(port, USB4_SB_TARGET_RETIMER, index, in usb4_port_retimer_nvm_authenticate()
1328 * usb4_port_retimer_nvm_authenticate_status() - Read status of NVM upgrade
1329 * @port: USB4 port
1340 int usb4_port_retimer_nvm_authenticate_status(struct tb_port *port, u8 index, in usb4_port_retimer_nvm_authenticate_status() argument
1346 ret = usb4_port_retimer_read(port, index, USB4_SB_OPCODE, &val, in usb4_port_retimer_nvm_authenticate_status()
1357 ret = usb4_port_retimer_read(port, index, USB4_SB_METADATA, in usb4_port_retimer_nvm_authenticate_status()
1366 return -EOPNOTSUPP; in usb4_port_retimer_nvm_authenticate_status()
1369 return -EIO; in usb4_port_retimer_nvm_authenticate_status()
1377 struct tb_port *port = info->port; in usb4_port_retimer_nvm_read_block() local
1378 u8 index = info->index; in usb4_port_retimer_nvm_read_block()
1386 ret = usb4_port_retimer_write(port, index, USB4_SB_METADATA, &metadata, in usb4_port_retimer_nvm_read_block()
1391 ret = usb4_port_retimer_op(port, index, USB4_SB_OPCODE_NVM_READ, 500); in usb4_port_retimer_nvm_read_block()
1395 return usb4_port_retimer_read(port, index, USB4_SB_DATA, buf, in usb4_port_retimer_nvm_read_block()
1400 * usb4_port_retimer_nvm_read() - Read contents of retimer NVM
1401 * @port: USB4 port
1409 * Specifically returns %-ENODEV if there is no retimer at @index.
1411 int usb4_port_retimer_nvm_read(struct tb_port *port, u8 index, in usb4_port_retimer_nvm_read() argument
1414 struct retimer_info info = { .port = port, .index = index }; in usb4_port_retimer_nvm_read()
1421 * usb4_usb3_port_max_link_rate() - Maximum support USB3 link rate
1422 * @port: USB3 adapter port
1427 int usb4_usb3_port_max_link_rate(struct tb_port *port) in usb4_usb3_port_max_link_rate() argument
1432 if (!tb_port_is_usb3_down(port) && !tb_port_is_usb3_up(port)) in usb4_usb3_port_max_link_rate()
1433 return -EINVAL; in usb4_usb3_port_max_link_rate()
1435 ret = tb_port_read(port, &val, TB_CFG_PORT, in usb4_usb3_port_max_link_rate()
1436 port->cap_adap + ADP_USB3_CS_4, 1); in usb4_usb3_port_max_link_rate()
1445 * usb4_usb3_port_actual_link_rate() - Established USB3 link rate
1446 * @port: USB3 adapter port
1451 int usb4_usb3_port_actual_link_rate(struct tb_port *port) in usb4_usb3_port_actual_link_rate() argument
1456 if (!tb_port_is_usb3_down(port) && !tb_port_is_usb3_up(port)) in usb4_usb3_port_actual_link_rate()
1457 return -EINVAL; in usb4_usb3_port_actual_link_rate()
1459 ret = tb_port_read(port, &val, TB_CFG_PORT, in usb4_usb3_port_actual_link_rate()
1460 port->cap_adap + ADP_USB3_CS_4, 1); in usb4_usb3_port_actual_link_rate()
1471 static int usb4_usb3_port_cm_request(struct tb_port *port, bool request) in usb4_usb3_port_cm_request() argument
1476 if (!tb_port_is_usb3_down(port)) in usb4_usb3_port_cm_request()
1477 return -EINVAL; in usb4_usb3_port_cm_request()
1478 if (tb_route(port->sw)) in usb4_usb3_port_cm_request()
1479 return -EINVAL; in usb4_usb3_port_cm_request()
1481 ret = tb_port_read(port, &val, TB_CFG_PORT, in usb4_usb3_port_cm_request()
1482 port->cap_adap + ADP_USB3_CS_2, 1); in usb4_usb3_port_cm_request()
1491 ret = tb_port_write(port, &val, TB_CFG_PORT, in usb4_usb3_port_cm_request()
1492 port->cap_adap + ADP_USB3_CS_2, 1); in usb4_usb3_port_cm_request()
1501 return usb4_port_wait_for_bit(port, port->cap_adap + ADP_USB3_CS_1, in usb4_usb3_port_cm_request()
1505 static inline int usb4_usb3_port_set_cm_request(struct tb_port *port) in usb4_usb3_port_set_cm_request() argument
1507 return usb4_usb3_port_cm_request(port, true); in usb4_usb3_port_set_cm_request()
1510 static inline int usb4_usb3_port_clear_cm_request(struct tb_port *port) in usb4_usb3_port_clear_cm_request() argument
1512 return usb4_usb3_port_cm_request(port, false); in usb4_usb3_port_clear_cm_request()
1527 /* 1 uframe is 1/8 ms (125 us) -> 1 / 8000 s */ in mbps_to_usb3_bw()
1532 static int usb4_usb3_port_read_allocated_bandwidth(struct tb_port *port, in usb4_usb3_port_read_allocated_bandwidth() argument
1539 ret = tb_port_read(port, &val, TB_CFG_PORT, in usb4_usb3_port_read_allocated_bandwidth()
1540 port->cap_adap + ADP_USB3_CS_2, 1); in usb4_usb3_port_read_allocated_bandwidth()
1544 ret = tb_port_read(port, &scale, TB_CFG_PORT, in usb4_usb3_port_read_allocated_bandwidth()
1545 port->cap_adap + ADP_USB3_CS_3, 1); in usb4_usb3_port_read_allocated_bandwidth()
1561 * usb4_usb3_port_allocated_bandwidth() - Bandwidth allocated for USB3
1562 * @port: USB3 adapter port
1570 int usb4_usb3_port_allocated_bandwidth(struct tb_port *port, int *upstream_bw, in usb4_usb3_port_allocated_bandwidth() argument
1575 ret = usb4_usb3_port_set_cm_request(port); in usb4_usb3_port_allocated_bandwidth()
1579 ret = usb4_usb3_port_read_allocated_bandwidth(port, upstream_bw, in usb4_usb3_port_allocated_bandwidth()
1581 usb4_usb3_port_clear_cm_request(port); in usb4_usb3_port_allocated_bandwidth()
1586 static int usb4_usb3_port_read_consumed_bandwidth(struct tb_port *port, in usb4_usb3_port_read_consumed_bandwidth() argument
1593 ret = tb_port_read(port, &val, TB_CFG_PORT, in usb4_usb3_port_read_consumed_bandwidth()
1594 port->cap_adap + ADP_USB3_CS_1, 1); in usb4_usb3_port_read_consumed_bandwidth()
1598 ret = tb_port_read(port, &scale, TB_CFG_PORT, in usb4_usb3_port_read_consumed_bandwidth()
1599 port->cap_adap + ADP_USB3_CS_3, 1); in usb4_usb3_port_read_consumed_bandwidth()
1614 static int usb4_usb3_port_write_allocated_bandwidth(struct tb_port *port, in usb4_usb3_port_write_allocated_bandwidth() argument
1622 ret = tb_port_read(port, &scale, TB_CFG_PORT, in usb4_usb3_port_write_allocated_bandwidth()
1623 port->cap_adap + ADP_USB3_CS_3, 1); in usb4_usb3_port_write_allocated_bandwidth()
1631 ret = tb_port_read(port, &val, TB_CFG_PORT, in usb4_usb3_port_write_allocated_bandwidth()
1632 port->cap_adap + ADP_USB3_CS_2, 1); in usb4_usb3_port_write_allocated_bandwidth()
1640 return tb_port_write(port, &val, TB_CFG_PORT, in usb4_usb3_port_write_allocated_bandwidth()
1641 port->cap_adap + ADP_USB3_CS_2, 1); in usb4_usb3_port_write_allocated_bandwidth()
1645 * usb4_usb3_port_allocate_bandwidth() - Allocate bandwidth for USB3
1646 * @port: USB3 adapter port
1661 int usb4_usb3_port_allocate_bandwidth(struct tb_port *port, int *upstream_bw, in usb4_usb3_port_allocate_bandwidth() argument
1666 ret = usb4_usb3_port_set_cm_request(port); in usb4_usb3_port_allocate_bandwidth()
1670 ret = usb4_usb3_port_read_consumed_bandwidth(port, &consumed_up, in usb4_usb3_port_allocate_bandwidth()
1679 ret = usb4_usb3_port_write_allocated_bandwidth(port, allocate_up, in usb4_usb3_port_allocate_bandwidth()
1688 usb4_usb3_port_clear_cm_request(port); in usb4_usb3_port_allocate_bandwidth()
1693 * usb4_usb3_port_release_bandwidth() - Release allocated USB3 bandwidth
1694 * @port: USB3 adapter port
1703 int usb4_usb3_port_release_bandwidth(struct tb_port *port, int *upstream_bw, in usb4_usb3_port_release_bandwidth() argument
1708 ret = usb4_usb3_port_set_cm_request(port); in usb4_usb3_port_release_bandwidth()
1712 ret = usb4_usb3_port_read_consumed_bandwidth(port, &consumed_up, in usb4_usb3_port_release_bandwidth()
1726 ret = usb4_usb3_port_write_allocated_bandwidth(port, consumed_up, in usb4_usb3_port_release_bandwidth()
1735 usb4_usb3_port_clear_cm_request(port); in usb4_usb3_port_release_bandwidth()