Lines Matching refs:sw
16 int tb_lc_read_uuid(struct tb_switch *sw, u32 *uuid) in tb_lc_read_uuid() argument
18 if (!sw->cap_lc) 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()
23 static int read_lc_desc(struct tb_switch *sw, u32 *desc) in read_lc_desc() argument
25 if (!sw->cap_lc) 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() local
36 ret = read_lc_desc(sw, &desc); 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_configure_lane() local
55 if (sw->generation < 2) in tb_lc_configure_lane()
62 ret = tb_sw_read(sw, &ctrl, TB_CFG_SWITCH, cap + TB_LC_SX_CTRL, 1); in tb_lc_configure_lane()
82 return tb_sw_write(sw, &ctrl, TB_CFG_SWITCH, cap + TB_LC_SX_CTRL, 1); in tb_lc_configure_lane()
92 int tb_lc_configure_link(struct tb_switch *sw) in tb_lc_configure_link() argument
97 if (!sw->config.enabled || !tb_route(sw)) in tb_lc_configure_link()
100 up = tb_upstream_port(sw); in tb_lc_configure_link()
101 down = tb_port_at(tb_route(sw), tb_to_switch(sw->dev.parent)); in tb_lc_configure_link()
123 void tb_lc_unconfigure_link(struct tb_switch *sw) in tb_lc_unconfigure_link() argument
127 if (sw->is_unplugged || !sw->config.enabled || !tb_route(sw)) in tb_lc_unconfigure_link()
130 up = tb_upstream_port(sw); in tb_lc_unconfigure_link()
131 down = tb_port_at(tb_route(sw), tb_to_switch(sw->dev.parent)); in tb_lc_unconfigure_link()
144 int tb_lc_set_sleep(struct tb_switch *sw) in tb_lc_set_sleep() argument
149 if (sw->generation < 2) in tb_lc_set_sleep()
152 ret = read_lc_desc(sw, &desc); in tb_lc_set_sleep()
163 unsigned int offset = sw->cap_lc + start + i * size; in tb_lc_set_sleep()
166 ret = tb_sw_read(sw, &ctrl, TB_CFG_SWITCH, in tb_lc_set_sleep()
172 ret = tb_sw_write(sw, &ctrl, TB_CFG_SWITCH, in tb_lc_set_sleep()