Message ID | 20231025104457.628109-2-robimarko@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp2507205vqx; Wed, 25 Oct 2023 03:46:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEieLlhqFSwnmfj/VQ19aGLIafS7Zws+7Y8oVWDhkJXAOLEAFq84KdEU3CgcwqHGUD5u/S1 X-Received: by 2002:a1f:5a14:0:b0:49e:2145:1654 with SMTP id o20-20020a1f5a14000000b0049e21451654mr13106590vkb.7.1698230777922; Wed, 25 Oct 2023 03:46:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698230777; cv=none; d=google.com; s=arc-20160816; b=0Q46NUpZt90BpWVu0q/z91M7IFXp55VeEDE632J4HjDeqk6r8IVB9Z3Omjw4NuqZ3r IYtIvAR9QRP2zNcwU/UdcF0G9sLHMZkT7vkq1vK7wkWTHYzWjvJFIzK8SmSKNSxOZA9y Gc2AFCGc/gePrwwxdiMjEIUzPjlW2c9RBH4G/mvqw2zLNe/xH3ysm5EAJhpXmcCXIZwm eMRDWLMHYDh0yOtug8CL4TFOf2kUILmkylHQ0QKXhGXRgCU4IC3WsBRoNms/EL5/KF9R h/Ia38I4Q4jyS7DShwvg7g0rqhfgWXjmKWq8fYZBFT1ALQIHO346/lyktqnV88mmdo1H 9Xmg== 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 :dkim-signature; bh=6esSzcgffSka4qrRFDqhwYHqVtJjmpE8kipUoxPN9Z4=; fh=Boy+T4pL0LUDoE3NPA/m2ZOj6lUD0dSpXvPMDje6Nwg=; b=oWAkBK9PctgfXi45jVFPs+dLlGDMBUxHHib/OHA6jQvFcQjNDtOx75IgXYYOOzSPi+ brZEMmTowfjnKCmasRuomQs/E6I94tQXu4Grgpqv1GOGDR0d1FgGyDcyVgEkmD5JgBwe CHXak+vMGLo1zqI2mAz3Xd7agaxs7/fiIIp38hZIcVpwRdtbFCaKqkJ7a1AL5lOSqGsM ZeDhn8z49O0EIx2zpcwPH/6uvdDi1fnzncTZwscPebMf3G00KSP8vk0q2qaMsNGtLFGH gyvzv4QPT+13U4toU90knn9ert6epcPum2sFqcfA/TDzdNwrBTyne29Zpv0PB4BSGUGT WzOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hFEjF4nb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id i130-20020a819188000000b005a7e60e367asi10757093ywg.216.2023.10.25.03.46.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 03:46:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hFEjF4nb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 91A078052705; Wed, 25 Oct 2023 03:45:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343875AbjJYKpQ (ORCPT <rfc822;aposhian.dev@gmail.com> + 26 others); Wed, 25 Oct 2023 06:45:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234629AbjJYKpI (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 25 Oct 2023 06:45:08 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A203132; Wed, 25 Oct 2023 03:45:03 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-53f6ccea1eeso8544680a12.3; Wed, 25 Oct 2023 03:45:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698230702; x=1698835502; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6esSzcgffSka4qrRFDqhwYHqVtJjmpE8kipUoxPN9Z4=; b=hFEjF4nbPVd/18u1QyV+LGqIXrWWXrUxJHAgL6I9T9jmvnNWh37q/1Kr/aDTemHv9U yfiawR/Rq+lDV7xRa2ASf2vIKFAN28tqV73qvTigmDPw5IVwp9W1GIsUib2spmZZekcH Ihn/KGlOQwIWGRRusxvA4PIRBi6gVo0OyimhAOKGMU/BbcESBGrACl2zC1TSs070xOR5 rWPnum/+yGwBFDGqe6RiMxvoLQNgp5wsmH+NVpr9S9wkHA8NqIfBndlp78MNWkRmTzP4 iAkuHLvLYkggwaRAkd0h98U29vLf1j7yvFKgPj7t8bfjMytn+cQYCdnvHFfcta7Tz8Ki E0yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698230702; x=1698835502; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6esSzcgffSka4qrRFDqhwYHqVtJjmpE8kipUoxPN9Z4=; b=BgEWyX00WamPdniLPwLlqOMwSC9lrvaxOys55EixbQ7mZX0N5aPj19gywZBesF2PzN e4pIVOMuV/UsHBwTukoq5I4QlcWPZ1gXQU7geC7mEFNDlfnsma1LzdJMdOdAfigN0dB2 gX0znZxvcjD3I0qXuBIdjZPzy7ANq1kdtZCxor7ZBwv6GB4Q0ss1S7e/dKnTyE2NQPae d+zwCfwlgtDoGvW9znEFQk0Yhkj8r+iJsj2bPjJttv17nMDdvqAHrHpm7IwHPnUb3xJp RoTYCW4IQu+9EbpPE9cTjawqMlLG9/NmVWTT3zL14haYHESTe0W/TNa0DQ9A1Y64W4/e lH2g== X-Gm-Message-State: AOJu0YwQOGgYsJ5T0tZMHTtr5c1rx36C4MYbgJd6ijhPsqoCRaDPCxOE i3PxBFBFi5rk3eDSDanjrWA= X-Received: by 2002:a17:907:6eaa:b0:9c4:b8c9:1bf4 with SMTP id sh42-20020a1709076eaa00b009c4b8c91bf4mr14206819ejc.19.1698230702080; Wed, 25 Oct 2023 03:45:02 -0700 (PDT) Received: from fedora.. (dh207-97-46.xnet.hr. [88.207.97.46]) by smtp.googlemail.com with ESMTPSA id t11-20020a1709066bcb00b009be14e5cd54sm9626292ejs.57.2023.10.25.03.45.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 03:45:01 -0700 (PDT) From: Robert Marko <robimarko@gmail.com> To: agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, mturquette@baylibre.com, sboyd@kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org Cc: Robert Marko <robimarko@gmail.com> Subject: [PATCH 2/3] clk: qcom: ipq6018: add USB GDSCs Date: Wed, 25 Oct 2023 12:44:10 +0200 Message-ID: <20231025104457.628109-2-robimarko@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231025104457.628109-1-robimarko@gmail.com> References: <20231025104457.628109-1-robimarko@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 25 Oct 2023 03:45:53 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780724036240183270 X-GMAIL-MSGID: 1780724036240183270 |
Series |
[1/3] dt-bindings: clock: qcom: ipq6018: add USB GDSCs
|
|
Commit Message
Robert Marko
Oct. 25, 2023, 10:44 a.m. UTC
IPQ6018 has GDSC-s for each of the USB ports, so lets define them as such
and drop the curent code that is de-asserting the USB GDSC-s as part of
the GCC probe.
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
drivers/clk/qcom/Kconfig | 1 +
drivers/clk/qcom/gcc-ipq6018.c | 33 ++++++++++++++++++++++++---------
2 files changed, 25 insertions(+), 9 deletions(-)
Comments
On 10/25/23 12:44, Robert Marko wrote: > IPQ6018 has GDSC-s for each of the USB ports, so lets define them as such > and drop the curent code that is de-asserting the USB GDSC-s as part of > the GCC probe. > > Signed-off-by: Robert Marko <robimarko@gmail.com> > --- Applying patches 1 and 3 without this one breaks usb, no? Konrad
On 10/26/23 20:42, Konrad Dybcio wrote: > > > On 10/25/23 12:44, Robert Marko wrote: >> IPQ6018 has GDSC-s for each of the USB ports, so lets define them as such >> and drop the curent code that is de-asserting the USB GDSC-s as part of >> the GCC probe. >> >> Signed-off-by: Robert Marko <robimarko@gmail.com> >> --- > Applying patches 1 and 3 without this one breaks usb, no? Sorry, my hands don't keep up with my brain - that's almost another speculative execution vulnerability! What I meant to say is: applying patches 1 and 2 breaks USB but the solution here would be to apply patch 1 and patch 3, followed by patch 2 (unless it will make the USB defer, IDK, it's probably easier to just test than to dive deep into the code) with Bjorn taking both subsystems, we can make that work I think Konrad
On Thu, 26 Oct 2023 at 20:45, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: > > > > On 10/26/23 20:42, Konrad Dybcio wrote: > > > > > > On 10/25/23 12:44, Robert Marko wrote: > >> IPQ6018 has GDSC-s for each of the USB ports, so lets define them as such > >> and drop the curent code that is de-asserting the USB GDSC-s as part of > >> the GCC probe. > >> > >> Signed-off-by: Robert Marko <robimarko@gmail.com> > >> --- > > Applying patches 1 and 3 without this one breaks usb, no? > Sorry, my hands don't keep up with my brain - that's almost another > speculative execution vulnerability! > > What I meant to say is: > > applying patches 1 and 2 breaks USB > > but > > the solution here would be to apply patch 1 and patch 3, followed > by patch 2 (unless it will make the USB defer, IDK, it's probably > easier to just test than to dive deep into the code) > > with Bjorn taking both subsystems, we can make that work I think Hi, Applying patches 1 and 3 without patch 2 will make USB fail with: # [ 11.351681] dwc3-qcom 8af8800.usb: deferred probe timeout, ignoring dependency [ 11.351729] dwc3-qcom: probe of 8af8800.usb failed with error -110 And yes, applying patches 1 and 2 without patch 3 will also break USB. That is why I sent this as a series. Regards, Robert > > Konrad
On Wed, 25 Oct 2023 at 12:45, Robert Marko <robimarko@gmail.com> wrote: > > IPQ6018 has GDSC-s for each of the USB ports, so lets define them as such > and drop the curent code that is de-asserting the USB GDSC-s as part of > the GCC probe. > > Signed-off-by: Robert Marko <robimarko@gmail.com> Unfortunately, after testing on multiple devices I hit the same GDSC issue I had a long time ago that was the reason I did not send this upstream. It seems that USB3 port GDSC (USB0 GDSC in code) works just fine, however the USB2 one (USB1 GDSC in code) it is stuck off and USB2 port will fail due to this: 1.607531] ------------[ cut here ]------------ [ 1.607559] usb1_gdsc status stuck at 'off' [ 1.607592] WARNING: CPU: 0 PID: 35 at gdsc_toggle_logic+0x16c/0x174 [ 1.615120] Modules linked in: [ 1.621712] CPU: 0 PID: 35 Comm: kworker/u8:1 Tainted: G W 6.6.0-rc7-next-20231026 #5 [ 1.624586] Hardware name: Wallys DR6018 v4 (DT) [ 1.633867] Workqueue: events_unbound deferred_probe_work_func [ 1.638556] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 1.644200] pc : gdsc_toggle_logic+0x16c/0x174 [ 1.651052] lr : gdsc_toggle_logic+0x16c/0x174 [ 1.655566] sp : ffffffc081a03a40 [ 1.659990] x29: ffffffc081a03a40 x28: 0000000000000000 x27: 0000000000000000 [ 1.663384] x26: ffffff8000156ac0 x25: 0000000000000000 x24: ffffffc081824c90 [ 1.670502] x23: ffffffc081824840 x22: 0000000000000000 x21: 0000000000000001 [ 1.677620] x20: 00000000ffffff92 x19: ffffffc081824840 x18: ffffffffffffffff [ 1.684738] x17: 00000000cdb32eee x16: 00000000d648a142 x15: fffffffffffc38ff [ 1.691855] x14: ffffffc0817994c0 x13: 00000000000000e0 x12: 00000000000000e0 [ 1.698974] x11: 00000000ffffffea x10: ffffffc0817f14c0 x9 : 0000000000000001 [ 1.706094] x8 : 0000000000000001 x7 : 0000000000017fe8 x6 : c0000000ffffefff [ 1.713211] x5 : 0000000000057fa8 x4 : 0000000000000000 x3 : ffffffc081a03840 [ 1.720328] x2 : ffffffc081799400 x1 : ffffffc081799400 x0 : 000000000000001f [ 1.727448] Call trace: [ 1.734556] gdsc_toggle_logic+0x16c/0x174 [ 1.736815] gdsc_enable+0x60/0x27c [ 1.740980] genpd_power_on+0x180/0x22c [ 1.744367] __genpd_dev_pm_attach+0x140/0x238 [ 1.748188] genpd_dev_pm_attach+0x60/0x70 [ 1.752701] dev_pm_domain_attach+0x20/0x34 [ 1.756780] platform_probe+0x50/0xc0 [ 1.760859] really_probe+0x148/0x2b8 [ 1.764679] __driver_probe_device+0x78/0x12c [ 1.768327] driver_probe_device+0xdc/0x160 [ 1.772667] __device_attach_driver+0xb8/0x134 [ 1.776660] bus_for_each_drv+0x70/0xb8 [ 1.781173] __device_attach+0xa0/0x184 [ 1.784905] device_initial_probe+0x14/0x20 [ 1.788725] bus_probe_device+0xac/0xb0 [ 1.792891] deferred_probe_work_func+0x88/0xc0 [ 1.796712] process_one_work+0x158/0x2bc [ 1.801226] worker_thread+0x2a0/0x4bc [ 1.805391] kthread+0xe4/0xf0 [ 1.809035] ret_from_fork+0x10/0x20 [ 1.812075] ---[ end trace 0000000000000000 ]--- Kathiravan, do you happen to have any docs or info if the USB1 GDSC is special and its status bits are broken or? Maybe the offset is even wrong as I based it on the current driver. Regards, Robert > --- > drivers/clk/qcom/Kconfig | 1 + > drivers/clk/qcom/gcc-ipq6018.c | 33 ++++++++++++++++++++++++--------- > 2 files changed, 25 insertions(+), 9 deletions(-) > > diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig > index ad1acd9b7426b..2aefa2231b51b 100644 > --- a/drivers/clk/qcom/Kconfig > +++ b/drivers/clk/qcom/Kconfig > @@ -164,6 +164,7 @@ config IPQ_GCC_5332 > > config IPQ_GCC_6018 > tristate "IPQ6018 Global Clock Controller" > + select QCOM_GDSC > help > Support for global clock controller on ipq6018 devices. > Say Y if you want to use peripheral devices such as UART, SPI, > diff --git a/drivers/clk/qcom/gcc-ipq6018.c b/drivers/clk/qcom/gcc-ipq6018.c > index cc20a16d8973c..9d5ee2ac012a1 100644 > --- a/drivers/clk/qcom/gcc-ipq6018.c > +++ b/drivers/clk/qcom/gcc-ipq6018.c > @@ -23,6 +23,7 @@ > #include "clk-alpha-pll.h" > #include "clk-regmap-divider.h" > #include "clk-regmap-mux.h" > +#include "gdsc.h" > #include "reset.h" > > enum { > @@ -4691,6 +4692,22 @@ static struct clk_branch gcc_dcc_clk = { > }, > }; > > +static struct gdsc usb0_gdsc = { > + .gdscr = 0x3e078, > + .pd = { > + .name = "usb0_gdsc", > + }, > + .pwrsts = PWRSTS_OFF_ON, > +}; > + > +static struct gdsc usb1_gdsc = { > + .gdscr = 0x3f078, > + .pd = { > + .name = "usb1_gdsc", > + }, > + .pwrsts = PWRSTS_OFF_ON, > +}; > + > static const struct alpha_pll_config ubi32_pll_config = { > .l = 0x3e, > .alpha = 0x6667, > @@ -5138,6 +5155,11 @@ static const struct qcom_reset_map gcc_ipq6018_resets[] = { > [GCC_Q6_AXIM_ARES] = {0x59110, 4}, > }; > > +static struct gdsc *gcc_ipq6018_gdscs[] = { > + [USB0_GDSC] = &usb0_gdsc, > + [USB1_GDSC] = &usb1_gdsc, > +}; > + > static const struct of_device_id gcc_ipq6018_match_table[] = { > { .compatible = "qcom,gcc-ipq6018" }, > { } > @@ -5160,6 +5182,8 @@ static const struct qcom_cc_desc gcc_ipq6018_desc = { > .num_resets = ARRAY_SIZE(gcc_ipq6018_resets), > .clk_hws = gcc_ipq6018_hws, > .num_clk_hws = ARRAY_SIZE(gcc_ipq6018_hws), > + .gdscs = gcc_ipq6018_gdscs, > + .num_gdscs = ARRAY_SIZE(gcc_ipq6018_gdscs), > }; > > static int gcc_ipq6018_probe(struct platform_device *pdev) > @@ -5170,15 +5194,6 @@ static int gcc_ipq6018_probe(struct platform_device *pdev) > if (IS_ERR(regmap)) > return PTR_ERR(regmap); > > - /* Disable SW_COLLAPSE for USB0 GDSCR */ > - regmap_update_bits(regmap, 0x3e078, BIT(0), 0x0); > - /* Enable SW_OVERRIDE for USB0 GDSCR */ > - regmap_update_bits(regmap, 0x3e078, BIT(2), BIT(2)); > - /* Disable SW_COLLAPSE for USB1 GDSCR */ > - regmap_update_bits(regmap, 0x3f078, BIT(0), 0x0); > - /* Enable SW_OVERRIDE for USB1 GDSCR */ > - regmap_update_bits(regmap, 0x3f078, BIT(2), BIT(2)); > - > /* SW Workaround for UBI Huyara PLL */ > regmap_update_bits(regmap, 0x2501c, BIT(26), BIT(26)); > > -- > 2.41.0 >
On 29.10.2023 12:04, Robert Marko wrote: > On Wed, 25 Oct 2023 at 12:45, Robert Marko <robimarko@gmail.com> wrote: >> >> IPQ6018 has GDSC-s for each of the USB ports, so lets define them as such >> and drop the curent code that is de-asserting the USB GDSC-s as part of >> the GCC probe. >> >> Signed-off-by: Robert Marko <robimarko@gmail.com> > > Unfortunately, after testing on multiple devices I hit the same GDSC > issue I had a long time ago > that was the reason I did not send this upstream. > It seems that USB3 port GDSC (USB0 GDSC in code) works just fine, > however the USB2 one > (USB1 GDSC in code) it is stuck off and USB2 port will fail due to this: > 1.607531] ------------[ cut here ]------------ > [ 1.607559] usb1_gdsc status stuck at 'off' > [ 1.607592] WARNING: CPU: 0 PID: 35 at gdsc_toggle_logic+0x16c/0x174 > [ 1.615120] Modules linked in: Can you dump GDSCR (the entire 32-bit register) at boot and when toggling? Konrad
On Mon, 30 Oct 2023 at 20:37, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: > > On 29.10.2023 12:04, Robert Marko wrote: > > On Wed, 25 Oct 2023 at 12:45, Robert Marko <robimarko@gmail.com> wrote: > >> > >> IPQ6018 has GDSC-s for each of the USB ports, so lets define them as such > >> and drop the curent code that is de-asserting the USB GDSC-s as part of > >> the GCC probe. > >> > >> Signed-off-by: Robert Marko <robimarko@gmail.com> > > > > Unfortunately, after testing on multiple devices I hit the same GDSC > > issue I had a long time ago > > that was the reason I did not send this upstream. > > It seems that USB3 port GDSC (USB0 GDSC in code) works just fine, > > however the USB2 one > > (USB1 GDSC in code) it is stuck off and USB2 port will fail due to this: > > 1.607531] ------------[ cut here ]------------ > > [ 1.607559] usb1_gdsc status stuck at 'off' > > [ 1.607592] WARNING: CPU: 0 PID: 35 at gdsc_toggle_logic+0x16c/0x174 > > [ 1.615120] Modules linked in: > Can you dump GDSCR (the entire 32-bit register) at boot and when toggling? Sure, here it is: [ 0.023760] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3e078 val: 0x8222004 init [ 0.023782] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: 0x8222004 init [ 0.988626] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: 0x8282000 before toggle [ 1.202506] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: 0x8282000 after toggle [ 1.207208] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3e078 val: 0xa0282000 before toggle [ 1.216208] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3e078 val: 0xa0282000 after toggle [ 1.648261] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: 0x8282000 before toggle [ 1.865867] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: 0x8282000 after toggle [ 1.880638] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: 0x8282000 before toggle [ 2.108643] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: 0x8282000 after toggle [ 2.113495] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: 0x8282000 before toggle [ 2.340844] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: 0x8282000 after toggle [ 10.588698] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: 0x8282000 before toggle [ 10.815257] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: 0x8282000 after toggle [ 11.554561] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: 0x8282000 before toggle [ 11.774515] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: 0x8282000 after toggle [ 11.781652] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: 0x8282000 before toggle [ 12.039619] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: 0x8282000 after toggle [ 22.233021] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: 0x8282000 before toggle [ 22.452907] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: 0x8282000 after toggle BTW, earlier I tried manually setting BIT(2) to 1 and that will allow the USB1 master clock to come up. Regards, Robert > > Konrad
On 30.10.2023 21:37, Robert Marko wrote: > On Mon, 30 Oct 2023 at 20:37, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: >> >> On 29.10.2023 12:04, Robert Marko wrote: >>> On Wed, 25 Oct 2023 at 12:45, Robert Marko <robimarko@gmail.com> wrote: >>>> >>>> IPQ6018 has GDSC-s for each of the USB ports, so lets define them as such >>>> and drop the curent code that is de-asserting the USB GDSC-s as part of >>>> the GCC probe. >>>> >>>> Signed-off-by: Robert Marko <robimarko@gmail.com> >>> >>> Unfortunately, after testing on multiple devices I hit the same GDSC >>> issue I had a long time ago >>> that was the reason I did not send this upstream. >>> It seems that USB3 port GDSC (USB0 GDSC in code) works just fine, >>> however the USB2 one >>> (USB1 GDSC in code) it is stuck off and USB2 port will fail due to this: >>> 1.607531] ------------[ cut here ]------------ >>> [ 1.607559] usb1_gdsc status stuck at 'off' >>> [ 1.607592] WARNING: CPU: 0 PID: 35 at gdsc_toggle_logic+0x16c/0x174 >>> [ 1.615120] Modules linked in: >> Can you dump GDSCR (the entire 32-bit register) at boot and when toggling? > > Sure, here it is: > [ 0.023760] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3e078 val: 0x8222004 init > [ 0.023782] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: 0x8222004 init > [ 0.988626] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: > 0x8282000 before toggle > [ 1.202506] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: > 0x8282000 after toggle > [ 1.207208] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3e078 val: > 0xa0282000 before toggle Any chance .en_few_wait_val = 0x2 (turning BIT(19) into BIT(17)) will make a difference? Konrad
On Mon, 30 Oct 2023 at 22:12, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: > > On 30.10.2023 21:37, Robert Marko wrote: > > On Mon, 30 Oct 2023 at 20:37, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: > >> > >> On 29.10.2023 12:04, Robert Marko wrote: > >>> On Wed, 25 Oct 2023 at 12:45, Robert Marko <robimarko@gmail.com> wrote: > >>>> > >>>> IPQ6018 has GDSC-s for each of the USB ports, so lets define them as such > >>>> and drop the curent code that is de-asserting the USB GDSC-s as part of > >>>> the GCC probe. > >>>> > >>>> Signed-off-by: Robert Marko <robimarko@gmail.com> > >>> > >>> Unfortunately, after testing on multiple devices I hit the same GDSC > >>> issue I had a long time ago > >>> that was the reason I did not send this upstream. > >>> It seems that USB3 port GDSC (USB0 GDSC in code) works just fine, > >>> however the USB2 one > >>> (USB1 GDSC in code) it is stuck off and USB2 port will fail due to this: > >>> 1.607531] ------------[ cut here ]------------ > >>> [ 1.607559] usb1_gdsc status stuck at 'off' > >>> [ 1.607592] WARNING: CPU: 0 PID: 35 at gdsc_toggle_logic+0x16c/0x174 > >>> [ 1.615120] Modules linked in: > >> Can you dump GDSCR (the entire 32-bit register) at boot and when toggling? > > > > Sure, here it is: > > [ 0.023760] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3e078 val: 0x8222004 init > > [ 0.023782] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: 0x8222004 init > > [ 0.988626] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: > > 0x8282000 before toggle > > [ 1.202506] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: > > 0x8282000 after toggle > > [ 1.207208] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3e078 val: > > 0xa0282000 before toggle > Any chance > > .en_few_wait_val = 0x2 > > (turning BIT(19) into BIT(17)) > > will make a difference? Sadly, it makes no difference and GDSC status bit newer comes up which is rather weird as USB0 one seems to work just fine. Regards, Robert > > Konrad
On 10/29/2023 4:34 PM, Robert Marko wrote: > On Wed, 25 Oct 2023 at 12:45, Robert Marko <robimarko@gmail.com> wrote: >> >> IPQ6018 has GDSC-s for each of the USB ports, so lets define them as such >> and drop the curent code that is de-asserting the USB GDSC-s as part of >> the GCC probe. >> >> Signed-off-by: Robert Marko <robimarko@gmail.com> > > Unfortunately, after testing on multiple devices I hit the same GDSC > issue I had a long time ago > that was the reason I did not send this upstream. > It seems that USB3 port GDSC (USB0 GDSC in code) works just fine, > however the USB2 one > (USB1 GDSC in code) it is stuck off and USB2 port will fail due to this: > 1.607531] ------------[ cut here ]------------ > [ 1.607559] usb1_gdsc status stuck at 'off' > [ 1.607592] WARNING: CPU: 0 PID: 35 at gdsc_toggle_logic+0x16c/0x174 > [ 1.615120] Modules linked in: > [ 1.621712] CPU: 0 PID: 35 Comm: kworker/u8:1 Tainted: G W > 6.6.0-rc7-next-20231026 #5 > [ 1.624586] Hardware name: Wallys DR6018 v4 (DT) > [ 1.633867] Workqueue: events_unbound deferred_probe_work_func > [ 1.638556] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) > [ 1.644200] pc : gdsc_toggle_logic+0x16c/0x174 > [ 1.651052] lr : gdsc_toggle_logic+0x16c/0x174 > [ 1.655566] sp : ffffffc081a03a40 > [ 1.659990] x29: ffffffc081a03a40 x28: 0000000000000000 x27: 0000000000000000 > [ 1.663384] x26: ffffff8000156ac0 x25: 0000000000000000 x24: ffffffc081824c90 > [ 1.670502] x23: ffffffc081824840 x22: 0000000000000000 x21: 0000000000000001 > [ 1.677620] x20: 00000000ffffff92 x19: ffffffc081824840 x18: ffffffffffffffff > [ 1.684738] x17: 00000000cdb32eee x16: 00000000d648a142 x15: fffffffffffc38ff > [ 1.691855] x14: ffffffc0817994c0 x13: 00000000000000e0 x12: 00000000000000e0 > [ 1.698974] x11: 00000000ffffffea x10: ffffffc0817f14c0 x9 : 0000000000000001 > [ 1.706094] x8 : 0000000000000001 x7 : 0000000000017fe8 x6 : c0000000ffffefff > [ 1.713211] x5 : 0000000000057fa8 x4 : 0000000000000000 x3 : ffffffc081a03840 > [ 1.720328] x2 : ffffffc081799400 x1 : ffffffc081799400 x0 : 000000000000001f > [ 1.727448] Call trace: > [ 1.734556] gdsc_toggle_logic+0x16c/0x174 > [ 1.736815] gdsc_enable+0x60/0x27c > [ 1.740980] genpd_power_on+0x180/0x22c > [ 1.744367] __genpd_dev_pm_attach+0x140/0x238 > [ 1.748188] genpd_dev_pm_attach+0x60/0x70 > [ 1.752701] dev_pm_domain_attach+0x20/0x34 > [ 1.756780] platform_probe+0x50/0xc0 > [ 1.760859] really_probe+0x148/0x2b8 > [ 1.764679] __driver_probe_device+0x78/0x12c > [ 1.768327] driver_probe_device+0xdc/0x160 > [ 1.772667] __device_attach_driver+0xb8/0x134 > [ 1.776660] bus_for_each_drv+0x70/0xb8 > [ 1.781173] __device_attach+0xa0/0x184 > [ 1.784905] device_initial_probe+0x14/0x20 > [ 1.788725] bus_probe_device+0xac/0xb0 > [ 1.792891] deferred_probe_work_func+0x88/0xc0 > [ 1.796712] process_one_work+0x158/0x2bc > [ 1.801226] worker_thread+0x2a0/0x4bc > [ 1.805391] kthread+0xe4/0xf0 > [ 1.809035] ret_from_fork+0x10/0x20 > [ 1.812075] ---[ end trace 0000000000000000 ]--- > > Kathiravan, do you happen to have any docs or info if the USB1 GDSC is special > and its status bits are broken or? Robert, sorry for the late response. Unfortunately, we didn't handle the GDSC via the framework, so not sure if something is broken at HW level. I can try to get some information on this, but immediately is not quite possible. Thanks for the understanding. Thanks, > > Maybe the offset is even wrong as I based it on the current driver. > > Regards, > Robert > >> --- >> drivers/clk/qcom/Kconfig | 1 + >> drivers/clk/qcom/gcc-ipq6018.c | 33 ++++++++++++++++++++++++--------- >> 2 files changed, 25 insertions(+), 9 deletions(-) >> >> diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig >> index ad1acd9b7426b..2aefa2231b51b 100644 >> --- a/drivers/clk/qcom/Kconfig >> +++ b/drivers/clk/qcom/Kconfig >> @@ -164,6 +164,7 @@ config IPQ_GCC_5332 >> >> config IPQ_GCC_6018 >> tristate "IPQ6018 Global Clock Controller" >> + select QCOM_GDSC >> help >> Support for global clock controller on ipq6018 devices. >> Say Y if you want to use peripheral devices such as UART, SPI, >> diff --git a/drivers/clk/qcom/gcc-ipq6018.c b/drivers/clk/qcom/gcc-ipq6018.c >> index cc20a16d8973c..9d5ee2ac012a1 100644 >> --- a/drivers/clk/qcom/gcc-ipq6018.c >> +++ b/drivers/clk/qcom/gcc-ipq6018.c >> @@ -23,6 +23,7 @@ >> #include "clk-alpha-pll.h" >> #include "clk-regmap-divider.h" >> #include "clk-regmap-mux.h" >> +#include "gdsc.h" >> #include "reset.h" >> >> enum { >> @@ -4691,6 +4692,22 @@ static struct clk_branch gcc_dcc_clk = { >> }, >> }; >> >> +static struct gdsc usb0_gdsc = { >> + .gdscr = 0x3e078, >> + .pd = { >> + .name = "usb0_gdsc", >> + }, >> + .pwrsts = PWRSTS_OFF_ON, >> +}; >> + >> +static struct gdsc usb1_gdsc = { >> + .gdscr = 0x3f078, >> + .pd = { >> + .name = "usb1_gdsc", >> + }, >> + .pwrsts = PWRSTS_OFF_ON, >> +}; >> + >> static const struct alpha_pll_config ubi32_pll_config = { >> .l = 0x3e, >> .alpha = 0x6667, >> @@ -5138,6 +5155,11 @@ static const struct qcom_reset_map gcc_ipq6018_resets[] = { >> [GCC_Q6_AXIM_ARES] = {0x59110, 4}, >> }; >> >> +static struct gdsc *gcc_ipq6018_gdscs[] = { >> + [USB0_GDSC] = &usb0_gdsc, >> + [USB1_GDSC] = &usb1_gdsc, >> +}; >> + >> static const struct of_device_id gcc_ipq6018_match_table[] = { >> { .compatible = "qcom,gcc-ipq6018" }, >> { } >> @@ -5160,6 +5182,8 @@ static const struct qcom_cc_desc gcc_ipq6018_desc = { >> .num_resets = ARRAY_SIZE(gcc_ipq6018_resets), >> .clk_hws = gcc_ipq6018_hws, >> .num_clk_hws = ARRAY_SIZE(gcc_ipq6018_hws), >> + .gdscs = gcc_ipq6018_gdscs, >> + .num_gdscs = ARRAY_SIZE(gcc_ipq6018_gdscs), >> }; >> >> static int gcc_ipq6018_probe(struct platform_device *pdev) >> @@ -5170,15 +5194,6 @@ static int gcc_ipq6018_probe(struct platform_device *pdev) >> if (IS_ERR(regmap)) >> return PTR_ERR(regmap); >> >> - /* Disable SW_COLLAPSE for USB0 GDSCR */ >> - regmap_update_bits(regmap, 0x3e078, BIT(0), 0x0); >> - /* Enable SW_OVERRIDE for USB0 GDSCR */ >> - regmap_update_bits(regmap, 0x3e078, BIT(2), BIT(2)); >> - /* Disable SW_COLLAPSE for USB1 GDSCR */ >> - regmap_update_bits(regmap, 0x3f078, BIT(0), 0x0); >> - /* Enable SW_OVERRIDE for USB1 GDSCR */ >> - regmap_update_bits(regmap, 0x3f078, BIT(2), BIT(2)); >> - >> /* SW Workaround for UBI Huyara PLL */ >> regmap_update_bits(regmap, 0x2501c, BIT(26), BIT(26)); >> >> -- >> 2.41.0 >>
On 10/31/23 10:01, Robert Marko wrote: > On Mon, 30 Oct 2023 at 22:12, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: >> >> On 30.10.2023 21:37, Robert Marko wrote: >>> On Mon, 30 Oct 2023 at 20:37, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: >>>> >>>> On 29.10.2023 12:04, Robert Marko wrote: >>>>> On Wed, 25 Oct 2023 at 12:45, Robert Marko <robimarko@gmail.com> wrote: >>>>>> >>>>>> IPQ6018 has GDSC-s for each of the USB ports, so lets define them as such >>>>>> and drop the curent code that is de-asserting the USB GDSC-s as part of >>>>>> the GCC probe. >>>>>> >>>>>> Signed-off-by: Robert Marko <robimarko@gmail.com> >>>>> >>>>> Unfortunately, after testing on multiple devices I hit the same GDSC >>>>> issue I had a long time ago >>>>> that was the reason I did not send this upstream. >>>>> It seems that USB3 port GDSC (USB0 GDSC in code) works just fine, >>>>> however the USB2 one >>>>> (USB1 GDSC in code) it is stuck off and USB2 port will fail due to this: >>>>> 1.607531] ------------[ cut here ]------------ >>>>> [ 1.607559] usb1_gdsc status stuck at 'off' >>>>> [ 1.607592] WARNING: CPU: 0 PID: 35 at gdsc_toggle_logic+0x16c/0x174 >>>>> [ 1.615120] Modules linked in: >>>> Can you dump GDSCR (the entire 32-bit register) at boot and when toggling? >>> >>> Sure, here it is: >>> [ 0.023760] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3e078 val: 0x8222004 init >>> [ 0.023782] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: 0x8222004 init >>> [ 0.988626] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: >>> 0x8282000 before toggle >>> [ 1.202506] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: >>> 0x8282000 after toggle >>> [ 1.207208] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3e078 val: >>> 0xa0282000 before toggle >> Any chance >> >> .en_few_wait_val = 0x2 >> >> (turning BIT(19) into BIT(17)) >> >> will make a difference? > > Sadly, it makes no difference and GDSC status bit newer comes up which is > rather weird as USB0 one seems to work just fine. What if you add clk_ignore_unused? Konrad
On Tue, 7 Nov 2023 at 22:51, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: > > > > On 10/31/23 10:01, Robert Marko wrote: > > On Mon, 30 Oct 2023 at 22:12, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: > >> > >> On 30.10.2023 21:37, Robert Marko wrote: > >>> On Mon, 30 Oct 2023 at 20:37, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: > >>>> > >>>> On 29.10.2023 12:04, Robert Marko wrote: > >>>>> On Wed, 25 Oct 2023 at 12:45, Robert Marko <robimarko@gmail.com> wrote: > >>>>>> > >>>>>> IPQ6018 has GDSC-s for each of the USB ports, so lets define them as such > >>>>>> and drop the curent code that is de-asserting the USB GDSC-s as part of > >>>>>> the GCC probe. > >>>>>> > >>>>>> Signed-off-by: Robert Marko <robimarko@gmail.com> > >>>>> > >>>>> Unfortunately, after testing on multiple devices I hit the same GDSC > >>>>> issue I had a long time ago > >>>>> that was the reason I did not send this upstream. > >>>>> It seems that USB3 port GDSC (USB0 GDSC in code) works just fine, > >>>>> however the USB2 one > >>>>> (USB1 GDSC in code) it is stuck off and USB2 port will fail due to this: > >>>>> 1.607531] ------------[ cut here ]------------ > >>>>> [ 1.607559] usb1_gdsc status stuck at 'off' > >>>>> [ 1.607592] WARNING: CPU: 0 PID: 35 at gdsc_toggle_logic+0x16c/0x174 > >>>>> [ 1.615120] Modules linked in: > >>>> Can you dump GDSCR (the entire 32-bit register) at boot and when toggling? > >>> > >>> Sure, here it is: > >>> [ 0.023760] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3e078 val: 0x8222004 init > >>> [ 0.023782] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: 0x8222004 init > >>> [ 0.988626] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: > >>> 0x8282000 before toggle > >>> [ 1.202506] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: > >>> 0x8282000 after toggle > >>> [ 1.207208] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3e078 val: > >>> 0xa0282000 before toggle > >> Any chance > >> > >> .en_few_wait_val = 0x2 > >> > >> (turning BIT(19) into BIT(17)) > >> > >> will make a difference? > > > > Sadly, it makes no difference and GDSC status bit newer comes up which is > > rather weird as USB0 one seems to work just fine. > What if you add clk_ignore_unused? To the USB1 master clock or? There is definitively something broken regarding the GDSC as GDSC_STATE bits (30-27) change from 0 to something on the USB0 GDSC but on GDSC1 they are 0 even after SW_OVERRIDE BIT(2) is set to 1, and the POWER BIT(31) newer changes to 1. However, if you manually set BIT(2) to 1 then the USB1 master clock can come up so GDSC seems to work. USB1 (The USB2.0 HS) port is still broken after this if USB mass storage is used but that was present before the GDSC changes as well and I still need to figure out which quirk is missing for this. Regards, Robert > > Konrad
On 11.11.2023 12:28, Robert Marko wrote: > On Tue, 7 Nov 2023 at 22:51, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: >> >> >> >> On 10/31/23 10:01, Robert Marko wrote: >>> On Mon, 30 Oct 2023 at 22:12, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: >>>> >>>> On 30.10.2023 21:37, Robert Marko wrote: >>>>> On Mon, 30 Oct 2023 at 20:37, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: >>>>>> >>>>>> On 29.10.2023 12:04, Robert Marko wrote: >>>>>>> On Wed, 25 Oct 2023 at 12:45, Robert Marko <robimarko@gmail.com> wrote: >>>>>>>> >>>>>>>> IPQ6018 has GDSC-s for each of the USB ports, so lets define them as such >>>>>>>> and drop the curent code that is de-asserting the USB GDSC-s as part of >>>>>>>> the GCC probe. >>>>>>>> >>>>>>>> Signed-off-by: Robert Marko <robimarko@gmail.com> >>>>>>> >>>>>>> Unfortunately, after testing on multiple devices I hit the same GDSC >>>>>>> issue I had a long time ago >>>>>>> that was the reason I did not send this upstream. >>>>>>> It seems that USB3 port GDSC (USB0 GDSC in code) works just fine, >>>>>>> however the USB2 one >>>>>>> (USB1 GDSC in code) it is stuck off and USB2 port will fail due to this: >>>>>>> 1.607531] ------------[ cut here ]------------ >>>>>>> [ 1.607559] usb1_gdsc status stuck at 'off' >>>>>>> [ 1.607592] WARNING: CPU: 0 PID: 35 at gdsc_toggle_logic+0x16c/0x174 >>>>>>> [ 1.615120] Modules linked in: >>>>>> Can you dump GDSCR (the entire 32-bit register) at boot and when toggling? >>>>> >>>>> Sure, here it is: >>>>> [ 0.023760] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3e078 val: 0x8222004 init >>>>> [ 0.023782] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: 0x8222004 init >>>>> [ 0.988626] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: >>>>> 0x8282000 before toggle >>>>> [ 1.202506] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: >>>>> 0x8282000 after toggle >>>>> [ 1.207208] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3e078 val: >>>>> 0xa0282000 before toggle >>>> Any chance >>>> >>>> .en_few_wait_val = 0x2 >>>> >>>> (turning BIT(19) into BIT(17)) >>>> >>>> will make a difference? >>> >>> Sadly, it makes no difference and GDSC status bit newer comes up which is >>> rather weird as USB0 one seems to work just fine. >> What if you add clk_ignore_unused? > > To the USB1 master clock or? That's a command line parameter, effectively setting it on all clks. > > There is definitively something broken regarding the GDSC as > GDSC_STATE bits (30-27) > change from 0 to something on the USB0 GDSC but on GDSC1 they are 0 even after > SW_OVERRIDE BIT(2) is set to 1, and the POWER BIT(31) newer changes to 1. > > However, if you manually set BIT(2) to 1 then the USB1 master clock > can come up so > GDSC seems to work. > USB1 (The USB2.0 HS) port is still broken after this if USB mass storage is used > but that was present before the GDSC changes as well and I still need > to figure out > which quirk is missing for this. Please try clk_ignore_unused and see if toggling the GDSC is still broken. Konrad
On Mon, 13 Nov 2023 at 12:58, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: > > On 11.11.2023 12:28, Robert Marko wrote: > > On Tue, 7 Nov 2023 at 22:51, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: > >> > >> > >> > >> On 10/31/23 10:01, Robert Marko wrote: > >>> On Mon, 30 Oct 2023 at 22:12, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: > >>>> > >>>> On 30.10.2023 21:37, Robert Marko wrote: > >>>>> On Mon, 30 Oct 2023 at 20:37, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: > >>>>>> > >>>>>> On 29.10.2023 12:04, Robert Marko wrote: > >>>>>>> On Wed, 25 Oct 2023 at 12:45, Robert Marko <robimarko@gmail.com> wrote: > >>>>>>>> > >>>>>>>> IPQ6018 has GDSC-s for each of the USB ports, so lets define them as such > >>>>>>>> and drop the curent code that is de-asserting the USB GDSC-s as part of > >>>>>>>> the GCC probe. > >>>>>>>> > >>>>>>>> Signed-off-by: Robert Marko <robimarko@gmail.com> > >>>>>>> > >>>>>>> Unfortunately, after testing on multiple devices I hit the same GDSC > >>>>>>> issue I had a long time ago > >>>>>>> that was the reason I did not send this upstream. > >>>>>>> It seems that USB3 port GDSC (USB0 GDSC in code) works just fine, > >>>>>>> however the USB2 one > >>>>>>> (USB1 GDSC in code) it is stuck off and USB2 port will fail due to this: > >>>>>>> 1.607531] ------------[ cut here ]------------ > >>>>>>> [ 1.607559] usb1_gdsc status stuck at 'off' > >>>>>>> [ 1.607592] WARNING: CPU: 0 PID: 35 at gdsc_toggle_logic+0x16c/0x174 > >>>>>>> [ 1.615120] Modules linked in: > >>>>>> Can you dump GDSCR (the entire 32-bit register) at boot and when toggling? > >>>>> > >>>>> Sure, here it is: > >>>>> [ 0.023760] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3e078 val: 0x8222004 init > >>>>> [ 0.023782] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: 0x8222004 init > >>>>> [ 0.988626] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: > >>>>> 0x8282000 before toggle > >>>>> [ 1.202506] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: > >>>>> 0x8282000 after toggle > >>>>> [ 1.207208] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3e078 val: > >>>>> 0xa0282000 before toggle > >>>> Any chance > >>>> > >>>> .en_few_wait_val = 0x2 > >>>> > >>>> (turning BIT(19) into BIT(17)) > >>>> > >>>> will make a difference? > >>> > >>> Sadly, it makes no difference and GDSC status bit newer comes up which is > >>> rather weird as USB0 one seems to work just fine. > >> What if you add clk_ignore_unused? > > > > To the USB1 master clock or? > That's a command line parameter, effectively setting it on all clks. Oh that, I understand now. > > > > > There is definitively something broken regarding the GDSC as > > GDSC_STATE bits (30-27) > > change from 0 to something on the USB0 GDSC but on GDSC1 they are 0 even after > > SW_OVERRIDE BIT(2) is set to 1, and the POWER BIT(31) newer changes to 1. > > > > However, if you manually set BIT(2) to 1 then the USB1 master clock > > can come up so > > GDSC seems to work. > > USB1 (The USB2.0 HS) port is still broken after this if USB mass storage is used > > but that was present before the GDSC changes as well and I still need > > to figure out > > which quirk is missing for this. > Please try clk_ignore_unused and see if toggling the GDSC is still broken. Sadly, passing clk_ignore_unused in the bootargs doesn't help, GDSC is still stuck off. Regards, Robert > > Konrad
On 11/13/23 13:50, Robert Marko wrote: > On Mon, 13 Nov 2023 at 12:58, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: >> >> On 11.11.2023 12:28, Robert Marko wrote: >>> On Tue, 7 Nov 2023 at 22:51, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: >>>> >>>> >>>> >>>> On 10/31/23 10:01, Robert Marko wrote: >>>>> On Mon, 30 Oct 2023 at 22:12, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: >>>>>> >>>>>> On 30.10.2023 21:37, Robert Marko wrote: >>>>>>> On Mon, 30 Oct 2023 at 20:37, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: >>>>>>>> >>>>>>>> On 29.10.2023 12:04, Robert Marko wrote: >>>>>>>>> On Wed, 25 Oct 2023 at 12:45, Robert Marko <robimarko@gmail.com> wrote: >>>>>>>>>> >>>>>>>>>> IPQ6018 has GDSC-s for each of the USB ports, so lets define them as such >>>>>>>>>> and drop the curent code that is de-asserting the USB GDSC-s as part of >>>>>>>>>> the GCC probe. >>>>>>>>>> >>>>>>>>>> Signed-off-by: Robert Marko <robimarko@gmail.com> >>>>>>>>> >>>>>>>>> Unfortunately, after testing on multiple devices I hit the same GDSC >>>>>>>>> issue I had a long time ago >>>>>>>>> that was the reason I did not send this upstream. >>>>>>>>> It seems that USB3 port GDSC (USB0 GDSC in code) works just fine, >>>>>>>>> however the USB2 one >>>>>>>>> (USB1 GDSC in code) it is stuck off and USB2 port will fail due to this: >>>>>>>>> 1.607531] ------------[ cut here ]------------ >>>>>>>>> [ 1.607559] usb1_gdsc status stuck at 'off' >>>>>>>>> [ 1.607592] WARNING: CPU: 0 PID: 35 at gdsc_toggle_logic+0x16c/0x174 >>>>>>>>> [ 1.615120] Modules linked in: >>>>>>>> Can you dump GDSCR (the entire 32-bit register) at boot and when toggling? >>>>>>> >>>>>>> Sure, here it is: >>>>>>> [ 0.023760] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3e078 val: 0x8222004 init >>>>>>> [ 0.023782] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: 0x8222004 init >>>>>>> [ 0.988626] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: >>>>>>> 0x8282000 before toggle >>>>>>> [ 1.202506] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: >>>>>>> 0x8282000 after toggle >>>>>>> [ 1.207208] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3e078 val: >>>>>>> 0xa0282000 before toggle >>>>>> Any chance >>>>>> >>>>>> .en_few_wait_val = 0x2 >>>>>> >>>>>> (turning BIT(19) into BIT(17)) >>>>>> >>>>>> will make a difference? >>>>> >>>>> Sadly, it makes no difference and GDSC status bit newer comes up which is >>>>> rather weird as USB0 one seems to work just fine. >>>> What if you add clk_ignore_unused? >>> >>> To the USB1 master clock or? >> That's a command line parameter, effectively setting it on all clks. > > Oh that, I understand now. > >> >>> >>> There is definitively something broken regarding the GDSC as >>> GDSC_STATE bits (30-27) >>> change from 0 to something on the USB0 GDSC but on GDSC1 they are 0 even after >>> SW_OVERRIDE BIT(2) is set to 1, and the POWER BIT(31) newer changes to 1. >>> >>> However, if you manually set BIT(2) to 1 then the USB1 master clock >>> can come up so >>> GDSC seems to work. >>> USB1 (The USB2.0 HS) port is still broken after this if USB mass storage is used >>> but that was present before the GDSC changes as well and I still need >>> to figure out >>> which quirk is missing for this. >> Please try clk_ignore_unused and see if toggling the GDSC is still broken. > > Sadly, passing clk_ignore_unused in the bootargs doesn't help, GDSC is > still stuck off. Hm, so it looks like there's no clock dependency for this GDSC.. Maybe some regulator needs to be turned on? Can you try to add regulator-always-on to all vregs and retry? (and keep clk_ignore_unused to be sure) Konrad
On Wed, 15 Nov 2023 at 17:22, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: > > > > On 11/13/23 13:50, Robert Marko wrote: > > On Mon, 13 Nov 2023 at 12:58, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: > >> > >> On 11.11.2023 12:28, Robert Marko wrote: > >>> On Tue, 7 Nov 2023 at 22:51, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: > >>>> > >>>> > >>>> > >>>> On 10/31/23 10:01, Robert Marko wrote: > >>>>> On Mon, 30 Oct 2023 at 22:12, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: > >>>>>> > >>>>>> On 30.10.2023 21:37, Robert Marko wrote: > >>>>>>> On Mon, 30 Oct 2023 at 20:37, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: > >>>>>>>> > >>>>>>>> On 29.10.2023 12:04, Robert Marko wrote: > >>>>>>>>> On Wed, 25 Oct 2023 at 12:45, Robert Marko <robimarko@gmail.com> wrote: > >>>>>>>>>> > >>>>>>>>>> IPQ6018 has GDSC-s for each of the USB ports, so lets define them as such > >>>>>>>>>> and drop the curent code that is de-asserting the USB GDSC-s as part of > >>>>>>>>>> the GCC probe. > >>>>>>>>>> > >>>>>>>>>> Signed-off-by: Robert Marko <robimarko@gmail.com> > >>>>>>>>> > >>>>>>>>> Unfortunately, after testing on multiple devices I hit the same GDSC > >>>>>>>>> issue I had a long time ago > >>>>>>>>> that was the reason I did not send this upstream. > >>>>>>>>> It seems that USB3 port GDSC (USB0 GDSC in code) works just fine, > >>>>>>>>> however the USB2 one > >>>>>>>>> (USB1 GDSC in code) it is stuck off and USB2 port will fail due to this: > >>>>>>>>> 1.607531] ------------[ cut here ]------------ > >>>>>>>>> [ 1.607559] usb1_gdsc status stuck at 'off' > >>>>>>>>> [ 1.607592] WARNING: CPU: 0 PID: 35 at gdsc_toggle_logic+0x16c/0x174 > >>>>>>>>> [ 1.615120] Modules linked in: > >>>>>>>> Can you dump GDSCR (the entire 32-bit register) at boot and when toggling? > >>>>>>> > >>>>>>> Sure, here it is: > >>>>>>> [ 0.023760] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3e078 val: 0x8222004 init > >>>>>>> [ 0.023782] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: 0x8222004 init > >>>>>>> [ 0.988626] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: > >>>>>>> 0x8282000 before toggle > >>>>>>> [ 1.202506] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3f078 val: > >>>>>>> 0x8282000 after toggle > >>>>>>> [ 1.207208] qcom,gcc-ipq6018 1800000.gcc: reg: 0x3e078 val: > >>>>>>> 0xa0282000 before toggle > >>>>>> Any chance > >>>>>> > >>>>>> .en_few_wait_val = 0x2 > >>>>>> > >>>>>> (turning BIT(19) into BIT(17)) > >>>>>> > >>>>>> will make a difference? > >>>>> > >>>>> Sadly, it makes no difference and GDSC status bit newer comes up which is > >>>>> rather weird as USB0 one seems to work just fine. > >>>> What if you add clk_ignore_unused? > >>> > >>> To the USB1 master clock or? > >> That's a command line parameter, effectively setting it on all clks. > > > > Oh that, I understand now. > > > >> > >>> > >>> There is definitively something broken regarding the GDSC as > >>> GDSC_STATE bits (30-27) > >>> change from 0 to something on the USB0 GDSC but on GDSC1 they are 0 even after > >>> SW_OVERRIDE BIT(2) is set to 1, and the POWER BIT(31) newer changes to 1. > >>> > >>> However, if you manually set BIT(2) to 1 then the USB1 master clock > >>> can come up so > >>> GDSC seems to work. > >>> USB1 (The USB2.0 HS) port is still broken after this if USB mass storage is used > >>> but that was present before the GDSC changes as well and I still need > >>> to figure out > >>> which quirk is missing for this. > >> Please try clk_ignore_unused and see if toggling the GDSC is still broken. > > > > Sadly, passing clk_ignore_unused in the bootargs doesn't help, GDSC is > > still stuck off. > Hm, so it looks like there's no clock dependency for this GDSC.. > > Maybe some regulator needs to be turned on? > > Can you try to add regulator-always-on to all vregs and retry? > (and keep clk_ignore_unused to be sure) Sorry for the ultra late reply, currently there is just CPU regulator described via RPM. I will look into describing the VQMMC and others I can find but I doubt it will change anything as no regulators are getting disabled currently. Regards, Robert > > Konrad
diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig index ad1acd9b7426b..2aefa2231b51b 100644 --- a/drivers/clk/qcom/Kconfig +++ b/drivers/clk/qcom/Kconfig @@ -164,6 +164,7 @@ config IPQ_GCC_5332 config IPQ_GCC_6018 tristate "IPQ6018 Global Clock Controller" + select QCOM_GDSC help Support for global clock controller on ipq6018 devices. Say Y if you want to use peripheral devices such as UART, SPI, diff --git a/drivers/clk/qcom/gcc-ipq6018.c b/drivers/clk/qcom/gcc-ipq6018.c index cc20a16d8973c..9d5ee2ac012a1 100644 --- a/drivers/clk/qcom/gcc-ipq6018.c +++ b/drivers/clk/qcom/gcc-ipq6018.c @@ -23,6 +23,7 @@ #include "clk-alpha-pll.h" #include "clk-regmap-divider.h" #include "clk-regmap-mux.h" +#include "gdsc.h" #include "reset.h" enum { @@ -4691,6 +4692,22 @@ static struct clk_branch gcc_dcc_clk = { }, }; +static struct gdsc usb0_gdsc = { + .gdscr = 0x3e078, + .pd = { + .name = "usb0_gdsc", + }, + .pwrsts = PWRSTS_OFF_ON, +}; + +static struct gdsc usb1_gdsc = { + .gdscr = 0x3f078, + .pd = { + .name = "usb1_gdsc", + }, + .pwrsts = PWRSTS_OFF_ON, +}; + static const struct alpha_pll_config ubi32_pll_config = { .l = 0x3e, .alpha = 0x6667, @@ -5138,6 +5155,11 @@ static const struct qcom_reset_map gcc_ipq6018_resets[] = { [GCC_Q6_AXIM_ARES] = {0x59110, 4}, }; +static struct gdsc *gcc_ipq6018_gdscs[] = { + [USB0_GDSC] = &usb0_gdsc, + [USB1_GDSC] = &usb1_gdsc, +}; + static const struct of_device_id gcc_ipq6018_match_table[] = { { .compatible = "qcom,gcc-ipq6018" }, { } @@ -5160,6 +5182,8 @@ static const struct qcom_cc_desc gcc_ipq6018_desc = { .num_resets = ARRAY_SIZE(gcc_ipq6018_resets), .clk_hws = gcc_ipq6018_hws, .num_clk_hws = ARRAY_SIZE(gcc_ipq6018_hws), + .gdscs = gcc_ipq6018_gdscs, + .num_gdscs = ARRAY_SIZE(gcc_ipq6018_gdscs), }; static int gcc_ipq6018_probe(struct platform_device *pdev) @@ -5170,15 +5194,6 @@ static int gcc_ipq6018_probe(struct platform_device *pdev) if (IS_ERR(regmap)) return PTR_ERR(regmap); - /* Disable SW_COLLAPSE for USB0 GDSCR */ - regmap_update_bits(regmap, 0x3e078, BIT(0), 0x0); - /* Enable SW_OVERRIDE for USB0 GDSCR */ - regmap_update_bits(regmap, 0x3e078, BIT(2), BIT(2)); - /* Disable SW_COLLAPSE for USB1 GDSCR */ - regmap_update_bits(regmap, 0x3f078, BIT(0), 0x0); - /* Enable SW_OVERRIDE for USB1 GDSCR */ - regmap_update_bits(regmap, 0x3f078, BIT(2), BIT(2)); - /* SW Workaround for UBI Huyara PLL */ regmap_update_bits(regmap, 0x2501c, BIT(26), BIT(26));