Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1889409rwl; Wed, 12 Apr 2023 21:26:27 -0700 (PDT) X-Google-Smtp-Source: AKy350aUjX04qB1PWRAwTcOX1YQT11mPopiHmdEtt17aEfCiR+ncyBGOVRmq8+lT1NvpAkCGv3oS X-Received: by 2002:a05:6a00:13a5:b0:636:e1b4:28c with SMTP id t37-20020a056a0013a500b00636e1b4028cmr1852754pfg.1.1681359986737; Wed, 12 Apr 2023 21:26:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681359986; cv=none; d=google.com; s=arc-20160816; b=sI/9lepbXp59DnRJbv6gQUTZAaC100C7HKvX3aPpsVtB0K/vbTI39pxKpxEuVbuO1t 9Le69WJUmpNcMB8VbtgzH3fyA9ZfB3JvxgpGAz4spFNPRwIbYgHMhKVXkDIuPK1IPoi3 zR2s5cZ8aUdb5og2om6ig2OTWr800D+XSldtTrQ7/dF973TK69mYUfRuCFh8A0OgsrLl juJzpX1NP/zbeDRKtSMDYf9hHbX8p9BAQi2DWGoKOsdPwWbBMRwU8km4P6CWu/ecMugr UG/mQmWzP4gpxjgpoU9KmRUoI29wApJ03vzTXnL775wJp/A/MIg3s5Su4o+fHrJEX2Wt 3qWg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :authenticated-by; bh=hyHlVk93fBdzJPcjAhoWz+5T2hrLPQfWlcaNJjvXzFU=; b=HI96hObnLBz4LgyYsoxaVXkop+493wWMkOEVh3ShkDv3JifVDDN3z5kMfruf01VltR dglxlvqhab9ASd2n8N+lM6XxnZwG7KNGLHBWRKx6h+D9btlvaUn0HKFbphP+42pTIYvA QJ3rrt+g47fjVa5X5evhpnev2D37muvbo34wq2bsKgJESP62r+HTk1zHS1veqX+zV+Wv 6EACMKTjZ53+3uj/2fX8LXRWe5dTVV7FUA2Ny6je/qA2yQGiXqljGAUYMhY352q2Mmfh CB+9+B+YQhna8nZKiif3M9PBbV0WgFL9bX9+fmCZyLtoxa87MN5sYqW3s2zdNv6W595b TlLg== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n16-20020aa79850000000b006396e2eb0d5si625121pfq.244.2023.04.12.21.26.15; Wed, 12 Apr 2023 21:26:26 -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 S229611AbjDMEYb (ORCPT + 99 others); Thu, 13 Apr 2023 00:24:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229501AbjDMEYa (ORCPT ); Thu, 13 Apr 2023 00:24:30 -0400 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAA77BB; Wed, 12 Apr 2023 21:24:29 -0700 (PDT) Authenticated-By: X-SpamFilter-By: ArmorX SpamTrap 5.77 with qID 33D4O0VC0024180, 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 33D4O0VC0024180 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK); Thu, 13 Apr 2023 12:24:00 +0800 Received: from RTEXMBS05.realtek.com.tw (172.21.6.98) 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, 13 Apr 2023 12:24:22 +0800 Received: from RTEXH36505.realtek.com.tw (172.21.6.25) by RTEXMBS05.realtek.com.tw (172.21.6.98) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 13 Apr 2023 12:24:22 +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, 13 Apr 2023 12:24:22 +0800 From: Stanley Chang To: Thinh Nguyen CC: Stanley Chang , , Greg Kroah-Hartman , Subject: [PATCH v2 1/2] usb: dwc3: core: add support for remapping global register start address Date: Thu, 13 Apr 2023 12:24:22 +0800 Message-ID: <20230413042422.3723-1-stanley_chang@realtek.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230412033006.10859-1-stanley_chang@realtek.com> References: <20230412033006.10859-1-stanley_chang@realtek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-KSE-ServerInfo: RTEXMBS05.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 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: X-Mailing-List: linux-kernel@vger.kernel.org The RTK DHC SoCs were designed the global register address offset at 0x8100. The default address is at DWC3_GLOBALS_REGS_START (0xc100). Therefore, add the property of device-tree to adjust this start address. Signed-off-by: Stanley Chang --- 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 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 476b63618511..8c1d1afbdc65 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1785,6 +1785,21 @@ static int dwc3_probe(struct platform_device *pdev) dwc_res = *res; dwc_res.start += DWC3_GLOBALS_REGS_START; + /* + * For some dwc3 controller, the dwc3 global register start address is + * not at DWC3_GLOBALS_REGS_START (0xc100). + */ + if (dev->of_node) { + int global_regs_starting_offset = 0; + + device_property_read_u32(dev, "snps,global-regs-starting-offset", + &global_regs_starting_offset); + if (global_regs_starting_offset) { + dwc_res.start -= DWC3_GLOBALS_REGS_START; + dwc_res.start += global_regs_starting_offset; + } + } + regs = devm_ioremap_resource(dev, &dwc_res); if (IS_ERR(regs)) return PTR_ERR(regs); -- 2.34.1