Commit a9aac385 authored by Antoine Tenart's avatar Antoine Tenart Committed by David S. Miller

net: mvpp2: rename the IRQs to match the hardware

This patch renames the IRQs in the Marvell PPv2 driver as their current
names match the way they are used in software. But this will change in
the future, and those IRQs have nothing to do with Rx/Tx interrupts
(this can be configured). The new binding also describe more interrupts
as some where left out.

The old binding support is kept for backward compatibility.
Signed-off-by: default avatarAntoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cf55ace4
...@@ -613,6 +613,7 @@ ...@@ -613,6 +613,7 @@
/* Port flags */ /* Port flags */
#define MVPP2_F_LOOPBACK BIT(0) #define MVPP2_F_LOOPBACK BIT(0)
#define MVPP2_F_DT_COMPAT BIT(1)
/* Marvell tag types */ /* Marvell tag types */
enum mvpp2_tag_type { enum mvpp2_tag_type {
......
...@@ -3998,7 +3998,10 @@ static int mvpp2_multi_queue_vectors_init(struct mvpp2_port *port, ...@@ -3998,7 +3998,10 @@ static int mvpp2_multi_queue_vectors_init(struct mvpp2_port *port,
v->sw_thread_id = i; v->sw_thread_id = i;
v->sw_thread_mask = BIT(i); v->sw_thread_mask = BIT(i);
if (port->flags & MVPP2_F_DT_COMPAT)
snprintf(irqname, sizeof(irqname), "tx-cpu%d", i); snprintf(irqname, sizeof(irqname), "tx-cpu%d", i);
else
snprintf(irqname, sizeof(irqname), "hif%d", i);
if (queue_mode == MVPP2_QDIST_MULTI_MODE) { if (queue_mode == MVPP2_QDIST_MULTI_MODE) {
v->first_rxq = i * MVPP2_DEFAULT_RXQ; v->first_rxq = i * MVPP2_DEFAULT_RXQ;
...@@ -4008,6 +4011,8 @@ static int mvpp2_multi_queue_vectors_init(struct mvpp2_port *port, ...@@ -4008,6 +4011,8 @@ static int mvpp2_multi_queue_vectors_init(struct mvpp2_port *port,
v->first_rxq = 0; v->first_rxq = 0;
v->nrxqs = port->nrxqs; v->nrxqs = port->nrxqs;
v->type = MVPP2_QUEUE_VECTOR_SHARED; v->type = MVPP2_QUEUE_VECTOR_SHARED;
if (port->flags & MVPP2_F_DT_COMPAT)
strncpy(irqname, "rx-shared", sizeof(irqname)); strncpy(irqname, "rx-shared", sizeof(irqname));
} }
...@@ -4204,24 +4209,47 @@ static int mvpp2_port_init(struct mvpp2_port *port) ...@@ -4204,24 +4209,47 @@ static int mvpp2_port_init(struct mvpp2_port *port)
return err; return err;
} }
/* Checks if the port DT description has the TX interrupts static bool mvpp22_port_has_legacy_tx_irqs(struct device_node *port_node,
* described. On PPv2.1, there are no such interrupts. On PPv2.2, unsigned long *flags)
* there are available, but we need to keep support for old DTs. {
char *irqs[5] = { "rx-shared", "tx-cpu0", "tx-cpu1", "tx-cpu2",
"tx-cpu3" };
int i;
for (i = 0; i < 5; i++)
if (of_property_match_string(port_node, "interrupt-names",
irqs[i]) < 0)
return false;
*flags |= MVPP2_F_DT_COMPAT;
return true;
}
/* Checks if the port dt description has the required Tx interrupts:
* - PPv2.1: there are no such interrupts.
* - PPv2.2:
* - The old DTs have: "rx-shared", "tx-cpuX" with X in [0...3]
* - The new ones have: "hifX" with X in [0..8]
*
* All those variants are supported to keep the backward compatibility.
*/ */
static bool mvpp2_port_has_tx_irqs(struct mvpp2 *priv, static bool mvpp2_port_has_irqs(struct mvpp2 *priv,
struct device_node *port_node) struct device_node *port_node,
unsigned long *flags)
{ {
char *irqs[5] = { "rx-shared", "tx-cpu0", "tx-cpu1", char name[5];
"tx-cpu2", "tx-cpu3" }; int i;
int ret, i;
if (priv->hw_version == MVPP21) if (priv->hw_version == MVPP21)
return false; return false;
for (i = 0; i < 5; i++) { if (mvpp22_port_has_legacy_tx_irqs(port_node, flags))
ret = of_property_match_string(port_node, "interrupt-names", return true;
irqs[i]);
if (ret < 0) for (i = 0; i < MVPP2_MAX_THREADS; i++) {
snprintf(name, 5, "hif%d", i);
if (of_property_match_string(port_node, "interrupt-names",
name) < 0)
return false; return false;
} }
...@@ -4599,6 +4627,7 @@ static int mvpp2_port_probe(struct platform_device *pdev, ...@@ -4599,6 +4627,7 @@ static int mvpp2_port_probe(struct platform_device *pdev,
struct phylink *phylink; struct phylink *phylink;
char *mac_from = ""; char *mac_from = "";
unsigned int ntxqs, nrxqs; unsigned int ntxqs, nrxqs;
unsigned long flags = 0;
bool has_tx_irqs; bool has_tx_irqs;
u32 id; u32 id;
int features; int features;
...@@ -4606,7 +4635,7 @@ static int mvpp2_port_probe(struct platform_device *pdev, ...@@ -4606,7 +4635,7 @@ static int mvpp2_port_probe(struct platform_device *pdev,
int err, i, cpu; int err, i, cpu;
if (port_node) { if (port_node) {
has_tx_irqs = mvpp2_port_has_tx_irqs(priv, port_node); has_tx_irqs = mvpp2_port_has_irqs(priv, port_node, &flags);
} else { } else {
has_tx_irqs = true; has_tx_irqs = true;
queue_mode = MVPP2_QDIST_MULTI_MODE; queue_mode = MVPP2_QDIST_MULTI_MODE;
...@@ -4662,6 +4691,7 @@ static int mvpp2_port_probe(struct platform_device *pdev, ...@@ -4662,6 +4691,7 @@ static int mvpp2_port_probe(struct platform_device *pdev,
port->nrxqs = nrxqs; port->nrxqs = nrxqs;
port->priv = priv; port->priv = priv;
port->has_tx_irqs = has_tx_irqs; port->has_tx_irqs = has_tx_irqs;
port->flags = flags;
err = mvpp2_queue_vectors_init(port, port_node); err = mvpp2_queue_vectors_init(port, port_node);
if (err) if (err)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment