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 A60CBC43219 for ; Thu, 10 Nov 2022 08:02:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232927AbiKJICj (ORCPT ); Thu, 10 Nov 2022 03:02:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232964AbiKJICY (ORCPT ); Thu, 10 Nov 2022 03:02:24 -0500 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF57C31EF9; Thu, 10 Nov 2022 00:02:22 -0800 (PST) Received: (Authenticated sender: herve.codina@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 2B6201C000B; Thu, 10 Nov 2022 08:02:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1668067341; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WqL93lMbLibNFmjL/ZxBaK+pr+dw8H6VpJCHP8INXo0=; b=YpgztuC1ou+CSt9KwkJAV0BNxbZsErmlR2pB2E8hM4PMlV73AzNMLA4wWIK+DXC4wgmS/C 37S+lQKONQsNz0MXyt/8MfyfXoRn4GarhrqBruI/sMv4pH/oA1/Ab1xQT11XdP8iHU7GXM JEkIWte037BqcOCj9kklk60g8Jpa69S/FzVRzjvVnuOfUZtaaKMemAvQ8PJ4eoppoGMe1N LrSamTKWWWSzbBX7WzFne0CpdJfqjxBJm/IrCz+sISAYHLZVTHEc6Eb5Ri5eBrXlGgXBqz WIDduuYZxTaI5PYmRhq5A9rl1F5y+4PNSPnDd5mGWOGUJlQ4562sSLh7LdGdqw== Date: Thu, 10 Nov 2022 09:02:17 +0100 From: Herve Codina To: Geert Uytterhoeven Cc: Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Greg Kroah-Hartman , Magnus Damm , Gareth Williams , linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Thomas Petazzoni , Miquel Raynal Subject: Re: [PATCH 1/7] soc: renesas: r9a06g032-sysctrl: Export function to get H2MODE from CFG_USB register Message-ID: <20221110090217.4f4f4a0e@bootlin.com> In-Reply-To: References: <20221107135825.583877-1-herve.codina@bootlin.com> <20221107135825.583877-2-herve.codina@bootlin.com> <20221107175446.29c93376@bootlin.com> Organization: Bootlin X-Mailer: Claws Mail 4.1.0 (GTK 3.24.34; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Hi Geert, Oops, my bad I removed all people from the email previously. Re-added them on this reply.=20 On Mon, 7 Nov 2022 20:23:06 +0100 Geert Uytterhoeven wrote: > Hi Herv=C3=A9, >=20 > On Mon, Nov 7, 2022 at 5:54 PM Herve Codina wr= ote: > > On Mon, 7 Nov 2022 15:40:53 +0100 > > Geert Uytterhoeven wrote: =20 > > > On Mon, Nov 7, 2022 at 2:59 PM Herve Codina wrote: =20 > > > > The CFG_USB register is located within the system controller. > > > > > > > > We need a helper to get the H2MODE value from the CFG_USB register > > > > without syscon. > > > > > > > > Signed-off-by: Herve Codina =20 > > > =20 > > > > --- a/drivers/clk/renesas/r9a06g032-clocks.c > > > > +++ b/drivers/clk/renesas/r9a06g032-clocks.c > > > > @@ -25,6 +25,8 @@ > > > > #include > > > > #include > > > > > > > > +#define R9A06G032_SYSCTRL_USB 0x00 > > > > +#define R9A06G032_SYSCTRL_USB_H2MODE (1<<1) > > > > #define R9A06G032_SYSCTRL_DMAMUX 0xA0 > > > > > > > > struct r9a06g032_gate { > > > > @@ -341,6 +343,22 @@ int r9a06g032_sysctrl_set_dmamux(u32 mask, u32= val) > > > > } > > > > EXPORT_SYMBOL_GPL(r9a06g032_sysctrl_set_dmamux); > > > > > > > > + > > > > +/* Exported helper to get the H2MODE bit from USB register */ > > > > +int r9a06g032_sysctrl_get_usb_h2mode(bool *h2mode) > > > > +{ > > > > + u32 usb; > > > > + > > > > + if (!sysctrl_priv) > > > > + return -EPROBE_DEFER; > > > > + > > > > + usb =3D readl(sysctrl_priv->reg + R9A06G032_SYSCTRL_USB); > > > > + *h2mode =3D (usb & R9A06G032_SYSCTRL_USB_H2MODE) ? true : f= alse; > > > > + > > > > + return 0; =20 > > > > > > Perhaps not pass *h2mode, but just return USB_ROLE_{HOST,DEVICE} > > > (enum usb_role in ), or a negative error code? =20 > > > > Yes, good idea. > > I will also rename the function : > > enum usb_role r9a06g032_sysctrl_get_usb_role(void); > > > > Is that ok for you or do you prefer that I keep the previous name ? =20 >=20 > r9a06g032_sysctrl_get_usb_role() sounds fine! > But it should return "int", as the return value can be a negative error c= ode, > too. All right, I will do that in v2 series. Thanks, Herv=C3=A9 --=20 Herv=C3=A9 Codina, Bootlin Embedded Linux and Kernel engineering https://bootlin.com