Lines Matching +full:irq +full:- +full:syscfg
1 // SPDX-License-Identifier: GPL-2.0-only
7 * This is a re-write of Christophe Kerello's PMU driver.
10 #include <dt-bindings/interrupt-controller/irq-st.h>
38 unsigned int syscfg; member
45 .compatible = "st,stih407-irq-syscfg",
52 int device, int channel, bool irq) in st_irq_xlate() argument
54 struct st_irq_syscfg *ddata = dev_get_drvdata(&pdev->dev); in st_irq_xlate()
59 ddata->config |= ST_A9_IRQ_EN_EXT_0; in st_irq_xlate()
62 ddata->config |= ST_A9_IRQ_EN_EXT_1; in st_irq_xlate()
65 ddata->config |= ST_A9_IRQ_EN_EXT_2; in st_irq_xlate()
68 ddata->config |= ST_A9_IRQ_EN_CTI_0; in st_irq_xlate()
71 ddata->config |= ST_A9_IRQ_EN_CTI_1; in st_irq_xlate()
74 ddata->config |= ST_A9_IRQ_EN_PMU_0; in st_irq_xlate()
77 ddata->config |= ST_A9_IRQ_EN_PMU_1; in st_irq_xlate()
80 ddata->config |= ST_A9_IRQ_EN_PL310_L2; in st_irq_xlate()
85 dev_err(&pdev->dev, "Unrecognised device %d\n", device); in st_irq_xlate()
86 return -EINVAL; in st_irq_xlate()
89 /* Select IRQ/FIQ channel for device. */ in st_irq_xlate()
90 ddata->config |= irq ? in st_irq_xlate()
99 struct device_node *np = pdev->dev.of_node; in st_irq_syscfg_enable()
100 struct st_irq_syscfg *ddata = dev_get_drvdata(&pdev->dev); in st_irq_syscfg_enable()
104 channels = of_property_count_u32_elems(np, "st,irq-device"); in st_irq_syscfg_enable()
106 dev_err(&pdev->dev, "st,enable-irq-device must have 2 elems\n"); in st_irq_syscfg_enable()
107 return -EINVAL; in st_irq_syscfg_enable()
110 channels = of_property_count_u32_elems(np, "st,fiq-device"); in st_irq_syscfg_enable()
112 dev_err(&pdev->dev, "st,enable-fiq-device must have 2 elems\n"); in st_irq_syscfg_enable()
113 return -EINVAL; in st_irq_syscfg_enable()
117 of_property_read_u32_index(np, "st,irq-device", i, &device); in st_irq_syscfg_enable()
123 of_property_read_u32_index(np, "st,fiq-device", i, &device); in st_irq_syscfg_enable()
131 of_property_read_u32(np, "st,invert-ext", &invert); in st_irq_syscfg_enable()
132 ddata->config |= ST_A9_EXTIRQ_INV_SEL(invert); in st_irq_syscfg_enable()
134 return regmap_update_bits(ddata->regmap, ddata->syscfg, in st_irq_syscfg_enable()
135 ST_A9_IRQ_MASK, ddata->config); in st_irq_syscfg_enable()
140 struct device_node *np = pdev->dev.of_node; in st_irq_syscfg_probe()
143 ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); in st_irq_syscfg_probe()
145 return -ENOMEM; in st_irq_syscfg_probe()
147 ddata->syscfg = (unsigned int) device_get_match_data(&pdev->dev); in st_irq_syscfg_probe()
149 ddata->regmap = syscon_regmap_lookup_by_phandle(np, "st,syscfg"); in st_irq_syscfg_probe()
150 if (IS_ERR(ddata->regmap)) { in st_irq_syscfg_probe()
151 dev_err(&pdev->dev, "syscfg phandle missing\n"); in st_irq_syscfg_probe()
152 return PTR_ERR(ddata->regmap); in st_irq_syscfg_probe()
155 dev_set_drvdata(&pdev->dev, ddata); in st_irq_syscfg_probe()
164 return regmap_update_bits(ddata->regmap, ddata->syscfg, in st_irq_syscfg_resume()
165 ST_A9_IRQ_MASK, ddata->config); in st_irq_syscfg_resume()