diff mbox series

[v2,14/15] ARM: dts: bcm2711: Add the BSC interrupt controller

Message ID 20210111142309.193441-15-maxime@cerno.tech (mailing list archive)
State New, archived
Headers show
Series drm/vc4: hdmi: Add CEC support for the BCM2711 | expand

Commit Message

Maxime Ripard Jan. 11, 2021, 2:23 p.m. UTC
The BSC controllers used for the HDMI DDC have an interrupt controller
shared between both instances. Let's add it to avoid polling.

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 arch/arm/boot/dts/bcm2711.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Dave Stevenson Feb. 9, 2021, 9:49 a.m. UTC | #1
Hi Maxime

On Mon, 11 Jan 2021 at 14:23, Maxime Ripard <maxime@cerno.tech> wrote:
>
> The BSC controllers used for the HDMI DDC have an interrupt controller
> shared between both instances. Let's add it to avoid polling.

This seems to have unintended side effects.
GIC interrupt 117 is shared between the standard I2C controllers
(i2c-bcm2835) and the l2-intc block handling the HDMI I2C interrupts.

Whilst i2c-bcm2835 requests the interrupt with IRQF_SHARED, that
doesn't appear to be an option for l2-intc registering as an interrupt
controller. i2c-bcm2835 therefore loses out and fails to register for
the interrupt.

Is there an equivalent flag that an interrupt controller can add to
say that the parent interrupt is shared? Is that even supported?

Thanks
  Dave

> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
>  arch/arm/boot/dts/bcm2711.dtsi | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/arch/arm/boot/dts/bcm2711.dtsi b/arch/arm/boot/dts/bcm2711.dtsi
> index 4847dd305317..8bb46ae76a92 100644
> --- a/arch/arm/boot/dts/bcm2711.dtsi
> +++ b/arch/arm/boot/dts/bcm2711.dtsi
> @@ -308,6 +308,14 @@ dvp: clock@7ef00000 {
>                         #reset-cells = <1>;
>                 };
>
> +               bsc_intr: interrupt-controller@7ef00040 {
> +                       compatible = "brcm,bcm2711-l2-intc", "brcm,l2-intc";
> +                       reg = <0x7ef00040 0x30>;
> +                       interrupts = <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>;
> +                       interrupt-controller;
> +                       #interrupt-cells = <1>;
> +               };
> +
>                 hdmi0: hdmi@7ef00700 {
>                         compatible = "brcm,bcm2711-hdmi0";
>                         reg = <0x7ef00700 0x300>,
> @@ -341,6 +349,8 @@ ddc0: i2c@7ef04500 {
>                         reg = <0x7ef04500 0x100>, <0x7ef00b00 0x300>;
>                         reg-names = "bsc", "auto-i2c";
>                         clock-frequency = <97500>;
> +                       interrupt-parent = <&bsc_intr>;
> +                       interrupts = <0>;
>                         status = "disabled";
>                 };
>
> @@ -377,6 +387,8 @@ ddc1: i2c@7ef09500 {
>                         reg = <0x7ef09500 0x100>, <0x7ef05b00 0x300>;
>                         reg-names = "bsc", "auto-i2c";
>                         clock-frequency = <97500>;
> +                       interrupt-parent = <&bsc_intr>;
> +                       interrupts = <1>;
>                         status = "disabled";
>                 };
>         };
> --
> 2.29.2
>
Maxime Ripard Feb. 10, 2021, 2:40 p.m. UTC | #2
Hi Dave,

On Tue, Feb 09, 2021 at 09:49:05AM +0000, Dave Stevenson wrote:
> On Mon, 11 Jan 2021 at 14:23, Maxime Ripard <maxime@cerno.tech> wrote:
> >
> > The BSC controllers used for the HDMI DDC have an interrupt controller
> > shared between both instances. Let's add it to avoid polling.
> 
> This seems to have unintended side effects.
> GIC interrupt 117 is shared between the standard I2C controllers
> (i2c-bcm2835) and the l2-intc block handling the HDMI I2C interrupts.
> 
> Whilst i2c-bcm2835 requests the interrupt with IRQF_SHARED, that
> doesn't appear to be an option for l2-intc registering as an interrupt
> controller. i2c-bcm2835 therefore loses out and fails to register for
> the interrupt.
> 
> Is there an equivalent flag that an interrupt controller can add to
> say that the parent interrupt is shared? Is that even supported?

Indeed, it looks like setting an equivalent to IRQF_SHARED would be the
solution, but I couldn't find anything that would allow us to in the
irqchip code.

Marc, Thomas, is it something that is allowed?

Thanks!
Maxime
Marc Zyngier Feb. 10, 2021, 3:30 p.m. UTC | #3
Hi Maxime,

On 2021-02-10 14:40, Maxime Ripard wrote:
> Hi Dave,
> 
> On Tue, Feb 09, 2021 at 09:49:05AM +0000, Dave Stevenson wrote:
>> On Mon, 11 Jan 2021 at 14:23, Maxime Ripard <maxime@cerno.tech> wrote:
>> >
>> > The BSC controllers used for the HDMI DDC have an interrupt controller
>> > shared between both instances. Let's add it to avoid polling.
>> 
>> This seems to have unintended side effects.
>> GIC interrupt 117 is shared between the standard I2C controllers
>> (i2c-bcm2835) and the l2-intc block handling the HDMI I2C interrupts.
>> 
>> Whilst i2c-bcm2835 requests the interrupt with IRQF_SHARED, that
>> doesn't appear to be an option for l2-intc registering as an interrupt
>> controller. i2c-bcm2835 therefore loses out and fails to register for
>> the interrupt.
>> 
>> Is there an equivalent flag that an interrupt controller can add to
>> say that the parent interrupt is shared? Is that even supported?
> 
> Indeed, it looks like setting an equivalent to IRQF_SHARED would be the
> solution, but I couldn't find anything that would allow us to in the
> irqchip code.
> 
> Marc, Thomas, is it something that is allowed?

No, not really. That's because the chained handler is actually an
interrupt flow, and not a normal handler. IRQF_SHARED acts at the wrong
level for that.

I can see two possibilities:

- the l2-intc gets turned into a normal handler, and does the demux
   from there. Horrible stuff.

- the i2c controller gets parented to the l2c-int as a fake interrupt,
   and gets called from there. Horrible stuff.

Pick your poison... :-/

         M.
Dave Stevenson Feb. 10, 2021, 3:49 p.m. UTC | #4
Hi Marc.

On Wed, 10 Feb 2021 at 15:30, Marc Zyngier <maz@kernel.org> wrote:
>
> Hi Maxime,
>
> On 2021-02-10 14:40, Maxime Ripard wrote:
> > Hi Dave,
> >
> > On Tue, Feb 09, 2021 at 09:49:05AM +0000, Dave Stevenson wrote:
> >> On Mon, 11 Jan 2021 at 14:23, Maxime Ripard <maxime@cerno.tech> wrote:
> >> >
> >> > The BSC controllers used for the HDMI DDC have an interrupt controller
> >> > shared between both instances. Let's add it to avoid polling.
> >>
> >> This seems to have unintended side effects.
> >> GIC interrupt 117 is shared between the standard I2C controllers
> >> (i2c-bcm2835) and the l2-intc block handling the HDMI I2C interrupts.
> >>
> >> Whilst i2c-bcm2835 requests the interrupt with IRQF_SHARED, that
> >> doesn't appear to be an option for l2-intc registering as an interrupt
> >> controller. i2c-bcm2835 therefore loses out and fails to register for
> >> the interrupt.
> >>
> >> Is there an equivalent flag that an interrupt controller can add to
> >> say that the parent interrupt is shared? Is that even supported?
> >
> > Indeed, it looks like setting an equivalent to IRQF_SHARED would be the
> > solution, but I couldn't find anything that would allow us to in the
> > irqchip code.
> >
> > Marc, Thomas, is it something that is allowed?
>
> No, not really. That's because the chained handler is actually an
> interrupt flow, and not a normal handler. IRQF_SHARED acts at the wrong
> level for that.
>
> I can see two possibilities:
>
> - the l2-intc gets turned into a normal handler, and does the demux
>    from there. Horrible stuff.
>
> - the i2c controller gets parented to the l2c-int as a fake interrupt,
>    and gets called from there. Horrible stuff.
>
> Pick your poison... :-/

Thanks for the info.

Option 3 - remove l2-intc and drop back to polling the i2c-brcmstb
blocks (which the driver supports anyway).
HDMI I2C generally isn't heavily used once displays are connected, so
I'd be OK with that.

(We can keep the l2-intc that handles CEC and HPD as that is on a
unique GIC interrupt).

  Dave
Florian Fainelli Feb. 10, 2021, 6:49 p.m. UTC | #5
On 2/10/21 7:49 AM, Dave Stevenson wrote:
> Hi Marc.
> 
> On Wed, 10 Feb 2021 at 15:30, Marc Zyngier <maz@kernel.org> wrote:
>>
>> Hi Maxime,
>>
>> On 2021-02-10 14:40, Maxime Ripard wrote:
>>> Hi Dave,
>>>
>>> On Tue, Feb 09, 2021 at 09:49:05AM +0000, Dave Stevenson wrote:
>>>> On Mon, 11 Jan 2021 at 14:23, Maxime Ripard <maxime@cerno.tech> wrote:
>>>>>
>>>>> The BSC controllers used for the HDMI DDC have an interrupt controller
>>>>> shared between both instances. Let's add it to avoid polling.
>>>>
>>>> This seems to have unintended side effects.
>>>> GIC interrupt 117 is shared between the standard I2C controllers
>>>> (i2c-bcm2835) and the l2-intc block handling the HDMI I2C interrupts.
>>>>
>>>> Whilst i2c-bcm2835 requests the interrupt with IRQF_SHARED, that
>>>> doesn't appear to be an option for l2-intc registering as an interrupt
>>>> controller. i2c-bcm2835 therefore loses out and fails to register for
>>>> the interrupt.
>>>>
>>>> Is there an equivalent flag that an interrupt controller can add to
>>>> say that the parent interrupt is shared? Is that even supported?
>>>
>>> Indeed, it looks like setting an equivalent to IRQF_SHARED would be the
>>> solution, but I couldn't find anything that would allow us to in the
>>> irqchip code.
>>>
>>> Marc, Thomas, is it something that is allowed?
>>
>> No, not really. That's because the chained handler is actually an
>> interrupt flow, and not a normal handler. IRQF_SHARED acts at the wrong
>> level for that.
>>
>> I can see two possibilities:
>>
>> - the l2-intc gets turned into a normal handler, and does the demux
>>    from there. Horrible stuff.
>>
>> - the i2c controller gets parented to the l2c-int as a fake interrupt,
>>    and gets called from there. Horrible stuff.
>>
>> Pick your poison... :-/
> 
> Thanks for the info.
> 
> Option 3 - remove l2-intc and drop back to polling the i2c-brcmstb
> blocks (which the driver supports anyway).
> HDMI I2C generally isn't heavily used once displays are connected, so
> I'd be OK with that.
> 
> (We can keep the l2-intc that handles CEC and HPD as that is on a
> unique GIC interrupt).

Agreed, Maxime or Nicolas do you want me to send a revert of this patch?
Nicolas Saenz Julienne Feb. 12, 2021, 11:20 a.m. UTC | #6
On Wed, 2021-02-10 at 10:49 -0800, Florian Fainelli wrote:
> On 2/10/21 7:49 AM, Dave Stevenson wrote:
> > Hi Marc.
> > 
> > On Wed, 10 Feb 2021 at 15:30, Marc Zyngier <maz@kernel.org> wrote:
> > > 
> > > Hi Maxime,
> > > 
> > > On 2021-02-10 14:40, Maxime Ripard wrote:
> > > > Hi Dave,
> > > > 
> > > > On Tue, Feb 09, 2021 at 09:49:05AM +0000, Dave Stevenson wrote:
> > > > > On Mon, 11 Jan 2021 at 14:23, Maxime Ripard <maxime@cerno.tech> wrote:
> > > > > > 
> > > > > > The BSC controllers used for the HDMI DDC have an interrupt controller
> > > > > > shared between both instances. Let's add it to avoid polling.
> > > > > 
> > > > > This seems to have unintended side effects.
> > > > > GIC interrupt 117 is shared between the standard I2C controllers
> > > > > (i2c-bcm2835) and the l2-intc block handling the HDMI I2C interrupts.
> > > > > 
> > > > > Whilst i2c-bcm2835 requests the interrupt with IRQF_SHARED, that
> > > > > doesn't appear to be an option for l2-intc registering as an interrupt
> > > > > controller. i2c-bcm2835 therefore loses out and fails to register for
> > > > > the interrupt.
> > > > > 
> > > > > Is there an equivalent flag that an interrupt controller can add to
> > > > > say that the parent interrupt is shared? Is that even supported?
> > > > 
> > > > Indeed, it looks like setting an equivalent to IRQF_SHARED would be the
> > > > solution, but I couldn't find anything that would allow us to in the
> > > > irqchip code.
> > > > 
> > > > Marc, Thomas, is it something that is allowed?
> > > 
> > > No, not really. That's because the chained handler is actually an
> > > interrupt flow, and not a normal handler. IRQF_SHARED acts at the wrong
> > > level for that.
> > > 
> > > I can see two possibilities:
> > > 
> > > - the l2-intc gets turned into a normal handler, and does the demux
> > >    from there. Horrible stuff.
> > > 
> > > - the i2c controller gets parented to the l2c-int as a fake interrupt,
> > >    and gets called from there. Horrible stuff.
> > > 
> > > Pick your poison... :-/
> > 
> > Thanks for the info.
> > 
> > Option 3 - remove l2-intc and drop back to polling the i2c-brcmstb
> > blocks (which the driver supports anyway).
> > HDMI I2C generally isn't heavily used once displays are connected, so
> > I'd be OK with that.
> > 
> > (We can keep the l2-intc that handles CEC and HPD as that is on a
> > unique GIC interrupt).
> 
> Agreed, Maxime or Nicolas do you want me to send a revert of this patch?

Reverting seems the safe move, but I'll defer to whatever Maxime says.

Regards,
Nicolas
Maxime Ripard Feb. 12, 2021, 11:34 a.m. UTC | #7
On Fri, Feb 12, 2021 at 12:20:14PM +0100, Nicolas Saenz Julienne wrote:
> On Wed, 2021-02-10 at 10:49 -0800, Florian Fainelli wrote:
> > On 2/10/21 7:49 AM, Dave Stevenson wrote:
> > > Hi Marc.
> > > 
> > > On Wed, 10 Feb 2021 at 15:30, Marc Zyngier <maz@kernel.org> wrote:
> > > > 
> > > > Hi Maxime,
> > > > 
> > > > On 2021-02-10 14:40, Maxime Ripard wrote:
> > > > > Hi Dave,
> > > > > 
> > > > > On Tue, Feb 09, 2021 at 09:49:05AM +0000, Dave Stevenson wrote:
> > > > > > On Mon, 11 Jan 2021 at 14:23, Maxime Ripard <maxime@cerno.tech> wrote:
> > > > > > > 
> > > > > > > The BSC controllers used for the HDMI DDC have an interrupt controller
> > > > > > > shared between both instances. Let's add it to avoid polling.
> > > > > > 
> > > > > > This seems to have unintended side effects.
> > > > > > GIC interrupt 117 is shared between the standard I2C controllers
> > > > > > (i2c-bcm2835) and the l2-intc block handling the HDMI I2C interrupts.
> > > > > > 
> > > > > > Whilst i2c-bcm2835 requests the interrupt with IRQF_SHARED, that
> > > > > > doesn't appear to be an option for l2-intc registering as an interrupt
> > > > > > controller. i2c-bcm2835 therefore loses out and fails to register for
> > > > > > the interrupt.
> > > > > > 
> > > > > > Is there an equivalent flag that an interrupt controller can add to
> > > > > > say that the parent interrupt is shared? Is that even supported?
> > > > > 
> > > > > Indeed, it looks like setting an equivalent to IRQF_SHARED would be the
> > > > > solution, but I couldn't find anything that would allow us to in the
> > > > > irqchip code.
> > > > > 
> > > > > Marc, Thomas, is it something that is allowed?
> > > > 
> > > > No, not really. That's because the chained handler is actually an
> > > > interrupt flow, and not a normal handler. IRQF_SHARED acts at the wrong
> > > > level for that.
> > > > 
> > > > I can see two possibilities:
> > > > 
> > > > - the l2-intc gets turned into a normal handler, and does the demux
> > > >    from there. Horrible stuff.
> > > > 
> > > > - the i2c controller gets parented to the l2c-int as a fake interrupt,
> > > >    and gets called from there. Horrible stuff.
> > > > 
> > > > Pick your poison... :-/
> > > 
> > > Thanks for the info.
> > > 
> > > Option 3 - remove l2-intc and drop back to polling the i2c-brcmstb
> > > blocks (which the driver supports anyway).
> > > HDMI I2C generally isn't heavily used once displays are connected, so
> > > I'd be OK with that.
> > > 
> > > (We can keep the l2-intc that handles CEC and HPD as that is on a
> > > unique GIC interrupt).
> > 
> > Agreed, Maxime or Nicolas do you want me to send a revert of this patch?
> 
> Reverting seems the safe move, but I'll defer to whatever Maxime says.

Yes, reverting it seems like the easiest way forward. If you can send it
Florian that would be great :)

Maxime
diff mbox series

Patch

diff --git a/arch/arm/boot/dts/bcm2711.dtsi b/arch/arm/boot/dts/bcm2711.dtsi
index 4847dd305317..8bb46ae76a92 100644
--- a/arch/arm/boot/dts/bcm2711.dtsi
+++ b/arch/arm/boot/dts/bcm2711.dtsi
@@ -308,6 +308,14 @@  dvp: clock@7ef00000 {
 			#reset-cells = <1>;
 		};
 
+		bsc_intr: interrupt-controller@7ef00040 {
+			compatible = "brcm,bcm2711-l2-intc", "brcm,l2-intc";
+			reg = <0x7ef00040 0x30>;
+			interrupts = <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>;
+			interrupt-controller;
+			#interrupt-cells = <1>;
+		};
+
 		hdmi0: hdmi@7ef00700 {
 			compatible = "brcm,bcm2711-hdmi0";
 			reg = <0x7ef00700 0x300>,
@@ -341,6 +349,8 @@  ddc0: i2c@7ef04500 {
 			reg = <0x7ef04500 0x100>, <0x7ef00b00 0x300>;
 			reg-names = "bsc", "auto-i2c";
 			clock-frequency = <97500>;
+			interrupt-parent = <&bsc_intr>;
+			interrupts = <0>;
 			status = "disabled";
 		};
 
@@ -377,6 +387,8 @@  ddc1: i2c@7ef09500 {
 			reg = <0x7ef09500 0x100>, <0x7ef05b00 0x300>;
 			reg-names = "bsc", "auto-i2c";
 			clock-frequency = <97500>;
+			interrupt-parent = <&bsc_intr>;
+			interrupts = <1>;
 			status = "disabled";
 		};
 	};