mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Macpaul Lin <macpaul.lin@mediatek.com>
To: Biao Huang <biao.huang@mediatek.com>,
	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>,
	Yinghua Pan <ot_yinghua.pan@mediatek.com>,
	<srv_heupstream@mediatek.com>
Subject: Re: [PATCH net-next v2 8/9] net: ethernet: mtk-star-emac: add support for MII interface
Date: Thu, 27 Jan 2022 10:17:18 +0800	[thread overview]
Message-ID: <cef66664-192c-ab2f-2a3c-18c5d48b5093@mediatek.com> (raw)
In-Reply-To: <20220127015857.9868-9-biao.huang@mediatek.com>

On 1/27/22 9:58 AM, Biao Huang wrote:
> Add support for MII interface.
> If user wants to use MII, assign "MII" to "phy-mode" property in dts.
> 
> Signed-off-by: Biao Huang <biao.huang@mediatek.com>
> Signed-off-by: Yinghua Pan <ot_yinghua.pan@mediatek.com>
> ---
>   drivers/net/ethernet/mediatek/mtk_star_emac.c | 13 +++++++++++--
>   1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mediatek/mtk_star_emac.c b/drivers/net/ethernet/mediatek/mtk_star_emac.c
> index d5e974e0db6d..167a019fd8f5 100644
> --- a/drivers/net/ethernet/mediatek/mtk_star_emac.c
> +++ b/drivers/net/ethernet/mediatek/mtk_star_emac.c
> @@ -193,6 +193,7 @@ static const char *const mtk_star_clk_names[] = { "core", "reg", "trans" };
>   #define MTK_PERICFG_REG_NIC_CFG1_CON		0x03c8
>   #define MTK_PERICFG_REG_NIC_CFG_CON_V2		0x0c10
>   #define MTK_PERICFG_REG_NIC_CFG_CON_CFG_INTF	GENMASK(3, 0)
> +#define MTK_PERICFG_BIT_NIC_CFG_CON_MII		0
>   #define MTK_PERICFG_BIT_NIC_CFG_CON_RMII	1
>   #define MTK_PERICFG_BIT_NIC_CFG_CON_CLK		BIT(0)
>   #define MTK_PERICFG_BIT_NIC_CFG_CON_CLK_V2	BIT(8)
> @@ -1463,6 +1464,7 @@ static int mtk_star_set_timing(struct mtk_star_priv *priv)
>   	unsigned int delay_val = 0;
>   
>   	switch (priv->phy_intf) {
> +	case PHY_INTERFACE_MODE_MII:
>   	case PHY_INTERFACE_MODE_RMII:
>   		delay_val |= FIELD_PREP(MTK_STAR_BIT_INV_RX_CLK, priv->rx_inv);
>   		delay_val |= FIELD_PREP(MTK_STAR_BIT_INV_TX_CLK, priv->tx_inv);
> @@ -1545,7 +1547,8 @@ static int mtk_star_probe(struct platform_device *pdev)
>   	ret = of_get_phy_mode(of_node, &priv->phy_intf);
>   	if (ret) {
>   		return ret;
> -	} else if (priv->phy_intf != PHY_INTERFACE_MODE_RMII) {
> +	} else if (priv->phy_intf != PHY_INTERFACE_MODE_RMII &&
> +		   priv->phy_intf != PHY_INTERFACE_MODE_MII) {
>   		dev_err(dev, "unsupported phy mode: %s\n",
>   			phy_modes(priv->phy_intf));
>   		return -EINVAL;
> @@ -1610,9 +1613,12 @@ static int mt8516_set_interface_mode(struct net_device *ndev)
>   {
>   	struct mtk_star_priv *priv = netdev_priv(ndev);
>   	struct device *dev = mtk_star_get_dev(priv);
> -	unsigned int intf_val, ret, rmii_rxc;
> +	unsigned int intf_val, ret, rmii_rxc = 0;
>   
>   	switch (priv->phy_intf) {
> +	case PHY_INTERFACE_MODE_MII:
> +		intf_val = MTK_PERICFG_BIT_NIC_CFG_CON_MII;
> +		break;
>   	case PHY_INTERFACE_MODE_RMII:
>   		intf_val = MTK_PERICFG_BIT_NIC_CFG_CON_RMII;
>   		rmii_rxc = priv->rmii_rxc ? 0 : MTK_PERICFG_BIT_NIC_CFG_CON_CLK;
> @@ -1642,6 +1648,9 @@ static int mt8365_set_interface_mode(struct net_device *ndev)
>   	unsigned int intf_val;
>   
>   	switch (priv->phy_intf) {
> +	case PHY_INTERFACE_MODE_MII:
> +		intf_val = MTK_PERICFG_BIT_NIC_CFG_CON_MII;
> +		break;
>   	case PHY_INTERFACE_MODE_RMII:
>   		intf_val = MTK_PERICFG_BIT_NIC_CFG_CON_RMII;
>   		intf_val |= priv->rmii_rxc ? 0 : MTK_PERICFG_BIT_NIC_CFG_CON_CLK_V2;
> 

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

Regards,
Macpaul Lin

  reply	other threads:[~2022-01-27  2:17 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-27  1:58 [PATCH net-next v2 0/9] add more features for mtk-star-emac Biao Huang
2022-01-27  1:58 ` [PATCH net-next v2 1/9] net: ethernet: mtk-star-emac: store bit_clk_div in compat structure Biao Huang
2022-01-27  2:23   ` Macpaul Lin
2022-01-27  1:58 ` [PATCH net-next v2 2/9] net: ethernet: mtk-star-emac: modify IRQ trigger flags Biao Huang
2022-01-27  1:58 ` [PATCH net-next v2 3/9] net: ethernet: mtk-star-emac: add support for MT8365 SoC Biao Huang
2022-01-27  2:22   ` Macpaul Lin
2022-01-27  1:58 ` [PATCH net-next v2 4/9] dt-bindings: net: mtk-star-emac: add support for MT8365 Biao Huang
2022-02-09  3:35   ` Rob Herring
2022-01-27  1:58 ` [PATCH net-next v2 5/9] net: ethernet: mtk-star-emac: add clock pad selection for RMII Biao Huang
2022-01-27  2:26   ` Macpaul Lin
2022-01-27  1:58 ` [PATCH net-next v2 6/9] net: ethernet: mtk-star-emac: add timing adjustment support Biao Huang
2022-01-27  2:20   ` Macpaul Lin
2022-01-27  1:58 ` [PATCH net-next v2 7/9] dt-bindings: net: mtk-star-emac: add description for new properties Biao Huang
2022-02-09  3:36   ` Rob Herring
2022-01-27  1:58 ` [PATCH net-next v2 8/9] net: ethernet: mtk-star-emac: add support for MII interface Biao Huang
2022-01-27  2:17   ` Macpaul Lin [this message]
2022-01-27  1:58 ` [PATCH net-next v2 9/9] net: ethernet: mtk-star-emac: separate tx/rx handling with two NAPIs Biao Huang
2022-01-28  3:43   ` Jakub Kicinski
2022-01-28  7:05     ` Biao Huang
2022-01-28 15:44       ` Jakub Kicinski
2022-03-14  7:01         ` Biao Huang
2022-03-14 15:57           ` Jakub Kicinski
2022-03-15  0:59             ` 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=cef66664-192c-ab2f-2a3c-18c5d48b5093@mediatek.com \
    --to=macpaul.lin@mediatek.com \
    --cc=Mark-MC.Lee@mediatek.com \
    --cc=biao.huang@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=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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®