From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 73D1F3FE59 for ; Thu, 23 Nov 2023 17:22:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="XEnd+Al+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0C0EC433D9; Thu, 23 Nov 2023 17:22:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1700760159; bh=2D3aUhEExlMCoGyBeeeacQjJUG+XraZinasPd6JBJW0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XEnd+Al+R2lAela/niSU367F4vosKZr3w25UtMD2C+vBQ7mtTDqd6shdG3Th7MK1w sEV0HrmSPBJkl17Gsn1VN95x1gItdZsCpWWxFTF5KUTYtDZfENPNPemsasuvv+Wi9R 6sV80XlhTRfQajBK+lGsKWT3F2ieHOEIOO76zu5Q= Date: Thu, 23 Nov 2023 13:55:57 +0000 From: Greg Kroah-Hartman To: Frieder Schrempf Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Matthias Kaehlcke , Frieder Schrempf , Anand Moon , Benjamin Bara , Icenowy Zheng , Rob Herring , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= Subject: Re: [PATCH 1/2] usb: misc: onboard_usb_hub: Add support for clock input Message-ID: <2023112329-augmented-ecology-0753@gregkh> References: <20231123134728.709533-1-frieder@fris.de> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231123134728.709533-1-frieder@fris.de> On Thu, Nov 23, 2023 at 02:47:20PM +0100, Frieder Schrempf wrote: > From: Frieder Schrempf > > Most onboard USB hubs have a dedicated crystal oscillator but on some > boards the clock signal for the hub is provided by the SoC. > > In order to support this, we add the possibility of specifying a > clock in the devicetree that gets enabled/disabled when the hub > is powered up/down. > > Signed-off-by: Frieder Schrempf > --- > drivers/usb/misc/onboard_usb_hub.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/drivers/usb/misc/onboard_usb_hub.c b/drivers/usb/misc/onboard_usb_hub.c > index a341b2fbb7b44..e710e3c82ba9b 100644 > --- a/drivers/usb/misc/onboard_usb_hub.c > +++ b/drivers/usb/misc/onboard_usb_hub.c > @@ -5,6 +5,7 @@ > * Copyright (c) 2022, Google LLC > */ > > +#include > #include > #include > #include > @@ -60,12 +61,19 @@ struct onboard_hub { > bool going_away; > struct list_head udev_list; > struct mutex lock; > + struct clk *clk; > }; > > static int onboard_hub_power_on(struct onboard_hub *hub) > { > int err; > > + err = clk_prepare_enable(hub->clk); > + if (err) { > + dev_err(hub->dev, "failed to enable clock: %d\n", err); > + return err; > + } But what happens if clk is not set here? And doesn't clk_prepare_enable() print out a message if it fails? thanks, greg k-h