Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3297311pxj; Mon, 7 Jun 2021 07:20:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwc+ueUZyhYhrVgXbKFfGvZ14/T10+6bnsB3Y64q8LSTED28HiRFrOG8oE7Wgv4UOWEP9p X-Received: by 2002:a05:6402:520f:: with SMTP id s15mr1511198edd.125.1623075642361; Mon, 07 Jun 2021 07:20:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623075642; cv=none; d=google.com; s=arc-20160816; b=BUod6AtUlAIcUYOp1lhZOXj6lq07eJg/zaYsVDVsjK//k2MGb8Rng08kywl2n5acMe qZSuIiPvpPyGDif8jGGVqJQa4ZHJVem/2l/4hE0PUDtNiS/4XRJAq2/CINDvxFYbvTtr MV0Gm2eBaNcqDVEpG9RHDwg4LYMvHNsuq+rp9tBFDWnNVbPAPWe1z3+6IaBG+HikZj+V zfcg4sAG4fknnNUuqFF+1NfP4biJZvertfauQfVmtwp4heFzitTuj5NZB4TRu0t6Z7jQ Ohipp3lB7MTpQDcCJbzlOf/YpLqBVdP2tbFIi5kmf7dcWvQSHsfnLy/1cB+mkS2w92r0 654Q== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=Re7pS3VsAwPx/zM57YqQYXxT+BEmjVO3Oofpef6tqnw=; b=Qwo4xk4MmsA2uZCg1PZUGXRY/3mjP42AL4SRoVdm2ZZnIlktl26IO3KzmxDMjj5wyn QZ1HKSAd7fUozkYdfmo+af2CkcF1Oj09xkENI/lqWjiDxao6cTZSBmIwFEILql7C/Rew I6ob2j/eMZ6Gk8rhNDz2gdvl2HDLGxTdyWfMPwi0D8/rAf5VT6IZJrc23MZ+wahOoReq 5jicrnKQLRk4oJZL4k9YWywl89QVuIuTP0xJhd2Xm97sNHM2YvLV/gET8+1sLklmfuAc ASZ/Wlv3VIvN3Mbyh+jraZ5+au9FG5iJZptPozIDd9COpURnBop9gV1KAtuHS9ZzpORd SYIw== ARC-Authentication-Results: i=1; mx.google.com; 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=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y4si12941584edi.355.2021.06.07.07.20.16; Mon, 07 Jun 2021 07:20:42 -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; 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=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230340AbhFGOTt (ORCPT + 99 others); Mon, 7 Jun 2021 10:19:49 -0400 Received: from foss.arm.com ([217.140.110.172]:34402 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230212AbhFGOTr (ORCPT ); Mon, 7 Jun 2021 10:19:47 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DB1116D; Mon, 7 Jun 2021 07:17:54 -0700 (PDT) Received: from slackpad.fritz.box (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B5ECB3F694; Mon, 7 Jun 2021 07:17:52 -0700 (PDT) Date: Mon, 7 Jun 2021 15:17:42 +0100 From: Andre Przywara To: Maxime Ripard Cc: Chen-Yu Tsai , Jernej Skrabec , Rob Herring , Icenowy Zheng , Samuel Holland , Ondrej Jirman , linux-arm-kernel@lists.infradead.org, linux-sunxi@googlegroups.com, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Kishon Vijay Abraham I , Vinod Koul , linux-phy@lists.infradead.org, linux-usb@vger.kernel.org Subject: Re: [PATCH v6 12/17] phy: sun4i-usb: Introduce port2 SIDDQ quirk Message-ID: <20210607151742.2f05ff95@slackpad.fritz.box> In-Reply-To: <20210607132255.7fa75a7k7ud2g7ux@gilmour> References: <20210519104152.21119-1-andre.przywara@arm.com> <20210519104152.21119-13-andre.przywara@arm.com> <20210524115946.jwsasjbr3biyixhz@gilmour> <20210525122901.778bfccd@slackpad.fritz.box> <20210607132255.7fa75a7k7ud2g7ux@gilmour> Organization: Arm Ltd. X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.31; x86_64-slackware-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 7 Jun 2021 15:22:55 +0200 Maxime Ripard wrote: Hi Maxime, > On Tue, May 25, 2021 at 12:29:01PM +0100, Andre Przywara wrote: > > On Mon, 24 May 2021 13:59:46 +0200 > > Maxime Ripard wrote: > > > > Hi Maxime, > > > > > On Wed, May 19, 2021 at 11:41:47AM +0100, Andre Przywara wrote: > > > > At least the Allwinner H616 SoC requires a weird quirk to make most > > > > USB PHYs work: Only port2 works out of the box, but all other ports > > > > need some help from this port2 to work correctly: The CLK_BUS_PHY2 and > > > > RST_USB_PHY2 clock and reset need to be enabled, and the SIDDQ bit in > > > > the PMU PHY control register needs to be cleared. For this register to > > > > be accessible, CLK_BUS_ECHI2 needs to be ungated. Don't ask .... > > > > > > > > Instead of disguising this as some generic feature, do exactly that > > > > in our PHY init: > > > > If the quirk bit is set, and we initialise a PHY other than PHY2, ungate > > > > this one special clock, and clear the SIDDQ bit. We can pull in the > > > > other required clocks via the DT. > > > > > > > > Signed-off-by: Andre Przywara > > > > > > What is this SIDDQ bit doing exactly? > > > > I probably know as much as you do, but as Jernej pointed out, in some > > Rockchip code it's indeed documented as some analogue PHY supply switch: > > ($ git grep -i siddq drivers/phy/rockchip) > > > > In fact we had this pin/bit for ages, it was just hidden as BIT(1) in > > our infamous PMU_UNK1 register. Patch 10/17 drags that into the light. > > Ok > > > > I guess we could also expose this using a power-domain if it's relevant? > > > > Mmmh, interesting idea. So are you thinking about registering a genpd > > provider in sun4i_usb_phy_probe(), then having a power-domains property > > in the ehci/ohci nodes, pointing to the PHY node? And if yes, should > > the provider be a subnode of the USB PHY node, with a separate > > compatible? That sounds a bit more involved, but would have the > > advantage of allowing us to specify the resets and clocks from PHY2 > > there, and would look a bit cleaner than hacking them into the > > other EHCI/OHCI nodes. > > I'm not sure we need a separate device node, we could just register the > phy driver as a genpd provider, and then with an arg (so with > of_genpd_add_provider_onecell?) the index of the USB controller we want > to power up. Yeah, I figured that myself meanwhile ;-) I now have a fairly nice implementation, which does away with the extra clocks and resets from the EHCI/OHCI nodes, and just adds one extra clock to the PHY node. The rest is power domains properties. > > I would not touch the existing SoCs (even though it seems to apply to > > them as well, just not in the exact same way), but I can give it a > > try for the H616. It seems like the other SIDDQ bits (in the other > > PHYs) are still needed for operation, but the PD provide could actually > > take care of this as well. > > > > Does that make sense or is this a bit over the top for just clearing an > > extra bit? > > Using what I described above should be fairly simple, so if we can fit > in an available and relevant abstraction, yeah, I guess :) Thanks! I will post what I have, just need to find some solution for the RTC clock bits. Cheers, Andre