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 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.lore.kernel.org (Postfix) with ESMTPS id 4CE1DC4332F for ; Mon, 14 Nov 2022 00:21:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id 19379C43470; Mon, 14 Nov 2022 00:21:53 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.kernel.org (Postfix) with ESMTP id 0CC4DC433C1; Mon, 14 Nov 2022 00:21:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org 0CC4DC433C1 Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=arm.com 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 C9C1A23A; Sun, 13 Nov 2022 16:21:56 -0800 (PST) Received: from slackpad.lan (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5DF6F3F73B; Sun, 13 Nov 2022 16:21:48 -0800 (PST) Date: Mon, 14 Nov 2022 00:20:25 +0000 From: Andre Przywara To: Samuel Holland List-Id: Cc: Icenowy Zheng , Chen-Yu Tsai , Jernej Skrabec , Rob Herring , Krzysztof Kozlowski , Greg Kroah-Hartman , soc@kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-phy@lists.infradead.org, linux-usb@vger.kernel.org, Kishon Vijay Abraham I , Vinod Koul Subject: Re: [PATCH v3 10/11] phy: sun4i-usb: Replace types with explicit quirk flags Message-ID: <20221114002025.351d3084@slackpad.lan> In-Reply-To: <7b2606df-3ae5-2699-66bd-12815ffc785b@sholland.org> References: <20221106154826.6687-1-andre.przywara@arm.com> <20221106154826.6687-11-andre.przywara@arm.com> <7b2606df-3ae5-2699-66bd-12815ffc785b@sholland.org> Organization: Arm Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.31; x86_64-slackware-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Sun, 13 Nov 2022 17:52:33 -0600 Samuel Holland wrote: > On 11/6/22 09:54, Icenowy Zheng wrote: > >=20 > >=20 > > =E4=BA=8E 2022=E5=B9=B411=E6=9C=886=E6=97=A5 GMT+08:00 =E4=B8=8B=E5=8D= =8811:48:25, Andre Przywara =E5=86=99=E5=88=B0: =20 > >> So far we were assigning some crude "type" (SoC name, really) to each > >> Allwinner USB PHY model, then guarding certain quirks based on this. > >> This does not only look weird, but gets more or more cumbersome to > >> maintain. > >> > >> Remove the bogus type names altogether, instead introduce flags for ea= ch > >> quirk, and explicitly check for them. > >> This improves readability, and simplifies future extensions. > >> > >> Signed-off-by: Andre Przywara > >> --- > >> drivers/phy/allwinner/phy-sun4i-usb.c | 50 ++++++++------------------- > >> 1 file changed, 15 insertions(+), 35 deletions(-) > >> > >> diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwi= nner/phy-sun4i-usb.c > >> index 51fb24c6dcb3..422129c66282 100644 > >> --- a/drivers/phy/allwinner/phy-sun4i-usb.c > >> +++ b/drivers/phy/allwinner/phy-sun4i-usb.c > >> @@ -99,27 +99,17 @@ > >> #define DEBOUNCE_TIME msecs_to_jiffies(50) > >> #define POLL_TIME msecs_to_jiffies(250) > >> > >> -enum sun4i_usb_phy_type { > >> - sun4i_a10_phy, > >> - sun6i_a31_phy, > >> - sun8i_a33_phy, > >> - sun8i_a83t_phy, > >> - sun8i_h3_phy, > >> - sun8i_r40_phy, > >> - sun8i_v3s_phy, > >> - sun50i_a64_phy, > >> - sun50i_h6_phy, > >> -}; > >> - > >> struct sun4i_usb_phy_cfg { > >> int num_phys; > >> int hsic_index; > >> - enum sun4i_usb_phy_type type; > >> u32 disc_thresh; > >> u32 hci_phy_ctl_clear; > >> u8 phyctl_offset; > >> bool dedicated_clocks; > >> bool phy0_dual_route; > >> + bool phy2_is_hsic; =20 > >=20 > > Maybe use a `int hsic_phy` instead? But the problem is this practice is > > assuming USB0 could not be HSIC -- although USB0 is usually OTG. =20 >=20 > There is already a `hsic_index` variable in the struct we can use. Ha, indeed, good find! And we are already checking for the same condition (is this the HSIC port?) using this variable. Saves one more member in the struct. Thanks! Andre >=20 > Regards, > Samuel >=20 >=20