Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp459084pxx; Wed, 28 Oct 2020 08:49:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbTjqguma0gJ60GEibSWVkecL13HfMO8gCJPHXd2LA97lfQFYBb3sydrEEvq/oWGnViWZ/ X-Received: by 2002:a50:8c24:: with SMTP id p33mr8447653edp.330.1603900168538; Wed, 28 Oct 2020 08:49:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603900168; cv=none; d=google.com; s=arc-20160816; b=hIj32jPJkfS/nRxUoqpjLkvxmoEWuI3y0s4A5Rtrpa5gQUZiEKJups4kpVDBRrQD3d X/0747zNoa+B6folAUocHFhXUdoTI76hWn7nfSsMsrsI7O1bujmrv5RKlx9qUeXq7C+z JSDnvPR0qMvq0y0hbKpluNcg+qimD8FkGLh2gzLhENKdMZqjY67OFQn9a20qw/QugN+w ab/LFP35mvikRWplUKwQbUclgFNUMjAnHtVwhD2/tCAQOKpbb2vcxeKWQrD5uhykA9Zf FNCmCPAlBBuIIl2GHfqKuRzK3ed1ktMlwSBwYraO2oZU/lorIN7OEzQJNaW8ebnDseq3 ivjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RymecHK60Q2KCE9zqqioCGhKJll+eRJZx1AZb/sxdp8=; b=Qtx7rkVbtUUBl6JJp95KTfqAgGxjDWepj9Rk+hrZXtgD2/JHkSFHf3No4ZbIZzVuUT YS359PnjBF0OSVb/HtVN4q1B4o8sCyPVJcEMpMvERZK1e9zGEagqehGA8gtfVDYOl+Gy o76wh6yO/g12E7hUWyDki/MFH0nGtNHDiU/jNTzLJMN42h+kv0SDZk9fWzkIuURHwuTe JC6oZjybnvIF0jnbodiIO9szb4+kWPPzCOk0xQ7QVpCrW97Q0I5reEOxi5U3suqOz16E LZRuaPMyQb1nBrO4itiK4OIUij0phosxp6HYYUU5pK3q3Y9SeGxidbrMcXvzVm4QRttN NR8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=R0lF7OfI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b29si2827715edn.354.2020.10.28.08.49.06; Wed, 28 Oct 2020 08:49:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=R0lF7OfI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1813203AbgJ0Qt0 (ORCPT + 99 others); Tue, 27 Oct 2020 12:49:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:51190 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1794891AbgJ0POK (ORCPT ); Tue, 27 Oct 2020 11:14:10 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A145B2225C; Tue, 27 Oct 2020 15:14:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603811650; bh=u7nPZzkRRzuV3tv9agFs4O1qUmlvICKJHw5liXlk7Vc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R0lF7OfIpE2aOWUGpVPYi9OhdnZwOrEicXK5BJut801KRn8zRjghM37jh+y0Zdrp/ o8sdnSNH4hMWygieeH8od50/8ld5VDXc38rpNl1+fRrt71LOTNHZZIt+4PazIBlAN8 8Go4hfrR+SUmVS+F1AW0ssqKlzWDBGv6PUfgAQkA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yu Chen , Mauro Carvalho Chehab , Felipe Balbi , Sasha Levin Subject: [PATCH 5.8 568/633] usb: dwc3: Add splitdisable quirk for Hisilicon Kirin Soc Date: Tue, 27 Oct 2020 14:55:11 +0100 Message-Id: <20201027135549.451467380@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yu Chen [ Upstream commit f580170f135af14e287560d94045624d4242d712 ] SPLIT_BOUNDARY_DISABLE should be set for DesignWare USB3 DRD Core of Hisilicon Kirin Soc when dwc3 core act as host. [mchehab: dropped a dev_dbg() as only traces are now allowwed on this driver] Signed-off-by: Yu Chen Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Felipe Balbi Signed-off-by: Sasha Levin --- drivers/usb/dwc3/core.c | 25 +++++++++++++++++++++++++ drivers/usb/dwc3/core.h | 7 +++++++ 2 files changed, 32 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 7c5a18f9f66c8..928a85b0d1cdd 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -119,6 +119,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; @@ -172,6 +173,11 @@ static void __dwc3_set_mode(struct work_struct *work) otg_set_vbus(dwc->usb2_phy->otg, true); phy_set_mode(dwc->usb2_generic_phy, PHY_MODE_USB_HOST); phy_set_mode(dwc->usb3_generic_phy, PHY_MODE_USB_HOST); + 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: @@ -1350,6 +1356,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; @@ -1867,10 +1876,26 @@ 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) { + 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 013f42a2b5dcc..af5533b097133 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -138,6 +138,7 @@ #define DWC3_GEVNTCOUNT(n) (0xc40c + ((n) * 0x10)) #define DWC3_GHWPARAMS8 0xc600 +#define DWC3_GUCTL3 0xc60c #define DWC3_GFLADJ 0xc630 /* Device Registers */ @@ -380,6 +381,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) @@ -1052,6 +1056,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. */ @@ -1245,6 +1250,8 @@ struct dwc3 { unsigned dis_metastability_quirk:1; + unsigned dis_split_quirk:1; + u16 imod_interval; }; -- 2.25.1