From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [bug report] thunderbolt: Add initial support for USB4
Date: Tue, 7 Jan 2020 12:25:40 +0200 [thread overview]
Message-ID: <20200107102540.GQ465886@lahna.fi.intel.com> (raw)
In-Reply-To: <20200107052424.pidwn5f7wyayany2@kili.mountain>
On Tue, Jan 07, 2020 at 08:24:24AM +0300, Dan Carpenter wrote:
> [ Should linux-usb be listed in MAINTAINERS? - dan]
Yes, I think so. I'll make a patch for that.
> Hello Mika Westerberg,
>
> The patch b04079837b20: "thunderbolt: Add initial support for USB4"
> from Dec 17, 2019, leads to the following static checker warning:
>
> drivers/thunderbolt/usb4.c:242 usb4_switch_setup()
> warn: bool mask it always valse 'xhci & ((((1))) << (18))'
>
> drivers/thunderbolt/usb4.c
> 206 bool tbt3, xhci;
> ^^^^ ^^^^
>
> 207 u32 val = 0;
> 208 int ret;
> 209
> 210 if (!tb_route(sw))
> 211 return 0;
> 212
> 213 ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, ROUTER_CS_6, 1);
> 214 if (ret)
> 215 return ret;
> 216
> 217 xhci = val & ROUTER_CS_6_HCI;
> 218 tbt3 = !(val & ROUTER_CS_6_TNS);
> 219
> 220 tb_sw_dbg(sw, "TBT3 support: %s, xHCI: %s\n",
> 221 tbt3 ? "yes" : "no", xhci ? "yes" : "no");
> 222
> 223 ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, ROUTER_CS_5, 1);
> 224 if (ret)
> 225 return ret;
> 226
> 227 parent = tb_switch_parent(sw);
> 228
> 229 if (tb_switch_find_port(parent, TB_TYPE_USB3_DOWN)) {
> 230 val |= ROUTER_CS_5_UTO;
> 231 xhci = false;
> 232 }
> 233
> 234 /* Only enable PCIe tunneling if the parent router supports it */
> 235 if (tb_switch_find_port(parent, TB_TYPE_PCIE_DOWN)) {
> 236 val |= ROUTER_CS_5_PTO;
> 237 /*
> 238 * xHCI can be enabled if PCIe tunneling is supported
> 239 * and the parent does not have any USB3 dowstream
> 240 * adapters (so we cannot do USB 3.x tunneling).
> 241 */
> 242 if (xhci & ROUTER_CS_6_HCI)
> ^^^^^^^^^^^^^^^^^^^^^^
> "xhci" is bool so BIT(18) is not set.
Good finding. It should be
if (xhci)
val |= ROUTER_CS_5_HCO;
I think. I'll make patch fixing it as well.
prev parent reply other threads:[~2020-01-07 10:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-07 5:24 [bug report] thunderbolt: Add initial support for USB4 Dan Carpenter
2020-01-07 10:25 ` Mika Westerberg [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200107102540.GQ465886@lahna.fi.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=dan.carpenter@oracle.com \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).