devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bert Vermeulen <bert@biot.com>
To: Marc Zyngier <maz@kernel.org>
Cc: "Thomas Bogendoerfer" <tsbogend@alpha.franken.de>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Paul Burton" <paulburton@kernel.org>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Damien Le Moal" <damien.lemoal@wdc.com>,
	"Mateusz Holenko" <mholenko@antmicro.com>,
	"Stafford Horne" <shorne@gmail.com>,
	"Pawel Czarnecki" <pczarnecki@internships.antmicro.com>,
	"Palmer Dabbelt" <palmerdabbelt@google.com>,
	"Cédric Le Goater" <clg@kaod.org>,
	"Shawn Guo" <shawnguo@kernel.org>,
	"Joel Stanley" <joel@jms.id.au>,
	"Leonard Crestez" <leonard.crestez@nxp.com>,
	"Peng Fan" <peng.fan@nxp.com>,
	linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH v2] Add support for Realtek RTL838x/RTL839x switch SoCs
Date: Sat, 26 Dec 2020 16:02:21 +0100	[thread overview]
Message-ID: <b8c989de-aae3-fa5e-90aa-ebce668c80f2@biot.com> (raw)
In-Reply-To: <87o8ikqywn.wl-maz@kernel.org>

On 12/23/20 5:18 PM, Marc Zyngier wrote:

Marc,

Thanks for reviewing. We will rework as needed, however:

> On Wed, 23 Dec 2020 15:06:24 +0000,
> Bert Vermeulen <bert@biot.com> wrote:
[...]

>> +/* Interrupt numbers/bits */
>> +#define RTL8380_IRQ_UART0		31
>> +#define RTL8380_IRQ_UART1		30
>> +#define RTL8380_IRQ_TC0			29
>> +#define RTL8380_IRQ_TC1			28
>> +#define RTL8380_IRQ_OCPTO		27
>> +#define RTL8380_IRQ_HLXTO		26
>> +#define RTL8380_IRQ_SLXTO		25
>> +#define RTL8380_IRQ_NIC			24
>> +#define RTL8380_IRQ_GPIO_ABCD		23
>> +#define RTL8380_IRQ_GPIO_EFGH		22
>> +#define RTL8380_IRQ_RTC			21
>> +#define RTL8380_IRQ_SWCORE		20
>> +#define RTL8380_IRQ_WDT_IP1		19
>> +#define RTL8380_IRQ_WDT_IP2		18
> 
> Why do we need any of this? The mapping should be explicit in the DT.
> 
>> +
>> +/* Global Interrupt Mask Register */
>> +#define RTL8380_ICTL_GIMR	0x00
>> +/* Global Interrupt Status Register */
>> +#define RTL8380_ICTL_GISR	0x04
>> +
>> +/* Cascaded interrupts */
>> +#define RTL8380_CPU_IRQ_SHARED0		(MIPS_CPU_IRQ_BASE + 2)
>> +#define RTL8380_CPU_IRQ_UART		(MIPS_CPU_IRQ_BASE + 3)
>> +#define RTL8380_CPU_IRQ_SWITCH		(MIPS_CPU_IRQ_BASE + 4)
>> +#define RTL8380_CPU_IRQ_SHARED1		(MIPS_CPU_IRQ_BASE + 5)
>> +#define RTL8380_CPU_IRQ_EXTERNAL	(MIPS_CPU_IRQ_BASE + 6)
>> +#define RTL8380_CPU_IRQ_COUNTER		(MIPS_CPU_IRQ_BASE + 7)
>> +
>> +
>> +/* Interrupt routing register */
>> +#define RTL8380_IRR0		0x08
>> +#define RTL8380_IRR1		0x0c
>> +#define RTL8380_IRR2		0x10
>> +#define RTL8380_IRR3		0x14
>> +
>> +/* Cascade map */
>> +#define RTL8380_IRQ_CASCADE_UART0	2
>> +#define RTL8380_IRQ_CASCADE_UART1	1
>> +#define RTL8380_IRQ_CASCADE_TC0		5
>> +#define RTL8380_IRQ_CASCADE_TC1		1
>> +#define RTL8380_IRQ_CASCADE_OCPTO	1
>> +#define RTL8380_IRQ_CASCADE_HLXTO	1
>> +#define RTL8380_IRQ_CASCADE_SLXTO	1
>> +#define RTL8380_IRQ_CASCADE_NIC		4
>> +#define RTL8380_IRQ_CASCADE_GPIO_ABCD	4
>> +#define RTL8380_IRQ_CASCADE_GPIO_EFGH	4
>> +#define RTL8380_IRQ_CASCADE_RTC		4
>> +#define RTL8380_IRQ_CASCADE_SWCORE	3
>> +#define RTL8380_IRQ_CASCADE_WDT_IP1	4
>> +#define RTL8380_IRQ_CASCADE_WDT_IP2	5
>> +
>> +/* Pack cascade map into interrupt routing registers */
>> +#define RTL8380_IRR0_SETTING (\
>> +	(RTL8380_IRQ_CASCADE_UART0	<< 28) | \
>> +	(RTL8380_IRQ_CASCADE_UART1	<< 24) | \
>> +	(RTL8380_IRQ_CASCADE_TC0	<< 20) | \
>> +	(RTL8380_IRQ_CASCADE_TC1	<< 16) | \
>> +	(RTL8380_IRQ_CASCADE_OCPTO	<< 12) | \
>> +	(RTL8380_IRQ_CASCADE_HLXTO	<< 8)  | \
>> +	(RTL8380_IRQ_CASCADE_SLXTO	<< 4)  | \
>> +	(RTL8380_IRQ_CASCADE_NIC	<< 0))
>> +#define RTL8380_IRR1_SETTING (\
>> +	(RTL8380_IRQ_CASCADE_GPIO_ABCD	<< 28) | \
>> +	(RTL8380_IRQ_CASCADE_GPIO_EFGH	<< 24) | \
>> +	(RTL8380_IRQ_CASCADE_RTC	<< 20) | \
>> +	(RTL8380_IRQ_CASCADE_SWCORE	<< 16))
>> +#define RTL8380_IRR2_SETTING	0
>> +#define RTL8380_IRR3_SETTING	0

[...]

>> +	/* Set up interrupt routing */
>> +	writel(RTL8380_IRR0_SETTING, REG(RTL8380_IRR0));
>> +	writel(RTL8380_IRR1_SETTING, REG(RTL8380_IRR1));
>> +	writel(RTL8380_IRR2_SETTING, REG(RTL8380_IRR2));
>> +	writel(RTL8380_IRR3_SETTING, REG(RTL8380_IRR3));
> 
> What is this doing?

It's fairly evident considering the comments -- routing of secondary IRQs 
onto the CPU IRQs. But as to packing this into DTS I'm not sure.

DTS syntax being what it is, this would inevitably get more complex and 
harder to understand. Do you have an example where this is done in a better way?

thanks,


-- 
Bert Vermeulen
bert@biot.com

  reply	other threads:[~2020-12-26 15:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20201223150648.1633113-1-bert@biot.com>
2020-12-23 16:18 ` [PATCH v2] Add support for Realtek RTL838x/RTL839x switch SoCs Marc Zyngier
2020-12-26 15:02   ` Bert Vermeulen [this message]
2020-12-27 11:33     ` Marc Zyngier

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=b8c989de-aae3-fa5e-90aa-ebce668c80f2@biot.com \
    --to=bert@biot.com \
    --cc=clg@kaod.org \
    --cc=damien.lemoal@wdc.com \
    --cc=devicetree@vger.kernel.org \
    --cc=joel@jms.id.au \
    --cc=leonard.crestez@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=mholenko@antmicro.com \
    --cc=palmerdabbelt@google.com \
    --cc=paulburton@kernel.org \
    --cc=pczarnecki@internships.antmicro.com \
    --cc=peng.fan@nxp.com \
    --cc=robh+dt@kernel.org \
    --cc=shawnguo@kernel.org \
    --cc=shorne@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=tsbogend@alpha.franken.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;
as well as URLs for NNTP newsgroup(s).