@@ -142,6 +142,7 @@ struct apple_pcie {
142
142
};
143
143
144
144
struct apple_pcie_port {
145
+ raw_spinlock_t lock ;
145
146
struct apple_pcie * pcie ;
146
147
struct device_node * np ;
147
148
void __iomem * base ;
@@ -261,14 +262,16 @@ static void apple_port_irq_mask(struct irq_data *data)
261
262
{
262
263
struct apple_pcie_port * port = irq_data_get_irq_chip_data (data );
263
264
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 );
265
267
}
266
268
267
269
static void apple_port_irq_unmask (struct irq_data * data )
268
270
{
269
271
struct apple_pcie_port * port = irq_data_get_irq_chip_data (data );
270
272
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 );
272
275
}
273
276
274
277
static bool hwirq_is_intx (unsigned int hwirq )
@@ -387,7 +390,7 @@ static int apple_pcie_port_setup_irq(struct apple_pcie_port *port)
387
390
return - ENOMEM ;
388
391
389
392
/* Disable all interrupts */
390
- writel_relaxed (~0 , port -> base + PORT_INTMSKSET );
393
+ writel_relaxed (~0 , port -> base + PORT_INTMSK );
391
394
writel_relaxed (~0 , port -> base + PORT_INTSTAT );
392
395
393
396
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,
537
540
port -> pcie = pcie ;
538
541
port -> np = np ;
539
542
543
+ raw_spin_lock_init (& port -> lock );
544
+
540
545
port -> base = devm_platform_ioremap_resource (platform , port -> idx + 2 );
541
546
if (IS_ERR (port -> base ))
542
547
return PTR_ERR (port -> base );
0 commit comments