[v5] usb: dwc3: core: add support for realtek SoCs custom's global register start address
Message ID | 20230504034423.20813-1-stanley_chang@realtek.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp36022vqo; Wed, 3 May 2023 20:57:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7vma52PJ3By2ZDPnXYCzc0NB7ZZb3Voyls8N0eI3v9x/8YrAFFGlqdC5Vmo6rWGvoUmc/s X-Received: by 2002:a17:903:2303:b0:1aa:d4ba:de2 with SMTP id d3-20020a170903230300b001aad4ba0de2mr2497477plh.18.1683172666639; Wed, 03 May 2023 20:57:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683172666; cv=none; d=google.com; s=arc-20160816; b=cUgPdJVKhvT2sLzbvbyu4uH0yAbKwlFUIKZfRWhOLO1hYzIRWlsw6bYX0O/K3XF2Cq zW44dHpCeGrOTyV6iNlo/lsJPMCvRx8KKfTo0Au5a8uyYEJfIj5qKw/GvLndk2O7yTio DNdfmeu2kZuej8M5Q0zJpUUQJi5iwF6gmRA7CXjQzIKbpaYQH1xqVTCQ8rQzg1vCo5C2 1q4YMpyFMSO3Urq41QjiTzeBkmi82M5BROYJ15Qbi4zWSAEAz1VB9OGV3AxKsRFDL7So IaAkW2PxgWx5BDfdQtnRXByuT1QGlRu9BPztOxDMXNX4MK6ms2KP4WLq/CsoP7NdmSl7 zCsw== 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 :message-id:date:subject:cc:to:from:authenticated-by; bh=VMzE01WJUIGuiEMnKXr9hkkbFy4HBkY1n0xLrDLGKWg=; b=gk0NqMnIa5rVMU6t1Sq6MYqKcz8reMjggy2gNkItEyvthLUW8ECIB5JRLIe7aJbIF5 Phecn3dF2fWZSSi+jEtdC8h2qkuKUrtMbKNU7dlNU7pE1tsnSn54/G635AimwfXvqgkl +8TYB2fMf2YHhKdKIzz5Op+4jbBeq3WlDvuV5b8QTIcTcg7hmIIMt8Jh9Ws8s5P4KtsF xffuc3A7wgxwJXJUFNCzw0zWZVNKMpBTDV7dF2ZBiKPE3u1aGNRCWzpVCK1y1rbksXDu Iv2raXo6oaN+WC3SMw3fPfAoas/r2tW/g915TtKQ3EQcy8KhqNR8aFIRFr+jJ1yv5H5S 8nNw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m7-20020a170902db0700b001a6556cf95esi6667723plx.170.2023.05.03.20.57.31; Wed, 03 May 2023 20:57:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229824AbjEDDoh (ORCPT <rfc822;lhua1029@gmail.com> + 99 others); Wed, 3 May 2023 23:44:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229553AbjEDDoe (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 3 May 2023 23:44:34 -0400 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F78C1B1; Wed, 3 May 2023 20:44:32 -0700 (PDT) Authenticated-By: X-SpamFilter-By: ArmorX SpamTrap 5.77 with qID 3443iJQ21015327, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36505.realtek.com.tw[172.21.6.25]) by rtits2.realtek.com.tw (8.15.2/2.81/5.90) with ESMTPS id 3443iJQ21015327 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK); Thu, 4 May 2023 11:44:20 +0800 Received: from RTEXMBS01.realtek.com.tw (172.21.6.94) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.32; Thu, 4 May 2023 11:44:24 +0800 Received: from RTEXH36505.realtek.com.tw (172.21.6.25) by RTEXMBS01.realtek.com.tw (172.21.6.94) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Thu, 4 May 2023 11:44:23 +0800 Received: from localhost.localdomain (172.21.252.101) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server id 15.1.2375.32 via Frontend Transport; Thu, 4 May 2023 11:44:23 +0800 From: Stanley Chang <stanley_chang@realtek.com> To: Thinh Nguyen <Thinh.Nguyen@synopsys.com> CC: Stanley Chang <stanley_chang@realtek.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, <linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org> Subject: [PATCH v5] usb: dwc3: core: add support for realtek SoCs custom's global register start address Date: Thu, 4 May 2023 11:44:23 +0800 Message-ID: <20230504034423.20813-1-stanley_chang@realtek.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-KSE-ServerInfo: RTEXMBS01.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-ServerInfo: RTEXH36505.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764934462068202899?= X-GMAIL-MSGID: =?utf-8?q?1764934462068202899?= |
Series |
[v5] usb: dwc3: core: add support for realtek SoCs custom's global register start address
|
|
Commit Message
Stanley Chang[昌育德]
May 4, 2023, 3:44 a.m. UTC
The Realtek RTD1xxx SoCs were designed, the global register address
offset at 0x8100. The default address offset is constant at
DWC3_GLOBALS_REGS_START (0xc100). Therefore, add a check if the
compatible name of the parent is "realtek,rtd1xxx-dwc3", then global
register start address will remap to 0x8100.
Signed-off-by: Stanley Chang <stanley_chang@realtek.com>
---
v4 to v5 change:
Use the compatible name of the parent to match this special offset.
v3 to v4 change:
Use the compatible name to specify the global register address offset.
If the compatible name is "snps,dwc3-rtk-soc", then the offset use 0x8100.
Otherwise, the offset is default value 0xc100.
v2 to v3 change:
1. Fix the dtschema validation error.
v1 to v2 change:
1. Change the name of the property "snps,global-regs-starting-offset".
2. Adjust the format of comment.
3. Add initial value of the global_regs_starting_offset
4. Remove the log of dev_info.
---
drivers/usb/dwc3/core.c | 11 +++++++++++
drivers/usb/dwc3/core.h | 2 ++
2 files changed, 13 insertions(+)
Comments
Hello! On 5/4/23 6:44 AM, Stanley Chang wrote: > The Realtek RTD1xxx SoCs were designed, the global register address > offset at 0x8100. Can't parse that, perhaps "with" is missing? > The default address offset is constant at > DWC3_GLOBALS_REGS_START (0xc100). Therefore, add a check if the > compatible name of the parent is "realtek,rtd1xxx-dwc3", then global Wildcards are not allowed in the "compatible" props... > register start address will remap to 0x8100. > > Signed-off-by: Stanley Chang <stanley_chang@realtek.com> [...] MBR, Sergey
> On 5/4/23 6:44 AM, Stanley Chang wrote: > > > The Realtek RTD1xxx SoCs were designed, the global register address > > offset at 0x8100. > > Can't parse that, perhaps "with" is missing? > > > The default address offset is constant at DWC3_GLOBALS_REGS_START > > (0xc100). Therefore, add a check if the compatible name of the parent > > is "realtek,rtd1xxx-dwc3", then global > > Wildcards are not allowed in the "compatible" props... I can't understand your meaning. Do you mean I can't use rtd1xxx ?
On 5/4/23 11:26 AM, Stanley Chang[昌育德] wrote: [...] >>> The Realtek RTD1xxx SoCs were designed, the global register address >>> offset at 0x8100. >> >> Can't parse that, perhaps "with" is missing? >> >>> The default address offset is constant at DWC3_GLOBALS_REGS_START >>> (0xc100). Therefore, add a check if the compatible name of the parent >>> is "realtek,rtd1xxx-dwc3", then global >> >> Wildcards are not allowed in the "compatible" props... > > I can't understand your meaning. > Do you mean I can't use rtd1xxx ? You can't, indeed. MBR, Sergey
> > I can't understand your meaning. > > Do you mean I can't use rtd1xxx ? > > You can't, indeed. > The namr rtd1xxx is represent the name of SoCs, for rtd129x, rtd139x, rtd16xx, ... etc. Must I use a real chip name, example rtd129x? Or can I use "rtd" only to represent all Socs?
On 5/4/23 11:36 AM, Stanley Chang[昌育德] wrote: >>> I can't understand your meaning. >>> Do you mean I can't use rtd1xxx ? >> >> You can't, indeed. >> > The namr rtd1xxx is represent the name of SoCs, for rtd129x, rtd139x, rtd16xx, ... etc. > > Must I use a real chip name, example rtd129x? Yes but iff x is not also a wildcard. rtd1290 would fit iff that SoC actually exists. > Or can I use "rtd" only to represent all Socs? If you have a fallback value of the "compatible" prop, you can use it... MBR, Sergey
> >>> I can't understand your meaning. > >>> Do you mean I can't use rtd1xxx ? > >> > >> You can't, indeed. > >> > > The namr rtd1xxx is represent the name of SoCs, for rtd129x, rtd139x, > rtd16xx, ... etc. > > > > Must I use a real chip name, example rtd129x? > > Yes but iff x is not also a wildcard. rtd1290 would fit iff that SoC actually > exists. > > > Or can I use "rtd" only to represent all Socs? > > If you have a fallback value of the "compatible" prop, you can use it... I will use the name "rtd" to instead the "rtd1xxx". Thanks, Stanley
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 0beaab932e7d..0adafb5439ed 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1800,6 +1800,17 @@ static int dwc3_probe(struct platform_device *pdev) dwc_res = *res; dwc_res.start += DWC3_GLOBALS_REGS_START; + if (dev->of_node) { + struct device_node *parent = of_get_parent(dev->of_node); + + if (of_device_is_compatible(parent, "realtek,rtd1xxx-dwc3")) { + dwc_res.start -= DWC3_GLOBALS_REGS_START; + dwc_res.start += DWC3_RTK_RTD1XXX_GLOBALS_REGS_START; + } + + of_node_put(parent); + } + regs = devm_ioremap_resource(dev, &dwc_res); if (IS_ERR(regs)) return PTR_ERR(regs); diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index d56457c02996..c004e3a548ca 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -84,6 +84,8 @@ #define DWC3_OTG_REGS_START 0xcc00 #define DWC3_OTG_REGS_END 0xccff +#define DWC3_RTK_RTD1XXX_GLOBALS_REGS_START 0x8100 + /* Global Registers */ #define DWC3_GSBUSCFG0 0xc100 #define DWC3_GSBUSCFG1 0xc104