From patchwork Thu Jun 20 21:09:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Cooper X-Patchwork-Id: 11008171 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4B7DF924 for ; Thu, 20 Jun 2019 21:10:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3DC60281C3 for ; Thu, 20 Jun 2019 21:10:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 326C52847B; Thu, 20 Jun 2019 21:10:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DAC86281C3 for ; Thu, 20 Jun 2019 21:10:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726431AbfFTVKL (ORCPT ); Thu, 20 Jun 2019 17:10:11 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:44900 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725958AbfFTVKL (ORCPT ); Thu, 20 Jun 2019 17:10:11 -0400 Received: by mail-pf1-f193.google.com with SMTP id t16so2342157pfe.11; Thu, 20 Jun 2019 14:10:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=n2SpWI1yibR3pZui+zsA5SWkFvXjKqrr9tlPiUDopnI=; b=QjHUnmYdROWMRYkxYVPmuYVPNDV1DbWvIZdcfWSL55ySQ0MctwPQ9kYZxtuXgqp1WN EiEtZTikp/OrBL78jp7ZsaUlGVGvvU2GhjHeSxPORWHhACye+nvo/3LszmRKEV9cA7Q5 egtZ2bn2jLsOfpLFDWD43lWgiS4k0/U3ZcdpvfDAfhGWrr8/Q8G1uS/Lxe3zz5Xyk77b 0rEmNWPpy1awuYwCEZ9j1MBHCK53Gcsqld1OOY6ErSXX5okAvXyKv/zAwFmK3J1iTJX0 9xovg3LrnJ7ssWLnc1wdc5IdyFN3adPCq7qNSLjRYp4bDD6aT2HOWUVZ5fMChUYmNXvM WVSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=n2SpWI1yibR3pZui+zsA5SWkFvXjKqrr9tlPiUDopnI=; b=RCEPSJnt5KolhyWgB/zVisQoopjWtcIu7WLs58uIKeFGEbFUoLN/BjrJlVRl5va/Wi jGbZd58bTIEs1cXYqfchdrOo32HMcfspVTx3YAwJw6zQe5V8Jc1HuQpZjLFXkmPLzGYw QrRtPFO3v3pxbeexW3q+UGdqA6nldlpAgen4cf/sJ9TEFYmdDRXK37kRfi4JyDihij+w OBn3vknX8HUg+Aqbis8FSN5F4b5w3BwB2hFLGR3h7Wc+hACPK+2RidCnrVGC1B2jVCa7 j8dN1tTH2N7HL9ey79fQ0xyWolTp8c7FNngDgxx2V0+3nWPAN+P7+ktuA/KUcgM2/zt1 927g== X-Gm-Message-State: APjAAAWO0zgXTCqAOvgQd+G6cweMGB+WBsd7ZWkd7lQtqnT+R2rEz9fq cbJlbFIp1G3KpRzyez8lWz0JGrBp9WY= X-Google-Smtp-Source: APXvYqyqTjMPZxbB9dUfZRknPAWnuMOyFhDiYUlVPyNhviWwjbGwPMxDXClY5RvgmUGxxVByRgYZCA== X-Received: by 2002:a17:90a:4803:: with SMTP id a3mr1775554pjh.58.1561065009830; Thu, 20 Jun 2019 14:10:09 -0700 (PDT) Received: from stbsrv-and-3.and.broadcom.com ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id p1sm386805pff.74.2019.06.20.14.10.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jun 2019 14:10:09 -0700 (PDT) From: Al Cooper To: linux-kernel@vger.kernel.org Cc: Al Cooper , devicetree@vger.kernel.org, Felipe Balbi , Greg Kroah-Hartman , linux-usb@vger.kernel.org, Luis Chamberlain , Mark Rutland , Rob Herring Subject: [PATCH 1/6] usb: bdc: driver runs out of buffer descriptors on large ADB transfers Date: Thu, 20 Jun 2019 17:09:46 -0400 Message-Id: <1561064991-16874-2-git-send-email-alcooperx@gmail.com> X-Mailer: git-send-email 1.9.0.138.g2de3478 In-Reply-To: <1561064991-16874-1-git-send-email-alcooperx@gmail.com> References: <1561064991-16874-1-git-send-email-alcooperx@gmail.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Version v1.0.40 of the Android host ADB software increased maximum transfer sizes from 256K to 1M. Since the STB ADB gadget driver requests only 16K at a time, the BDC driver ran out of buffer descriptors (BDs) if the queuing happens faster than the incoming 16K transfers. This issue is fixed by doubling the number of BDs that can be queued so that the entire 1M request can be queued without running out of buffers. Signed-off-by: Al Cooper --- drivers/usb/gadget/udc/bdc/bdc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/udc/bdc/bdc.h b/drivers/usb/gadget/udc/bdc/bdc.h index 6e1e881dc51e..ac75e25c3b6a 100644 --- a/drivers/usb/gadget/udc/bdc/bdc.h +++ b/drivers/usb/gadget/udc/bdc/bdc.h @@ -44,7 +44,7 @@ #define NUM_SR_ENTRIES 64 /* Num of bds per table */ -#define NUM_BDS_PER_TABLE 32 +#define NUM_BDS_PER_TABLE 64 /* Num of tables in bd list for control,bulk and Int ep */ #define NUM_TABLES 2 From patchwork Thu Jun 20 21:09:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Cooper X-Patchwork-Id: 11008169 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F218E14DB for ; Thu, 20 Jun 2019 21:10:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4C6628458 for ; Thu, 20 Jun 2019 21:10:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D92502847B; Thu, 20 Jun 2019 21:10:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 83A3F281C3 for ; Thu, 20 Jun 2019 21:10:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726134AbfFTVKl (ORCPT ); Thu, 20 Jun 2019 17:10:41 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:43954 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726716AbfFTVKM (ORCPT ); Thu, 20 Jun 2019 17:10:12 -0400 Received: by mail-pg1-f194.google.com with SMTP id f25so2202842pgv.10; Thu, 20 Jun 2019 14:10:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=G1Ij2gv2TDQKvgmKxxszCgpp7AI+3jM9fqq69fwOpA4=; b=S0b2a7aE0WAuieFytAiXyQlQYVr7CGECSzLS6wJFSzGtJ+1HgTIIaRECxzTfKTjNkb cErfqueoa45U43t+jz8QO0Zwp/ZwWHSElXz3DG5jBope2nWbrkpDBhA9V5YnPEj/MbyN B67GD9QJ35CfNL5Exh83tpWY1m75RLYEzuyFH3wTESQ1cFH2WuascjO24sU7gvKKUC5X 0sm+/gYt6xFT3mUBqYxXFtiqMEuW6YfUZaLiLbHkf5Awrc2EcrPeowK9YqkPooHME/mE oVNqgxxj3NpqdCZ89eLk5V608mQw2kea8NJ9K65x4x3D6Gebm6f9uhgvtou/id7uGQqH 2aYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=G1Ij2gv2TDQKvgmKxxszCgpp7AI+3jM9fqq69fwOpA4=; b=QeWulPQmbgmfywwsgPA9AYqLrmzKW9i8f08hEeS0pbKdFAglAnNODCLdueyH+eDcFu clU6pzPBgcmRRjDM/wTHclcJuMD1g8WSuOLxZ+docL/WGwl7zRBD7Z9NyequoTQ2ZoLY K8PlV3bcOWi1gMppjP6lm9K8XQgVC00v+eu9/4pg1sEAbj8koXahsdNPGAuubSET7o5T JFkfVyaNTotfV3SY+oeS3dIaQDyKYcfG8vSw+kN4vHOEgXYkKTdXjA3nb/2or7I85J3Q gAVo9JNoqwpwRaqcPJubjPTclIeRkLJpBdhYPrvQrMYhN/VYyPkj36frQcTzyOcE5kR1 msyw== X-Gm-Message-State: APjAAAXl1cM84Mxijtmx9OOud9U4WdqPig1cgedz9PEMzBV/Dp94dfWP yZQ8VirK9aRPaObprO8/r0glDgx06rc= X-Google-Smtp-Source: APXvYqzhfbSmcHI0Ef9C7wLbXuSiZnL4lXcN/K/RVjRqcfrVNFxMmQJbBdZzfxS1WWdDw4WarFSUVw== X-Received: by 2002:a17:90a:a505:: with SMTP id a5mr1715567pjq.27.1561065011551; Thu, 20 Jun 2019 14:10:11 -0700 (PDT) Received: from stbsrv-and-3.and.broadcom.com ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id p1sm386805pff.74.2019.06.20.14.10.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jun 2019 14:10:11 -0700 (PDT) From: Al Cooper To: linux-kernel@vger.kernel.org Cc: Al Cooper , devicetree@vger.kernel.org, Felipe Balbi , Greg Kroah-Hartman , linux-usb@vger.kernel.org, Luis Chamberlain , Mark Rutland , Rob Herring Subject: [PATCH 2/6] usb: bdc: Cleanup clock support Date: Thu, 20 Jun 2019 17:09:47 -0400 Message-Id: <1561064991-16874-3-git-send-email-alcooperx@gmail.com> X-Mailer: git-send-email 1.9.0.138.g2de3478 In-Reply-To: <1561064991-16874-1-git-send-email-alcooperx@gmail.com> References: <1561064991-16874-1-git-send-email-alcooperx@gmail.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP - Fix driver to defer on clk_get defer Signed-off-by: Al Cooper --- drivers/usb/gadget/udc/bdc/bdc_core.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/usb/gadget/udc/bdc/bdc_core.c b/drivers/usb/gadget/udc/bdc/bdc_core.c index ccbd1d34eb2a..11a43de6c1c6 100644 --- a/drivers/usb/gadget/udc/bdc/bdc_core.c +++ b/drivers/usb/gadget/udc/bdc/bdc_core.c @@ -490,8 +490,14 @@ static int bdc_probe(struct platform_device *pdev) dev_dbg(dev, "%s()\n", __func__); + bdc = devm_kzalloc(dev, sizeof(*bdc), GFP_KERNEL); + if (!bdc) + return -ENOMEM; + clk = devm_clk_get(dev, "sw_usbd"); if (IS_ERR(clk)) { + if (PTR_ERR(clk) == -EPROBE_DEFER) + return -EPROBE_DEFER; dev_info(dev, "Clock not found in Device Tree\n"); clk = NULL; } @@ -501,11 +507,6 @@ static int bdc_probe(struct platform_device *pdev) dev_err(dev, "could not enable clock\n"); return ret; } - - bdc = devm_kzalloc(dev, sizeof(*bdc), GFP_KERNEL); - if (!bdc) - return -ENOMEM; - bdc->clk = clk; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -551,7 +552,7 @@ static int bdc_probe(struct platform_device *pdev) ret = bdc_phy_init(bdc); if (ret) { dev_err(bdc->dev, "BDC phy init failure:%d\n", ret); - return ret; + goto clk_cleanup; } temp = bdc_readl(bdc->regs, BDC_BDCCAP1); @@ -583,6 +584,8 @@ static int bdc_probe(struct platform_device *pdev) bdc_hw_exit(bdc); phycleanup: bdc_phy_exit(bdc); +clk_cleanup: + clk_disable_unprepare(bdc->clk); return ret; } From patchwork Thu Jun 20 21:09:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Cooper X-Patchwork-Id: 11008165 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BBB66924 for ; Thu, 20 Jun 2019 21:10:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE389281C3 for ; Thu, 20 Jun 2019 21:10:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A22C12847B; Thu, 20 Jun 2019 21:10:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4FF37281C3 for ; Thu, 20 Jun 2019 21:10:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726758AbfFTVKP (ORCPT ); Thu, 20 Jun 2019 17:10:15 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:36921 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725958AbfFTVKO (ORCPT ); Thu, 20 Jun 2019 17:10:14 -0400 Received: by mail-pf1-f195.google.com with SMTP id 19so2360943pfa.4; Thu, 20 Jun 2019 14:10:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=d7vMFa0RiXSgIQ7GsvInRxIKmt+saHYI+AQuO3/IDBY=; b=gWbcCmVMhKhfH83nz0SjOdViQ6bh80WcOh4JOq9apD0RZ3GvLo6yMIGpz6gWuRBfhg xyhsiwWbOmiD3O1NFP+UCB+IfcbuNYmqLr2gHzzayjHX75hby0YC+7Yz2hFuV+u1dilz a8NV+0xx44k5S91z/FNjzBResy8ZymC96ybQBmF0qfCTxZHf2hO6zcBw+xO2P8vgE5+R lcN0jQLlyI7HWxYRogLqGz5N53kMU1P3M/XoSQTHIsj5KMgGo9rzrZp3bU75W6O/PAre NLosSZLaNftHUl8nDeEpKppSNajoZNEcH9z2Pv/lvoRTwlzAhQZHxiz3EUS3El8OGKx4 Mpaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=d7vMFa0RiXSgIQ7GsvInRxIKmt+saHYI+AQuO3/IDBY=; b=IOoij155dGht7F7hij+rHgnM4pTFjPQdDdNSgC4UUyCBgu0hKyip7isF9J4jciNmwx CeFfuVMFTBiBKRFK4OSdWRcrpJCFeDylLx/HorO+5968dwI3pVIGTQnnKQOvdEfYKNN6 hJON/QYnZUIOgFdqtMeklAqiDWUmKKWJ9uEOL4FwQalC+Zn6PRzpgjIkkAs6vvSWjCX/ miiuBYiEwjPyBpZAB9JCNHE9LxD5LaYCJ53/Xi5uvHHNRacswI60pk5zE02cvAbGTfDV bbCVF9YdL16NbRwIdYQra5fF671j5PxoSZzjZkgzYRYNrTKJ13IpfyXBVh2waN64Lz3s 7g6g== X-Gm-Message-State: APjAAAWeV0F3ebOujyGyKB+n2Omq+P1mWzd3uIZDYfBCpYRyCNbMWdT6 juTmK0IaZNA9FZENF8KD1DuSGPC4DfU= X-Google-Smtp-Source: APXvYqwPu7zJoLPZ+CyAH5QO33Bz/OAkt9kFMf1CNxrQboGzgxE1HFuV1K6F0dmYBSU8fVvnKOW7bg== X-Received: by 2002:a17:90a:cb8e:: with SMTP id a14mr1653269pju.124.1561065013299; Thu, 20 Jun 2019 14:10:13 -0700 (PDT) Received: from stbsrv-and-3.and.broadcom.com ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id p1sm386805pff.74.2019.06.20.14.10.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jun 2019 14:10:12 -0700 (PDT) From: Al Cooper To: linux-kernel@vger.kernel.org Cc: Al Cooper , devicetree@vger.kernel.org, Felipe Balbi , Greg Kroah-Hartman , linux-usb@vger.kernel.org, Luis Chamberlain , Mark Rutland , Rob Herring Subject: [PATCH 3/6] usb: bdc: driver may fail to get USB PHY Date: Thu, 20 Jun 2019 17:09:48 -0400 Message-Id: <1561064991-16874-4-git-send-email-alcooperx@gmail.com> X-Mailer: git-send-email 1.9.0.138.g2de3478 In-Reply-To: <1561064991-16874-1-git-send-email-alcooperx@gmail.com> References: <1561064991-16874-1-git-send-email-alcooperx@gmail.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Initialization order is important for the USB PHY and the PHY clients. The init order is based on the build order of the drivers in the makefiles and the PHY drivers are built early to help with dependencies, but the new SCMI based clock subsystem has the side effect of making some additional drivers DEFER until the clock is ready. This is causing the USB PHY driver to defer which is causing some PHY clients to fail when they try to get the PHY. The fix is to have the client driver return DEFER when it's "get phy" routine returns DEFER. Signed-off-by: Al Cooper --- drivers/usb/gadget/udc/bdc/bdc_core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/udc/bdc/bdc_core.c b/drivers/usb/gadget/udc/bdc/bdc_core.c index 11a43de6c1c6..c794890d785b 100644 --- a/drivers/usb/gadget/udc/bdc/bdc_core.c +++ b/drivers/usb/gadget/udc/bdc/bdc_core.c @@ -543,9 +543,13 @@ static int bdc_probe(struct platform_device *pdev) dev, dev->of_node, phy_num); if (IS_ERR(bdc->phys[phy_num])) { ret = PTR_ERR(bdc->phys[phy_num]); + if (ret == -EPROBE_DEFER) { + dev_dbg(bdc->dev, "DEFER, waiting for PHY\n"); + return ret; + } dev_err(bdc->dev, "BDC phy specified but not found:%d\n", ret); - return ret; + goto clk_cleanup; } } From patchwork Thu Jun 20 21:09:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Cooper X-Patchwork-Id: 11008167 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CE81F1932 for ; Thu, 20 Jun 2019 21:10:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C0A99281C3 for ; Thu, 20 Jun 2019 21:10:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B48752847B; Thu, 20 Jun 2019 21:10:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9FAE6281C3 for ; Thu, 20 Jun 2019 21:10:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726943AbfFTVKd (ORCPT ); Thu, 20 Jun 2019 17:10:33 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:37689 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726734AbfFTVKQ (ORCPT ); Thu, 20 Jun 2019 17:10:16 -0400 Received: by mail-pl1-f194.google.com with SMTP id bh12so1887045plb.4; Thu, 20 Jun 2019 14:10:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yUxHr0hNOMB2xE/tt9UalgG6ujmd92ZRH1krBwmSmgY=; b=E4lqWYrRkM6KJNjQ2DdXr2dcOiHpEGX2YRmNRNuIGzZisK03dVPjlXa+lAsoEPO5Hh Gqvhzx4fd8Y51hbboeQtdjvM2X0V6OQUtzOkYN7m29YNGNF8A64XTvGme42xbGtwE/3/ 16okdMQxaLDPooy0IqkFhpvK1aehYqCG82uUQB1ehc56NBXLDF9U28CDTFhoEZo0B4XW LlMUSMn3cQ93elqet52/RzUkirP2EUvoJvYFxRVLpQ6eZNY3LFm0qON76XiihtegDSw7 y81apneBMySgv734LUTJlCnNOwzbOuyVT7od+80xEcdU+dpNY7x+DF50O+ckJG/7Jzpt FgAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yUxHr0hNOMB2xE/tt9UalgG6ujmd92ZRH1krBwmSmgY=; b=BM3k/y3JLZ7CHs2FjT1EEjIWFDNluzSyXZN7uPlSNUZcB7krEloLCo6yPYFT+tdJmh 36iQzavFJTWrQi+VXY7H5JmrUt+daMI26AGb8Ixg2Cfooy8BE8EuPUtG4P8GJZTWOLYa trpr6bicEm47rpp+VWYsBK40BiK+O0Xs33IUGMS5+6K0GB7OYMZCAiSr1JqOQclWZJWB P2kfkuYuHHATSz/gxmw4P4PU7w8pAXOpGuJeIfKBJPq4qMHw4lfUVnJIJ2IMYDXpT2ZP Xnsxi6jiPDQeDVbUr6hE4FGlFK3VAt+/6Y19Yge5hNTILpKI2nAppYAEwWOMUu0EgFjw WFVA== X-Gm-Message-State: APjAAAX+vvptjLfTkZ3XzlGVztCkvsLUf8ysoVCUcSZJ8ryX0blBMkNX +tI2lMZ0Z7P8ympSp8QfQiiZRBfI6As= X-Google-Smtp-Source: APXvYqweQXsePQOeD1QPqsLfAMJ2XNXS6TyEIzqv76S2fzeWoPA1Sn43mDciVODO5YNLQLkKVML5NQ== X-Received: by 2002:a17:902:28e9:: with SMTP id f96mr78619023plb.114.1561065015001; Thu, 20 Jun 2019 14:10:15 -0700 (PDT) Received: from stbsrv-and-3.and.broadcom.com ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id p1sm386805pff.74.2019.06.20.14.10.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jun 2019 14:10:14 -0700 (PDT) From: Al Cooper To: linux-kernel@vger.kernel.org Cc: Al Cooper , devicetree@vger.kernel.org, Felipe Balbi , Greg Kroah-Hartman , linux-usb@vger.kernel.org, Luis Chamberlain , Mark Rutland , Rob Herring Subject: [PATCH 4/6] usb: bdc: Fix bug causing crash after multiple disconnects Date: Thu, 20 Jun 2019 17:09:49 -0400 Message-Id: <1561064991-16874-5-git-send-email-alcooperx@gmail.com> X-Mailer: git-send-email 1.9.0.138.g2de3478 In-Reply-To: <1561064991-16874-1-git-send-email-alcooperx@gmail.com> References: <1561064991-16874-1-git-send-email-alcooperx@gmail.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Multiple connects/disconnects can cause a crash on the second disconnect. The driver had a problem where it would try to send endpoint commands after it was disconnected which is not allowed by the hardware. The fix is to only allow the endpoint commands when the endpoint is connected. This will also fix issues that showed up when using configfs to create gadgets. Signed-off-by: Al Cooper --- drivers/usb/gadget/udc/bdc/bdc_core.c | 4 ++++ drivers/usb/gadget/udc/bdc/bdc_ep.c | 16 ++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/usb/gadget/udc/bdc/bdc_core.c b/drivers/usb/gadget/udc/bdc/bdc_core.c index c794890d785b..15e28790142d 100644 --- a/drivers/usb/gadget/udc/bdc/bdc_core.c +++ b/drivers/usb/gadget/udc/bdc/bdc_core.c @@ -282,6 +282,7 @@ static void bdc_mem_init(struct bdc *bdc, bool reinit) * in that case reinit is passed as 1 */ if (reinit) { + int i; /* Enable interrupts */ temp = bdc_readl(bdc->regs, BDC_BDCSC); temp |= BDC_GIE; @@ -291,6 +292,9 @@ static void bdc_mem_init(struct bdc *bdc, bool reinit) /* Initialize SRR to 0 */ memset(bdc->srr.sr_bds, 0, NUM_SR_ENTRIES * sizeof(struct bdc_bd)); + /* clear ep flags to avoid post disconnect stops/deconfigs */ + for (i = 1; i < bdc->num_eps; ++i) + bdc->bdc_ep_array[i]->flags = 0; } else { /* One time initiaization only */ /* Enable status report function pointers */ diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.c b/drivers/usb/gadget/udc/bdc/bdc_ep.c index a4d9b5e1e50e..3f34d10939d0 100644 --- a/drivers/usb/gadget/udc/bdc/bdc_ep.c +++ b/drivers/usb/gadget/udc/bdc/bdc_ep.c @@ -615,7 +615,6 @@ int bdc_ep_enable(struct bdc_ep *ep) } bdc_dbg_bd_list(bdc, ep); /* only for ep0: config ep is called for ep0 from connect event */ - ep->flags |= BDC_EP_ENABLED; if (ep->ep_num == 1) return ret; @@ -759,10 +758,13 @@ static int ep_dequeue(struct bdc_ep *ep, struct bdc_req *req) __func__, ep->name, start_bdi, end_bdi); dev_dbg(bdc->dev, "ep_dequeue ep=%p ep->desc=%p\n", ep, (void *)ep->usb_ep.desc); - /* Stop the ep to see where the HW is ? */ - ret = bdc_stop_ep(bdc, ep->ep_num); - /* if there is an issue with stopping ep, then no need to go further */ - if (ret) + /* if still connected, stop the ep to see where the HW is ? */ + if (!(bdc_readl(bdc->regs, BDC_USPC) & BDC_PST_MASK)) { + ret = bdc_stop_ep(bdc, ep->ep_num); + /* if there is an issue, then no need to go further */ + if (ret) + return 0; + } else return 0; /* @@ -1911,7 +1913,9 @@ static int bdc_gadget_ep_disable(struct usb_ep *_ep) __func__, ep->name, ep->flags); if (!(ep->flags & BDC_EP_ENABLED)) { - dev_warn(bdc->dev, "%s is already disabled\n", ep->name); + if (bdc->gadget.speed != USB_SPEED_UNKNOWN) + dev_warn(bdc->dev, "%s is already disabled\n", + ep->name); return 0; } spin_lock_irqsave(&bdc->lock, flags); From patchwork Thu Jun 20 21:09:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Cooper X-Patchwork-Id: 11008161 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 369D214DB for ; Thu, 20 Jun 2019 21:10:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25146281C3 for ; Thu, 20 Jun 2019 21:10:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 15ED128458; Thu, 20 Jun 2019 21:10:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01F06288E6 for ; Thu, 20 Jun 2019 21:10:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726817AbfFTVKT (ORCPT ); Thu, 20 Jun 2019 17:10:19 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:41616 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725958AbfFTVKR (ORCPT ); Thu, 20 Jun 2019 17:10:17 -0400 Received: by mail-pl1-f195.google.com with SMTP id m7so1876307pls.8; Thu, 20 Jun 2019 14:10:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cDab2WaDc8pmyozwLyE8nCfYmBAFCdTC9FtT+TR/XI0=; b=uY7cEYYQj2MK+bqyQ9CpRQfc3g1dfCFniZZIXkdY8drNCUNjJBLLaHdZH5+p06aemy GcGPYFm+q6oXQg+Jk8Ala/K1G1hgnI/L09BDHXHqDAkba54zHOpJbaSyOCQ2sJ5l05eV ALWeeMvw72G9T8lbNHqkzhfWXR9/ZBQy9k2FxcErC0mA2YYQHGxp7/d53WjF+pivlOxI cl6enhqqSNB+LYMH8jSauOfmidOQtrqYIJvkL2iSEbHFH3w3HCip2upVzj0jXjK7A1cK v1BO7cd/kPDvEeTCxLY/QuvFgikQTM3Vhf9T+ateZNZyvGVYPp6VhyrfIowMOGjNJy+H L6MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cDab2WaDc8pmyozwLyE8nCfYmBAFCdTC9FtT+TR/XI0=; b=mFt3vCx/TijTuTXuUdRGZmf74cqAHpzWRW8CEN/qGNepBQVqQ5HuYNKTfnxovsR5kp 4B8iXqSYWH+9uHkuPvaWoinOiSO4c9DyKLn7YsCvhacNimxumcVRoKUjj51+g6OELPE3 sjaeyNNFIRDJidvdRLVrt7n7oxAegpIG/8HVT2YPoqcW1C3oiKuAaMJTZdwidGum+MlB rEqmUInsFN+mOsFphDxMGXNsP6s4yP5Ywv7PpzwRW7Pjt0uD06ULz0ayuXLXdqF+Dzic 6bMjAflC9+zbVmgUnWvbtnQSMpDpNGxpTTwJ5+btjI7VdErVVr4ZsA58w2t2B3ESMnMG AFMg== X-Gm-Message-State: APjAAAWJknMq5MDPU6QDU6mfXRq9wsaEZEq94A7O7kDDYWh9JqhuVP/t Wphr1CDuzn1d1FmEJNnfi9x1BPTBOYQ= X-Google-Smtp-Source: APXvYqwZjKo2rGUjYzKp0BcPEdJYd30LpDC7JkTj8NUjDCwb1T5DEN95UNT37w4J5RCNhwMlN2GQvA== X-Received: by 2002:a17:902:4623:: with SMTP id o32mr9490608pld.112.1561065016794; Thu, 20 Jun 2019 14:10:16 -0700 (PDT) Received: from stbsrv-and-3.and.broadcom.com ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id p1sm386805pff.74.2019.06.20.14.10.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jun 2019 14:10:16 -0700 (PDT) From: Al Cooper To: linux-kernel@vger.kernel.org Cc: Al Cooper , devicetree@vger.kernel.org, Felipe Balbi , Greg Kroah-Hartman , linux-usb@vger.kernel.org, Luis Chamberlain , Mark Rutland , Rob Herring Subject: [PATCH 5/6] dt-bindings: usb: bdc: Update compatible strings Date: Thu, 20 Jun 2019 17:09:50 -0400 Message-Id: <1561064991-16874-6-git-send-email-alcooperx@gmail.com> X-Mailer: git-send-email 1.9.0.138.g2de3478 In-Reply-To: <1561064991-16874-1-git-send-email-alcooperx@gmail.com> References: <1561064991-16874-1-git-send-email-alcooperx@gmail.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Remove "brcm,bdc-v0.16" because it was never used on any system. Add "brcm,bdc-udc-v3.1" which exists for any STB system with BDC. Signed-off-by: Al Cooper Reviewed-by: Rob Herring --- Documentation/devicetree/bindings/usb/brcm,bdc.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/brcm,bdc.txt b/Documentation/devicetree/bindings/usb/brcm,bdc.txt index 63e63af3bf59..597f3902d857 100644 --- a/Documentation/devicetree/bindings/usb/brcm,bdc.txt +++ b/Documentation/devicetree/bindings/usb/brcm,bdc.txt @@ -4,7 +4,7 @@ Broadcom USB Device Controller (BDC) Required properties: - compatible: must be one of: - "brcm,bdc-v0.16" + "brcm,bdc-udc-v3.1" "brcm,bdc" - reg: the base register address and length - interrupts: the interrupt line for this controller @@ -21,7 +21,7 @@ On Broadcom STB platforms, these properties are required: Example: bdc@f0b02000 { - compatible = "brcm,bdc-v0.16"; + compatible = "brcm,bdc-udc-v3.1"; reg = <0xf0b02000 0xfc4>; interrupts = <0x0 0x60 0x0>; phys = <&usbphy_0 0x0>; From patchwork Thu Jun 20 21:09:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Cooper X-Patchwork-Id: 11008163 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CAE78924 for ; Thu, 20 Jun 2019 21:10:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB0CE281C3 for ; Thu, 20 Jun 2019 21:10:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ADCC32847B; Thu, 20 Jun 2019 21:10:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61324281C3 for ; Thu, 20 Jun 2019 21:10:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726875AbfFTVKX (ORCPT ); Thu, 20 Jun 2019 17:10:23 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:40188 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726807AbfFTVKT (ORCPT ); Thu, 20 Jun 2019 17:10:19 -0400 Received: by mail-pl1-f195.google.com with SMTP id a93so1889373pla.7; Thu, 20 Jun 2019 14:10:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nBLqKjSVrBp381m0eswowtTt2XvGMCRYc4oh6uPOArU=; b=odDqhRBWBoc3kunhmHJB492EcjJwrhFnyXSUVW3/CoWDvFNgUyRMRIvvo6XsI+hRpC F8PK8A4AnBpq6wLd0H7Pjr9ZGlp6xHPWKnQFGO00cnPVFoJ/lyFb9pdg4jra3fGKxQEU 2X3q20gRCZDdgRqN07nqK1bFVIAlAbplibG1x+sLxagcy10U6sMBk4oNYWqHoncvtpPg oERoRdPPpL2cBcuymbSzsj1Fty4chUNuNV230KR63W3ofdO/Ydca1wDvHnklAChhmpXf iqogw3hGzMxaVxmddB9nF6KsM+TmyR35hKtNUGKFttAKPS9ESWc5O3JpHXLRf+TeEwRF r3dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=nBLqKjSVrBp381m0eswowtTt2XvGMCRYc4oh6uPOArU=; b=pHz08Le6tZRfLPIGDLxMfm8EQngjEYmkFZoBHlLKz6uowVMlBbEE6D8swpjFd+7jtO gzDvvpM7UgnGeKO9iE87rN+i7eFmpdjn55NOG+67LOs356wWtloJ9a/pfga89yP044ae DfXF1Kl/379ognT72/BcrKgCX0+cAR+V/NCjeXbkfr460W1cHjT1+jcd2d7a+QRI9B+7 rNFbgCiNx3LPyontYnwJP3LiOtAQm89LVd2gIZetH5AcvMI4LiLgDMqleus33ymU49cl FQMSnSY2zkW9zywC5vNGSNQD9100cXCY7BK3qHij0cR7GQ/yMPAvOnhVfYQkE/WM53Pi 8Z+w== X-Gm-Message-State: APjAAAU7grOSWOUf6m3DaQIqH0zzwBgGKVAfsj7yf3wFABXAt9CKoogM x1JRQKhCA/CLVMc6CM2lOpWQ4fV8xOA= X-Google-Smtp-Source: APXvYqwQeDcUXcq5wDH39La0AxAdtmC0QX43bHAhnAlNJBq86E2hHf1IRQ7lkIFgYUWZ30soK4xk5A== X-Received: by 2002:a17:902:2862:: with SMTP id e89mr127805856plb.258.1561065018506; Thu, 20 Jun 2019 14:10:18 -0700 (PDT) Received: from stbsrv-and-3.and.broadcom.com ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id p1sm386805pff.74.2019.06.20.14.10.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jun 2019 14:10:18 -0700 (PDT) From: Al Cooper To: linux-kernel@vger.kernel.org Cc: Al Cooper , devicetree@vger.kernel.org, Felipe Balbi , Greg Kroah-Hartman , linux-usb@vger.kernel.org, Luis Chamberlain , Mark Rutland , Rob Herring Subject: [PATCH 6/6] usb: bdc: Update compatible match strings Date: Thu, 20 Jun 2019 17:09:51 -0400 Message-Id: <1561064991-16874-7-git-send-email-alcooperx@gmail.com> X-Mailer: git-send-email 1.9.0.138.g2de3478 In-Reply-To: <1561064991-16874-1-git-send-email-alcooperx@gmail.com> References: <1561064991-16874-1-git-send-email-alcooperx@gmail.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Remove "brcm,bdc-v0.16" because it was never used on any system. Add "brcm,bdc-udc-v3.1" which exists for any STB system with BDC. Signed-off-by: Al Cooper --- drivers/usb/gadget/udc/bdc/bdc_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/gadget/udc/bdc/bdc_core.c b/drivers/usb/gadget/udc/bdc/bdc_core.c index 15e28790142d..e2b2628925e6 100644 --- a/drivers/usb/gadget/udc/bdc/bdc_core.c +++ b/drivers/usb/gadget/udc/bdc/bdc_core.c @@ -644,6 +644,7 @@ static SIMPLE_DEV_PM_OPS(bdc_pm_ops, bdc_suspend, bdc_resume); static const struct of_device_id bdc_of_match[] = { + { .compatible = "brcm,bdc-udc-v3.1" }, { .compatible = "brcm,bdc-v0.16" }, { .compatible = "brcm,bdc" }, { /* sentinel */ }