From patchwork Wed Mar 21 12:27:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 10299375 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D32AB60349 for ; Wed, 21 Mar 2018 12:28:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C620D29852 for ; Wed, 21 Mar 2018 12:28:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BAB0D29858; Wed, 21 Mar 2018 12:28:30 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5142129852 for ; Wed, 21 Mar 2018 12:28:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aHwxKau9CK4VLZE97qWD30ixBGdAEfM89JTc02eVQhM=; b=q+T4TYvrg3m/Ts i8kT/Nf7Q9sX4dAd6kvnnsjwa38cghTTY2+O0w2VwQANcyTRw9JmXRslcIRAAIxElAjUsdjYMXpc6 NxsSXINH2WAru4Pjkm5JSmq69+GKMDMSKKERD2Jjxef/GFrV20uA09718e+SWs3mx8DFaRxGFrn3h IlVgPJnbrQiFWNuHDwxJ4Do6gcigUBUak5kpppO4LizM0pv7aXTnTG6N3phfU0MkNNfjauxD6RnQP HrUkiZ0Yl2hNEp9UV4aSAnpCQ2I2KLmxM9M8wJKtXBGLSXIy8H1NrCBQNY4x2TY+UjFBIQgoMnJzl 546GpWxmxzhj9cfKL6JA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1eycqx-00063A-4v; Wed, 21 Mar 2018 12:28:27 +0000 Received: from lelnx194.ext.ti.com ([198.47.27.80]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1eycqV-0005kx-C0; Wed, 21 Mar 2018 12:28:01 +0000 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id w2LCRiN3032363; Wed, 21 Mar 2018 07:27:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1521635264; bh=yLlA49xb9fbkvaESIHBT3OOtSbzYh7vgVMCNsib9Y/8=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=SUs09Lx21O9gHwLdkAZSvV+rN7iwUztVHtN9tjpoMhNaSN9B1Qmxj3R3TTs1wrsQA s5LEScUzpHU1X49VMBeDYuys6EuOEsWa9mJT/KflwVbnLW/OsYO8yjwh18cO+KTbih esBCFciiQhNicaT9Y+pEVFXSFa6uAPUS4Gd0iY9s= Received: from DFLE108.ent.ti.com (dfle108.ent.ti.com [10.64.6.29]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w2LCRiZS000870; Wed, 21 Mar 2018 07:27:44 -0500 Received: from DFLE111.ent.ti.com (10.64.6.32) by DFLE108.ent.ti.com (10.64.6.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Wed, 21 Mar 2018 07:27:44 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Wed, 21 Mar 2018 07:27:44 -0500 Received: from [192.168.2.6] (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w2LCRfnt000591; Wed, 21 Mar 2018 07:27:42 -0500 Subject: Re: [usb-next PATCH] usb: xhci: skip phys initialization of shared hcd To: Chunfeng Yun References: <1ece0d5508a00bca67d16e64310a071646b59c7d.1521612280.git.chunfeng.yun@mediatek.com> <1521633020.3717.128.camel@mhfsdcap03> From: Roger Quadros Message-ID: <99d5db89-0ba3-84df-5238-6edd6a3d99a1@ti.com> Date: Wed, 21 Mar 2018 14:27:41 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1521633020.3717.128.camel@mhfsdcap03> Content-Language: en-GB X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180321_052759_504528_9E04A846 X-CRM114-Status: GOOD ( 27.86 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mathias Nyman , Martin Blumenstingl , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On 21/03/18 13:50, Chunfeng Yun wrote: > Hi Roger, > > On Wed, 2018-03-21 at 11:05 +0200, Roger Quadros wrote: >> Hi Chunfeng, >> >> On 21/03/18 08:12, Chunfeng Yun wrote: >>> The phys has already been initialized when add primary hcd, >>> including usb2 phys and usb3 phys also if exist, so needn't >>> re-parse "phys" property again. >>> >>> Signed-off-by: Chunfeng Yun >>> --- >>> drivers/usb/host/xhci-mtk.c | 1 + >>> drivers/usb/host/xhci-plat.c | 1 + >>> 2 files changed, 2 insertions(+) >>> >>> diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c >>> index 7334da9..6bb23fb 100644 >>> --- a/drivers/usb/host/xhci-mtk.c >>> +++ b/drivers/usb/host/xhci-mtk.c >>> @@ -554,6 +554,7 @@ static int xhci_mtk_probe(struct platform_device *pdev) >>> if (HCC_MAX_PSA(xhci->hcc_params) >= 4) >>> xhci->shared_hcd->can_do_streams = 1; >>> >>> + xhci->shared_hcd->skip_phy_initialization = 1; >>> ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED); >>> if (ret) >>> goto dealloc_usb2_hcd; >>> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c >>> index 6700e5e..65a4294 100644 >>> --- a/drivers/usb/host/xhci-plat.c >>> +++ b/drivers/usb/host/xhci-plat.c >>> @@ -294,6 +294,7 @@ static int xhci_plat_probe(struct platform_device *pdev) >>> if (HCC_MAX_PSA(xhci->hcc_params) >= 4) >>> xhci->shared_hcd->can_do_streams = 1; >>> >>> + xhci->shared_hcd->skip_phy_initialization = 1; >> >> I think this is unnecessary. >> There aren't separate PHYs for the primary and shared HCDs right? > Yes, the primary and shared HCDs will get the same PHYs provided by > "phys" property. > >> >> Also how can you be sure that phy_init() has been done for all platform HCD users? > Here I assume that "phys" and "usb-phy" properties are not used at the > same time. There are two cases: > 1. Using "usb-phy": no "phys" to be got by shared HCD. > 2. Using "phys": the primary HCD will get those phys, so shared HCD can > skip them. Now I see the problem. But the right fix should be in core/hcd.c > >> >>> ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED); >>> if (ret) >>> goto dealloc_usb2_hcd; >>> >> > > diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 2884607..1d1da12 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -2757,7 +2757,7 @@ int usb_add_hcd(struct usb_hcd *hcd, } } - if (!hcd->skip_phy_initialization) { + if (!hcd->skip_phy_initialization && usb_hcd_is_primary_hcd(hcd)) { hcd->phy_roothub = usb_phy_roothub_init(hcd->self.sysdev); if (IS_ERR(hcd->phy_roothub)) { retval = PTR_ERR(hcd->phy_roothub);