Lines Matching +full:invert +full:- +full:enable

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>
48 .compatible = "st,stih415-irq-syscfg",
52 .compatible = "st,stih416-irq-syscfg",
56 .compatible = "st,stih407-irq-syscfg",
60 .compatible = "st,stid127-irq-syscfg",
69 struct st_irq_syscfg *ddata = dev_get_drvdata(&pdev->dev); in st_irq_xlate()
71 /* Set the device enable bit. */ in st_irq_xlate()
74 ddata->config |= ST_A9_IRQ_EN_EXT_0; in st_irq_xlate()
77 ddata->config |= ST_A9_IRQ_EN_EXT_1; in st_irq_xlate()
80 ddata->config |= ST_A9_IRQ_EN_EXT_2; in st_irq_xlate()
83 ddata->config |= ST_A9_IRQ_EN_CTI_0; in st_irq_xlate()
86 ddata->config |= ST_A9_IRQ_EN_CTI_1; in st_irq_xlate()
89 ddata->config |= ST_A9_IRQ_EN_PMU_0; in st_irq_xlate()
92 ddata->config |= ST_A9_IRQ_EN_PMU_1; in st_irq_xlate()
95 ddata->config |= ST_A9_IRQ_EN_PL310_L2; in st_irq_xlate()
100 dev_err(&pdev->dev, "Unrecognised device %d\n", device); in st_irq_xlate()
101 return -EINVAL; in st_irq_xlate()
105 ddata->config |= irq ? in st_irq_xlate()
114 struct device_node *np = pdev->dev.of_node; in st_irq_syscfg_enable()
115 struct st_irq_syscfg *ddata = dev_get_drvdata(&pdev->dev); in st_irq_syscfg_enable()
117 u32 device, invert; in st_irq_syscfg_enable() local
119 channels = of_property_count_u32_elems(np, "st,irq-device"); in st_irq_syscfg_enable()
121 dev_err(&pdev->dev, "st,enable-irq-device must have 2 elems\n"); in st_irq_syscfg_enable()
122 return -EINVAL; in st_irq_syscfg_enable()
125 channels = of_property_count_u32_elems(np, "st,fiq-device"); in st_irq_syscfg_enable()
127 dev_err(&pdev->dev, "st,enable-fiq-device must have 2 elems\n"); in st_irq_syscfg_enable()
128 return -EINVAL; in st_irq_syscfg_enable()
132 of_property_read_u32_index(np, "st,irq-device", i, &device); in st_irq_syscfg_enable()
138 of_property_read_u32_index(np, "st,fiq-device", i, &device); in st_irq_syscfg_enable()
146 of_property_read_u32(np, "st,invert-ext", &invert); in st_irq_syscfg_enable()
147 ddata->config |= ST_A9_EXTIRQ_INV_SEL(invert); in st_irq_syscfg_enable()
149 return regmap_update_bits(ddata->regmap, ddata->syscfg, in st_irq_syscfg_enable()
150 ST_A9_IRQ_MASK, ddata->config); in st_irq_syscfg_enable()
155 struct device_node *np = pdev->dev.of_node; in st_irq_syscfg_probe()
159 ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); in st_irq_syscfg_probe()
161 return -ENOMEM; in st_irq_syscfg_probe()
163 match = of_match_device(st_irq_syscfg_match, &pdev->dev); in st_irq_syscfg_probe()
165 return -ENODEV; in st_irq_syscfg_probe()
167 ddata->syscfg = (unsigned int)match->data; in st_irq_syscfg_probe()
169 ddata->regmap = syscon_regmap_lookup_by_phandle(np, "st,syscfg"); in st_irq_syscfg_probe()
170 if (IS_ERR(ddata->regmap)) { in st_irq_syscfg_probe()
171 dev_err(&pdev->dev, "syscfg phandle missing\n"); in st_irq_syscfg_probe()
172 return PTR_ERR(ddata->regmap); in st_irq_syscfg_probe()
175 dev_set_drvdata(&pdev->dev, ddata); in st_irq_syscfg_probe()
184 return regmap_update_bits(ddata->regmap, ddata->syscfg, in st_irq_syscfg_resume()
185 ST_A9_IRQ_MASK, ddata->config); in st_irq_syscfg_resume()