Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp178658yba; Fri, 19 Apr 2019 23:42:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqws1QYv8032djkxmqgEtw2d4P4oZ9t4WEyd7ewmETIIFh1ZJene4DwwsMwG+Jqr2j/UubcD X-Received: by 2002:a17:902:1105:: with SMTP id d5mr8187204pla.311.1555742545194; Fri, 19 Apr 2019 23:42:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555742545; cv=none; d=google.com; s=arc-20160816; b=ZmY0K664dZZk5vWHBIVTfvl9uCDRj8zN0RtzV2OZWPUlxKgMehd4HnWNpg1qrzxT/6 nCbSi/rhMXLcvoGrziExeHejmRI+6iLaxWRk5DDETLxdaIOsEpQQEfvVPEWcG6ONrTg8 JHA1BhoOGmPkNiTSjaB2u595THp9Fa1TmPrtpq9RVFOm5YcXnueMZ8ZjIQQPaIYZ8ywA fs3cXAjUbjzSSmP9BmbsISGBapEZNDSrdlHxTHJ3Xp3Pm+UK+3tIylQlmnRm1Fnvdw80 t/pisg92JD9r2mtgZ3/Tt4CL5ZpX+D/21eUI5iNh0CDk5vcs9BmGywV1kLYKToy4HMum baPw== 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; bh=CqHd6XSZ8SqsYxK0rUUAHEJAx3+sVOVowVblgJGD2sY=; b=recaDNIjBK5H4oK8PqmX5DKvEwTu9I9BH3lQtXD/JPgyvbxfvpc8jNOBnle7Q5Xs8w +0BT1iJHC5et7foR3fauDo121Szjk6jtRRL+wwYZT0/qgo9ybYe0edsf0UiJ3Xag7NJh 5JbLHrHs+jOjtHYK1attjaJlTwul+NBe0wXfjcoPHJqqQLanR0GY7TooOIqQmOgBuuOc bIQ204a4MzhBFj1y3woY0GEsQx8APmFwOG41Sqw6AbePnxY9KPOASK3UBKQpgwCwgqVY 1QLDwWWYRSK8RbKlrfoXG0PQgoT/CDeXVJhNAnYC/mo5QlIdPHE92aIFuEkgjgOac3hm g75g== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b74si7361536pfj.121.2019.04.19.23.42.07; Fri, 19 Apr 2019 23:42:25 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728169AbfDTGkx (ORCPT + 99 others); Sat, 20 Apr 2019 02:40:53 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:39472 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728099AbfDTGks (ORCPT ); Sat, 20 Apr 2019 02:40:48 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 767D4C91910EBE785ECB; Sat, 20 Apr 2019 14:40:34 +0800 (CST) Received: from vm100-107-113-134.huawei.com (100.107.113.134) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.408.0; Sat, 20 Apr 2019 14:40:26 +0800 From: Yu Chen To: , , CC: , , , , , , , , , , , , , , Yu Chen , Andy Shevchenko , Felipe Balbi , "Greg Kroah-Hartman" , Binghui Wang Subject: [PATCH v6 04/13] usb: dwc3: Add splitdisable quirk for Hisilicon Kirin Soc Date: Sat, 20 Apr 2019 14:40:10 +0800 Message-ID: <20190420064019.57522-5-chenyu56@huawei.com> X-Mailer: git-send-email 2.15.0-rc2 In-Reply-To: <20190420064019.57522-1-chenyu56@huawei.com> References: <20190420064019.57522-1-chenyu56@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [100.107.113.134] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org SPLIT_BOUNDARY_DISABLE should be set for DesignWare USB3 DRD Core of Hisilicon Kirin Soc when dwc3 core act as host. Cc: Andy Shevchenko Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: John Stultz Cc: Binghui Wang Signed-off-by: Yu Chen --- v4: * Add dwc3_complete definition while CONFIG_PM_SLEEP does not defined. * Add description for 'dis_split_quirk'. --- --- drivers/usb/dwc3/core.c | 26 ++++++++++++++++++++++++++ drivers/usb/dwc3/core.h | 7 +++++++ 2 files changed, 33 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index a1b126f90261..c3ef6bd2b0d4 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -117,6 +117,7 @@ static void __dwc3_set_mode(struct work_struct *work) struct dwc3 *dwc = work_to_dwc(work); unsigned long flags; int ret; + u32 reg; if (dwc->dr_mode != USB_DR_MODE_OTG) return; @@ -169,6 +170,11 @@ static void __dwc3_set_mode(struct work_struct *work) phy_set_mode(dwc->usb2_generic_phy, PHY_MODE_USB_HOST); phy_set_mode(dwc->usb3_generic_phy, PHY_MODE_USB_HOST); phy_calibrate(dwc->usb2_generic_phy); + if (dwc->dis_split_quirk) { + reg = dwc3_readl(dwc->regs, DWC3_GUCTL3); + reg |= DWC3_GUCTL3_SPLITDISABLE; + dwc3_writel(dwc->regs, DWC3_GUCTL3, reg); + } } break; case DWC3_GCTL_PRTCAP_DEVICE: @@ -1306,6 +1312,9 @@ static void dwc3_get_properties(struct dwc3 *dwc) dwc->dis_metastability_quirk = device_property_read_bool(dev, "snps,dis_metastability_quirk"); + dwc->dis_split_quirk = device_property_read_bool(dev, + "snps,dis-split-quirk"); + dwc->lpm_nyet_threshold = lpm_nyet_threshold; dwc->tx_de_emphasis = tx_de_emphasis; @@ -1825,10 +1834,27 @@ static int dwc3_resume(struct device *dev) return 0; } + +static void dwc3_complete(struct device *dev) +{ + struct dwc3 *dwc = dev_get_drvdata(dev); + u32 reg; + + if (dwc->current_dr_role == DWC3_GCTL_PRTCAP_HOST && + dwc->dis_split_quirk) { + dev_dbg(dwc->dev, "set DWC3_GUCTL3_SPLITDISABLE\n"); + reg = dwc3_readl(dwc->regs, DWC3_GUCTL3); + reg |= DWC3_GUCTL3_SPLITDISABLE; + dwc3_writel(dwc->regs, DWC3_GUCTL3, reg); + } +} +#else +#define dwc3_complete NULL #endif /* CONFIG_PM_SLEEP */ static const struct dev_pm_ops dwc3_dev_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(dwc3_suspend, dwc3_resume) + .complete = dwc3_complete, SET_RUNTIME_PM_OPS(dwc3_runtime_suspend, dwc3_runtime_resume, dwc3_runtime_idle) }; diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 1528d395b156..28475e301ad9 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -136,6 +136,7 @@ #define DWC3_GEVNTCOUNT(n) (0xc40c + ((n) * 0x10)) #define DWC3_GHWPARAMS8 0xc600 +#define DWC3_GUCTL3 0xc60c #define DWC3_GFLADJ 0xc630 /* Device Registers */ @@ -370,6 +371,9 @@ /* Global User Control Register 2 */ #define DWC3_GUCTL2_RST_ACTBITLATER BIT(14) +/* Global User Control Register 3 */ +#define DWC3_GUCTL3_SPLITDISABLE BIT(14) + /* Device Configuration Register */ #define DWC3_DCFG_DEVADDR(addr) ((addr) << 3) #define DWC3_DCFG_DEVADDR_MASK DWC3_DCFG_DEVADDR(0x7f) @@ -1030,6 +1034,7 @@ struct dwc3_scratchpad_array { * 2 - No de-emphasis * 3 - Reserved * @dis_metastability_quirk: set to disable metastability quirk. + * @dis_split_quirk: set to disable split boundary. * @imod_interval: set the interrupt moderation interval in 250ns * increments or 0 to disable. */ @@ -1216,6 +1221,8 @@ struct dwc3 { unsigned dis_metastability_quirk:1; + unsigned dis_split_quirk:1; + u16 imod_interval; }; -- 2.15.0-rc2