thunderbolt: Sideband access and retimer lane margining support
Subsystems (2)
v2 cover thunderbolt: Sideband access and retimer lane margining support
Hi all,
This series adds USB4 link sideband access through debugfs. This can be used to run port operations etc. from userspace usable for example in manufacturing. The other feature is receiver lane margining support for retimers with similar use case.
Mika Westerberg (6):
thunderbolt: Move usb4_port_margining_caps() declaration into correct place
thunderbolt: Make usb4_port_sb_read/write() available outside of usb4.c
thunderbolt: Add sideband register access to debugfs
thunderbolt: Split out margining from USB4 port
thunderbolt: Make margining functions accept target and retimer index
thunderbolt: Add receiver lane margining support for retimers
drivers/thunderbolt/Kconfig | 11 +- drivers/thunderbolt/debugfs.c | 623 ++++++++++++++++++++++++++-------- drivers/thunderbolt/retimer.c | 53 +-- drivers/thunderbolt/sb_regs.h | 9 + drivers/thunderbolt/tb.h | 45 ++- drivers/thunderbolt/usb4.c | 183 +++++----- 6 files changed, 655 insertions(+), 269 deletions(-)
Signature · 1 line
2.43.0
PATCH v2 1/6 thunderbolt: Move usb4_port_margining_caps() declaration into correct place
It is supposed to be close with the other lane margining functions so move it there. No functional changes.
--- drivers/thunderbolt/tb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thunderbolt/tb.h +1 -1
@@ -1327,12 +1327,12 @@ int usb4_port_router_offline(struct tb_port *port);int usb4_port_router_online (struct tb_port *port);int usb4_port_enumerate_retimers (struct tb_port *port);bool usb4_port_clx_supported (struct tb_port *port); -int usb4_port_margining_caps (struct tb_port *port,u32 *caps);bool usb4_port_asym_supported (struct tb_port *port);int usb4_port_asym_set_link_width (struct tb_port *port,enum tb_link_width width);int usb4_port_asym_start (struct tb_port *port); +int usb4_port_margining_caps (struct tb_port *port,u32 *caps);int usb4_port_hw_margin (struct tb_port *port,unsigned int lanes,unsigned int ber_level,bool timing,bool right_high,u32 *results);
Signature · 1 line
2.43.0
PATCH v2 2/6 thunderbolt: Make usb4_port_sb_read/write() available outside of usb4.c
In reply to Mika WesterbergWe need to call these from other files too so make them available outside of usb4.c.
--- drivers/thunderbolt/retimer.c | 8 +-- drivers/thunderbolt/tb.h | 21 +++++-- drivers/thunderbolt/usb4.c | 112 ++++++++++++++-------------------- 3 files changed, 66 insertions(+), 75 deletions(-)
drivers/thunderbolt/retimer.c +4 -4
@@ -372,16 +372,16 @@ static int tb_retimer_add(struct tb_port *port, u8 index, u32 auth_status)u32 vendor, device;int ret; - ret =usb4_port_retimer_read (port, index,USB4_SB_VENDOR_ID , &vendor, -sizeof (vendor)); + ret =usb4_port_sb_read (port,USB4_SB_TARGET_RETIMER , index, +USB4_SB_VENDOR_ID , &vendor,sizeof (vendor));if (ret) {if (ret != -ENODEV )tb_port_warn (port,"failed read retimer VendorId: %d\n" , ret);return ret; } - ret =usb4_port_retimer_read (port, index,USB4_SB_PRODUCT_ID , &device, -sizeof (device)); + ret =usb4_port_sb_read (port,USB4_SB_TARGET_RETIMER , index, +USB4_SB_PRODUCT_ID , &device,sizeof (device));if (ret) {if (ret != -ENODEV )tb_port_warn (port,"failed read retimer ProductId: %d\n" , ret);
drivers/thunderbolt/tb.h +17 -4
@@ -1332,6 +1332,23 @@ bool usb4_port_asym_supported(struct tb_port *port);int usb4_port_asym_set_link_width (struct tb_port *port,enum tb_link_width width);int usb4_port_asym_start (struct tb_port *port); +/** +* enum tb_sb_target - Sideband transaction target +* @USB4_SB_TARGET_ROUTER: Target is the router itself +* @USB4_SB_TARGET_PARTNER: Target is partner +* @USB4_SB_TARGET_RETIMER: Target is retimer +*/ +enum usb4_sb_target { +USB4_SB_TARGET_ROUTER , +USB4_SB_TARGET_PARTNER , +USB4_SB_TARGET_RETIMER , +}; + +int usb4_port_sb_read (struct tb_port *port,enum usb4_sb_target target,u8 index, +u8 reg,void *buf,u8 size); +int usb4_port_sb_write (struct tb_port *port,enum usb4_sb_target target, +u8 index,u8 reg,const void *buf,u8 size); +int usb4_port_margining_caps (struct tb_port *port,u32 *caps); int usb4_port_hw_margin(struct tb_port *port, unsigned int lanes, unsigned int ber_level, bool timing, bool right_high,
@@ -1342,10 +1359,6 @@ int usb4_port_sw_margin_errors(struct tb_port *port, u32 *errors);int usb4_port_retimer_set_inbound_sbtx (struct tb_port *port,u8 index);int usb4_port_retimer_unset_inbound_sbtx (struct tb_port *port,u8 index); -int usb4_port_retimer_read (struct tb_port *port,u8 index,u8 reg,void *buf, -u8 size); -int usb4_port_retimer_write (struct tb_port *port,u8 index,u8 reg, -const void *buf,u8 size);int usb4_port_retimer_is_last (struct tb_port *port,u8 index);int usb4_port_retimer_nvm_sector_size (struct tb_port *port,u8 index); int usb4_port_retimer_nvm_set_offset(struct tb_port *port, u8 index,
drivers/thunderbolt/usb4.c +45 -67
184 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH v2 3/6 thunderbolt: Add sideband register access to debugfs
In reply to Mika WesterbergThis makes it possible to read and write USB4 port and retimer sideband registers through debugfs which is useful for debugging and manufacturing purposes. We add "sb_regs" debugfs attribute under each USB4 port and retimer that is used to access the sideband.
--- drivers/thunderbolt/debugfs.c | 293 ++++++++++++++++++++++++++++++++++ drivers/thunderbolt/retimer.c | 2 + drivers/thunderbolt/sb_regs.h | 8 + drivers/thunderbolt/tb.h | 4 + 4 files changed, 307 insertions(+)
drivers/thunderbolt/debugfs.c +293 -0
@@ -33,6 +33,44 @@#define COUNTER_SET_LEN 3 +/* Sideband registers and their sizes as defined in the USB4 spec */ +struct sb_reg { +unsigned int reg; +unsigned int size; +}; + +#define SB_MAX_SIZE 64 + +/* Sideband registers for router */ +static const struct sb_reg port_sb_regs[] = { + {USB4_SB_VENDOR_ID ,4 }, + {USB4_SB_PRODUCT_ID ,4 }, + {USB4_SB_DEBUG_CONF ,4 }, + {USB4_SB_DEBUG ,54 }, + {USB4_SB_LRD_TUNING ,4 }, + {USB4_SB_OPCODE ,4 }, + {USB4_SB_METADATA ,4 }, + {USB4_SB_LINK_CONF ,3 }, + {USB4_SB_GEN23_TXFFE ,4 }, + {USB4_SB_GEN4_TXFFE ,4 }, + {USB4_SB_VERSION ,4 }, + {USB4_SB_DATA ,64 }, +}; + +/* Sideband registers for retimer */ +static const struct sb_reg retimer_sb_regs[] = { + {USB4_SB_VENDOR_ID ,4 }, + {USB4_SB_PRODUCT_ID ,4 }, + {USB4_SB_FW_VERSION ,4 }, + {USB4_SB_LRD_TUNING ,4 }, + {USB4_SB_OPCODE ,4 }, + {USB4_SB_METADATA ,4 }, + {USB4_SB_GEN23_TXFFE ,4 }, + {USB4_SB_GEN4_TXFFE ,4 }, + {USB4_SB_VERSION ,4 }, + {USB4_SB_DATA ,64 }, +}; +#define DEBUGFS_ATTR (__space, __write) \ static int __space ## _open(struct inode *inode, struct file *file) \ { \
@@ -184,10 +222,157 @@ static ssize_t switch_regs_write(struct file *file, const char __user *user_buf,return regs_write (sw,NULL , user_buf, count, ppos); } + +static bool parse_sb_line (char **line,u8 *reg,u8 *data,size_t data_size, +size_t *bytes_read) +{ +char *field, *token; +int i; + + token =strsep (line,"\n" ); +if (!token) +return false; + +/* Parse the register first */ + field =strsep (&token," " ); +if (!field) +return false; +if (kstrtou8 (field,0 , reg)) +return false; + +/* Then the values for the register, up to data_size */ +for (i =0 ; i < data_size; i++) { + field =strsep (&token," " ); +if (!field) +break ; +if (kstrtou8 (field,0 , &data[i])) +return false; + } + + *bytes_read = i; +return true; +} + +static ssize_t sb_regs_write (struct tb_port *port,const struct sb_reg *sb_regs, +size_t size,enum usb4_sb_target target,u8 index, +char *buf,size_t count,loff_t *ppos) +{ +u8 reg, data[SB_MAX_SIZE ]; +size_t bytes_read; +char *line = buf; + +/* User did hardware changes behind the driver's back */ +add_taint (TAINT_USER ,LOCKDEP_STILL_OK ); + +/* +* For sideband registers we accept: +* reg b0 b1 b2...\n +* +* Here "reg" is the byte offset of the sideband register and "b0".. +* are the byte values. There can be less byte values than the register +* size. The leftovers will not be overwritten. +*/ +while (parse_sb_line (&line, ®, data,ARRAY_SIZE (data), &bytes_read)) { +const struct sb_reg *sb_reg; +int ret; + +/* At least one byte must be passed */ +if (bytes_read <1 ) +return -EINVAL ; + +/* Find the register */ + sb_reg =NULL ; +for (int i =0 ; i < size; i++) { +if (sb_regs[i].reg == reg) { + sb_reg = &sb_regs[i]; +break ; + } + } + +if (!sb_reg) +return -EINVAL ; + +if (bytes_read > sb_regs->size) +return -E2BIG ; + + ret =usb4_port_sb_write (port, target, index, sb_reg->reg, data, + bytes_read); +if (ret) +return ret; + } + +return 0 ; +} + +static ssize_t port_sb_regs_write (struct file *file,const char __user *user_buf, +size_t count,loff_t *ppos) +{ +struct seq_file *s = file->private_data; +struct tb_port *port = s->private; +struct tb_switch *sw = port->sw; +struct tb *tb = sw->tb; +char *buf; +int ret; + + buf =validate_and_copy_from_user (user_buf, &count); +if (IS_ERR (buf)) +return PTR_ERR (buf); + +pm_runtime_get_sync (&sw->dev); + +if (mutex_lock_interruptible (&tb->lock)) { + ret = -ERESTARTSYS ; + goto out_rpm_put; + } + + ret =sb_regs_write (port, port_sb_regs,ARRAY_SIZE (port_sb_regs), +USB4_SB_TARGET_ROUTER ,0 , buf, count, ppos); + +mutex_unlock (&tb->lock); +out_rpm_put: +pm_runtime_mark_last_busy (&sw->dev); +pm_runtime_put_autosuspend (&sw->dev); + +return ret <0 ? ret : count; +} + +static ssize_t retimer_sb_regs_write (struct file *file, +const char __user *user_buf, +size_t count,loff_t *ppos) +{ +struct seq_file *s = file->private_data; +struct tb_retimer *rt = s->private; +struct tb *tb = rt->tb; +char *buf; +int ret; + + buf =validate_and_copy_from_user (user_buf, &count); +if (IS_ERR (buf)) +return PTR_ERR (buf); + +pm_runtime_get_sync (&rt->dev); + +if (mutex_lock_interruptible (&tb->lock)) { + ret = -ERESTARTSYS ; + goto out_rpm_put; + } + + ret =sb_regs_write (rt->port, retimer_sb_regs,ARRAY_SIZE (retimer_sb_regs), +USB4_SB_TARGET_RETIMER , rt->index, buf, count, ppos); + +mutex_unlock (&tb->lock); +out_rpm_put: +pm_runtime_mark_last_busy (&rt->dev); +pm_runtime_put_autosuspend (&rt->dev); + +return ret <0 ? ret : count; +}#define DEBUGFS_MODE 0600#else #define port_regs_write NULL#define switch_regs_write NULL +#define port_sb_regs_write NULL +#define retimer_sb_regs_write NULL#define DEBUGFS_MODE 0400#endif
@@ -1505,6 +1690,60 @@ static int counters_show(struct seq_file *s, void *not_used) }DEBUGFS_ATTR_RW (counters); +static int sb_regs_show (struct tb_port *port,const struct sb_reg *sb_regs, +size_t size,enum usb4_sb_target target,u8 index, +struct seq_file *s) +{ +int ret, i; + +seq_puts (s,"# register value\n" ); + +for (i =0 ; i < size; i++) { +const struct sb_reg *regs = &sb_regs[i]; +u8 data[64 ]; +int j; + +memset (data,0 ,sizeof (data)); + ret =usb4_port_sb_read (port, target, index, regs->reg, data, + regs->size); +if (ret) +return ret; + +seq_printf (s,"0x%02x" , regs->reg); +for (j =0 ; j < regs->size; j++) +seq_printf (s," 0x%02x" , data[j]); +seq_puts (s,"\n" ); + } + +return 0 ; +} + +static int port_sb_regs_show (struct seq_file *s,void *not_used) +{ +struct tb_port *port = s->private; +struct tb_switch *sw = port->sw; +struct tb *tb = sw->tb; +int ret; + +pm_runtime_get_sync (&sw->dev); + +if (mutex_lock_interruptible (&tb->lock)) { + ret = -ERESTARTSYS ; + goto out_rpm_put; + } + + ret =sb_regs_show (port, port_sb_regs,ARRAY_SIZE (port_sb_regs), +USB4_SB_TARGET_ROUTER ,0 , s); + +mutex_unlock (&tb->lock); +out_rpm_put: +pm_runtime_mark_last_busy (&sw->dev); +pm_runtime_put_autosuspend (&sw->dev); + +return ret; +} +DEBUGFS_ATTR_RW (port_sb_regs); +/** * tb_switch_debugfs_init() - Add debugfs entries for router * @sw: Pointer to the router
@@ -1539,6 +1778,9 @@ void tb_switch_debugfs_init(struct tb_switch *sw)if (port->config.counters_support)debugfs_create_file ("counters" ,0600 , debugfs_dir, port, &counters_fops); +if (port->usb4) +debugfs_create_file ("sb_regs" ,DEBUGFS_MODE , debugfs_dir, + port, &port_sb_regs_fops); }margining_switch_init (sw);
@@ -1590,6 +1832,57 @@ void tb_service_debugfs_remove(struct tb_service *svc) svc->debugfs_dir =NULL ; } +static int retimer_sb_regs_show (struct seq_file *s,void *not_used) +{ +struct tb_retimer *rt = s->private; +struct tb *tb = rt->tb; +int ret; + +pm_runtime_get_sync (&rt->dev); + +if (mutex_lock_interruptible (&tb->lock)) { + ret = -ERESTARTSYS ; + goto out_rpm_put; + } + + ret =sb_regs_show (rt->port, retimer_sb_regs,ARRAY_SIZE (retimer_sb_regs), +USB4_SB_TARGET_RETIMER , rt->index, s); + +mutex_unlock (&tb->lock); +out_rpm_put: +pm_runtime_mark_last_busy (&rt->dev); +pm_runtime_put_autosuspend (&rt->dev); + +return ret; +} +DEBUGFS_ATTR_RW (retimer_sb_regs); + +/** +* tb_retimer_debugfs_init() - Add debugfs directory for retimer +* @rt: Pointer to retimer structure +* +* Adds and populates retimer debugfs directory. +*/ +void tb_retimer_debugfs_init (struct tb_retimer *rt) +{ +struct dentry *debugfs_dir; + + debugfs_dir =debugfs_create_dir (dev_name (&rt->dev), tb_debugfs_root); +debugfs_create_file ("sb_regs" ,DEBUGFS_MODE , debugfs_dir, rt, + &retimer_sb_regs_fops); +} + +/** +* tb_retimer_debugfs_remove() - Remove retimer debugfs directory +* @rt: Pointer to retimer structure +* +* Removes the retimer debugfs directory along with its contents. +*/ +void tb_retimer_debugfs_remove (struct tb_retimer *rt) +{ +debugfs_lookup_and_remove (dev_name (&rt->dev), tb_debugfs_root); +} +void tb_debugfs_init (void ) { tb_debugfs_root =debugfs_create_dir ("thunderbolt" ,NULL );
drivers/thunderbolt/retimer.c +2 -0
@@ -437,12 +437,14 @@ static int tb_retimer_add(struct tb_port *port, u8 index, u32 auth_status)pm_runtime_mark_last_busy (&rt->dev);pm_runtime_use_autosuspend (&rt->dev); +tb_retimer_debugfs_init (rt);return 0 ; }static void tb_retimer_remove (struct tb_retimer *rt) {dev_info (&rt->dev,"retimer disconnected\n" ); +tb_retimer_debugfs_remove (rt);tb_nvm_free (rt->nvm);device_unregister (&rt->dev); }
drivers/thunderbolt/sb_regs.h +8 -0
@@ -12,6 +12,10 @@#define USB4_SB_VENDOR_ID 0x00#define USB4_SB_PRODUCT_ID 0x01 +#define USB4_SB_FW_VERSION 0x02 +#define USB4_SB_DEBUG_CONF 0x05 +#define USB4_SB_DEBUG 0x06 +#define USB4_SB_LRD_TUNING 0x07#define USB4_SB_OPCODE 0x08enum usb4_sb_opcode {
@@ -35,6 +39,10 @@ enum usb4_sb_opcode {#define USB4_SB_METADATA 0x09#define USB4_SB_METADATA_NVM_AUTH_WRITE_MASK GENMASK(5, 0) +#define USB4_SB_LINK_CONF 0x0c +#define USB4_SB_GEN23_TXFFE 0x0d +#define USB4_SB_GEN4_TXFFE 0x0e +#define USB4_SB_VERSION 0x0f#define USB4_SB_DATA 0x12/* USB4_SB_OPCODE_READ_LANE_MARGINING_CAP */
drivers/thunderbolt/tb.h +4 -0
@@ -1458,6 +1458,8 @@ void tb_xdomain_debugfs_init(struct tb_xdomain *xd);void tb_xdomain_debugfs_remove (struct tb_xdomain *xd);void tb_service_debugfs_init (struct tb_service *svc);void tb_service_debugfs_remove (struct tb_service *svc); +void tb_retimer_debugfs_init (struct tb_retimer *rt); +void tb_retimer_debugfs_remove (struct tb_retimer *rt);#else static inline void tb_debugfs_init (void ) { }static inline void tb_debugfs_exit (void ) { }
@@ -1467,6 +1469,8 @@ static inline void tb_xdomain_debugfs_init(struct tb_xdomain *xd) { }static inline void tb_xdomain_debugfs_remove (struct tb_xdomain *xd) { }static inline void tb_service_debugfs_init (struct tb_service *svc) { }static inline void tb_service_debugfs_remove (struct tb_service *svc) { } +static inline void tb_retimer_debugfs_init (struct tb_retimer *rt) { } +static inline void tb_retimer_debugfs_remove (struct tb_retimer *rt) { }#endif #endif
Signature · 1 line
2.43.0
PATCH v2 4/6 thunderbolt: Split out margining from USB4 port
In reply to Mika WesterbergWe are going to expand lane margining support for retimers too so split out the generic margining functionality out of being specific to USB4 ports.
--- drivers/thunderbolt/debugfs.c | 234 ++++++++++++++++------------------ 1 file changed, 112 insertions(+), 122 deletions(-)
drivers/thunderbolt/debugfs.c +112 -122
@@ -379,6 +379,7 @@ static ssize_t retimer_sb_regs_write(struct file *file,#if IS_ENABLED (CONFIG_USB4_DEBUGFS_MARGINING )/** * struct tb_margining - Lane margining support +* @port: USB4 port through which the margining operations are run * @caps: Port lane margining capabilities * @results: Last lane margining results * @lanes: %0, %1 or %7 (all)
@@ -395,6 +396,7 @@ static ssize_t retimer_sb_regs_write(struct file *file,* right/high */ struct tb_margining { +struct tb_port *port;u32 caps[2 ];u32 results[2 ];unsigned int lanes;
@@ -410,36 +412,38 @@ struct tb_margining {bool right_high; }; -static bool supports_software (const struct usb4_port *usb4) +static bool supports_software (const struct tb_margining *margining) { -return usb4->margining->caps[0 ] &USB4_MARGIN_CAP_0_MODES_SW ; +return margining->caps[0 ] &USB4_MARGIN_CAP_0_MODES_SW ; } -static bool supports_hardware (const struct usb4_port *usb4) +static bool supports_hardware (const struct tb_margining *margining) { -return usb4->margining->caps[0 ] &USB4_MARGIN_CAP_0_MODES_HW ; +return margining->caps[0 ] &USB4_MARGIN_CAP_0_MODES_HW ; } -static bool both_lanes (const struct usb4_port *usb4) +static bool both_lanes (const struct tb_margining *margining) { -return usb4->margining->caps[0 ] &USB4_MARGIN_CAP_0_2_LANES ; +return margining->caps[0 ] &USB4_MARGIN_CAP_0_2_LANES ; } -static unsigned int independent_voltage_margins (const struct usb4_port *usb4) +static unsigned int +independent_voltage_margins (const struct tb_margining *margining) { -return (usb4->margining->caps[0 ] &USB4_MARGIN_CAP_0_VOLTAGE_INDP_MASK ) >> +return (margining->caps[0 ] &USB4_MARGIN_CAP_0_VOLTAGE_INDP_MASK ) >>USB4_MARGIN_CAP_0_VOLTAGE_INDP_SHIFT ; } -static bool supports_time (const struct usb4_port *usb4) +static bool supports_time (const struct tb_margining *margining) { -return usb4->margining->caps[0 ] &USB4_MARGIN_CAP_0_TIME ; +return margining->caps[0 ] &USB4_MARGIN_CAP_0_TIME ; }/* Only applicable if supports_time() returns true */ -static unsigned int independent_time_margins (const struct usb4_port *usb4) +static unsigned int +independent_time_margins (const struct tb_margining *margining) { -return (usb4->margining->caps[1 ] &USB4_MARGIN_CAP_1_TIME_INDP_MASK ) >> +return (margining->caps[1 ] &USB4_MARGIN_CAP_1_TIME_INDP_MASK ) >>USB4_MARGIN_CAP_1_TIME_INDP_SHIFT ; }
@@ -448,9 +452,8 @@ margining_ber_level_write(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos) { struct seq_file *s = file->private_data; -struct tb_port *port = s->private; -struct usb4_port *usb4 = port->usb4; -struct tb *tb = port->sw->tb; +struct tb_margining *margining = s->private; +struct tb *tb = margining->port->sw->tb;unsigned int val;int ret =0 ;char *buf;
@@ -458,7 +461,7 @@ margining_ber_level_write(struct file *file, const char __user *user_buf,if (mutex_lock_interruptible (&tb->lock))return -ERESTARTSYS ; -if (usb4->margining->software) { +if (margining->software) { ret = -EINVAL ; goto out_unlock; }
@@ -475,13 +478,13 @@ margining_ber_level_write(struct file *file, const char __user *user_buf,if (ret) goto out_free; -if (val < usb4->margining->min_ber_level || - val > usb4->margining->max_ber_level) { +if (val < margining->min_ber_level || + val > margining->max_ber_level) { ret = -EINVAL ; goto out_free; } - usb4->margining->ber_level = val; + margining->ber_level = val; out_free:free_page ((unsigned long )buf);
@@ -501,52 +504,50 @@ static void ber_level_show(struct seq_file *s, unsigned int val)static int margining_ber_level_show (struct seq_file *s,void *not_used) { -struct tb_port *port = s->private; -struct usb4_port *usb4 = port->usb4; +const struct tb_margining *margining = s->private; -if (usb4->margining->software) +if (margining->software)return -EINVAL ; -ber_level_show (s, usb4->margining->ber_level); +ber_level_show (s, margining->ber_level);return 0 ; }DEBUGFS_ATTR_RW (margining_ber_level);static int margining_caps_show (struct seq_file *s,void *not_used) { -struct tb_port *port = s->private; -struct usb4_port *usb4 = port->usb4; -struct tb *tb = port->sw->tb; +struct tb_margining *margining = s->private; +struct tb *tb = margining->port->sw->tb;u32 cap0, cap1;if (mutex_lock_interruptible (&tb->lock))return -ERESTARTSYS ;/* Dump the raw caps first */ - cap0 = usb4->margining->caps[0 ]; + cap0 = margining->caps[0 ];seq_printf (s,"0x%08x\n" , cap0); - cap1 = usb4->margining->caps[1 ]; + cap1 = margining->caps[1 ];seq_printf (s,"0x%08x\n" , cap1);seq_printf (s,"# software margining: %s\n" , -supports_software (usb4) ?"yes" :"no" ); -if (supports_hardware (usb4)) { +supports_software (margining) ?"yes" :"no" ); +if (supports_hardware (margining)) {seq_puts (s,"# hardware margining: yes\n" );seq_puts (s,"# minimum BER level contour: " ); -ber_level_show (s, usb4->margining->min_ber_level); +ber_level_show (s, margining->min_ber_level);seq_puts (s,"# maximum BER level contour: " ); -ber_level_show (s, usb4->margining->max_ber_level); +ber_level_show (s, margining->max_ber_level); }else {seq_puts (s,"# hardware margining: no\n" ); }seq_printf (s,"# both lanes simultaneously: %s\n" , -both_lanes (usb4) ?"yes" :"no" ); +both_lanes (margining) ?"yes" :"no" );seq_printf (s,"# voltage margin steps: %u\n" , - usb4->margining->voltage_steps); + margining->voltage_steps);seq_printf (s,"# maximum voltage offset: %u mV\n" , - usb4->margining->max_voltage_offset); + margining->max_voltage_offset); -switch (independent_voltage_margins (usb4)) { +switch (independent_voltage_margins (margining)) {case USB4_MARGIN_CAP_0_VOLTAGE_MIN :seq_puts (s,"# returns minimum between high and low voltage margins\n" );break ;
@@ -558,12 +559,12 @@ static int margining_caps_show(struct seq_file *s, void *not_used)break ; } -if (supports_time (usb4)) { +if (supports_time (margining)) {seq_puts (s,"# time margining: yes\n" );seq_printf (s,"# time margining is destructive: %s\n" , cap1 &USB4_MARGIN_CAP_1_TIME_DESTR ?"yes" :"no" ); -switch (independent_time_margins (usb4)) { +switch (independent_time_margins (margining)) {case USB4_MARGIN_CAP_1_TIME_MIN :seq_puts (s,"# returns minimum between left and right time margins\n" );break ;
@@ -576,9 +577,9 @@ static int margining_caps_show(struct seq_file *s, void *not_used) }seq_printf (s,"# time margin steps: %u\n" , - usb4->margining->time_steps); + margining->time_steps);seq_printf (s,"# maximum time offset: %u mUI\n" , - usb4->margining->max_time_offset); + margining->max_time_offset); }else {seq_puts (s,"# time margining: no\n" ); }
@@ -593,9 +594,8 @@ margining_lanes_write(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos) { struct seq_file *s = file->private_data; -struct tb_port *port = s->private; -struct usb4_port *usb4 = port->usb4; -struct tb *tb = port->sw->tb; +struct tb_margining *margining = s->private; +struct tb *tb = margining->port->sw->tb;int ret =0 ;char *buf;
@@ -611,13 +611,13 @@ margining_lanes_write(struct file *file, const char __user *user_buf, }if (!strcmp (buf,"0" )) { - usb4->margining->lanes =0 ; + margining->lanes =0 ; }else if (!strcmp (buf,"1" )) { - usb4->margining->lanes =1 ; + margining->lanes =1 ; }else if (!strcmp (buf,"all" )) {/* Needs to be supported */ -if (both_lanes (usb4)) - usb4->margining->lanes =7 ; +if (both_lanes (margining)) + margining->lanes =7 ;else ret = -EINVAL ; }else {
@@ -633,16 +633,15 @@ margining_lanes_write(struct file *file, const char __user *user_buf,static int margining_lanes_show (struct seq_file *s,void *not_used) { -struct tb_port *port = s->private; -struct usb4_port *usb4 = port->usb4; -struct tb *tb = port->sw->tb; +struct tb_margining *margining = s->private; +struct tb *tb = margining->port->sw->tb;unsigned int lanes;if (mutex_lock_interruptible (&tb->lock))return -ERESTARTSYS ; - lanes = usb4->margining->lanes; -if (both_lanes (usb4)) { + lanes = margining->lanes; +if (both_lanes (margining)) {if (!lanes)seq_puts (s,"[0] 1 all\n" );else if (lanes ==1 )
@@ -666,9 +665,8 @@ static ssize_t margining_mode_write(struct file *file, size_t count, loff_t *ppos) { struct seq_file *s = file->private_data; -struct tb_port *port = s->private; -struct usb4_port *usb4 = port->usb4; -struct tb *tb = port->sw->tb; +struct tb_margining *margining = s->private; +struct tb *tb = margining->port->sw->tb;int ret =0 ;char *buf;
@@ -684,13 +682,13 @@ static ssize_t margining_mode_write(struct file *file, }if (!strcmp (buf,"software" )) { -if (supports_software (usb4)) - usb4->margining->software = true; +if (supports_software (margining)) + margining->software = true;else ret = -EINVAL ; }else if (!strcmp (buf,"hardware" )) { -if (supports_hardware (usb4)) - usb4->margining->software = false; +if (supports_hardware (margining)) + margining->software = false;else ret = -EINVAL ; }else {
@@ -706,23 +704,22 @@ static ssize_t margining_mode_write(struct file *file,static int margining_mode_show (struct seq_file *s,void *not_used) { -const struct tb_port *port = s->private; -const struct usb4_port *usb4 = port->usb4; -struct tb *tb = port->sw->tb; +struct tb_margining *margining = s->private; +struct tb *tb = margining->port->sw->tb;const char *space ="" ;if (mutex_lock_interruptible (&tb->lock))return -ERESTARTSYS ; -if (supports_software (usb4)) { -if (usb4->margining->software) +if (supports_software (margining)) { +if (margining->software)seq_puts (s,"[software]" );else seq_puts (s,"software" ); space =" " ; } -if (supports_hardware (usb4)) { -if (usb4->margining->software) +if (supports_hardware (margining)) { +if (margining->software)seq_printf (s,"%shardware" , space);else seq_printf (s,"%s[hardware]" , space);
@@ -737,10 +734,9 @@ DEBUGFS_ATTR_RW(margining_mode);static int margining_run_write (void *data,u64 val) { -struct tb_port *port = data; -struct usb4_port *usb4 = port->usb4; +struct tb_margining *margining = data; +struct tb_port *port = margining->port;struct tb_switch *sw = port->sw; -struct tb_margining *margining;struct tb_switch *down_sw;struct tb *tb = sw->tb;int ret, clx;
@@ -775,8 +771,6 @@ static int margining_run_write(void *data, u64 val) clx = ret; } - margining = usb4->margining; -if (margining->software) {tb_port_dbg (port,"running software %s lane margining for lanes %u\n" , margining->time ?"time" :"voltage" , margining->lanes);
@@ -817,16 +811,15 @@ static ssize_t margining_results_write(struct file *file, size_t count, loff_t *ppos) { struct seq_file *s = file->private_data; -struct tb_port *port = s->private; -struct usb4_port *usb4 = port->usb4; -struct tb *tb = port->sw->tb; +struct tb_margining *margining = s->private; +struct tb *tb = margining->port->sw->tb;if (mutex_lock_interruptible (&tb->lock))return -ERESTARTSYS ;/* Just clear the results */ - usb4->margining->results[0 ] =0 ; - usb4->margining->results[1 ] =0 ; + margining->results[0 ] =0 ; + margining->results[1 ] =0 ;mutex_unlock (&tb->lock);return count;
@@ -860,15 +853,12 @@ static void time_margin_show(struct seq_file *s,static int margining_results_show (struct seq_file *s,void *not_used) { -struct tb_port *port = s->private; -struct usb4_port *usb4 = port->usb4; -struct tb_margining *margining; -struct tb *tb = port->sw->tb; +struct tb_margining *margining = s->private; +struct tb *tb = margining->port->sw->tb;if (mutex_lock_interruptible (&tb->lock))return -ERESTARTSYS ; - margining = usb4->margining;/* Dump the raw results first */ seq_printf (s,"0x%08x\n" , margining->results[0 ]);/* Only the hardware margining has two result dwords */
@@ -930,9 +920,8 @@ static ssize_t margining_test_write(struct file *file, size_t count, loff_t *ppos) { struct seq_file *s = file->private_data; -struct tb_port *port = s->private; -struct usb4_port *usb4 = port->usb4; -struct tb *tb = port->sw->tb; +struct tb_margining *margining = s->private; +struct tb *tb = margining->port->sw->tb;int ret =0 ;char *buf;
@@ -947,10 +936,10 @@ static ssize_t margining_test_write(struct file *file, goto out_free; } -if (!strcmp (buf,"time" ) &&supports_time (usb4)) - usb4->margining->time = true; +if (!strcmp (buf,"time" ) &&supports_time (margining)) + margining->time = true;else if (!strcmp (buf,"voltage" )) - usb4->margining->time = false; + margining->time = false;else ret = -EINVAL ;
@@ -963,15 +952,14 @@ static ssize_t margining_test_write(struct file *file,static int margining_test_show (struct seq_file *s,void *not_used) { -struct tb_port *port = s->private; -struct usb4_port *usb4 = port->usb4; -struct tb *tb = port->sw->tb; +struct tb_margining *margining = s->private; +struct tb *tb = margining->port->sw->tb;if (mutex_lock_interruptible (&tb->lock))return -ERESTARTSYS ; -if (supports_time (usb4)) { -if (usb4->margining->time) +if (supports_time (margining)) { +if (margining->time)seq_puts (s,"voltage [time]\n" );else seq_puts (s,"[voltage] time\n" );
@@ -989,9 +977,8 @@ static ssize_t margining_margin_write(struct file *file, size_t count, loff_t *ppos) { struct seq_file *s = file->private_data; -struct tb_port *port = s->private; -struct usb4_port *usb4 = port->usb4; -struct tb *tb = port->sw->tb; +struct tb_margining *margining = s->private; +struct tb *tb = margining->port->sw->tb;int ret =0 ;char *buf;
@@ -1006,18 +993,18 @@ static ssize_t margining_margin_write(struct file *file, goto out_free; } -if (usb4->margining->time) { +if (margining->time) {if (!strcmp (buf,"left" )) - usb4->margining->right_high = false; + margining->right_high = false;else if (!strcmp (buf,"right" )) - usb4->margining->right_high = true; + margining->right_high = true;else ret = -EINVAL ; }else {if (!strcmp (buf,"low" )) - usb4->margining->right_high = false; + margining->right_high = false;else if (!strcmp (buf,"high" )) - usb4->margining->right_high = true; + margining->right_high = true;else ret = -EINVAL ; }
@@ -1031,20 +1018,19 @@ static ssize_t margining_margin_write(struct file *file,static int margining_margin_show (struct seq_file *s,void *not_used) { -struct tb_port *port = s->private; -struct usb4_port *usb4 = port->usb4; -struct tb *tb = port->sw->tb; +struct tb_margining *margining = s->private; +struct tb *tb = margining->port->sw->tb;if (mutex_lock_interruptible (&tb->lock))return -ERESTARTSYS ; -if (usb4->margining->time) { -if (usb4->margining->right_high) +if (margining->time) { +if (margining->right_high)seq_puts (s,"left [right]\n" );else seq_puts (s,"[left] right\n" ); }else { -if (usb4->margining->right_high) +if (margining->right_high)seq_puts (s,"low [high]\n" );else seq_puts (s,"[low] high\n" );
@@ -1075,16 +1061,16 @@ static void margining_port_init(struct tb_port *port)if (!margining)return ; + margining->port = port; + ret =usb4_port_margining_caps (port, margining->caps);if (ret) {kfree (margining);return ; } - usb4->margining = margining; -/* Set the initial mode */ -if (supports_software (usb4)) +if (supports_software (margining)) margining->software = true; val = (margining->caps[0] & USB4_MARGIN_CAP_0_VOLTAGE_STEPS_MASK) >>
@@ -1094,7 +1080,7 @@ static void margining_port_init(struct tb_port *port)USB4_MARGIN_CAP_0_MAX_VOLTAGE_OFFSET_SHIFT ; margining->max_voltage_offset =74 + val *2 ; -if (supports_time (usb4)) { +if (supports_time (margining)) { val = (margining->caps[1 ] &USB4_MARGIN_CAP_1_TIME_STEPS_MASK ) >>USB4_MARGIN_CAP_1_TIME_STEPS_SHIFT ; margining->time_steps = val;
@@ -1108,7 +1094,7 @@ static void margining_port_init(struct tb_port *port) } dir =debugfs_create_dir ("margining" , parent); -if (supports_hardware (usb4)) { +if (supports_hardware (margining)) { val = (margining->caps[1 ] &USB4_MARGIN_CAP_1_MIN_BER_MASK ) >>USB4_MARGIN_CAP_1_MIN_BER_SHIFT ; margining->min_ber_level = val;
@@ -1119,19 +1105,23 @@ static void margining_port_init(struct tb_port *port)/* Set the default to minimum */ margining->ber_level = margining->min_ber_level; -debugfs_create_file ("ber_level_contour" ,0400 , dir, port, +debugfs_create_file ("ber_level_contour" ,0400 , dir, margining, &margining_ber_level_fops); } -debugfs_create_file ("caps" ,0400 , dir, port, &margining_caps_fops); -debugfs_create_file ("lanes" ,0600 , dir, port, &margining_lanes_fops); -debugfs_create_file ("mode" ,0600 , dir, port, &margining_mode_fops); -debugfs_create_file ("run" ,0600 , dir, port, &margining_run_fops); -debugfs_create_file ("results" ,0600 , dir, port, &margining_results_fops); -debugfs_create_file ("test" ,0600 , dir, port, &margining_test_fops); -if (independent_voltage_margins (usb4) ==USB4_MARGIN_CAP_0_VOLTAGE_HL || - (supports_time (usb4) && -independent_time_margins (usb4) ==USB4_MARGIN_CAP_1_TIME_LR )) -debugfs_create_file ("margin" ,0600 , dir, port, &margining_margin_fops); +debugfs_create_file ("caps" ,0400 , dir, margining, &margining_caps_fops); +debugfs_create_file ("lanes" ,0600 , dir, margining, &margining_lanes_fops); +debugfs_create_file ("mode" ,0600 , dir, margining, &margining_mode_fops); +debugfs_create_file ("run" ,0600 , dir, margining, &margining_run_fops); +debugfs_create_file ("results" ,0600 , dir, margining, + &margining_results_fops); +debugfs_create_file ("test" ,0600 , dir, margining, &margining_test_fops); +if (independent_voltage_margins (margining) ==USB4_MARGIN_CAP_0_VOLTAGE_HL || + (supports_time (margining) && +independent_time_margins (margining) ==USB4_MARGIN_CAP_1_TIME_LR )) +debugfs_create_file ("margin" ,0600 , dir, margining, + &margining_margin_fops); + + usb4->margining = margining; }static void margining_port_remove (struct tb_port *port)
Signature · 1 line
2.43.0
PATCH v2 5/6 thunderbolt: Make margining functions accept target and retimer index
In reply to Mika WesterbergIn order to add lane margining support for retimers make the margining functions take sideband target and retimer index as parameters. This makes it possible to access both router and retimer sideband using the same functions.
--- drivers/thunderbolt/debugfs.c | 16 ++++++----- drivers/thunderbolt/tb.h | 15 ++++++----- drivers/thunderbolt/usb4.c | 51 +++++++++++++++++++++-------------- 3 files changed, 50 insertions(+), 32 deletions(-)
drivers/thunderbolt/debugfs.c +10 -6
@@ -774,22 +774,25 @@ static int margining_run_write(void *data, u64 val)if (margining->software) {tb_port_dbg (port,"running software %s lane margining for lanes %u\n" , margining->time ?"time" :"voltage" , margining->lanes); - ret =usb4_port_sw_margin (port, margining->lanes, margining->time, + ret =usb4_port_sw_margin (port,USB4_SB_TARGET_ROUTER ,0 , + margining->lanes, margining->time, margining->right_high,USB4_MARGIN_SW_COUNTER_CLEAR );if (ret) goto out_clx; - ret =usb4_port_sw_margin_errors (port, &margining->results[0 ]); + ret =usb4_port_sw_margin_errors (port,USB4_SB_TARGET_ROUTER ,0 , + &margining->results[0 ]); }else {tb_port_dbg (port,"running hardware %s lane margining for lanes %u\n" , margining->time ?"time" :"voltage" , margining->lanes);/* Clear the results */ margining->results[0 ] =0 ; margining->results[1 ] =0 ; - ret =usb4_port_hw_margin (port, margining->lanes, - margining->ber_level, margining->time, - margining->right_high, margining->results); + ret =usb4_port_hw_margin (port,USB4_SB_TARGET_ROUTER ,0 , + margining->lanes, margining->ber_level, + margining->time, margining->right_high, + margining->results); } out_clx:
@@ -1063,7 +1066,8 @@ static void margining_port_init(struct tb_port *port) margining->port = port; - ret =usb4_port_margining_caps (port, margining->caps); + ret =usb4_port_margining_caps (port,USB4_SB_TARGET_ROUTER ,0 , + margining->caps);if (ret) {kfree (margining);return ;
drivers/thunderbolt/tb.h +9 -6
@@ -1349,13 +1349,16 @@ int usb4_port_sb_read(struct tb_port *port, enum usb4_sb_target target, u8 indexint usb4_port_sb_write (struct tb_port *port,enum usb4_sb_target target,u8 index,u8 reg,const void *buf,u8 size); -int usb4_port_margining_caps (struct tb_port *port,u32 *caps); -int usb4_port_hw_margin (struct tb_port *port,unsigned int lanes, -unsigned int ber_level,bool timing,bool right_high, -u32 *results); -int usb4_port_sw_margin (struct tb_port *port,unsigned int lanes,bool timing, +int usb4_port_margining_caps (struct tb_port *port,enum usb4_sb_target target, +u8 index,u32 *caps); +int usb4_port_hw_margin (struct tb_port *port,enum usb4_sb_target target, +u8 index,unsigned int lanes,unsigned int ber_level, +bool timing,bool right_high,u32 *results); +int usb4_port_sw_margin (struct tb_port *port,enum usb4_sb_target target, +u8 index,unsigned int lanes,bool timing,bool right_high,u32 counter); -int usb4_port_sw_margin_errors (struct tb_port *port,u32 *errors); +int usb4_port_sw_margin_errors (struct tb_port *port,enum usb4_sb_target target, +u8 index,u32 *errors);int usb4_port_retimer_set_inbound_sbtx (struct tb_port *port,u8 index);int usb4_port_retimer_unset_inbound_sbtx (struct tb_port *port,u8 index);
drivers/thunderbolt/usb4.c +31 -20
130 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH v2 6/6 thunderbolt: Add receiver lane margining support for retimers
In reply to Mika WesterbergRetimers support lane margining as well so make this available through debugfs in the same way as we do for the USB4 ports. When this is enabled we also expose retimers on the other side of the cable because typically margining is implemented only on direction towards the cable. However, for the retimers on the other side of the cable we do not allow NVM upgrade to avoid confusing the existing userspace (the same retimer may now appear twice with different name) and is probably not a good idea anyway.
--- drivers/thunderbolt/Kconfig | 11 +++-- drivers/thunderbolt/debugfs.c | 92 +++++++++++++++++++++++++---------- drivers/thunderbolt/retimer.c | 43 +++++++++------- drivers/thunderbolt/sb_regs.h | 1 + drivers/thunderbolt/tb.h | 5 ++ drivers/thunderbolt/usb4.c | 24 +++++++++ 6 files changed, 128 insertions(+), 48 deletions(-)
drivers/thunderbolt/Kconfig +6 -5
@@ -32,14 +32,15 @@ config USB4_DEBUGFS_WRITE this for production systems or distro kernels. config USB4_DEBUGFS_MARGINING - bool "Expose receiver lane margining operations under USB4 ports (DANGEROUS)" + bool "Expose receiver lane margining operations under USB4 ports and retimers (DANGEROUS)" depends on DEBUG_FS depends on USB4_DEBUGFS_WRITE help - Enables hardware and software based receiver lane margining support - under each USB4 port. Used for electrical quality and robustness - validation during manufacturing. Should not be enabled by distro - kernels. + Enables hardware and software based receiver lane margining + support under each USB4 port and retimer, including retimers + on the other side of the cable. Used for electrical quality + and robustness validation during manufacturing. Should not be + enabled by distro kernels. config USB4_KUNIT_TEST bool "KUnit tests" if !KUNIT_ALL_TESTS
drivers/thunderbolt/debugfs.c +66 -26
187 lines not on this page · raw message
drivers/thunderbolt/retimer.c +26 -17
98 lines not on this page · raw message
drivers/thunderbolt/sb_regs.h +1 -0
@@ -26,6 +26,7 @@ enum usb4_sb_opcode {USB4_SB_OPCODE_SET_INBOUND_SBTX =0x5055534c ,/* "LSUP" */ USB4_SB_OPCODE_UNSET_INBOUND_SBTX =0x50555355 ,/* "USUP" */ USB4_SB_OPCODE_QUERY_LAST_RETIMER =0x5453414c ,/* "LAST" */ +USB4_SB_OPCODE_QUERY_CABLE_RETIMER =0x524c4243 ,/* "CBLR" */ USB4_SB_OPCODE_GET_NVM_SECTOR_SIZE =0x53534e47 ,/* "GNSS" */ USB4_SB_OPCODE_NVM_SET_OFFSET =0x53504f42 ,/* "BOPS" */ USB4_SB_OPCODE_NVM_BLOCK_WRITE = 0x574b4c42, /* "BLKW" */
drivers/thunderbolt/tb.h +5 -0
@@ -329,6 +329,7 @@ struct usb4_port {* @nvm: Pointer to the NVM if the retimer has one (%NULL otherwise) * @no_nvm_upgrade: Prevent NVM upgrade of this retimer * @auth_status: Status of last NVM authentication +* @margining: Pointer to margining structure if enabled */ struct tb_retimer {struct device dev;
@@ -340,6 +341,9 @@ struct tb_retimer {struct tb_nvm *nvm;bool no_nvm_upgrade;u32 auth_status; +#ifdef CONFIG_USB4_DEBUGFS_MARGINING +struct tb_margining *margining; +#endif };/**
@@ -1363,6 +1367,7 @@ int usb4_port_sw_margin_errors(struct tb_port *port, enum usb4_sb_target target,int usb4_port_retimer_set_inbound_sbtx (struct tb_port *port,u8 index);int usb4_port_retimer_unset_inbound_sbtx (struct tb_port *port,u8 index);int usb4_port_retimer_is_last (struct tb_port *port,u8 index); +int usb4_port_retimer_is_cable (struct tb_port *port,u8 index);int usb4_port_retimer_nvm_sector_size (struct tb_port *port,u8 index);int usb4_port_retimer_nvm_set_offset (struct tb_port *port,u8 index,unsigned int address);
drivers/thunderbolt/usb4.c +24 -0
@@ -1830,6 +1830,30 @@ int usb4_port_retimer_is_last(struct tb_port *port, u8 index)return ret ? ret : metadata &1 ; } +/** +* usb4_port_retimer_is_cable() - Is the retimer cable retimer +* @port: USB4 port +* @index: Retimer index +* +* If the retimer at @index is last cable retimer this function returns +* %1 and %0 if it is on-board retimer. In case a retimer is not present +* at @index returns %-ENODEV. Otherwise returns negative errno. +*/ +int usb4_port_retimer_is_cable (struct tb_port *port,u8 index) +{ +u32 metadata; +int ret; + + ret =usb4_port_retimer_op (port, index,USB4_SB_OPCODE_QUERY_CABLE_RETIMER , +500 ); +if (ret) +return ret; + + ret =usb4_port_sb_read (port,USB4_SB_TARGET_RETIMER , index, +USB4_SB_METADATA , &metadata,sizeof (metadata)); +return ret ? ret : metadata &1 ; +} +/** * usb4_port_retimer_nvm_sector_size() - Read retimer NVM sector size * @port: USB4 port
Signature · 1 line
2.43.0
Greg KH
maintainerQuoted 15 lines · Mika Westerberg
Hi all,
This series adds USB4 link sideband access through debugfs. This can be used to run port operations etc. from userspace usable for example in manufacturing. The other feature is receiver lane margining support for retimers with similar use case.
Mika Westerberg (6):
thunderbolt: Moveusb4_port_margining_caps()declaration into correct place
thunderbolt: Make usb4_port_sb_read/write() available outside ofusb4.c
thunderbolt: Add sideband register access to debugfs
thunderbolt: Split out margining from USB4 port
thunderbolt: Make margining functions accept target and retimer index
thunderbolt: Add receiver lane margining support for retimers
Quoted 7 lines
drivers/thunderbolt/Kconfig | 11 +- drivers/thunderbolt/debugfs.c | 623 ++++++++++++++++++++++++++-------- drivers/thunderbolt/retimer.c | 53 +-- drivers/thunderbolt/sb_regs.h | 9 + drivers/thunderbolt/tb.h | 45 ++- drivers/thunderbolt/usb4.c | 183 +++++----- 6 files changed, 655 insertions(+), 269 deletions(-)
No hint as to what changed from v1?
thanks,
greg k-h
Quoted 24 lines · Greg KH
Quoted 15 lines · Mika Westerberg
Hi all,
This series adds USB4 link sideband access through debugfs. This can be used to run port operations etc. from userspace usable for example in manufacturing. The other feature is receiver lane margining support for retimers with similar use case.
Mika Westerberg (6):
thunderbolt: Moveusb4_port_margining_caps()declaration into correct place
thunderbolt: Make usb4_port_sb_read/write() available outside ofusb4.c
thunderbolt: Add sideband register access to debugfs
thunderbolt: Split out margining from USB4 port
thunderbolt: Make margining functions accept target and retimer index
thunderbolt: Add receiver lane margining support for retimersQuoted 7 lines
drivers/thunderbolt/Kconfig | 11 +- drivers/thunderbolt/debugfs.c | 623 ++++++++++++++++++++++++++-------- drivers/thunderbolt/retimer.c | 53 +-- drivers/thunderbolt/sb_regs.h | 9 + drivers/thunderbolt/tb.h | 45 ++- drivers/thunderbolt/usb4.c | 183 +++++----- 6 files changed, 655 insertions(+), 269 deletions(-)
Quoted 1 line
No hint as to what changed from v1?
Oh, crap. I added it but added for the v1 cover letter by accident :( Sorry about that. The changelog is below:
Previous version can be found:
https://lore.kernel.org/linux-usb/[email protected]/
Changes from previous version:
- Do not store debugfs dentry pointer, instead look it up when needed.
Greg KH
maintainerQuoted 30 lines · Mika Westerberg
Quoted 24 lines · Greg KH
Quoted 15 lines · Mika Westerberg
Hi all,
This series adds USB4 link sideband access through debugfs. This can be used to run port operations etc. from userspace usable for example in manufacturing. The other feature is receiver lane margining support for retimers with similar use case.
Mika Westerberg (6):
thunderbolt: Moveusb4_port_margining_caps()declaration into correct place
thunderbolt: Make usb4_port_sb_read/write() available outside ofusb4.c
thunderbolt: Add sideband register access to debugfs
thunderbolt: Split out margining from USB4 port
thunderbolt: Make margining functions accept target and retimer index
thunderbolt: Add receiver lane margining support for retimersQuoted 7 lines
drivers/thunderbolt/Kconfig | 11 +- drivers/thunderbolt/debugfs.c | 623 ++++++++++++++++++++++++++-------- drivers/thunderbolt/retimer.c | 53 +-- drivers/thunderbolt/sb_regs.h | 9 + drivers/thunderbolt/tb.h | 45 ++- drivers/thunderbolt/usb4.c | 183 +++++----- 6 files changed, 655 insertions(+), 269 deletions(-)Quoted 1 line
No hint as to what changed from v1?
Oh, crap. I added it but added for the v1 cover letter by accident :( Sorry about that. The changelog is below:
Quoted 7 lines
Previous version can be found:
https://lore.kernel.org/linux-usb/[email protected]/
Changes from previous version:
- Do not store debugfs dentry pointer, instead look it up when needed.
Great, thanks for the change, looks good!
greg k-h
Mika Westerberg
AppliedQuoted 7 lines · Mika Westerberg
Hi all,
This series adds USB4 link sideband access through debugfs. This can be used to run port operations etc. from userspace usable for example in manufacturing. The other feature is receiver lane margining support for retimers with similar use case.
Quoted 7 lines
Mika Westerberg (6):
thunderbolt: Moveusb4_port_margining_caps()declaration into correct place
thunderbolt: Make usb4_port_sb_read/write() available outside ofusb4.c
thunderbolt: Add sideband register access to debugfs
thunderbolt: Split out margining from USB4 port
thunderbolt: Make margining functions accept target and retimer index
thunderbolt: Add receiver lane margining support for retimers
Applied to thunderbolt.git/next.