File tree Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -1330,6 +1330,34 @@ static int tb_port_clx_enable(struct tb_port *port, enum tb_clx clx)
1330
1330
return __tb_port_clx_set (port , clx , true);
1331
1331
}
1332
1332
1333
+ /**
1334
+ * tb_port_is_clx_enabled() - Is given CL state enabled
1335
+ * @port: USB4 port to check
1336
+ * @clx_mask: Mask of CL states to check
1337
+ *
1338
+ * Returns true if any of the given CL states is enabled for @port.
1339
+ */
1340
+ bool tb_port_is_clx_enabled (struct tb_port * port , unsigned int clx_mask )
1341
+ {
1342
+ u32 val , mask = 0 ;
1343
+ int ret ;
1344
+
1345
+ if (!tb_port_clx_supported (port , clx_mask ))
1346
+ return false;
1347
+
1348
+ if (clx_mask & TB_CL1 )
1349
+ mask |= LANE_ADP_CS_1_CL0S_ENABLE | LANE_ADP_CS_1_CL1_ENABLE ;
1350
+ if (clx_mask & TB_CL2 )
1351
+ mask |= LANE_ADP_CS_1_CL2_ENABLE ;
1352
+
1353
+ ret = tb_port_read (port , & val , TB_CFG_PORT ,
1354
+ port -> cap_phy + LANE_ADP_CS_1 , 1 );
1355
+ if (ret )
1356
+ return false;
1357
+
1358
+ return !!(val & mask );
1359
+ }
1360
+
1333
1361
static int tb_port_start_lane_initialization (struct tb_port * port )
1334
1362
{
1335
1363
int ret ;
Original file line number Diff line number Diff line change @@ -1035,6 +1035,7 @@ void tb_port_lane_bonding_disable(struct tb_port *port);
1035
1035
int tb_port_wait_for_link_width (struct tb_port * port , int width ,
1036
1036
int timeout_msec );
1037
1037
int tb_port_update_credits (struct tb_port * port );
1038
+ bool tb_port_is_clx_enabled (struct tb_port * port , enum tb_clx clx );
1038
1039
1039
1040
int tb_switch_find_vse_cap (struct tb_switch * sw , enum tb_switch_vse_cap vsec );
1040
1041
int tb_switch_find_cap (struct tb_switch * sw , enum tb_switch_cap cap );
Original file line number Diff line number Diff line change @@ -334,6 +334,7 @@ struct tb_regs_port_header {
334
334
#define LANE_ADP_CS_1_TARGET_WIDTH_DUAL 0x3
335
335
#define LANE_ADP_CS_1_CL0S_ENABLE BIT(10)
336
336
#define LANE_ADP_CS_1_CL1_ENABLE BIT(11)
337
+ #define LANE_ADP_CS_1_CL2_ENABLE BIT(12)
337
338
#define LANE_ADP_CS_1_LD BIT(14)
338
339
#define LANE_ADP_CS_1_LB BIT(15)
339
340
#define LANE_ADP_CS_1_CURRENT_SPEED_MASK GENMASK(19, 16)
You can’t perform that action at this time.
0 commit comments