linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* DTS device tree node for dual port RAM
@ 2009-03-12 11:24 EXTERNAL Lange Matthias (AA-DGW/ENG1)
  2009-03-12 13:32 ` Grant Likely
  0 siblings, 1 reply; 4+ messages in thread
From: EXTERNAL Lange Matthias (AA-DGW/ENG1) @ 2009-03-12 11:24 UTC (permalink / raw)
  To: linuxppc-dev@ozlabs.org

Hi,

I am working on a MPC5200-based board. There is a dual port RAM connected t=
o the MPC5200 via the localbus. In my setup one can raise an interrupt at t=
he MPC5200 to signal new that new data has arrived in the dual port RAM. I =
have already found out that the interrupt delivery actually works (do_IRQ g=
ets called when raising the interrupt).

My problem is that my driver (kernel 2.6.24) can not register for the inter=
rupt. Each time I call request_irq I get -ENOSYS. I am suspecting that I ha=
ve done something wrong in my dts defining the dual port RAM. I have define=
d the device as follows

localbus {
        compatible =3D "fsl,orion-localbus",
                     "fsl,mpc5200-localbus",
                     "fsl,pq2-localbus";
        #address-cells =3D <2>;
        #size-cells =3D <1>;
        reg =3D <f0010100 40>;
        ranges =3D <0 0 fe000000 00400000>;

        dpram@40000000 {
                device_type =3D "dpram";
                interrupts =3D <0 0 0>;
                interrupt-parent =3D <&mpc5200_pic>;
        };
};

What am I doing wrong? What am I missing?

Thanks,
Matthias Lange.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: DTS device tree node for dual port RAM
  2009-03-12 11:24 DTS device tree node for dual port RAM EXTERNAL Lange Matthias (AA-DGW/ENG1)
@ 2009-03-12 13:32 ` Grant Likely
  2009-03-12 15:19   ` EXTERNAL Lange Matthias (AA-DGW/ENG1)
  0 siblings, 1 reply; 4+ messages in thread
From: Grant Likely @ 2009-03-12 13:32 UTC (permalink / raw)
  To: EXTERNAL Lange Matthias (AA-DGW/ENG1); +Cc: linuxppc-dev@ozlabs.org

On Thu, Mar 12, 2009 at 5:24 AM, EXTERNAL Lange Matthias (AA-DGW/ENG1)
<Matthias.Lange@beissbarth.com> wrote:
> Hi,
>
> I am working on a MPC5200-based board. There is a dual port RAM connected=
 to the MPC5200 via the localbus. In my setup one can raise an interrupt at=
 the MPC5200 to signal new that new data has arrived in the dual port RAM. =
I have already found out that the interrupt delivery actually works (do_IRQ=
 gets called when raising the interrupt).
>
> My problem is that my driver (kernel 2.6.24) can not register for the int=
errupt. Each time I call request_irq I get -ENOSYS. I am suspecting that I =
have done something wrong in my dts defining the dual port RAM. I have defi=
ned the device as follows
>
> localbus {
> =A0 =A0 =A0 =A0compatible =3D "fsl,orion-localbus",
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "fsl,mpc5200-localbus",
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "fsl,pq2-localbus";

This should be: compatible =3D "fsl,mpc5200b-lpb","fsl,mpc5200-lpb","simple=
-bus";

It doesn't make much sense to claim compatibility with fsl,orion or
fsl,pq2 because the mpc5200 localbus is neither of those.

> =A0 =A0 =A0 =A0#address-cells =3D <2>;
> =A0 =A0 =A0 =A0#size-cells =3D <1>;
> =A0 =A0 =A0 =A0reg =3D <f0010100 40>;
> =A0 =A0 =A0 =A0ranges =3D <0 0 fe000000 00400000>;
>
> =A0 =A0 =A0 =A0dpram@40000000 {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0device_type =3D "dpram";

Don't use device_type.  It doesn't make any sense in the flattened
device tree.  Use a compatible value instead, and prefix dpram with
the vendor and board name of the platform.  ie: compatible =3D
"<company>,<board>-dpram".  You should also document what this
compatible value means in Documentation/powerpc/device-tree/

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0interrupts =3D <0 0 0>;

What hardware irq# are you using?  See this link for a description of
what the interrupts property should look like for external IRQs:

http://patchwork.ozlabs.org/patch/11349/

To use this property, the irq_of_parse_and_map() function will
translate from the device tree to a Linux IRQ number.

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0interrupt-parent =3D <&mpc5200_pic>;

You probably also want a reg =3D <0 0 0x00400000>; property for mapping
the address range.

> =A0 =A0 =A0 =A0};
> };
>
> What am I doing wrong? What am I missing?
>
> Thanks,
> Matthias Lange.
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
>



--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: DTS device tree node for dual port RAM
  2009-03-12 13:32 ` Grant Likely
@ 2009-03-12 15:19   ` EXTERNAL Lange Matthias (AA-DGW/ENG1)
  2009-03-16  4:57     ` Grant Likely
  0 siblings, 1 reply; 4+ messages in thread
From: EXTERNAL Lange Matthias (AA-DGW/ENG1) @ 2009-03-12 15:19 UTC (permalink / raw)
  To: EXTERNAL Lange Matthias (AA-DGW/ENG1); +Cc: linuxppc-dev@ozlabs.org

> -----Original Message-----
> From:
> linuxppc-dev-bounces+matthias.lange=3Dbeissbarth.com@ozlabs.org
> [mailto:linuxppc-dev-bounces+matthias.lange=3Dbeissbarth.com@ozl
> abs.org] On Behalf Of Grant Likely
> Sent: Thursday, March 12, 2009 2:32 PM
> To: EXTERNAL Lange Matthias (AA-DGW/ENG1)
> Cc: linuxppc-dev@ozlabs.org
> Subject: Re: DTS device tree node for dual port RAM
>
> On Thu, Mar 12, 2009 at 5:24 AM, EXTERNAL Lange Matthias (AA-DGW/ENG1)
> <Matthias.Lange@beissbarth.com> wrote:
> > Hi,

[...]

>
> >                interrupts =3D <0 0 0>;
>
> What hardware irq# are you using?  See this link for a description of
> what the interrupts property should look like for external IRQs:

I am using hardware irq# 0 which is wired to the critical input line. That'=
s why I was defining the interrupts property to <0 0 0>. So my device tree =
node now looks like this

dpram@40000000 {
        compatible =3D "beissbarth,orion-dpram";
        interrupts =3D <0 0 0>;
        interrupt-parent =3D <&mpc5200_pic>;
};

If I am understanding it correctly I now need to implement a OF platform dr=
iver in which I can use irq_of_parse_and_map() to get the virq for my devic=
e.

Regards,
Matthias Lange.

>
> http://patchwork.ozlabs.org/patch/11349/
>
> To use this property, the irq_of_parse_and_map() function will
> translate from the device tree to a Linux IRQ number.
>
> >                interrupt-parent =3D <&mpc5200_pic>;
>
> You probably also want a reg =3D <0 0 0x00400000>; property for mapping
> the address range.
>
> >        };
> > };
> >
> > What am I doing wrong? What am I missing?
> >
> > Thanks,
> > Matthias Lange.
> > _______________________________________________
> > Linuxppc-dev mailing list
> > Linuxppc-dev@ozlabs.org
> > https://ozlabs.org/mailman/listinfo/linuxppc-dev
> >
>
>
>
> --
> Grant Likely, B.Sc., P.Eng.
> Secret Lab Technologies Ltd.
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: DTS device tree node for dual port RAM
  2009-03-12 15:19   ` EXTERNAL Lange Matthias (AA-DGW/ENG1)
@ 2009-03-16  4:57     ` Grant Likely
  0 siblings, 0 replies; 4+ messages in thread
From: Grant Likely @ 2009-03-16  4:57 UTC (permalink / raw)
  To: EXTERNAL Lange Matthias (AA-DGW/ENG1); +Cc: linuxppc-dev@ozlabs.org

On Thu, Mar 12, 2009 at 9:19 AM, EXTERNAL Lange Matthias (AA-DGW/ENG1)
<Matthias.Lange@beissbarth.com> wrote:
>> What hardware irq# are you using? =A0See this link for a description of
>> what the interrupts property should look like for external IRQs:
>
> I am using hardware irq# 0 which is wired to the critical input line. Tha=
t's why I was defining the interrupts property to <0 0 0>. So my device tre=
e node now looks like this

Okay, good.  I just wanted to make sure.

> dpram@40000000 {
> =A0 =A0 =A0 =A0compatible =3D "beissbarth,orion-dpram";
> =A0 =A0 =A0 =A0interrupts =3D <0 0 0>;
> =A0 =A0 =A0 =A0interrupt-parent =3D <&mpc5200_pic>;
> };

This is unrelated to your question, but I'm wondering why you don't
have a reg property in your node.

> If I am understanding it correctly I now need to implement a OF platform =
driver in which I can use irq_of_parse_and_map() to get the virq for my dev=
ice.

That is the easiest way, yes.  Actually, all you need to call
irq_of_parse_and_map() is a pointer to the device_node which can be
obtained by directly searching the tree.  However, writing an
of_platform driver is a better way to get the device_node in this
case.

g.

--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-03-16  4:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-12 11:24 DTS device tree node for dual port RAM EXTERNAL Lange Matthias (AA-DGW/ENG1)
2009-03-12 13:32 ` Grant Likely
2009-03-12 15:19   ` EXTERNAL Lange Matthias (AA-DGW/ENG1)
2009-03-16  4:57     ` Grant Likely

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).