Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1576580
| Path | csiph.com!news.redatomik.org!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/1] xhci: add USB2 test mode support |
| Date | Wed, 08 Feb 2017 14:30:02 +0100 |
| Message-ID | <t8AtQ-Rq-29@gated-at.bofh.it> (permalink) |
| References | <t8y8H-7Ir-47@gated-at.bofh.it> <t8A0N-rN-5@gated-at.bofh.it> <t8Akb-O0-53@gated-at.bofh.it> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| User-Agent | Mutt/1.7.2 (2016-11-26) |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 97 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Mathias Nyman <mathias.nyman@intel.com>, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, "Wang, Yu" <yu.y.wang@intel.com>, "Li, Guanglei" <guangleix.li@intel.com>, "Wu, Hao" <hao.wu@intel.com> |
| X-Original-Date | Wed, 8 Feb 2017 14:24:35 +0100 |
| X-Original-Message-ID | <20170208132435.GC30518@kroah.com> |
| X-Original-References | <20170208102635.23668-1-alexander.stein@systec-electronic.com> <20170208125330.GA27478@kroah.com> <2924299.FzB3BCsVab@ws-stein> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1576580 |
Show key headers only | View raw
On Wed, Feb 08, 2017 at 02:10:39PM +0100, Alexander Stein wrote:
> On Wednesday 08 February 2017 13:53:30, Greg Kroah-Hartman wrote:
> > On Wed, Feb 08, 2017 at 11:26:35AM +0100, Alexander Stein wrote:
> > > This patch adds support for USB2 test mode (Test_J, Test_K,
> > > Test_SE0_NAK and Test_Packet) per XHCI spec 4.19.6.
> >
> > What does that mean "in English"? In other words, why do we want this?
> > What does it provide for a user? Why do we care?
>
> USB2 test mode is a required hardware feature for system integrators
> validating their hardware according to USB spec, regarding signal strength and
> stuff. It is purely a hardware test feature.
Then the changelog needs to say that!
> > > @@ -1134,6 +1137,64 @@ int xhci_hub_control(struct usb_hcd *hcd, u16
> > > typeReq, u16 wValue,>
> > > temp |= PORT_U2_TIMEOUT(timeout);
> > > writel(temp, port_array[wIndex] + PORTPMSC);
> > > break;
> > >
> > > + case USB_PORT_FEAT_TEST:
> > > + /* 4.19.6 Port Test Modes (USB2 Test Mode) */
> > > + if (hcd->speed != HCD_USB2)
> > > + goto error;
> > > +
> > > + /* FIXME: Test_Force_Enable case to be implemented */
> > > + if (selector < TEST_J || selector > TEST_PACKET)
> > > + goto error;
> > > +
> > > + /* Disable all Device Slots */
> > > + for (i = 0; i < MAX_HC_SLOTS; i++) {
> > > + struct xhci_command *command;
> > > +
> > > + if (!xhci->dcbaa->dev_context_ptrs[i])
> > > + continue;
> > > + command = xhci_alloc_command(xhci, false,
> > > + false, GFP_ATOMIC);
> > > + if (!command)
> > > + return -ENOMEM;
> > > + if (xhci_queue_slot_control(xhci, command,
> > > + TRB_DISABLE_SLOT, i)) {
> > > + xhci_err(xhci,
> > > + "Disable slot[%d] fail!\n", i);
> > > + goto error;
> > > + }
> > > + xhci_dbg(xhci, "Disable Slot[%d].\n", i);
> > > + }
> > > +
> > > + /* Put all ports to the Disable state by clear PP */
> > > + xhci_dbg(xhci, "Disable all port (PP = 0)\n");
> > > + for (i = 0; i < max_ports; i++) {
> > > + temp = readl(port_array[i]);
> > > + temp &= ~PORT_POWER;
> > > + writel(temp, port_array[i]);
> > > + }
> > > +
> > > + /* Stop the controller */
> > > + xhci_dbg(xhci, "Stop controller\n");
> > > + temp = readl(&xhci->op_regs->command);
> > > + temp &= ~CMD_RUN;
> > > + writel(temp, &xhci->op_regs->command);
> > > +
> > > + if (xhci_handshake(&xhci->op_regs->status,
> > > + STS_HALT, STS_HALT, XHCI_MAX_HALT_USEC)) {
> > > + xhci_warn(xhci, "Stop controller timeout\n");
> > > + return -ETIMEDOUT;
> > > + }
> > > +
> > > + /* Disable runtime PM for test mode */
> > > + pm_runtime_forbid(hcd->self.controller);
> > > +
> > > + /* Set PORTPMSC.PTC field for selected test mode */
> > > + xhci_dbg(xhci, "Enter Test Mode: %d\n", selector);
> > > + temp = readl(port_array[wIndex] + PORTPMSC);
> > > + temp |= selector << 28;
> > > + writel(temp, port_array[wIndex] + PORTPMSC);
> > > +
> > > + break;
> >
> > What does this "test mode" do? Where does it report the information?
> > Who can use it?
>
> Useually you need an oscilloscope and have to enable those test modes on the
> hardware. This will send some specific test patterns on D+/D-. There is no
> report available (in linux itself) as it is purely externaly visible.
> Regular USB usage is not possible at that time.
> Anyone (well access to e.g. /dev/bus/usb/001/001 provided) can use it by
> sending appropriate USB_PORT_FEAT_TEST requests to the hub.
> The same feature for ehci based hosts is already available at
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/host/ehci-hub.c#n1267
Put that info in the changelog!
thanks,
greg k-h
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 1/1] xhci: add USB2 test mode support Alexander Stein <alexander.stein@systec-electronic.com> - 2017-02-08 12:00 +0100
Re: [PATCH 1/1] xhci: add USB2 test mode support Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-08 14:00 +0100
Re: [PATCH 1/1] xhci: add USB2 test mode support Alexander Stein <alexander.stein@systec-electronic.com> - 2017-02-08 14:20 +0100
Re: [PATCH 1/1] xhci: add USB2 test mode support Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-08 14:30 +0100
csiph-web