Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3458377imm; Mon, 6 Aug 2018 05:16:51 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfXdfTx6o7C0v3STwul1FK3JnzFCLo4yhwyPfDZ+Y085pYk7zJNVw0oAS0+LlDjt7BWJVuU X-Received: by 2002:a62:bd4:: with SMTP id 81-v6mr16929925pfl.67.1533557811485; Mon, 06 Aug 2018 05:16:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533557811; cv=none; d=google.com; s=arc-20160816; b=Jqhsx0acCw4JkRVcVer9qpxy26PrjKDlzMelAYv/TwHnh1/7Px9hMy7MGGhXKOCdqc g72+lbMEoisaNlwKNEm3/zY+BckxCt36DBIhYOw05jDkm+pjePcA423CHApzczIs5loQ DNIqMOnnlLx9FJqgoPIKaE+fO8t4Cl+jWGU5J95FUw56eKxP7ho8tGe1CDg0jZb/ioK8 X7VxtMmDGU+fxcsLFl91LF9/FTCqqpchkVZCPCIw1+XtV+G0DovIbZx0fmruQyKnx+ZE eDAWShSfBCcAqIf5C8LH/Jt92HwpEPm8+X3ZftZ8yioLPu9w805X0ZERKjvGw+ldxj0G vJ9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=Er8qDZaTkXhx/XjOWF445FhtnqEgrU9YageOJPRrpEc=; b=oNulN9rdDLKuKgfPa7vVD3/XFb7lLOM5uUfGNdD6vX78YuNUqQkhhMqqsPjWDlccaI SUYbmE+9R/TWau40+n04+cGfsBRagFmBJth2ZrQDSvcbyM5gC7TzOFoXYLxIwGI3ajMA 60RS3DBR055neFCFxOE2smr5DbXC+BwgLkPFx2DChBGX/QdbwDcOhDb1U9z5Hl+c0lko vt5PjyU2tmG+r6302c1h6Il5PMuUtZEyjE62b/NQ2pV71aEuU0o3YiX9T81dIhV414Hu MJcmGltCjSqkujNJm6ISGR4m2JpGW0/xJ1vwxqDMGGpDunORc8ws9QhO1ua0r9HSJrXQ OTjQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m3-v6si9903346pld.90.2018.08.06.05.16.35; Mon, 06 Aug 2018 05:16:51 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732063AbeHFOYi (ORCPT + 99 others); Mon, 6 Aug 2018 10:24:38 -0400 Received: from mga04.intel.com ([192.55.52.120]:12816 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730919AbeHFOYi (ORCPT ); Mon, 6 Aug 2018 10:24:38 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Aug 2018 05:15:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,452,1526367600"; d="scan'208";a="78879358" Received: from mattu-haswell.fi.intel.com (HELO [10.237.72.164]) ([10.237.72.164]) by fmsmga001.fm.intel.com with ESMTP; 06 Aug 2018 05:15:45 -0700 Subject: Re: [PATCH v2] usb: host: xhci-plat: Iterate over parent nodes for finding quirks To: Anurag Kumar Vulisha , mathias.nyman@intel.com, gregkh@linuxfoundation.org Cc: v.anuragkumar@gmail.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org References: <1533555373-24400-1-git-send-email-anurag.kumar.vulisha@xilinx.com> From: Mathias Nyman Message-ID: Date: Mon, 6 Aug 2018 15:18:45 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <1533555373-24400-1-git-send-email-anurag.kumar.vulisha@xilinx.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi On 06.08.2018 14:36, Anurag Kumar Vulisha wrote: > In xhci_plat_probe() both sysdev and pdev->dev are being used > for finding quirks. There are some drivers(like dwc3 host.c) > which adds quirks(like usb3-lpm-capable) into pdev and the logic > present in xhci_plat_probe() checks for quirks in either sysdev > or pdev for finding the quirks. Because of this logic, some of > the quirks are getting missed(usb3-lpm-capable quirk added by dwc3 > host.c driver is getting missed).This patch fixes this by iterating > over all the available parents for finding the quirks. In this way > all the quirks which are present in child or parent are correctly > updated. > > Signed-off-by: Anurag Kumar Vulisha > --- > Changes in v2: > 1. As suggested by Mathias, restoring immod_interval changes to > default > --- > drivers/usb/host/xhci-plat.c | 24 ++++++++++++++---------- > 1 file changed, 14 insertions(+), 10 deletions(-) > > diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c > index c1b22fc..f121238 100644 > --- a/drivers/usb/host/xhci-plat.c > +++ b/drivers/usb/host/xhci-plat.c > @@ -152,7 +152,7 @@ static int xhci_plat_probe(struct platform_device *pdev) > { > const struct xhci_plat_priv *priv_match; > const struct hc_driver *driver; > - struct device *sysdev; > + struct device *sysdev, *tmpdev; > struct xhci_hcd *xhci; > struct resource *res; > struct usb_hcd *hcd; > @@ -272,20 +272,24 @@ static int xhci_plat_probe(struct platform_device *pdev) > goto disable_clk; > } > > - if (device_property_read_bool(sysdev, "usb2-lpm-disable")) > - xhci->quirks |= XHCI_HW_LPM_DISABLE; > - > - if (device_property_read_bool(sysdev, "usb3-lpm-capable")) > - xhci->quirks |= XHCI_LPM_SUPPORT; > - > - if (device_property_read_bool(&pdev->dev, "quirk-broken-port-ped")) > - xhci->quirks |= XHCI_BROKEN_PORT_PED; > - > /* imod_interval is the interrupt moderation value in nanoseconds. */ > xhci->imod_interval = 40000; xhci->imod_interval = 40000 is now in the correct place > device_property_read_u32(sysdev, "imod-interval-ns", > &xhci->imod_interval); but the device_propery_read_u32() line above can be moved inside loop below. > > + /* Iterate over all parent nodes for finding quirks */ > + for (tmpdev = &pdev->dev; tmpdev; tmpdev = tmpdev->parent) { > + > + if (device_property_read_bool(tmpdev, "usb2-lpm-disable")) > + xhci->quirks |= XHCI_HW_LPM_DISABLE; > + > + if (device_property_read_bool(tmpdev, "usb3-lpm-capable")) > + xhci->quirks |= XHCI_LPM_SUPPORT; > + > + if (device_property_read_bool(tmpdev, "quirk-broken-port-ped")) > + xhci->quirks |= XHCI_BROKEN_PORT_PED; > + } > + > hcd->usb_phy = devm_usb_get_phy_by_phandle(sysdev, "usb-phy", 0); > if (IS_ERR(hcd->usb_phy)) { > ret = PTR_ERR(hcd->usb_phy); > -Mathias