Re: [PATCH v1 33/43] x86: irq: Support flags for acpi_gpe
Hi Wolfgang, On Wed, 1 Jul 2020 at 09:15, Wolfgang Wallner wrote: > > Hi Simon, > > -"Simon Glass" schrieb: - > > > Betreff: [PATCH v1 33/43] x86: irq: Support flags for acpi_gpe > > > > This binding currently has a flags cell but it is not used. Make use of it > > to create ACPI tables for interrupts. > > > > Signed-off-by: Simon Glass > > --- > > > > arch/x86/cpu/acpi_gpe.c | 26 +++ > > .../interrupt-controller/x86-irq.h| 14 ++ > > 2 files changed, 40 insertions(+) > > create mode 100644 include/dt-bindings/interrupt-controller/x86-irq.h > > > > [snip] > > > diff --git a/include/dt-bindings/interrupt-controller/x86-irq.h > > b/include/dt-bindings/interrupt-controller/x86-irq.h > > new file mode 100644 > > index 00..9e0b4612e1 > > --- /dev/null > > +++ b/include/dt-bindings/interrupt-controller/x86-irq.h > > @@ -0,0 +1,14 @@ > > +/* SPDX-License-Identifier: GPL-2.0 */ > > +/* > > + * Copyright 2019 Google LLC > > + * > > + * This provides additional flags used by x86. > > + */ > > + > > +#ifndef _DT_BINDINGS_INTERRUPT_CONTROLLER_X86_IRQ_H > > +#define _DT_BINDINGS_INTERRUPT_CONTROLLER_X86_IRQ_H > > + > > +#define X86_IRQ_TYPE_SHARED (1 << 4) > > +#define X86_IRQ_TYPE_WAKE(1 << 5) > > Nit: BIT(4) and BIT(4) ? I can't use those in devicetree bindings unfortunately. Regards, SImon
Re: [PATCH v1 33/43] x86: irq: Support flags for acpi_gpe
Hi Simon, -"Simon Glass" schrieb: - > Betreff: [PATCH v1 33/43] x86: irq: Support flags for acpi_gpe > > This binding currently has a flags cell but it is not used. Make use of it > to create ACPI tables for interrupts. > > Signed-off-by: Simon Glass > --- > > arch/x86/cpu/acpi_gpe.c | 26 +++ > .../interrupt-controller/x86-irq.h| 14 ++ > 2 files changed, 40 insertions(+) > create mode 100644 include/dt-bindings/interrupt-controller/x86-irq.h > [snip] > diff --git a/include/dt-bindings/interrupt-controller/x86-irq.h > b/include/dt-bindings/interrupt-controller/x86-irq.h > new file mode 100644 > index 00..9e0b4612e1 > --- /dev/null > +++ b/include/dt-bindings/interrupt-controller/x86-irq.h > @@ -0,0 +1,14 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +/* > + * Copyright 2019 Google LLC > + * > + * This provides additional flags used by x86. > + */ > + > +#ifndef _DT_BINDINGS_INTERRUPT_CONTROLLER_X86_IRQ_H > +#define _DT_BINDINGS_INTERRUPT_CONTROLLER_X86_IRQ_H > + > +#define X86_IRQ_TYPE_SHARED (1 << 4) > +#define X86_IRQ_TYPE_WAKE(1 << 5) Nit: BIT(4) and BIT(4) ? > + > +#endif > -- > 2.27.0.290.gba653c62da-goog Reviewed-by: Wolfgang Wallner
Re: [PATCH v1 33/43] x86: irq: Support flags for acpi_gpe
On Mon, Jun 15, 2020 at 11:58 AM Simon Glass wrote: > > This binding currently has a flags cell but it is not used. Make use of it > to create ACPI tables for interrupts. > > Signed-off-by: Simon Glass > --- > > arch/x86/cpu/acpi_gpe.c | 26 +++ > .../interrupt-controller/x86-irq.h| 14 ++ > 2 files changed, 40 insertions(+) > create mode 100644 include/dt-bindings/interrupt-controller/x86-irq.h > Reviewed-by: Bin Meng
[PATCH v1 33/43] x86: irq: Support flags for acpi_gpe
This binding currently has a flags cell but it is not used. Make use of it to create ACPI tables for interrupts. Signed-off-by: Simon Glass --- arch/x86/cpu/acpi_gpe.c | 26 +++ .../interrupt-controller/x86-irq.h| 14 ++ 2 files changed, 40 insertions(+) create mode 100644 include/dt-bindings/interrupt-controller/x86-irq.h diff --git a/arch/x86/cpu/acpi_gpe.c b/arch/x86/cpu/acpi_gpe.c index 8aa2009bd6..70badb15a3 100644 --- a/arch/x86/cpu/acpi_gpe.c +++ b/arch/x86/cpu/acpi_gpe.c @@ -8,7 +8,10 @@ #include #include #include +#include #include +#include +#include /** * struct acpi_gpe_priv - private driver information @@ -62,13 +65,36 @@ static int acpi_gpe_ofdata_to_platdata(struct udevice *dev) static int acpi_gpe_of_xlate(struct irq *irq, struct ofnode_phandle_args *args) { irq->id = args->args[0]; + irq->flags = args->args[1]; return 0; } +#if CONFIG_IS_ENABLED(ACPIGEN) +static int acpi_gpe_get_acpi(const struct irq *irq, struct acpi_irq *acpi_irq) +{ + memset(acpi_irq, '\0', sizeof(*acpi_irq)); + acpi_irq->pin = irq->id; + acpi_irq->mode = irq->flags & IRQ_TYPE_EDGE_BOTH ? + ACPI_IRQ_EDGE_TRIGGERED : ACPI_IRQ_LEVEL_TRIGGERED; + acpi_irq->polarity = irq->flags & +(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_LEVEL_LOW) ? +ACPI_IRQ_ACTIVE_LOW : ACPI_IRQ_ACTIVE_HIGH; + acpi_irq->shared = irq->flags & X86_IRQ_TYPE_SHARED ? + ACPI_IRQ_SHARED : ACPI_IRQ_EXCLUSIVE; + acpi_irq->wake = irq->flags & X86_IRQ_TYPE_WAKE ? ACPI_IRQ_WAKE : + ACPI_IRQ_NO_WAKE; + + return 0; +} +#endif + static const struct irq_ops acpi_gpe_ops = { .read_and_clear = acpi_gpe_read_and_clear, .of_xlate = acpi_gpe_of_xlate, +#if CONFIG_IS_ENABLED(ACPIGEN) + .get_acpi = acpi_gpe_get_acpi, +#endif }; static const struct udevice_id acpi_gpe_ids[] = { diff --git a/include/dt-bindings/interrupt-controller/x86-irq.h b/include/dt-bindings/interrupt-controller/x86-irq.h new file mode 100644 index 00..9e0b4612e1 --- /dev/null +++ b/include/dt-bindings/interrupt-controller/x86-irq.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright 2019 Google LLC + * + * This provides additional flags used by x86. + */ + +#ifndef _DT_BINDINGS_INTERRUPT_CONTROLLER_X86_IRQ_H +#define _DT_BINDINGS_INTERRUPT_CONTROLLER_X86_IRQ_H + +#define X86_IRQ_TYPE_SHARED(1 << 4) +#define X86_IRQ_TYPE_WAKE (1 << 5) + +#endif -- 2.27.0.290.gba653c62da-goog