Re: [PATCH 05/11] mfd: flexcard: add interrupt support

From: Lee Jones
Date: Mon Mar 30 2015 - 04:47:09 EST


On Wed, 25 Mar 2015, Holger Dengler wrote:

> From: Benedikt Spranger <b.spranger@xxxxxxxxxxxxx>
>
> The Flexcard comprise an interrupt controller for the attached
> tinys, timer, a Flexray related trigger and a second one for DMA.
> Both controllers share a single IRQ line.
>
> Add an interrupt domain for the non-DMA interrupts.
>
> Signed-off-by: Holger Dengler <dengler@xxxxxxxxxxxxx>
> Signed-off-by: Benedikt Spranger <b.spranger@xxxxxxxxxxxxx>
> cc: Samuel Ortiz <sameo@xxxxxxxxxxxxxxx>
> cc: Lee Jones <lee.jones@xxxxxxxxxx>
> ---
> drivers/mfd/Kconfig | 1 +
> drivers/mfd/flexcard/Makefile | 2 +-
> drivers/mfd/flexcard/core.c | 14 +++-
> drivers/mfd/flexcard/flexcard.h | 2 +
> drivers/mfd/flexcard/irq.c | 167 ++++++++++++++++++++++++++++++++++++++++
> drivers/mfd/flexcard/irq.h | 50 ++++++++++++
> include/linux/mfd/flexcard.h | 2 +
> 7 files changed, 235 insertions(+), 3 deletions(-)
> create mode 100644 drivers/mfd/flexcard/irq.c
> create mode 100644 drivers/mfd/flexcard/irq.h

[...]

> diff --git a/drivers/mfd/flexcard/irq.h b/drivers/mfd/flexcard/irq.h
> new file mode 100644
> index 0000000..b18fb5b
> --- /dev/null
> +++ b/drivers/mfd/flexcard/irq.h
> @@ -0,0 +1,50 @@
> +#ifndef FLEXCARD_IRQ_H
> +#define FLEXCARD_IRQ_H
> +
> +struct flexcard_irq_tab {
> + u32 enable;
> + u32 reset;
> + u32 status;
> +};
> +
> +#define to_irq_tab(e, s) { \
> + .enable = (1 << e), \
> + .status = (1 << s), \
> +}
> +
> +#define to_irq_tab_ack(e, r, s) { \
> + .enable = (1 << e), \
> + .reset = (1 << r), \
> + .status = (1 << s), \
> +}
> +
> +/*
> + * Interrupt Controller Register S-Box
> + * unlike other irq controllers the FlexCard bits for enable, reset and status
> + * looks more like a cryptographic S-box. Make a const table to have a more
> + * easier access to this bits in the irqchip callback functions.
> + * The table contains the registers for PMC2-cards.
> + */
> +static const struct flexcard_irq_tab flexcard_irq_tab[] = {
> + to_irq_tab_ack(28, 0, 28), /* TIMER */
> + to_irq_tab_ack(29, 1, 29), /* CC1CYS */
> + to_irq_tab_ack(30, 10, 21), /* CC2CYS */
> + to_irq_tab_ack(18, 2, 30), /* CC3CYS */
> + to_irq_tab_ack(19, 6, 25), /* CC4CYS */
> + to_irq_tab_ack(26, 4, 26), /* WAKE1A */
> + to_irq_tab_ack(27, 5, 27), /* WAKE1B */
> + to_irq_tab_ack(24, 8, 23), /* WAKE2A */
> + to_irq_tab_ack(25, 9, 22), /* WAKE2B */
> + to_irq_tab_ack(22, 12, 19), /* WAKE3A */
> + to_irq_tab_ack(23, 13, 18), /* WAKE3B */
> + to_irq_tab_ack(20, 14, 17), /* WAKE4A */
> + to_irq_tab_ack(21, 15, 16), /* WAKE4B */
> + to_irq_tab(15, 31), /* CC1T0 */
> + to_irq_tab(14, 3), /* CC2T0 */
> + to_irq_tab(16, 24), /* CC3T0 */
> + to_irq_tab(17, 20), /* CC4T0 */
> +};
> +
> +#define NR_FLEXCARD_IRQ ARRAY_SIZE(flexcard_irq_tab)

Is everything in this header used over multiple source files, or only
irq.c? If the latter, then please move them into irq.c.

> +#endif /* FLEXCARD_IRQ_H */
> diff --git a/include/linux/mfd/flexcard.h b/include/linux/mfd/flexcard.h
> index 84e155c..f5b789f 100644
> --- a/include/linux/mfd/flexcard.h
> +++ b/include/linux/mfd/flexcard.h
> @@ -22,12 +22,14 @@
> #define FLEXCARD_MAX_NAME 16
>
> struct flexcard_device {
> + raw_spinlock_t irq_lock;
> struct pci_dev *pdev;
> struct fc_conf_bar __iomem *conf;
> struct mfd_cell *cells;
> struct resource *res;
> struct miscdevice dev;
> struct kref ref;
> + struct irq_domain *irq_domain;
> int cardnr;
> char name[FLEXCARD_MAX_NAME];
> };

--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org â Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/