lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cc43eb64-b1f0-813e-2506-79cc41ab5def@arinc9.com>
Date:   Fri, 21 Apr 2023 21:29:16 +0300
From:   Arınç ÜNAL <arinc.unal@...nc9.com>
To:     Daniel Golle <daniel@...rotopia.org>
Cc:     Sean Wang <sean.wang@...iatek.com>,
        Landen Chao <Landen.Chao@...iatek.com>,
        DENG Qingfang <dqfext@...il.com>, Andrew Lunn <andrew@...n.ch>,
        Florian Fainelli <f.fainelli@...il.com>,
        Vladimir Oltean <olteanv@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Matthias Brugger <matthias.bgg@...il.com>,
        AngeloGioacchino Del Regno 
        <angelogioacchino.delregno@...labora.com>,
        Russell King <linux@...linux.org.uk>,
        Richard van Schagen <richard@...terhints.com>,
        Richard van Schagen <vschagen@...com>,
        Frank Wunderlich <frank-w@...lic-files.de>,
        erkin.bozoglu@...ont.com, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-mediatek@...ts.infradead.org
Subject: Re: [RFC PATCH net-next 03/22] net: dsa: mt7530: properly support
 MT7531AE and MT7531BE

On 21.04.2023 18:22, Daniel Golle wrote:
> On Fri, Apr 21, 2023 at 05:36:29PM +0300, arinc9.unal@...il.com wrote:
>> From: Arınç ÜNAL <arinc.unal@...nc9.com>
>>
>> Introduce the p5_sgmii pointer to store the information for whether port 5
>> has got SGMII or not. Print "found MT7531AE" if it's got it, print "found
>> MT7531BE" if it hasn't.
>>
>> Move the comment about MT7531AE and MT7531BE to mt7531_setup(), where the
>> switch is identified.
>>
>> Get rid of mt7531_dual_sgmii_supported() now that priv->p5_sgmii stores the
>> information. Address the code where mt7531_dual_sgmii_supported() is used.
>>
>> Get rid of mt7531_is_rgmii_port() which just prints the opposite of
>> priv->p5_sgmii.
>>
>> Remove P5_INTF_SEL_GMAC5_SGMII. The p5_interface_select enum is supposed to
>> represent the mode that port 5 is used in, not the hardware information of
>> port 5. Set p5_intf_sel to P5_INTF_SEL_GMAC5 instead, if port 5 is not
>> dsa_is_unused_port().
>>
>> Signed-off-by: Arınç ÜNAL <arinc.unal@...nc9.com>
>> ---
>>   drivers/net/dsa/mt7530-mdio.c |  7 ++---
>>   drivers/net/dsa/mt7530.c      | 49 +++++++++++++++--------------------
>>   drivers/net/dsa/mt7530.h      |  6 +++--
>>   3 files changed, 27 insertions(+), 35 deletions(-)
>>
>> diff --git a/drivers/net/dsa/mt7530-mdio.c b/drivers/net/dsa/mt7530-mdio.c
>> index 088533663b83..fa3ee85a99c1 100644
>> --- a/drivers/net/dsa/mt7530-mdio.c
>> +++ b/drivers/net/dsa/mt7530-mdio.c
>> @@ -81,17 +81,14 @@ static const struct regmap_bus mt7530_regmap_bus = {
>>   };
>>   
>>   static int
>> -mt7531_create_sgmii(struct mt7530_priv *priv, bool dual_sgmii)
>> +mt7531_create_sgmii(struct mt7530_priv *priv)
>>   {
>>   	struct regmap_config *mt7531_pcs_config[2] = {};
>>   	struct phylink_pcs *pcs;
>>   	struct regmap *regmap;
>>   	int i, ret = 0;
>>   
>> -	/* MT7531AE has two SGMII units for port 5 and port 6
>> -	 * MT7531BE has only one SGMII unit for port 6
>> -	 */
>> -	for (i = dual_sgmii ? 0 : 1; i < 2; i++) {
>> +	for (i = priv->p5_sgmii ? 0 : 1; i < 2; i++) {
>>   		mt7531_pcs_config[i] = devm_kzalloc(priv->dev,
>>   						    sizeof(struct regmap_config),
>>   						    GFP_KERNEL);
>> diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
>> index c680873819b0..edc34be745b2 100644
>> --- a/drivers/net/dsa/mt7530.c
>> +++ b/drivers/net/dsa/mt7530.c
>> @@ -473,15 +473,6 @@ mt7530_pad_clk_setup(struct dsa_switch *ds, phy_interface_t interface)
>>   	return 0;
>>   }
>>   
>> -static bool mt7531_dual_sgmii_supported(struct mt7530_priv *priv)
>> -{
>> -	u32 val;
>> -
>> -	val = mt7530_read(priv, MT7531_TOP_SIG_SR);
>> -
>> -	return (val & PAD_DUAL_SGMII_EN) != 0;
>> -}
>> -
>>   static int
>>   mt7531_pad_setup(struct dsa_switch *ds, phy_interface_t interface)
>>   {
>> @@ -496,7 +487,7 @@ mt7531_pll_setup(struct mt7530_priv *priv)
>>   	u32 xtal;
>>   	u32 val;
>>   
>> -	if (mt7531_dual_sgmii_supported(priv))
>> +	if (priv->p5_sgmii)
>>   		return;
>>   
>>   	val = mt7530_read(priv, MT7531_CREV);
>> @@ -907,8 +898,6 @@ static const char *p5_intf_modes(unsigned int p5_interface)
>>   		return "PHY P4";
>>   	case P5_INTF_SEL_GMAC5:
>>   		return "GMAC5";
>> -	case P5_INTF_SEL_GMAC5_SGMII:
>> -		return "GMAC5_SGMII";
>>   	default:
>>   		return "unknown";
>>   	}
>> @@ -2440,6 +2429,18 @@ mt7531_setup(struct dsa_switch *ds)
>>   		return -ENODEV;
>>   	}
>>   
>> +	/* MT7531AE has got two SGMII units. One for port 5, one for port 6.
>> +	 * MT7531BE has got only one SGMII unit which is for port 6.
>> +	 */
>> +	val = mt7530_read(priv, MT7531_TOP_SIG_SR);
>> +
>> +	if ((val & PAD_DUAL_SGMII_EN) != 0) {
>> +		priv->p5_sgmii = true;
>> +		dev_info(priv->dev, "found MT7531AE\n");
>> +	} else {
>> +		dev_info(priv->dev, "found MT7531BE\n");
> 
> I don't think dev_info is useful here for regular users.
> If you really want this output, use dev_dbg to reduce log pollution.
> Imho completely removing the else branch and only silently
> setting priv->p5_sgmii is sufficient, as users can also turn on
> dyndbg for drivers/net/pcs/pcs-mtk-lynxi.c and will then be informed
> about the created SGMII/1000Base-X/2500Base-X PCS instances.

Sounds good, I'll drop it.

Arınç

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ