Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp466190pxv; Thu, 1 Jul 2021 02:11:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJ9f0xLYkBsXv/MM7iZutgq29xLdddLRjWUdET9VXretK5l4GG72FUZcOz7QghF38KsIVU X-Received: by 2002:a92:8e45:: with SMTP id k5mr30537968ilh.116.1625130700205; Thu, 01 Jul 2021 02:11:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625130700; cv=none; d=google.com; s=arc-20160816; b=MDOupDLAV07SEC3xRraR57JOT8Y6455zvK2I+On80FfUBiD+3i1V2yhsANrjvJ/S4E BQpv6qy9hJMeq5HvibHr584yR8Ph6Iv4b2V82r42ORU0SICnK3TvXpSuWRyMTVqEB2h4 XO1ulULSpLxKSIjZTvTp3bTVfwCD3ajkMOxI/gaDkU89ZguS5MPSVNkFlTJrrzIPUzdM dF4GPIyYMtG5zyfZFKIkiDN3C31poC7G/d32Wcfho+n55bwZdHSvP0KIQ0Vs0pz/9C6X jhabzu4ERbAbbYnqA+xjS6PHknvO7WTARuNZzaUrYXWjXPmvpaz0+szIhP3wZyla5FVI Sapw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=sIqUpSy3WHJ9LFXbxhxyvcyP769k+GgXVkD4XIt1npQ=; b=yVnYeDJ4/oLPB+RgqFVKUVimY4GyssGFrxxwOmmqASok49XqH4Pw90DRomKAyHIiZS b3jM6AyDIkHB3ud1xl5DuNzPm9B/LK1LGfKp2Rby2kFjnOiJO/fJxOD2jyVQeow5bgBL fqXlQoOQBToqjvLQYEy2aSuF64LCAKmQ9j3neHm7N42nX3+piUdQ3ggDeL2PBfbzfkca 8Jvwv+V6jZ8JSDDJJ/QVWFGO+KZRhKvU8B+rVYY/79rLlOt8oMdKCrtuBevtXSlVUCZA HnCOHPxfcnFUHtmAF7FZzrZB/IA6RLPUbvUbLvQDw0WE6s+X5pUBszHzXCPLqr58po6s lxZg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l20si3998761ilk.149.2021.07.01.02.11.27; Thu, 01 Jul 2021 02:11:40 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235741AbhGAJKH (ORCPT + 99 others); Thu, 1 Jul 2021 05:10:07 -0400 Received: from mail-ua1-f45.google.com ([209.85.222.45]:35600 "EHLO mail-ua1-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235088AbhGAJKH (ORCPT ); Thu, 1 Jul 2021 05:10:07 -0400 Received: by mail-ua1-f45.google.com with SMTP id n61so2196631uan.2; Thu, 01 Jul 2021 02:07:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=sIqUpSy3WHJ9LFXbxhxyvcyP769k+GgXVkD4XIt1npQ=; b=fC8ODdPVYjPREdI8THrYL44SFYEIxCc4X0Kuk8IFNYjUeCsCXJ8+40YGdOEEXlOFWw v8fp1ZM4PwyOhOXYjI2AW4IZkf6EXZOrY/r/CsKGxG53ibDEiL8G18m7PfSSpPDLO0hK kMly2if8eHYqD+pYsTmLkp5JGyJQ6Sf6k5JGP9GHyPvvmzuu7HwRnnEFsoWEbCrKal0+ QRHE/hKVL3Zpr13MJSSG3GTRoPwfHKfElyxN9Zv+vOOhyWHHtcbxyrDXaVHFRFvJYZtW kilK62qy9M0q8FOS3geWNVtPQF+W2oxbsyesLTDtLXxLj8GDu8j7huEGQ9nNvOUtvl4b 1WdQ== X-Gm-Message-State: AOAM533nzpXIjobhj3VRnrKO1iKPxBuShRPI2iM8AbTioY+fOkT3FH3t +fwqT0Y3a9VeVBCEKiWVimEufMwoXrNuicBSbybdeVMz0Z+IZg== X-Received: by 2002:ab0:484b:: with SMTP id c11mr38743288uad.100.1625130456571; Thu, 01 Jul 2021 02:07:36 -0700 (PDT) MIME-Version: 1.0 References: <20210630173042.186394-1-aford173@gmail.com> <20210630173042.186394-2-aford173@gmail.com> In-Reply-To: <20210630173042.186394-2-aford173@gmail.com> From: Geert Uytterhoeven Date: Thu, 1 Jul 2021 11:07:25 +0200 Message-ID: Subject: Re: [PATCH 2/3] usb: renesas_usbhs: Enable support for more than two clks To: Adam Ford Cc: USB list , Adam Ford-BE , Greg Kroah-Hartman , Rob Herring , Magnus Damm , Yoshihiro Shimoda , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux Kernel Mailing List , Linux-Renesas Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Adam, Thanks for your patch! On Wed, Jun 30, 2021 at 7:30 PM Adam Ford wrote: > The RZ/G2 boards expect there to be an external clock reference for > USBHS controller, but this could be set by a programmable clock. > For those devices using a programmable clock, there need to be two > additional clocks beyond the internal reference clocks: > > rcar-usb2-clock-sel to specify we using an external clock, and > the external reference clock itself. Something is missing in the above sentence? > > Make this driver dynamically enable all the clocks assigned to it > instead of only enabling the first one or two clocks. > > Signed-off-by: Adam Ford > > diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c > index 3af91b2b8f76..255e4bd68ed3 100644 > --- a/drivers/usb/renesas_usbhs/common.c > +++ b/drivers/usb/renesas_usbhs/common.c > @@ -297,6 +297,8 @@ static bool usbhsc_is_multi_clks(struct usbhs_priv *priv) > > static int usbhsc_clk_get(struct device *dev, struct usbhs_priv *priv) > { > + unsigned int i; > + > if (!usbhsc_is_multi_clks(priv)) > return 0; > > @@ -309,11 +311,13 @@ static int usbhsc_clk_get(struct device *dev, struct usbhs_priv *priv) > * To backward compatibility with old DT, this driver checks the return > * value if it's -ENOENT or not. > */ > - priv->clks[1] = of_clk_get(dev_of_node(dev), 1); > - if (PTR_ERR(priv->clks[1]) == -ENOENT) > - priv->clks[1] = NULL; > - else if (IS_ERR(priv->clks[1])) > - return PTR_ERR(priv->clks[1]); > + for (i = 1; i < ARRAY_SIZE(priv->clks); i++) { > + priv->clks[1] = of_clk_get(dev->of_node, i); > + if (PTR_ERR(priv->clks[i]) == -ENOENT) > + priv->clks[i] = NULL; > + else if (IS_ERR(priv->clks[i])) > + return PTR_ERR(priv->clks[i]); > + } This is identical to the current code, as ARRAY_SIZE(priv->clks) == 2. Probably you wanted to increase usbhs_priv.clks[], too? Does it make sense to start using the clk_bulk*() API? > > return 0; > } Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds