From patchwork Mon Oct 7 12:16:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 175334 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp4196842ill; Mon, 7 Oct 2019 05:16:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqx5XYH3AIrC1uuw2qxqN5uS7yaR97Iy2VsCdXotI4ZVFQZ03MNGnNxqPboHXGpIXjvZvbYW X-Received: by 2002:a17:906:82d3:: with SMTP id a19mr22959389ejy.151.1570450597852; Mon, 07 Oct 2019 05:16:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570450597; cv=none; d=google.com; s=arc-20160816; b=bfLF5nU4RsUYudkaTT7J5r2LSxre8Plrz781aipJQwEf01NCJ5pUNrrvwkazprvr0M dVLoGyu6Vn2qVjRboB2irg8P/im/6p0OUjsKZV2xxJd2CHTdbtBT+oWZQ8xhP0DsBhI7 ZGMUncdii56TKs+OnMINvtk+gTXkgUCGBghySF1wUp6MZdLw4Oax2Lptv1gA2q/qvoIV qoYDE18T0gJKpIkizdJDnJU1lhl2j5YyDW7OB8OpJAvFBQGD46YIhqAViEU55n/91v/v npPibJw+Fk4xzSm967PUka6m6Af9e6+NYNaOAsFyB2O7SWXP0T92KGjvoNOhaYB4aFr9 64pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=luxPLzNAkImkqjzDPkTQhoXBhGNskTrAYJY6hFR5nmA=; b=WfQ+LyvVxQ6eUI+eAc2QT3Ec8y+zhtMBjjLOTq2d5belVCeb9DiBs6k0yD0WkBaJJa Yg8TKoPmp5XuALSojhPyvbLy/gGb2XK2lrM1DV1d53QIHG/u+X77vwcUPAjRa53FXXPH pHjNiFhxeCeEPoGoqnqfiAQMDZZD/rNUPBu2i56hhkLT1HCDkUCJSn5F/7gk8ABgRAR5 6lfGfeXwE8EDdSHplesu/ttKktqnFmaozGO6w5WWGoJxQv/p7NNtTqV9qAtYbbfQZ+d9 gT3fBQ2jcprZXQFLvKiWVsZ2mBwOGruVroBwiJPc2RLMba2EwT+X07eLvlFoDpA93gL1 odfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=f1SvghfH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o14si5615571ejc.433.2019.10.07.05.16.37; Mon, 07 Oct 2019 05:16:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=f1SvghfH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727935AbfJGMQg (ORCPT + 26 others); Mon, 7 Oct 2019 08:16:36 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:42698 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727561AbfJGMQg (ORCPT ); Mon, 7 Oct 2019 08:16:36 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x97CGBhW002292; Mon, 7 Oct 2019 07:16:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1570450571; bh=luxPLzNAkImkqjzDPkTQhoXBhGNskTrAYJY6hFR5nmA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=f1SvghfH1q1BAwutukAL/iITgkUw3QQ4S4tzdNoF96b7MsWWjn7wrv2RSg8FgKdN6 y4CVGVcMm0UGvjlQ6uvGFZAK96GPB3x/rwQd4CcwnO0/mmTtpGjQwY2xhHeJNnYSBI o4VU/wrYrxGxPk5i+16RE2GHx9BsGtZF7Az8LrzQ= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x97CGBGw070332 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 7 Oct 2019 07:16:11 -0500 Received: from DFLE107.ent.ti.com (10.64.6.28) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 7 Oct 2019 07:16:11 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE107.ent.ti.com (10.64.6.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Mon, 7 Oct 2019 07:16:09 -0500 Received: from lta0400828a.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id x97CG6fL070909; Mon, 7 Oct 2019 07:16:09 -0500 From: Roger Quadros To: , , CC: , , , , , Roger Quadros Subject: [PATCH 1/2] usb: cdns3: fix cdns3_core_init_role() Date: Mon, 7 Oct 2019 15:16:00 +0300 Message-ID: <20191007121601.25996-2-rogerq@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191007121601.25996-1-rogerq@ti.com> References: <20191007121601.25996-1-rogerq@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At startup we should trigger the HW state machine only if it is OTG mode. Otherwise we should just start the respective role. Initialize idle role by default. If we don't do this then cdns3_idle_role_stop() is not called when switching to host/device role and so lane switch mechanism doesn't work. This results to super-speed device not working in one orientation if it was plugged before driver probe. Signed-off-by: Roger Quadros Signed-off-by: Sekhar Nori --- drivers/usb/cdns3/core.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki Reviewed-by: Pawel Laszczak Tested-by: Pawel Laszczak diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c index 06f1e105be4e..1109dc5a4c39 100644 --- a/drivers/usb/cdns3/core.c +++ b/drivers/usb/cdns3/core.c @@ -160,10 +160,28 @@ static int cdns3_core_init_role(struct cdns3 *cdns) if (ret) goto err; - if (cdns->dr_mode != USB_DR_MODE_OTG) { + /* Initialize idle role to start with */ + ret = cdns3_role_start(cdns, USB_ROLE_NONE); + if (ret) + goto err; + + switch (cdns->dr_mode) { + case USB_DR_MODE_UNKNOWN: + case USB_DR_MODE_OTG: ret = cdns3_hw_role_switch(cdns); if (ret) goto err; + break; + case USB_DR_MODE_PERIPHERAL: + ret = cdns3_role_start(cdns, USB_ROLE_DEVICE); + if (ret) + goto err; + break; + case USB_DR_MODE_HOST: + ret = cdns3_role_start(cdns, USB_ROLE_HOST); + if (ret) + goto err; + break; } return ret;