Skip to content

Commit 0411c90

Browse files
Marc ZyngierMani-Sadhasivam
authored andcommitted
PCI: apple: Move away from INTMSK{SET,CLR} for INTx and private interrupts
T602x seems to have dropped the rather useful SET/CLR accessors to the masking register. Instead, let's use the mask register directly, and wrap it with a brand new spinlock. No, this isn't moving in the right direction. Signed-off-by: Marc Zyngier <[email protected]> Signed-off-by: Manivannan Sadhasivam <[email protected]> Tested-by: Janne Grunau <[email protected]> Reviewed-by: Rob Herring (Arm) <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Acked-by: Alyssa Rosenzweig <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent ed98286 commit 0411c90

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

drivers/pci/controller/pcie-apple.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ struct apple_pcie {
142142
};
143143

144144
struct apple_pcie_port {
145+
raw_spinlock_t lock;
145146
struct apple_pcie *pcie;
146147
struct device_node *np;
147148
void __iomem *base;
@@ -261,14 +262,16 @@ static void apple_port_irq_mask(struct irq_data *data)
261262
{
262263
struct apple_pcie_port *port = irq_data_get_irq_chip_data(data);
263264

264-
writel_relaxed(BIT(data->hwirq), port->base + PORT_INTMSKSET);
265+
guard(raw_spinlock_irqsave)(&port->lock);
266+
rmw_set(BIT(data->hwirq), port->base + PORT_INTMSK);
265267
}
266268

267269
static void apple_port_irq_unmask(struct irq_data *data)
268270
{
269271
struct apple_pcie_port *port = irq_data_get_irq_chip_data(data);
270272

271-
writel_relaxed(BIT(data->hwirq), port->base + PORT_INTMSKCLR);
273+
guard(raw_spinlock_irqsave)(&port->lock);
274+
rmw_clear(BIT(data->hwirq), port->base + PORT_INTMSK);
272275
}
273276

274277
static bool hwirq_is_intx(unsigned int hwirq)
@@ -387,7 +390,7 @@ static int apple_pcie_port_setup_irq(struct apple_pcie_port *port)
387390
return -ENOMEM;
388391

389392
/* Disable all interrupts */
390-
writel_relaxed(~0, port->base + PORT_INTMSKSET);
393+
writel_relaxed(~0, port->base + PORT_INTMSK);
391394
writel_relaxed(~0, port->base + PORT_INTSTAT);
392395

393396
irq_set_chained_handler_and_data(irq, apple_port_irq_handler, port);
@@ -537,6 +540,8 @@ static int apple_pcie_setup_port(struct apple_pcie *pcie,
537540
port->pcie = pcie;
538541
port->np = np;
539542

543+
raw_spin_lock_init(&port->lock);
544+
540545
port->base = devm_platform_ioremap_resource(platform, port->idx + 2);
541546
if (IS_ERR(port->base))
542547
return PTR_ERR(port->base);

0 commit comments

Comments
 (0)