From: Biao Huang <biao.huang@mediatek.com> To: David Miller <davem@davemloft.net>, Rob Herring <robh+dt@kernel.org>, Bartosz Golaszewski <brgl@bgdev.pl>, Fabien Parent <fparent@baylibre.com> Cc: Jakub Kicinski <kuba@kernel.org>, Felix Fietkau <nbd@nbd.name>, "John Crispin" <john@phrozen.org>, Sean Wang <sean.wang@mediatek.com>, Mark Lee <Mark-MC.Lee@mediatek.com>, Matthias Brugger <matthias.bgg@gmail.com>, <netdev@vger.kernel.org>, <devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, <linux-mediatek@lists.infradead.org>, Biao Huang <biao.huang@mediatek.com>, Yinghua Pan <ot_yinghua.pan@mediatek.com>, <srv_heupstream@mediatek.com>, Macpaul Lin <macpaul.lin@mediatek.com> Subject: [PATCH net-next v3 01/10] net: ethernet: mtk-star-emac: store bit_clk_div in compat structure Date: Wed, 22 Jun 2022 17:05:36 +0800 [thread overview] Message-ID: <20220622090545.23612-2-biao.huang@mediatek.com> (raw) In-Reply-To: <20220622090545.23612-1-biao.huang@mediatek.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@mediatek.com> Signed-off-by: Fabien Parent <fparent@baylibre.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 95839fd84dab..9c54043f7866 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> @@ -231,6 +232,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; @@ -256,6 +261,8 @@ struct mtk_star_priv { int duplex; int pause; + const struct mtk_star_compat *compat_data; + /* Protects against concurrent descriptor access. */ spinlock_t lock; @@ -898,7 +905,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) @@ -1460,6 +1467,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) } #ifdef CONFIG_OF +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); -- 2.25.1
WARNING: multiple messages have this Message-ID (diff)
From: Biao Huang <biao.huang@mediatek.com> To: David Miller <davem@davemloft.net>, Rob Herring <robh+dt@kernel.org>, Bartosz Golaszewski <brgl@bgdev.pl>, Fabien Parent <fparent@baylibre.com> Cc: Jakub Kicinski <kuba@kernel.org>, Felix Fietkau <nbd@nbd.name>, "John Crispin" <john@phrozen.org>, Sean Wang <sean.wang@mediatek.com>, Mark Lee <Mark-MC.Lee@mediatek.com>, Matthias Brugger <matthias.bgg@gmail.com>, <netdev@vger.kernel.org>, <devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, <linux-mediatek@lists.infradead.org>, Biao Huang <biao.huang@mediatek.com>, Yinghua Pan <ot_yinghua.pan@mediatek.com>, <srv_heupstream@mediatek.com>, Macpaul Lin <macpaul.lin@mediatek.com> Subject: [PATCH net-next v3 01/10] net: ethernet: mtk-star-emac: store bit_clk_div in compat structure Date: Wed, 22 Jun 2022 17:05:36 +0800 [thread overview] Message-ID: <20220622090545.23612-2-biao.huang@mediatek.com> (raw) In-Reply-To: <20220622090545.23612-1-biao.huang@mediatek.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@mediatek.com> Signed-off-by: Fabien Parent <fparent@baylibre.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 95839fd84dab..9c54043f7866 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> @@ -231,6 +232,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; @@ -256,6 +261,8 @@ struct mtk_star_priv { int duplex; int pause; + const struct mtk_star_compat *compat_data; + /* Protects against concurrent descriptor access. */ spinlock_t lock; @@ -898,7 +905,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) @@ -1460,6 +1467,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) } #ifdef CONFIG_OF +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); -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-06-22 9:06 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-06-22 9:05 [PATCH net-next v3 00/10] add more features for mtk-star-emac Biao Huang 2022-06-22 9:05 ` Biao Huang 2022-06-22 9:05 ` Biao Huang [this message] 2022-06-22 9:05 ` [PATCH net-next v3 01/10] net: ethernet: mtk-star-emac: store bit_clk_div in compat structure Biao Huang 2022-06-22 9:05 ` [PATCH net-next v3 02/10] net: ethernet: mtk-star-emac: modify IRQ trigger flags Biao Huang 2022-06-22 9:05 ` Biao Huang 2022-06-22 9:05 ` [PATCH net-next v3 03/10] net: ethernet: mtk-star-emac: add support for MT8365 SoC Biao Huang 2022-06-22 9:05 ` Biao Huang 2022-06-22 9:05 ` [PATCH net-next v3 04/10] dt-bindings: net: mtk-star-emac: add support for MT8365 Biao Huang 2022-06-22 9:05 ` Biao Huang 2022-06-22 9:05 ` [PATCH net-next v3 05/10] net: ethernet: mtk-star-emac: add clock pad selection for RMII Biao Huang 2022-06-22 9:05 ` Biao Huang 2022-06-22 9:05 ` [PATCH net-next v3 06/10] net: ethernet: mtk-star-emac: add timing adjustment support Biao Huang 2022-06-22 9:05 ` Biao Huang 2022-06-22 9:05 ` [PATCH net-next v3 07/10] dt-bindings: net: mtk-star-emac: add description for new properties Biao Huang 2022-06-22 9:05 ` Biao Huang 2022-06-22 9:05 ` [PATCH net-next v3 08/10] net: ethernet: mtk-star-emac: add support for MII interface Biao Huang 2022-06-22 9:05 ` Biao Huang 2022-06-22 9:05 ` [PATCH net-next v3 09/10] net: ethernet: mtk-star-emac: separate tx/rx handling with two NAPIs Biao Huang 2022-06-22 9:05 ` Biao Huang 2022-06-24 4:34 ` Jakub Kicinski 2022-06-24 4:34 ` Jakub Kicinski 2022-06-28 5:44 ` Biao Huang 2022-06-28 5:44 ` Biao Huang 2022-06-22 9:05 ` [PATCH net-next v3 10/10] net: ethernet: mtk-star-emac: enable half duplex hardware support Biao Huang 2022-06-22 9:05 ` Biao Huang
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220622090545.23612-2-biao.huang@mediatek.com \ --to=biao.huang@mediatek.com \ --cc=Mark-MC.Lee@mediatek.com \ --cc=brgl@bgdev.pl \ --cc=davem@davemloft.net \ --cc=devicetree@vger.kernel.org \ --cc=fparent@baylibre.com \ --cc=john@phrozen.org \ --cc=kuba@kernel.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mediatek@lists.infradead.org \ --cc=macpaul.lin@mediatek.com \ --cc=matthias.bgg@gmail.com \ --cc=nbd@nbd.name \ --cc=netdev@vger.kernel.org \ --cc=ot_yinghua.pan@mediatek.com \ --cc=robh+dt@kernel.org \ --cc=sean.wang@mediatek.com \ --cc=srv_heupstream@mediatek.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.