All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stas Sergeev <stsp@list.ru>
To: netdev@vger.kernel.org
Cc: Linux kernel <linux-kernel@vger.kernel.org>,
	Stas Sergeev <stsp@users.sourceforge.net>,
	Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Subject: [PATCH 6/6] mvneta: port marvell's official in-band status enabling procedure
Date: Fri, 27 Mar 2015 16:40:52 +0300	[thread overview]
Message-ID: <55155DE4.5060701@list.ru> (raw)
In-Reply-To: <55155AFC.4050800@list.ru>


This is a back-port of official marvell's patch.
It changes nothing visible for me but looks reasonable.
Hope people with access to marvell's specs can review and
justify this patch better.

CC: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
CC: netdev@vger.kernel.org
CC: linux-kernel@vger.kernel.org

Signed-off-by: Stas Sergeev <stsp@users.sourceforge.net>
---
 drivers/net/ethernet/marvell/mvneta.c |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 2d1c689..5dc7416 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -100,6 +100,8 @@
 #define MVNETA_TXQ_CMD                           0x2448
 #define      MVNETA_TXQ_DISABLE_SHIFT            8
 #define      MVNETA_TXQ_ENABLE_MASK              0x000000ff
+#define MVNETA_GMAC_CLOCK_DIVIDER                0x24f4
+#define      MVNETA_GMAC_1MS_CLOCK_ENABLE        BIT(31)
 #define MVNETA_ACC_MODE                          0x2500
 #define MVNETA_CPU_MAP(cpu)                      (0x2540 + ((cpu) << 2))
 #define      MVNETA_CPU_RXQ_ACCESS_ALL_MASK      0x000000ff
@@ -166,6 +168,7 @@
 #define      MVNETA_GMAC_MAX_RX_SIZE_MASK        0x7ffc
 #define      MVNETA_GMAC0_PORT_ENABLE            BIT(0)
 #define MVNETA_GMAC_CTRL_2                       0x2c08
+#define      MVNETA_GMAC2_INBAND_AN_ENABLE       BIT(0)
 #define      MVNETA_GMAC2_PCS_ENABLE             BIT(3)
 #define      MVNETA_GMAC2_PORT_RGMII             BIT(4)
 #define      MVNETA_GMAC2_PORT_RESET             BIT(6)
@@ -185,6 +188,7 @@
 #define      MVNETA_GMAC_CONFIG_MII_SPEED        BIT(5)
 #define      MVNETA_GMAC_CONFIG_GMII_SPEED       BIT(6)
 #define      MVNETA_GMAC_AN_SPEED_EN             BIT(7)
+#define      MVNETA_GMAC_AN_FLOW_CTRL_EN         BIT(11)
 #define      MVNETA_GMAC_CONFIG_FULL_DUPLEX      BIT(12)
 #define      MVNETA_GMAC_AN_DUPLEX_EN            BIT(13)
 #define MVNETA_MIB_COUNTERS_BASE                 0x3080
@@ -1000,11 +1004,15 @@ static void mvneta_defaults_set(struct mvneta_port *pp)
 	if (pp->inband_status) {
 		val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
 		val &= ~(MVNETA_GMAC_FORCE_LINK_PASS |
-			 MVNETA_GMAC_FORCE_LINK_DOWN);
+			 MVNETA_GMAC_FORCE_LINK_DOWN |
+			 MVNETA_GMAC_AN_FLOW_CTRL_EN);
 		val |= MVNETA_GMAC_INBAND_AN_ENABLE |
 		       MVNETA_GMAC_AN_SPEED_EN |
 		       MVNETA_GMAC_AN_DUPLEX_EN;
 		mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
+		val = mvreg_read(pp, MVNETA_GMAC_CLOCK_DIVIDER);
+		val |= MVNETA_GMAC_1MS_CLOCK_ENABLE;
+		mvreg_write(pp, MVNETA_GMAC_CLOCK_DIVIDER, val);
 	}

 	mvneta_set_ucast_table(pp, -1);
@@ -2977,6 +2985,9 @@ static int mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
 		return -EINVAL;
 	}

+	if (pp->inband_status)
+		ctrl |= MVNETA_GMAC2_INBAND_AN_ENABLE;
+
 	/* Cancel Port Reset */
 	ctrl &= ~MVNETA_GMAC2_PORT_RESET;
 	mvreg_write(pp, MVNETA_GMAC_CTRL_2, ctrl);
-- 
1.7.9.5

  parent reply	other threads:[~2015-03-27 13:40 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-27 13:28 [PATCH 0/6] mvneta: SGMII-based in-band link state signaling Stas Sergeev
2015-03-27 13:31 ` PATCH 1/6] fixed_phy: pass phy_device instead of net_device to link_update() function Stas Sergeev
2015-03-27 13:33 ` [PATCH 2/6] fixed_phy: add fixed_phy_unregister() Stas Sergeev
2015-03-27 13:34 ` [PATCH 1/6] fixed_phy: pass phy_device instead of net_device to link_update() function Stas Sergeev
2015-03-27 13:35 ` [PATCH 3/6] of_mdio: restructure of_phy_register_fixed_link() for further modifications Stas Sergeev
2015-03-27 13:37 ` [PATCH 4/6] of: add API for changing parameters of fixed link Stas Sergeev
     [not found]   ` <55155D35.1070703-cmBhpYW9OiY@public.gmane.org>
2015-03-27 15:41     ` Florian Fainelli
2015-03-27 15:41       ` Florian Fainelli
2015-03-27 16:07       ` Stas Sergeev
2015-03-27 16:21         ` Florian Fainelli
     [not found]           ` <CAGVrzcaLfQcTAx8OR=sE=7FLrp0gGvfX8_YfxK_CU+x26JHymw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-27 16:39             ` Stas Sergeev
2015-03-27 16:39               ` Stas Sergeev
2015-03-27 17:15               ` Florian Fainelli
2015-03-27 17:31                 ` Stas Sergeev
2015-03-30 14:39                 ` Stas Sergeev
2015-03-30 16:06                   ` Florian Fainelli
2015-03-30 17:04                     ` Stas Sergeev
2015-03-31 17:11                     ` Stas Sergeev
2015-03-27 13:39 ` [PATCH 0/6] mvneta: SGMII-based in-band link state signaling Andrew Lunn
2015-03-27 13:52   ` Stas Sergeev
2015-03-27 13:59     ` Andrew Lunn
2015-03-27 14:20       ` Stas Sergeev
2015-03-27 15:44         ` Florian Fainelli
2015-03-27 13:39 ` [PATCH 5/6] mvneta: implement " Stas Sergeev
2015-07-08 16:30   ` [5/6] " Sebastien Rannou
2015-07-08 16:51     ` Stas Sergeev
2015-07-09  9:03       ` Sebastien Rannou
2015-07-09  9:19         ` Thomas Petazzoni
2015-07-09 10:11           ` Stas Sergeev
2015-03-27 13:40 ` Stas Sergeev [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-03-26 15:56 [PATCH 0/6] mvneta: SGMII-based in-band link status signaling Stas Sergeev
2015-03-26 15:58 ` [PATCH 1/6] restructure of_phy_register_fixed_link() for further modifications Stas Sergeev
2015-03-26 16:00   ` [PATCH 2/6] pass phy_device instead of net_device to fixed_phy link_update() function Stas Sergeev
2015-03-26 16:01     ` [PATCH 3/6] fixed_phy: add fixed_phy_unregister() Stas Sergeev
2015-03-26 16:02       ` [PATCH 4/6] of: add API for changing parameters of fixed link Stas Sergeev
2015-03-26 16:03         ` [PATCH 5/6] mvneta: implement SGMII-based in-band link status signaling Stas Sergeev
2015-03-26 16:04           ` [PATCH 6/6] mvneta: port marvell's official in-band status enabling procedure Stas Sergeev

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=55155DE4.5060701@list.ru \
    --to=stsp@list.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stsp@users.sourceforge.net \
    --cc=thomas.petazzoni@free-electrons.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 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.