Skip to content

Commit c6325a2

Browse files
committed
Merge tag 'amlogic-drivers-for-v6.15' of https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux into soc/drivers
Amlogic drivers changes for v6.15: - GPIO interrupt controller support for Amlogic A4 and A5 SoCs * tag 'amlogic-drivers-for-v6.15' of https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux: irqchip: Add support for Amlogic A4 and A5 SoCs dt-bindings: interrupt-controller: Add support for Amlogic A4 and A5 SoCs Link: https://lore.kernel.org/r/eeaa8d3b-4fc3-4dae-92b8-0fc590e1a070@linaro.org Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2 parents 3603d92 + bbd6fcc commit c6325a2

2 files changed

Lines changed: 55 additions & 12 deletions

File tree

Documentation/devicetree/bindings/interrupt-controller/amlogic,meson-gpio-intc.yaml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ properties:
3535
- amlogic,meson-sm1-gpio-intc
3636
- amlogic,meson-a1-gpio-intc
3737
- amlogic,meson-s4-gpio-intc
38+
- amlogic,a4-gpio-intc
39+
- amlogic,a4-gpio-ao-intc
40+
- amlogic,a5-gpio-intc
3841
- amlogic,c3-gpio-intc
3942
- amlogic,t7-gpio-intc
4043
- const: amlogic,meson-gpio-intc
@@ -49,7 +52,7 @@ properties:
4952

5053
amlogic,channel-interrupts:
5154
description: Array with the upstream hwirq numbers
52-
minItems: 8
55+
minItems: 2
5356
maxItems: 12
5457
$ref: /schemas/types.yaml#/definitions/uint32-array
5558

@@ -60,6 +63,20 @@ required:
6063
- "#interrupt-cells"
6164
- amlogic,channel-interrupts
6265

66+
if:
67+
properties:
68+
compatible:
69+
contains:
70+
const: amlogic,a4-gpio-ao-intc
71+
then:
72+
properties:
73+
amlogic,channel-interrupts:
74+
maxItems: 2
75+
else:
76+
properties:
77+
amlogic,channel-interrupts:
78+
minItems: 8
79+
6380
additionalProperties: false
6481

6582
examples:

drivers/irqchip/irq-meson-gpio.c

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626

2727
/* use for A1 like chips */
2828
#define REG_PIN_A1_SEL 0x04
29-
/* Used for s4 chips */
30-
#define REG_EDGE_POL_S4 0x1c
3129

3230
/*
3331
* Note: The S905X3 datasheet reports that BOTH_EDGE is controlled by
@@ -72,6 +70,7 @@ struct meson_gpio_irq_params {
7270
bool support_edge_both;
7371
unsigned int edge_both_offset;
7472
unsigned int edge_single_offset;
73+
unsigned int edge_pol_reg;
7574
unsigned int pol_low_offset;
7675
unsigned int pin_sel_mask;
7776
struct irq_ctl_ops ops;
@@ -105,13 +104,26 @@ struct meson_gpio_irq_params {
105104
.pin_sel_mask = 0x7f, \
106105
.nr_channels = 8, \
107106

107+
#define INIT_MESON_A4_AO_COMMON_DATA(irqs) \
108+
INIT_MESON_COMMON(irqs, meson_a1_gpio_irq_init, \
109+
meson_a1_gpio_irq_sel_pin, \
110+
meson_s4_gpio_irq_set_type) \
111+
.support_edge_both = true, \
112+
.edge_both_offset = 0, \
113+
.edge_single_offset = 12, \
114+
.edge_pol_reg = 0x8, \
115+
.pol_low_offset = 0, \
116+
.pin_sel_mask = 0xff, \
117+
.nr_channels = 2, \
118+
108119
#define INIT_MESON_S4_COMMON_DATA(irqs) \
109120
INIT_MESON_COMMON(irqs, meson_a1_gpio_irq_init, \
110121
meson_a1_gpio_irq_sel_pin, \
111122
meson_s4_gpio_irq_set_type) \
112123
.support_edge_both = true, \
113124
.edge_both_offset = 0, \
114125
.edge_single_offset = 12, \
126+
.edge_pol_reg = 0x1c, \
115127
.pol_low_offset = 0, \
116128
.pin_sel_mask = 0xff, \
117129
.nr_channels = 12, \
@@ -146,6 +158,18 @@ static const struct meson_gpio_irq_params a1_params = {
146158
INIT_MESON_A1_COMMON_DATA(62)
147159
};
148160

161+
static const struct meson_gpio_irq_params a4_params = {
162+
INIT_MESON_S4_COMMON_DATA(81)
163+
};
164+
165+
static const struct meson_gpio_irq_params a4_ao_params = {
166+
INIT_MESON_A4_AO_COMMON_DATA(8)
167+
};
168+
169+
static const struct meson_gpio_irq_params a5_params = {
170+
INIT_MESON_S4_COMMON_DATA(99)
171+
};
172+
149173
static const struct meson_gpio_irq_params s4_params = {
150174
INIT_MESON_S4_COMMON_DATA(82)
151175
};
@@ -168,6 +192,9 @@ static const struct of_device_id meson_irq_gpio_matches[] __maybe_unused = {
168192
{ .compatible = "amlogic,meson-sm1-gpio-intc", .data = &sm1_params },
169193
{ .compatible = "amlogic,meson-a1-gpio-intc", .data = &a1_params },
170194
{ .compatible = "amlogic,meson-s4-gpio-intc", .data = &s4_params },
195+
{ .compatible = "amlogic,a4-gpio-ao-intc", .data = &a4_ao_params },
196+
{ .compatible = "amlogic,a4-gpio-intc", .data = &a4_params },
197+
{ .compatible = "amlogic,a5-gpio-intc", .data = &a5_params },
171198
{ .compatible = "amlogic,c3-gpio-intc", .data = &c3_params },
172199
{ .compatible = "amlogic,t7-gpio-intc", .data = &t7_params },
173200
{ }
@@ -299,11 +326,10 @@ meson_gpio_irq_release_channel(struct meson_gpio_irq_controller *ctl,
299326
static int meson8_gpio_irq_set_type(struct meson_gpio_irq_controller *ctl,
300327
unsigned int type, u32 *channel_hwirq)
301328
{
302-
u32 val = 0;
329+
const struct meson_gpio_irq_params *params = ctl->params;
303330
unsigned int idx;
304-
const struct meson_gpio_irq_params *params;
331+
u32 val = 0;
305332

306-
params = ctl->params;
307333
idx = meson_gpio_irq_get_channel_idx(ctl, channel_hwirq);
308334

309335
/*
@@ -356,19 +382,19 @@ static int meson8_gpio_irq_set_type(struct meson_gpio_irq_controller *ctl,
356382
static int meson_s4_gpio_irq_set_type(struct meson_gpio_irq_controller *ctl,
357383
unsigned int type, u32 *channel_hwirq)
358384
{
359-
u32 val = 0;
385+
const struct meson_gpio_irq_params *params = ctl->params;
360386
unsigned int idx;
387+
u32 val = 0;
361388

362389
idx = meson_gpio_irq_get_channel_idx(ctl, channel_hwirq);
363390

364391
type &= IRQ_TYPE_SENSE_MASK;
365392

366-
meson_gpio_irq_update_bits(ctl, REG_EDGE_POL_S4, BIT(idx), 0);
393+
meson_gpio_irq_update_bits(ctl, params->edge_pol_reg, BIT(idx), 0);
367394

368395
if (type == IRQ_TYPE_EDGE_BOTH) {
369-
val |= BIT(ctl->params->edge_both_offset + idx);
370-
meson_gpio_irq_update_bits(ctl, REG_EDGE_POL_S4,
371-
BIT(ctl->params->edge_both_offset + idx), val);
396+
val = BIT(ctl->params->edge_both_offset + idx);
397+
meson_gpio_irq_update_bits(ctl, params->edge_pol_reg, val, val);
372398
return 0;
373399
}
374400

@@ -378,7 +404,7 @@ static int meson_s4_gpio_irq_set_type(struct meson_gpio_irq_controller *ctl,
378404
if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING))
379405
val |= BIT(ctl->params->edge_single_offset + idx);
380406

381-
meson_gpio_irq_update_bits(ctl, REG_EDGE_POL,
407+
meson_gpio_irq_update_bits(ctl, params->edge_pol_reg,
382408
BIT(idx) | BIT(12 + idx), val);
383409
return 0;
384410
};

0 commit comments

Comments
 (0)