public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Joshua Henderson <joshua.henderson@microchip.com>
Cc: linux-kernel@vger.kernel.org, linux-mips@linux-mips.org,
	Cristian Birsan <cristian.birsan@microchip.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Jason Cooper <jason@lakedaemon.net>,
	Marc Zyngier <marc.zyngier@arm.com>,
	Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	devicetree@vger.kernel.org
Subject: Re: [PATCH 01/14] DEVICETREE: Add bindings for PIC32 interrupt controller
Date: Sat, 21 Nov 2015 21:47:14 +0100	[thread overview]
Message-ID: <7036408.cJ9oZKCcQe@wuerfel> (raw)
In-Reply-To: <1448065205-15762-2-git-send-email-joshua.henderson@microchip.com>

On Friday 20 November 2015 17:17:13 Joshua Henderson wrote:

> +Example
> +-------
> +
> +evic: interrupt-controller@1f810000 {
> +        compatible = "microchip,evic-v2";
> +        interrupt-controller;
> +        #interrupt-cells = <3>;
> +        reg = <0x1f810000 0x1000>;
> +        device_type="evic-v2";
> +};

This is not a correct use of device_type. Just drop that property.

> diff --git a/include/dt-bindings/interrupt-controller/microchip,pic32mz-evic.h b/include/dt-bindings/interrupt-controller/microchip,pic32mz-evic.h
> new file mode 100644
> index 0000000..2c466b8
> --- /dev/null
> +++ b/include/dt-bindings/interrupt-controller/microchip,pic32mz-evic.h
> @@ -0,0 +1,238 @@
> +/*
> + * This header provides constants for the MICROCHIP PIC32 EVIC.
> + */
> +
> +#ifndef _DT_BINDINGS_INTERRUPT_CONTROLLER_MICROCHIP_EVIC_H
> +#define _DT_BINDINGS_INTERRUPT_CONTROLLER_MICROCHIP_EVIC_H
> +
> +#include <dt-bindings/interrupt-controller/irq.h>
> +
> +/* Hardware interrupt number */
> +#define CORE_TIMER_INTERRUPT 0
> +#define CORE_SOFTWARE_INTERRUPT_0 1
> +#define CORE_SOFTWARE_INTERRUPT_1 2
> +#define EXTERNAL_INTERRUPT_0 3
> +#define TIMER1 4

A header file like this is just going to make everyone's life
miserable. Try to remove as much as possible here: normally
you can just use the numbers from the data sheet that match
the actual hardware registers, and put them into the dts file.

> +/* Interrupt priority bits */
> +#define PRI_0	0	/* Note:This priority disables the interrupt! */
> +#define PRI_1	1
> +#define PRI_2	2
> +#define PRI_3	3
> +#define PRI_4	4
> +#define PRI_5	5
> +#define PRI_6	6
> +#define PRI_7	7

> +/* Interrupt subpriority bits */
> +#define SUB_PRI_0	0
> +#define SUB_PRI_1	1
> +#define SUB_PRI_2	2
> +#define SUB_PRI_3	3

These are obviously silly and should be removed/

> +#define PRI_MASK	0x7	/* 3 bit priority mask */
> +#define SUBPRI_MASK	0x3	/* 2 bit subpriority mask */
> +#define INT_MASK	0x1F	/* 5 bit pri and subpri mask */
> +#define NR_EXT_IRQS	5	/* 5 external interrupts sources */
> +
> +#define MICROCHIP_EVIC_MIN_PRIORITY 0
> +#define MICROCHIP_EVIC_MAX_PRIORITY INT_MASK
> +
> +#define INT_PRI(pri, subpri)	\
> +	(((pri & PRI_MASK) << 2) | (subpri & SUBPRI_MASK))
> +
> +#define DEFINE_INT(irq, pri) { irq, pri }
> +
> +#define DEFAULT_INT_PRI INT_PRI(2, 0)

Is it required to have a specific priority configured for each line?
If these are software selectable, it's probably better to not put
them into DT in the first place.

If you absolutely need them, I would suggest using two separate cells
for pri and subpri so you can avoid the macro.

	Arnd

  reply	other threads:[~2015-11-21 20:47 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-21  0:17 [PATCH 00/14] Initial Microchip PIC32MZDA Support Joshua Henderson
2015-11-21  0:17 ` [PATCH 01/14] DEVICETREE: Add bindings for PIC32 interrupt controller Joshua Henderson
2015-11-21 20:47   ` Arnd Bergmann [this message]
2015-11-25 18:22     ` Joshua Henderson
2015-11-22 21:14   ` Rob Herring
2015-11-26  5:01     ` Joshua Henderson
2015-11-21  0:17 ` [PATCH 02/14] irqchip: irq-pic32-evic: Add support " Joshua Henderson
2015-11-22 11:45   ` Marc Zyngier
2015-11-25 18:22     ` Joshua Henderson
2015-11-21  0:17 ` [PATCH 03/14] DEVICETREE: Add PIC32 clock binding documentation Joshua Henderson
2015-11-21 20:49   ` Arnd Bergmann
2015-11-26  4:05     ` Joshua Henderson
2015-11-22 21:31   ` Rob Herring
2015-11-26  5:36     ` Joshua Henderson
2015-11-30 21:43       ` Rob Herring
2015-12-03 17:37         ` Joshua Henderson
2015-11-21  0:17 ` [PATCH 04/14] clk: clk-pic32: Add PIC32 clock driver Joshua Henderson
2015-11-21  0:17 ` [PATCH 05/14] DEVICETREE: Add bindings for PIC32/MZDA platforms Joshua Henderson
2015-11-22 21:35   ` Rob Herring
2015-11-21  0:17 ` [PATCH 06/14] MIPS: Add support for PIC32MZDA platform Joshua Henderson
2015-11-21 11:37   ` Alban
2015-11-22 16:29     ` Joshua Henderson
2015-11-21  0:17 ` [PATCH 07/14] DEVICETREE: Add bindings for PIC32 pin control and GPIO Joshua Henderson
2015-11-22 21:47   ` Rob Herring
2015-12-04 13:02     ` Andrei.Pistirica
2015-12-08 22:13     ` Joshua Henderson
2015-11-21  0:17 ` [PATCH 08/14] pinctrl: Add PIC32 pin control driver Joshua Henderson
2015-11-30 13:41   ` Linus Walleij
2015-12-08 22:15     ` Joshua Henderson
2015-11-21  0:17 ` [PATCH 09/14] DEVICETREE: Add bindings for PIC32 usart driver Joshua Henderson
2015-11-21 15:20   ` Sergei Shtylyov
2015-11-22 21:56   ` Rob Herring
2015-12-11 16:16     ` Joshua Henderson
2015-11-21  0:17 ` [PATCH 10/14] serial: pic32_uart: Add PIC32 uart driver Joshua Henderson
2015-11-21  0:17 ` [PATCH 11/14] mmc: sdhci-pic32: Add PIC32 SDHC host controller driver Joshua Henderson
2015-11-25 15:55   ` Ulf Hansson
2015-11-25 16:38     ` Ulf Hansson
2015-11-29 20:14     ` Paul.Thacker
2015-11-21  0:17 ` [PATCH 12/14] DEVICETREE: Add bindings for PIC32 SDHC host controller Joshua Henderson
2015-11-21 15:19   ` Sergei Shtylyov
2015-11-26  4:40     ` Joshua Henderson
2015-11-22 21:57   ` Rob Herring
2015-11-26  5:16     ` Joshua Henderson
2015-11-21  0:17 ` [PATCH 13/14] MIPS: dts: Add initial DTS for the PIC32MZDA Starter Kit Joshua Henderson
2015-11-21  0:17 ` [PATCH 14/14] MIPS: pic32mzda: Add initial PIC32MZDA Starter Kit defconfig Joshua Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7036408.cJ9oZKCcQe@wuerfel \
    --to=arnd@arndb.de \
    --cc=cristian.birsan@microchip.com \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=jason@lakedaemon.net \
    --cc=joshua.henderson@microchip.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=marc.zyngier@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox