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: <7a544fae-e7ff-d2a2-0ee5-1dca2f855be0@mediatek.com>
Date:   Thu, 27 Jan 2022 10:23:35 +0800
From:   Macpaul Lin <macpaul.lin@...iatek.com>
To:     Biao Huang <biao.huang@...iatek.com>,
        David Miller <davem@...emloft.net>,
        Rob Herring <robh+dt@...nel.org>,
        Bartosz Golaszewski <brgl@...ev.pl>,
        "Fabien Parent" <fparent@...libre.com>
CC:     Jakub Kicinski <kuba@...nel.org>, Felix Fietkau <nbd@....name>,
        "John Crispin" <john@...ozen.org>,
        Sean Wang <sean.wang@...iatek.com>,
        Mark Lee <Mark-MC.Lee@...iatek.com>,
        Matthias Brugger <matthias.bgg@...il.com>,
        <netdev@...r.kernel.org>, <devicetree@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-mediatek@...ts.infradead.org>,
        Yinghua Pan <ot_yinghua.pan@...iatek.com>,
        <srv_heupstream@...iatek.com>
Subject: Re: [PATCH net-next v2 1/9] net: ethernet: mtk-star-emac: store
 bit_clk_div in compat structure

On 1/27/22 9:58 AM, Biao Huang wrote:
> From: Fabien Parent <fparent@...libre.com>
> 
> Not all the SoC are using the same clock divider. Move the divider into
> a compat structure specific to the SoCs.
> 
> Signed-off-by: Biao Huang <biao.huang@...iatek.com>
> Signed-off-by: Fabien Parent <fparent@...libre.com>
> ---
>   drivers/net/ethernet/mediatek/mtk_star_emac.c | 23 +++++++++++++++----
>   1 file changed, 19 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mediatek/mtk_star_emac.c b/drivers/net/ethernet/mediatek/mtk_star_emac.c
> index 1d5dd2015453..7fd8ec0fc636 100644
> --- a/drivers/net/ethernet/mediatek/mtk_star_emac.c
> +++ b/drivers/net/ethernet/mediatek/mtk_star_emac.c
> @@ -17,6 +17,7 @@
>   #include <linux/module.h>
>   #include <linux/netdevice.h>
>   #include <linux/of.h>
> +#include <linux/of_device.h>
>   #include <linux/of_mdio.h>
>   #include <linux/of_net.h>
>   #include <linux/platform_device.h>
> @@ -232,6 +233,10 @@ struct mtk_star_ring {
>   	unsigned int tail;
>   };
>   
> +struct mtk_star_compat {
> +	unsigned char bit_clk_div;
> +};
> +
>   struct mtk_star_priv {
>   	struct net_device *ndev;
>   
> @@ -257,6 +262,8 @@ struct mtk_star_priv {
>   	int duplex;
>   	int pause;
>   
> +	const struct mtk_star_compat *compat_data;
> +
>   	/* Protects against concurrent descriptor access. */
>   	spinlock_t lock;
>   
> @@ -899,7 +906,7 @@ static void mtk_star_init_config(struct mtk_star_priv *priv)
>   	regmap_write(priv->regs, MTK_STAR_REG_SYS_CONF, val);
>   	regmap_update_bits(priv->regs, MTK_STAR_REG_MAC_CLK_CONF,
>   			   MTK_STAR_MSK_MAC_CLK_CONF,
> -			   MTK_STAR_BIT_CLK_DIV_10);
> +			   priv->compat_data->bit_clk_div);
>   }
>   
>   static void mtk_star_set_mode_rmii(struct mtk_star_priv *priv)
> @@ -1461,6 +1468,7 @@ static int mtk_star_probe(struct platform_device *pdev)
>   
>   	priv = netdev_priv(ndev);
>   	priv->ndev = ndev;
> +	priv->compat_data = of_device_get_match_data(&pdev->dev);
>   	SET_NETDEV_DEV(ndev, dev);
>   	platform_set_drvdata(pdev, ndev);
>   
> @@ -1556,10 +1564,17 @@ static int mtk_star_probe(struct platform_device *pdev)
>   	return devm_register_netdev(dev, ndev);
>   }
>   
> +static const struct mtk_star_compat mtk_star_mt8516_compat = {
> +	.bit_clk_div = MTK_STAR_BIT_CLK_DIV_10,
> +};
> +
>   static const struct of_device_id mtk_star_of_match[] = {
> -	{ .compatible = "mediatek,mt8516-eth", },
> -	{ .compatible = "mediatek,mt8518-eth", },
> -	{ .compatible = "mediatek,mt8175-eth", },
> +	{ .compatible = "mediatek,mt8516-eth",
> +	  .data = &mtk_star_mt8516_compat },
> +	{ .compatible = "mediatek,mt8518-eth",
> +	  .data = &mtk_star_mt8516_compat },
> +	{ .compatible = "mediatek,mt8175-eth",
> +	  .data = &mtk_star_mt8516_compat },
>   	{ }
>   };
>   MODULE_DEVICE_TABLE(of, mtk_star_of_match);
> 

Reviewed-by: Macpaul Lin <macpaul.lin@...iatek.com>

Regards,
Macpaul Lin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ