From patchwork Wed Jun 24 13:59:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathias Nyman X-Patchwork-Id: 223028 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA711C433DF for ; Wed, 24 Jun 2020 13:56:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C32AD20724 for ; Wed, 24 Jun 2020 13:56:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403996AbgFXN4w (ORCPT ); Wed, 24 Jun 2020 09:56:52 -0400 Received: from mga02.intel.com ([134.134.136.20]:43621 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403988AbgFXN4v (ORCPT ); Wed, 24 Jun 2020 09:56:51 -0400 IronPort-SDR: QQz8Hc5i5KjwmscPx//gt9LfU1NXeUehjYrTOYA7I8UsDILNX2LFT3yFkBtDoxMwewCZTdEUvs mjGl2DSpiulQ== X-IronPort-AV: E=McAfee;i="6000,8403,9661"; a="132909248" X-IronPort-AV: E=Sophos;i="5.75,275,1589266800"; d="scan'208";a="132909248" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jun 2020 06:56:51 -0700 IronPort-SDR: Uxu3TMFCFHnKJdxg1E0+XmOR4Zz4FrMrAoeEiUd7ej26YP5XD5OmcddpMji3sYU00JcBl9V25N cL8Cnk1lnzAg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,275,1589266800"; d="scan'208";a="263644036" Received: from mattu-haswell.fi.intel.com ([10.237.72.170]) by fmsmga007.fm.intel.com with ESMTP; 24 Jun 2020 06:56:49 -0700 From: Mathias Nyman To: Cc: , Al Cooper , stable@vger.kernel.org, Mathias Nyman Subject: [PATCH 2/5] xhci: Fix enumeration issue when setting max packet size for FS devices. Date: Wed, 24 Jun 2020 16:59:46 +0300 Message-Id: <20200624135949.22611-3-mathias.nyman@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200624135949.22611-1-mathias.nyman@linux.intel.com> References: <20200624135949.22611-1-mathias.nyman@linux.intel.com> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Al Cooper Unable to complete the enumeration of a USB TV Tuner device. Per XHCI spec (4.6.5), the EP state field of the input context shall be cleared for a set address command. In the special case of an FS device that has "MaxPacketSize0 = 8", the Linux XHCI driver does not do this before evaluating the context. With an XHCI controller that checks the EP state field for parameter context error this causes a problem in cases such as the device getting reset again after enumeration. When that field is cleared, the problem does not occur. This was found and fixed by Sasi Kumar. Cc: stable@vger.kernel.org Signed-off-by: Al Cooper Signed-off-by: Mathias Nyman --- drivers/usb/host/xhci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index bee5deccc83d..03b64b73eb99 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -1430,6 +1430,7 @@ static int xhci_check_maxpacket(struct xhci_hcd *xhci, unsigned int slot_id, xhci->devs[slot_id]->out_ctx, ep_index); ep_ctx = xhci_get_ep_ctx(xhci, command->in_ctx, ep_index); + ep_ctx->ep_info &= cpu_to_le32(~EP_STATE_MASK);/* must clear */ ep_ctx->ep_info2 &= cpu_to_le32(~MAX_PACKET_MASK); ep_ctx->ep_info2 |= cpu_to_le32(MAX_PACKET(max_packet_size));