Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Antoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Antoine Tenart and committed by
David S. Miller
a9aac385 cf55ace4

+47 -16
+1
drivers/net/ethernet/marvell/mvpp2/mvpp2.h
··· 613 613 614 614 /* Port flags */ 615 615 #define MVPP2_F_LOOPBACK BIT(0) 616 + #define MVPP2_F_DT_COMPAT BIT(1) 616 617 617 618 /* Marvell tag types */ 618 619 enum mvpp2_tag_type {
+46 -16
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
··· 3998 3998 v->sw_thread_id = i; 3999 3999 v->sw_thread_mask = BIT(i); 4000 4000 4001 - snprintf(irqname, sizeof(irqname), "tx-cpu%d", i); 4001 + if (port->flags & MVPP2_F_DT_COMPAT) 4002 + snprintf(irqname, sizeof(irqname), "tx-cpu%d", i); 4003 + else 4004 + snprintf(irqname, sizeof(irqname), "hif%d", i); 4002 4005 4003 4006 if (queue_mode == MVPP2_QDIST_MULTI_MODE) { 4004 4007 v->first_rxq = i * MVPP2_DEFAULT_RXQ; ··· 4011 4008 v->first_rxq = 0; 4012 4009 v->nrxqs = port->nrxqs; 4013 4010 v->type = MVPP2_QUEUE_VECTOR_SHARED; 4014 - strncpy(irqname, "rx-shared", sizeof(irqname)); 4011 + 4012 + if (port->flags & MVPP2_F_DT_COMPAT) 4013 + strncpy(irqname, "rx-shared", sizeof(irqname)); 4015 4014 } 4016 4015 4017 4016 if (port_node) ··· 4209 4204 return err; 4210 4205 } 4211 4206 4212 - /* Checks if the port DT description has the TX interrupts 4213 - * described. On PPv2.1, there are no such interrupts. On PPv2.2, 4214 - * there are available, but we need to keep support for old DTs. 4215 - */ 4216 - static bool mvpp2_port_has_tx_irqs(struct mvpp2 *priv, 4217 - struct device_node *port_node) 4207 + static bool mvpp22_port_has_legacy_tx_irqs(struct device_node *port_node, 4208 + unsigned long *flags) 4218 4209 { 4219 - char *irqs[5] = { "rx-shared", "tx-cpu0", "tx-cpu1", 4220 - "tx-cpu2", "tx-cpu3" }; 4221 - int ret, i; 4210 + char *irqs[5] = { "rx-shared", "tx-cpu0", "tx-cpu1", "tx-cpu2", 4211 + "tx-cpu3" }; 4212 + int i; 4213 + 4214 + for (i = 0; i < 5; i++) 4215 + if (of_property_match_string(port_node, "interrupt-names", 4216 + irqs[i]) < 0) 4217 + return false; 4218 + 4219 + *flags |= MVPP2_F_DT_COMPAT; 4220 + return true; 4221 + } 4222 + 4223 + /* Checks if the port dt description has the required Tx interrupts: 4224 + * - PPv2.1: there are no such interrupts. 4225 + * - PPv2.2: 4226 + * - The old DTs have: "rx-shared", "tx-cpuX" with X in [0...3] 4227 + * - The new ones have: "hifX" with X in [0..8] 4228 + * 4229 + * All those variants are supported to keep the backward compatibility. 4230 + */ 4231 + static bool mvpp2_port_has_irqs(struct mvpp2 *priv, 4232 + struct device_node *port_node, 4233 + unsigned long *flags) 4234 + { 4235 + char name[5]; 4236 + int i; 4222 4237 4223 4238 if (priv->hw_version == MVPP21) 4224 4239 return false; 4225 4240 4226 - for (i = 0; i < 5; i++) { 4227 - ret = of_property_match_string(port_node, "interrupt-names", 4228 - irqs[i]); 4229 - if (ret < 0) 4241 + if (mvpp22_port_has_legacy_tx_irqs(port_node, flags)) 4242 + return true; 4243 + 4244 + for (i = 0; i < MVPP2_MAX_THREADS; i++) { 4245 + snprintf(name, 5, "hif%d", i); 4246 + if (of_property_match_string(port_node, "interrupt-names", 4247 + name) < 0) 4230 4248 return false; 4231 4249 } 4232 4250 ··· 4627 4599 struct phylink *phylink; 4628 4600 char *mac_from = ""; 4629 4601 unsigned int ntxqs, nrxqs; 4602 + unsigned long flags = 0; 4630 4603 bool has_tx_irqs; 4631 4604 u32 id; 4632 4605 int features; ··· 4635 4606 int err, i, cpu; 4636 4607 4637 4608 if (port_node) { 4638 - has_tx_irqs = mvpp2_port_has_tx_irqs(priv, port_node); 4609 + has_tx_irqs = mvpp2_port_has_irqs(priv, port_node, &flags); 4639 4610 } else { 4640 4611 has_tx_irqs = true; 4641 4612 queue_mode = MVPP2_QDIST_MULTI_MODE; ··· 4691 4662 port->nrxqs = nrxqs; 4692 4663 port->priv = priv; 4693 4664 port->has_tx_irqs = has_tx_irqs; 4665 + port->flags = flags; 4694 4666 4695 4667 err = mvpp2_queue_vectors_init(port, port_node); 4696 4668 if (err)