From: Vladimir Oltean <olteanv@gmail•com>
To: f.fainelli@gmail•com, vivien.didelot@gmail•com, andrew@lunn•ch,
davem@davemloft•net
Cc: netdev@vger•kernel.org, Vladimir Oltean <olteanv@gmail•com>
Subject: [PATCH net-next 3/4] net: dsa: sja1105: Export the sja1105_inhibit_tx function
Date: Sat, 8 Jun 2019 16:03:43 +0300 [thread overview]
Message-ID: <20190608130344.661-4-olteanv@gmail.com> (raw)
In-Reply-To: <20190608130344.661-1-olteanv@gmail.com>
This will be used to stop egress traffic in .phylink_mac_link_up.
Signed-off-by: Vladimir Oltean <olteanv@gmail•com>
---
drivers/net/dsa/sja1105/sja1105.h | 2 ++
drivers/net/dsa/sja1105/sja1105_spi.c | 14 ++++++++------
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/net/dsa/sja1105/sja1105.h b/drivers/net/dsa/sja1105/sja1105.h
index 38b6c7c7db86..ed66d00eb394 100644
--- a/drivers/net/dsa/sja1105/sja1105.h
+++ b/drivers/net/dsa/sja1105/sja1105.h
@@ -138,6 +138,8 @@ int sja1105_spi_send_long_packed_buf(const struct sja1105_private *priv,
sja1105_spi_rw_mode_t rw, u64 base_addr,
void *packed_buf, u64 buf_len);
int sja1105_static_config_upload(struct sja1105_private *priv);
+int sja1105_inhibit_tx(const struct sja1105_private *priv,
+ unsigned long port_bitmap, bool tx_inhibited);
extern struct sja1105_info sja1105e_info;
extern struct sja1105_info sja1105t_info;
diff --git a/drivers/net/dsa/sja1105/sja1105_spi.c b/drivers/net/dsa/sja1105/sja1105_spi.c
index d729a0f0b28e..d7ff74259b31 100644
--- a/drivers/net/dsa/sja1105/sja1105_spi.c
+++ b/drivers/net/dsa/sja1105/sja1105_spi.c
@@ -285,20 +285,22 @@ static int sja1105_cold_reset(const struct sja1105_private *priv)
return priv->info->reset_cmd(priv, &reset);
}
-static int sja1105_inhibit_tx(const struct sja1105_private *priv,
- const unsigned long *port_bitmap)
+int sja1105_inhibit_tx(const struct sja1105_private *priv,
+ unsigned long port_bitmap, bool tx_inhibited)
{
const struct sja1105_regs *regs = priv->info->regs;
u64 inhibit_cmd;
- int port, rc;
+ int rc;
rc = sja1105_spi_send_int(priv, SPI_READ, regs->port_control,
&inhibit_cmd, SJA1105_SIZE_PORT_CTRL);
if (rc < 0)
return rc;
- for_each_set_bit(port, port_bitmap, SJA1105_NUM_PORTS)
- inhibit_cmd |= BIT(port);
+ if (tx_inhibited)
+ inhibit_cmd |= port_bitmap;
+ else
+ inhibit_cmd &= ~port_bitmap;
return sja1105_spi_send_int(priv, SPI_WRITE, regs->port_control,
&inhibit_cmd, SJA1105_SIZE_PORT_CTRL);
@@ -415,7 +417,7 @@ int sja1105_static_config_upload(struct sja1105_private *priv)
* Tx on all ports and waiting for current packet to drain.
* Otherwise, the PHY will see an unterminated Ethernet packet.
*/
- rc = sja1105_inhibit_tx(priv, &port_bitmap);
+ rc = sja1105_inhibit_tx(priv, port_bitmap, true);
if (rc < 0) {
dev_err(dev, "Failed to inhibit Tx on ports\n");
return -ENXIO;
--
2.17.1
next prev parent reply other threads:[~2019-06-08 13:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-08 13:03 [PATCH net-next 0/4] Rethink PHYLINK callbacks for SJA1105 DSA Vladimir Oltean
2019-06-08 13:03 ` [PATCH net-next 1/4] net: dsa: sja1105: Use SPEED_{10,100,1000,UNKNOWN} macros Vladimir Oltean
2019-06-08 18:52 ` Andrew Lunn
2019-06-09 2:52 ` Florian Fainelli
2019-06-08 13:03 ` [PATCH net-next 2/4] net: dsa: sja1105: Update some comments about PHYLIB Vladimir Oltean
2019-06-08 18:53 ` Andrew Lunn
2019-06-09 2:53 ` Florian Fainelli
2019-06-08 13:03 ` Vladimir Oltean [this message]
2019-06-08 18:54 ` [PATCH net-next 3/4] net: dsa: sja1105: Export the sja1105_inhibit_tx function Andrew Lunn
2019-06-09 2:54 ` Florian Fainelli
2019-06-08 13:03 ` [PATCH net-next 4/4] net: dsa: sja1105: Rethink the PHYLINK callbacks Vladimir Oltean
2019-06-08 18:57 ` Andrew Lunn
2019-06-09 2:55 ` Florian Fainelli
2019-06-10 2:59 ` [PATCH net-next 0/4] Rethink PHYLINK callbacks for SJA1105 DSA David Miller
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=20190608130344.661-4-olteanv@gmail.com \
--to=olteanv@gmail$(echo .)com \
--cc=andrew@lunn$(echo .)ch \
--cc=davem@davemloft$(echo .)net \
--cc=f.fainelli@gmail$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=vivien.didelot@gmail$(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