From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4FD1C61D97 for ; Thu, 23 Nov 2023 17:22:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345438AbjKWRWg (ORCPT ); Thu, 23 Nov 2023 12:22:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229462AbjKWRWc (ORCPT ); Thu, 23 Nov 2023 12:22:32 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AD68D62 for ; Thu, 23 Nov 2023 09:22:39 -0800 (PST) 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231123134728.709533-1-frieder@fris.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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