public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Stas Sergeev <stsp@list•ru>
To: netdev@vger•kernel.org
Cc: Rami Rosen <rosenr@marvell•com>,
	Thomas Petazzoni <thomas.petazzoni@free-electrons•com>
Subject: [PATCH 6/6] mvneta: port marvell's official in-band status enabling procedure
Date: Thu, 26 Mar 2015 19:04:43 +0300	[thread overview]
Message-ID: <55142E1B.1000305@list.ru> (raw)
In-Reply-To: <55142DD4.9060004@list.ru>

-=-=-=-=-=-=-=-=-=# Don't remove this line #=-=-=-=-=-=-=-=-=-
This is a back-port of official marvell's patch.
It changes nothing visible for me but looks reasonable.

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

diff --git a/drivers/net/ethernet/marvell/mvneta.c
b/drivers/net/ethernet/marvell/mvneta.c
index 44d2655..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)
@@ -1001,12 +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_FLOW_CTRL_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);
@@ -2979,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

  reply	other threads:[~2015-03-26 16:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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           ` Stas Sergeev [this message]
2015-03-26 22:49     ` [PATCH 2/6] pass phy_device instead of net_device to fixed_phy link_update() function David Miller
2015-03-26 22:55       ` Stas Sergeev
2015-03-26 22:59         ` Thomas Petazzoni
2015-03-26 19:01   ` [PATCH 1/6] restructure of_phy_register_fixed_link() for further modifications Sergei Shtylyov
2015-03-26 20:26     ` Stas Sergeev
2015-03-26 17:13 ` [PATCH 0/6] mvneta: SGMII-based in-band link status signaling Florian Fainelli
2015-03-26 17:23   ` Stas Sergeev
2015-03-26 17:29     ` Florian Fainelli
2015-03-26 17:34       ` Stas Sergeev
  -- strict thread matches above, loose matches on Subject: below --
2015-03-27 13:28 [PATCH 0/6] mvneta: SGMII-based in-band link state signaling Stas Sergeev
2015-03-27 13:40 ` [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=55142E1B.1000305@list.ru \
    --to=stsp@list$(echo .)ru \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=rosenr@marvell$(echo .)com \
    --cc=thomas.petazzoni@free-electrons$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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