mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
irqchip: irq-bcm2836: Remove regmap and syscon use
The syscon node defines a register range that duplicates that used by the local_intc node on bcm2836/7. Since irq-bcm2835 and irq-bcm2836 are built in and always present together (both drivers are enabled by CONFIG_ARCH_BCM2835), it is possible to replace the syscon usage with a global variable that simplifies the code. Doing so does lose the locking provided by regmap, but as only one side is using the regmap interface (irq-bcm2835 uses readl and write) there is no loss of atomicity. See: https://github.com/raspberrypi/firmware/issues/926 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
This commit is contained in:
@@ -41,8 +41,6 @@
|
|||||||
#include <linux/of_irq.h>
|
#include <linux/of_irq.h>
|
||||||
#include <linux/irqchip.h>
|
#include <linux/irqchip.h>
|
||||||
#include <linux/irqdomain.h>
|
#include <linux/irqdomain.h>
|
||||||
#include <linux/mfd/syscon.h>
|
|
||||||
#include <linux/regmap.h>
|
|
||||||
|
|
||||||
#include <asm/exception.h>
|
#include <asm/exception.h>
|
||||||
#include <asm/mach/irq.h>
|
#include <asm/mach/irq.h>
|
||||||
@@ -92,7 +90,7 @@ struct armctrl_ic {
|
|||||||
void __iomem *enable[NR_BANKS];
|
void __iomem *enable[NR_BANKS];
|
||||||
void __iomem *disable[NR_BANKS];
|
void __iomem *disable[NR_BANKS];
|
||||||
struct irq_domain *domain;
|
struct irq_domain *domain;
|
||||||
struct regmap *local_regmap;
|
void __iomem *local_base;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct armctrl_ic intc __read_mostly;
|
static struct armctrl_ic intc __read_mostly;
|
||||||
@@ -129,24 +127,20 @@ static void armctrl_unmask_irq(struct irq_data *d)
|
|||||||
if (d->hwirq >= NUMBER_IRQS) {
|
if (d->hwirq >= NUMBER_IRQS) {
|
||||||
if (num_online_cpus() > 1) {
|
if (num_online_cpus() > 1) {
|
||||||
unsigned int data;
|
unsigned int data;
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (!intc.local_regmap) {
|
if (!intc.local_base) {
|
||||||
pr_err("FIQ is disabled due to missing regmap\n");
|
pr_err("FIQ is disabled due to missing arm_local_intc\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = regmap_read(intc.local_regmap,
|
data = readl_relaxed(intc.local_base +
|
||||||
ARM_LOCAL_GPU_INT_ROUTING, &data);
|
ARM_LOCAL_GPU_INT_ROUTING);
|
||||||
if (ret) {
|
|
||||||
pr_err("Failed to read int routing %d\n", ret);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
data &= ~0xc;
|
data &= ~0xc;
|
||||||
data |= (1 << 2);
|
data |= (1 << 2);
|
||||||
regmap_write(intc.local_regmap,
|
writel_relaxed(data,
|
||||||
ARM_LOCAL_GPU_INT_ROUTING, data);
|
intc.local_base +
|
||||||
|
ARM_LOCAL_GPU_INT_ROUTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
writel_relaxed(REG_FIQ_ENABLE | hwirq_to_fiq(d->hwirq),
|
writel_relaxed(REG_FIQ_ENABLE | hwirq_to_fiq(d->hwirq),
|
||||||
@@ -246,12 +240,10 @@ static int __init armctrl_of_init(struct device_node *node,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_2836) {
|
if (is_2836) {
|
||||||
intc.local_regmap =
|
extern void __iomem * __attribute__((weak)) arm_local_intc;
|
||||||
syscon_regmap_lookup_by_compatible("brcm,bcm2836-arm-local");
|
intc.local_base = arm_local_intc;
|
||||||
if (IS_ERR(intc.local_regmap)) {
|
if (!intc.local_base)
|
||||||
pr_err("Failed to get local register map. FIQ is disabled for cpus > 1\n");
|
pr_err("Failed to get local intc base. FIQ is disabled for cpus > 1\n");
|
||||||
intc.local_regmap = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make a duplicate irq range which is used to enable FIQ */
|
/* Make a duplicate irq range which is used to enable FIQ */
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ struct bcm2836_arm_irqchip_intc {
|
|||||||
|
|
||||||
static struct bcm2836_arm_irqchip_intc intc __read_mostly;
|
static struct bcm2836_arm_irqchip_intc intc __read_mostly;
|
||||||
|
|
||||||
|
void __iomem *arm_local_intc;
|
||||||
|
EXPORT_SYMBOL_GPL(arm_local_intc);
|
||||||
|
|
||||||
static void bcm2836_arm_irqchip_mask_per_cpu_irq(unsigned int reg_offset,
|
static void bcm2836_arm_irqchip_mask_per_cpu_irq(unsigned int reg_offset,
|
||||||
unsigned int bit,
|
unsigned int bit,
|
||||||
int cpu)
|
int cpu)
|
||||||
@@ -320,6 +323,8 @@ static int __init bcm2836_arm_irqchip_l1_intc_of_init(struct device_node *node,
|
|||||||
panic("%pOF: unable to map local interrupt registers\n", node);
|
panic("%pOF: unable to map local interrupt registers\n", node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
arm_local_intc = intc.base;
|
||||||
|
|
||||||
bcm2835_init_local_timer_frequency();
|
bcm2835_init_local_timer_frequency();
|
||||||
|
|
||||||
intc.domain = irq_domain_add_linear(node, LAST_IRQ + 1,
|
intc.domain = irq_domain_add_linear(node, LAST_IRQ + 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user