netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Biju Das <biju.das.jz@bp.renesas.com>
To: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Cc: Biju Das <biju.das.jz@bp.renesas.com>,
	Sergey Shtylyov <s.shtylyov@omp.ru>,
	Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Sergei Shtylyov <sergei.shtylyov@gmail.com>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Adam Ford <aford173@gmail.com>,
	Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
	netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	Chris Paterson <Chris.Paterson2@renesas.com>,
	Biju Das <biju.das@bp.renesas.com>
Subject: [RFC/PATCH 08/18] ravb: Add mii_rgmii_selection to struct ravb_hw_info
Date: Thu, 23 Sep 2021 15:08:03 +0100	[thread overview]
Message-ID: <20210923140813.13541-9-biju.das.jz@bp.renesas.com> (raw)
In-Reply-To: <20210923140813.13541-1-biju.das.jz@bp.renesas.com>

E-MAC on RZ/G2L supports MII/RGMII selection. Add a
mii_rgmii_selection feature bit to struct ravb_hw_info
to support this for RZ/G2L.
Currently only selecting RGMII is supported.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      | 17 +++++++++++++++++
 drivers/net/ethernet/renesas/ravb_main.c |  6 ++++++
 2 files changed, 23 insertions(+)

diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index bce480fadb91..dfaf3121da44 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -189,6 +189,8 @@ enum ravb_reg {
 	PIR	= 0x0520,
 	PSR	= 0x0528,
 	PIPR	= 0x052c,
+	CXR31	= 0x0530,	/* Documented for RZ/G2L only */
+	CXR35	= 0x0540,	/* Documented for RZ/G2L only */
 	MPR	= 0x0558,
 	PFTCR	= 0x055c,
 	PFRCR	= 0x0560,
@@ -951,6 +953,20 @@ enum RAVB_QUEUE {
 	RAVB_NC,	/* Network Control Queue */
 };
 
+enum CXR31_BIT {
+	CXR31_SEL_LINK0	= 0x00000001,
+	CXR31_SEL_LINK1	= 0x00000008,
+};
+
+enum CXR35_BIT {
+	CXR35_SEL_MODIN	= 0x00000100,
+};
+
+enum CSR0_BIT {
+	CSR0_TPE	= 0x00000010,
+	CSR0_RPE	= 0x00000020,
+};
+
 #define DBAT_ENTRY_NUM	22
 #define RX_QUEUE_OFFSET	4
 #define NUM_RX_QUEUE	2
@@ -1008,6 +1024,7 @@ struct ravb_hw_info {
 	unsigned ccc_gac:1;		/* AVB-DMAC has gPTP support active in config mode */
 	unsigned multi_tsrq:1;		/* AVB-DMAC has MULTI TSRQ */
 	unsigned magic_pkt:1;		/* E-MAC supports magic packet detection */
+	unsigned mii_rgmii_selection:1;	/* E-MAC supports mii/rgmii selection */
 };
 
 struct ravb_private {
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 529364d8f7fb..5d18681582b9 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1128,6 +1128,7 @@ static int ravb_phy_init(struct net_device *ndev)
 {
 	struct device_node *np = ndev->dev.parent->of_node;
 	struct ravb_private *priv = netdev_priv(ndev);
+	const struct ravb_hw_info *info = priv->info;
 	struct phy_device *phydev;
 	struct device_node *pn;
 	phy_interface_t iface;
@@ -1173,6 +1174,10 @@ static int ravb_phy_init(struct net_device *ndev)
 		netdev_info(ndev, "limited PHY to 100Mbit/s\n");
 	}
 
+	if (info->mii_rgmii_selection &&
+	    priv->phy_interface == PHY_INTERFACE_MODE_RGMII_ID)
+		ravb_write(ndev, ravb_read(ndev, CXR35) | CXR35_SEL_MODIN, CXR35);
+
 	/* 10BASE, Pause and Asym Pause is not supported */
 	phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_10baseT_Half_BIT);
 	phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_10baseT_Full_BIT);
@@ -2132,6 +2137,7 @@ static const struct ravb_hw_info rgeth_hw_info = {
 	.aligned_tx = 1,
 	.tx_counters = 1,
 	.no_gptp = 1,
+	.mii_rgmii_selection = 1,
 };
 
 static const struct of_device_id ravb_match_table[] = {
-- 
2.17.1


  parent reply	other threads:[~2021-09-23 14:08 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-23 14:07 [RFC/PATCH 00/18] Add Gigabit Ethernet driver support Biju Das
2021-09-23 14:07 ` [RFC/PATCH 01/18] ravb: Rename "ravb_set_features_rx_csum" function to "ravb_set_features_rcar" Biju Das
2021-09-27 19:54   ` Sergey Shtylyov
2021-09-23 14:07 ` [RFC/PATCH 02/18] ravb: Rename the variables "no_ptp_cfg_active" and "ptp_cfg_active" Biju Das
2021-09-23 16:07   ` Sergey Shtylyov
2021-09-23 16:35     ` Biju Das
2021-09-23 17:57       ` Sergey Shtylyov
2021-09-23 18:20         ` Biju Das
2021-09-26 13:34           ` Biju Das
2021-09-23 14:07 ` [RFC/PATCH 03/18] ravb: Initialize GbEthernet dmac Biju Das
2021-09-23 17:41   ` Sergey Shtylyov
2021-09-23 18:42     ` Biju Das
2021-09-23 19:07   ` Sergey Shtylyov
2021-09-23 19:22     ` Biju Das
2021-09-23 19:29       ` Biju Das
2021-09-26 13:38         ` Biju Das
2021-09-23 14:07 ` [RFC/PATCH 04/18] ravb: Enable aligned_tx and tx_counters for RZ/G2L Biju Das
2021-09-23 18:05   ` Sergey Shtylyov
2021-09-23 18:10     ` Sergey Shtylyov
2021-09-23 18:13     ` Biju Das
2021-09-26 13:40       ` Biju Das
2021-09-23 14:08 ` [RFC/PATCH 05/18] ravb: Exclude gPTP feature support " Biju Das
2021-09-23 19:00   ` Sergey Shtylyov
2021-09-23 19:13     ` Biju Das
2021-09-23 19:41       ` Sergey Shtylyov
2021-09-23 19:45         ` Biju Das
2021-09-26 13:48           ` Biju Das
2021-09-23 14:08 ` [RFC/PATCH 06/18] ravb: Add multi_tsrq to struct ravb_hw_info Biju Das
2021-09-23 20:19   ` Sergey Shtylyov
2021-09-24  6:19     ` Biju Das
2021-09-26 13:54       ` Biju Das
2021-09-23 14:08 ` [RFC/PATCH 07/18] ravb: Add magic_pkt " Biju Das
2021-09-23 20:42   ` Sergey Shtylyov
2021-09-24  6:24     ` Biju Das
2021-09-26 13:56       ` Biju Das
2021-09-23 14:08 ` Biju Das [this message]
2021-09-24 19:49   ` [RFC/PATCH 08/18] ravb: Add mii_rgmii_selection " Sergey Shtylyov
2021-09-25  6:23     ` Biju Das
2021-09-26 15:49       ` Biju Das
2021-09-23 14:08 ` [RFC/PATCH 09/18] ravb: Add half_duplex " Biju Das
2021-09-24 20:07   ` Sergey Shtylyov
2021-09-25  6:37     ` Biju Das
2021-09-26 15:51     ` Biju Das
2021-09-23 14:08 ` [RFC/PATCH 10/18] ravb: Initialize GbEthernet E-MAC Biju Das
2021-09-24 20:44   ` Sergey Shtylyov
2021-09-25  6:38     ` Biju Das
2021-09-23 14:08 ` [RFC/PATCH 11/18] ravb: Add rx_2k_buffers to struct ravb_hw_info Biju Das
2021-09-24 19:35   ` Sergey Shtylyov
2021-09-26 15:48     ` Biju Das
2021-09-23 14:08 ` [RFC/PATCH 12/18] ravb: Add timestamp " Biju Das
2021-09-25 20:52   ` Sergey Shtylyov
2021-09-26  6:34     ` Biju Das
2021-09-26 16:52       ` Biju Das
2021-09-26 20:45       ` Sergey Shtylyov
2021-09-26 20:48         ` Sergei Shtylyov
2021-09-27  6:10           ` Biju Das
2021-09-27  6:04         ` Biju Das
2021-09-23 14:08 ` [RFC/PATCH 13/18] ravb: Add rx_ring_free function support for GbEthernet Biju Das
2021-09-27 19:28   ` Sergey Shtylyov
2021-09-28  9:24     ` Biju Das
2021-09-23 14:08 ` [RFC/PATCH 14/18] ravb: Add rx_ring_format function " Biju Das
2021-09-27 20:32   ` Sergey Shtylyov
2021-09-29  7:49     ` Biju Das
2021-09-23 14:08 ` [RFC/PATCH 15/18] ravb: Add rx_alloc helper " Biju Das
2021-09-23 14:08 ` [RFC/PATCH 16/18] ravb: Add Packet receive function for Gigabit Ethernet Biju Das
2021-10-01 17:27   ` Sergey Shtylyov
2021-10-04 14:56     ` Biju Das
2021-09-23 14:08 ` [RFC/PATCH 17/18] ravb: Add carrier_counters to struct ravb_hw_info Biju Das
2021-09-28 20:50   ` Sergey Shtylyov
2021-09-23 14:08 ` [RFC/PATCH 18/18] ravb: Add set_feature support for RZ/G2L Biju Das
2021-09-30 20:39   ` Sergey Shtylyov
2021-10-01  6:53     ` Biju Das
2021-10-01  9:13       ` Sergey Shtylyov
2021-10-01  9:26         ` Biju Das
2021-10-01  8:22     ` Biju Das
2021-09-23 15:11 ` [RFC/PATCH 00/18] Add Gigabit Ethernet driver support Sergey Shtylyov
2021-09-23 15:13   ` Sergey Shtylyov
2021-09-23 15:37   ` Jakub Kicinski
2021-09-23 17:43     ` Sergey Shtylyov

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=20210923140813.13541-9-biju.das.jz@bp.renesas.com \
    --to=biju.das.jz@bp.renesas.com \
    --cc=Chris.Paterson2@renesas.com \
    --cc=aford173@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=biju.das@bp.renesas.com \
    --cc=davem@davemloft.net \
    --cc=geert+renesas@glider.be \
    --cc=kuba@kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=s.shtylyov@omp.ru \
    --cc=sergei.shtylyov@gmail.com \
    --cc=yoshihiro.shimoda.uh@renesas.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;
as well as URLs for NNTP newsgroup(s).