* OF PCI howto?
@ 2009-04-15 12:54 Joakim Tjernlund
2009-04-15 13:08 ` Wolfram Sang
0 siblings, 1 reply; 7+ messages in thread
From: Joakim Tjernlund @ 2009-04-15 12:54 UTC (permalink / raw)
To: linuxppc-dev
I have just started to add PCI support to our custom MPC832x board
and I have a hard time figuring out how to describe this in the
dts. Looking at mpc832x_mds.dts I see:
pci0: pci@e0008500 {
cell-index = <1>;
interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
interrupt-map = <
/* IDSEL 0x11 AD17 */
0x8800 0x0 0x0 0x1 &ipic 20 0x8
0x8800 0x0 0x0 0x2 &ipic 21 0x8
0x8800 0x0 0x0 0x3 &ipic 22 0x8
0x8800 0x0 0x0 0x4 &ipic 23 0x8
/* IDSEL 0x12 AD18 */
0x9000 0x0 0x0 0x1 &ipic 22 0x8
0x9000 0x0 0x0 0x2 &ipic 23 0x8
0x9000 0x0 0x0 0x3 &ipic 20 0x8
0x9000 0x0 0x0 0x4 &ipic 21 0x8
/* IDSEL 0x13 AD19 */
0x9800 0x0 0x0 0x1 &ipic 23 0x8
0x9800 0x0 0x0 0x2 &ipic 20 0x8
0x9800 0x0 0x0 0x3 &ipic 21 0x8
0x9800 0x0 0x0 0x4 &ipic 22 0x8
/* IDSEL 0x15 AD21*/
0xa800 0x0 0x0 0x1 &ipic 20 0x8
0xa800 0x0 0x0 0x2 &ipic 21 0x8
0xa800 0x0 0x0 0x3 &ipic 22 0x8
0xa800 0x0 0x0 0x4 &ipic 23 0x8
/* IDSEL 0x16 AD22*/
0xb000 0x0 0x0 0x1 &ipic 23 0x8
0xb000 0x0 0x0 0x2 &ipic 20 0x8
0xb000 0x0 0x0 0x3 &ipic 21 0x8
0xb000 0x0 0x0 0x4 &ipic 22 0x8
/* IDSEL 0x17 AD23*/
0xb800 0x0 0x0 0x1 &ipic 22 0x8
0xb800 0x0 0x0 0x2 &ipic 23 0x8
0xb800 0x0 0x0 0x3 &ipic 20 0x8
0xb800 0x0 0x0 0x4 &ipic 21 0x8
/* IDSEL 0x18 AD24*/
0xc000 0x0 0x0 0x1 &ipic 21 0x8
0xc000 0x0 0x0 0x2 &ipic 22 0x8
0xc000 0x0 0x0 0x3 &ipic 23 0x8
0xc000 0x0 0x0 0x4 &ipic 20 0x8>;
interrupt-parent = <&ipic>;
interrupts = <66 0x8>;
bus-range = <0x0 0x0>;
ranges = <0x02000000 0x0 0x90000000 0x90000000 0x0
0x10000000
0x42000000 0x0 0x80000000 0x80000000 0x0
0x10000000
0x01000000 0x0 0x00000000 0xd0000000 0x0
0x00100000>;
clock-frequency = <0>;
#interrupt-cells = <1>;
#size-cells = <2>;
#address-cells = <3>;
reg = <0xe0008500 0x100 /* internal registers */
0xe0008300 0x8>; /* config space access
registers */
compatible = "fsl,mpc8349-pci";
device_type = "pci";
};
But I can't figure out what all this mean.
The board will have one PCI device connected directly to the CPU. Is the
above
dts fragment correct for my setup? If not, is there a better example I can
look at?
Jocke
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: OF PCI howto?
2009-04-15 12:54 OF PCI howto? Joakim Tjernlund
@ 2009-04-15 13:08 ` Wolfram Sang
2009-04-15 15:20 ` Kumar Gala
0 siblings, 1 reply; 7+ messages in thread
From: Wolfram Sang @ 2009-04-15 13:08 UTC (permalink / raw)
To: Joakim Tjernlund; +Cc: linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 435 bytes --]
On Wed, Apr 15, 2009 at 02:54:57PM +0200, Joakim Tjernlund wrote:
> dts fragment correct for my setup? If not, is there a better example I can
> look at?
Maybe this message/thread can help you:
http://ozlabs.org/pipermail/devicetree-discuss/2009-March/000597.html
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: OF PCI howto?
2009-04-15 13:08 ` Wolfram Sang
@ 2009-04-15 15:20 ` Kumar Gala
2009-04-16 8:05 ` Joakim Tjernlund
0 siblings, 1 reply; 7+ messages in thread
From: Kumar Gala @ 2009-04-15 15:20 UTC (permalink / raw)
To: Wolfram Sang; +Cc: linuxppc-dev, Joakim Tjernlund
On Apr 15, 2009, at 8:08 AM, Wolfram Sang wrote:
> On Wed, Apr 15, 2009 at 02:54:57PM +0200, Joakim Tjernlund wrote:
>
>> dts fragment correct for my setup? If not, is there a better
>> example I can
>> look at?
>
> Maybe this message/thread can help you:
>
> http://ozlabs.org/pipermail/devicetree-discuss/2009-March/000597.html
You may also want to take a look at ePAPR on the power.org site
- k
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: OF PCI howto?
2009-04-15 15:20 ` Kumar Gala
@ 2009-04-16 8:05 ` Joakim Tjernlund
2009-04-16 9:03 ` Roderick Colenbrander
0 siblings, 1 reply; 7+ messages in thread
From: Joakim Tjernlund @ 2009-04-16 8:05 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
Kumar Gala <galak@kernel.crashing.org> wrote on 15/04/2009 17:20:21:
> On Apr 15, 2009, at 8:08 AM, Wolfram Sang wrote:
>
> > On Wed, Apr 15, 2009 at 02:54:57PM +0200, Joakim Tjernlund wrote:
> >
> >> dts fragment correct for my setup? If not, is there a better
> >> example I can
> >> look at?
> >
> > Maybe this message/thread can help you:
> >
> > http://ozlabs.org/pipermail/devicetree-discuss/2009-March/000597.html
>
> You may also want to take a look at ePAPR on the power.org site
Thanks guys
Looking in ePAPR I see I should read the IDSEL like this:
/* IDSEL 0x11 AD17 */
0x8800 0x0 0x0 0x1 &ipic 20 0x8 /* INTA */
0x8800 0x0 0x0 0x2 &ipic 21 0x8 /* INTB */
0x8800 0x0 0x0 0x3 &ipic 22 0x8 /* INTC */
0x8800 0x0 0x0 0x4 &ipic 23 0x8 /* INTD */
grouping the first line into:
"0x8800 0x0 0x0" "0x1" "&ipic" "20 0x8" /* INTA */
"0x8800 0x0 0x0" = child unit address
"0x1" = child interrupt specifier = INTA
"&ipic" = interrupt parent
"20 0x8" = parent interrupt specifier
Questions:
MPC832x appears to only have INTA so why are the INTB,INTC
and INTD lines there?
I don't understand how IDSEL values are decided. Are IDSEL 0x11-0x18
randomly
selected or are they fixed for MPC832x?
What I really trying to understand is what fields I might need to change
and what to change them to.
So far the "interrupt-map" and the "ranges" items looks like they might
need
some tweaking, but I really don't know at this point.
Any pointers in this area is much appreciated.
Jocke
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: OF PCI howto?
2009-04-16 8:05 ` Joakim Tjernlund
@ 2009-04-16 9:03 ` Roderick Colenbrander
2009-04-16 17:03 ` Scott Wood
2009-04-16 19:21 ` Grant Likely
0 siblings, 2 replies; 7+ messages in thread
From: Roderick Colenbrander @ 2009-04-16 9:03 UTC (permalink / raw)
To: Joakim Tjernlund; +Cc: linuxppc-dev
On Thu, Apr 16, 2009 at 10:05 AM, Joakim Tjernlund
<Joakim.Tjernlund@transmode.se> wrote:
> Kumar Gala <galak@kernel.crashing.org> wrote on 15/04/2009 17:20:21:
>> On Apr 15, 2009, at 8:08 AM, Wolfram Sang wrote:
>>
>> > On Wed, Apr 15, 2009 at 02:54:57PM +0200, Joakim Tjernlund wrote:
>> >
>> >> dts fragment correct for my setup? If not, is there a better
>> >> example I can
>> >> look at?
>> >
>> > Maybe this message/thread can help you:
>> >
>> > http://ozlabs.org/pipermail/devicetree-discuss/2009-March/000597.html
>>
>> You may also want to take a look at ePAPR on the power.org site
>
> Thanks guys
>
> Looking in ePAPR I see I should read the IDSEL like this:
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* IDSEL 0x11 AD17 */
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A00x8800 0x0 0x0 0x1 &ipic 20 0x8 /* INTA */
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A00x8800 0x0 0x0 0x2 &ipic 21 0x8 /* INTB */
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A00x8800 0x0 0x0 0x3 &ipic 22 0x8 /* INTC */
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A00x8800 0x0 0x0 0x4 &ipic 23 0x8 /* INTD */
>
> grouping the first line into:
> "0x8800 0x0 0x0" "0x1" "&ipic" "20 0x8" /* INTA */
>
> "0x8800 0x0 0x0" =3D child unit address
> "0x1" =3D child interrupt specifier =3D INTA
> "&ipic" =3D interrupt parent
> "20 0x8" =3D parent interrupt specifier
>
> Questions:
> =A0MPC832x appears to only have INTA so why are the INTB,INTC
> =A0and INTD lines there?
>
> =A0I don't understand how IDSEL values are decided. Are IDSEL 0x11-0x18
> randomly
> =A0selected or are they fixed for MPC832x?
The idsel values depend on how the pci slots are wired on your board.
The 0x8800 value is
in general a function of bus, device and function number. ( bus << 16
| devfn << 8)
Further I would also watch out with the parent interrupt specifier
e.g. '20 0x8'. The openfirmware spec
normally suggests to use a value of '2' for interrupts which are
active low. During parsing of the interrupt-map
this value is normally translated using 'xlate' to linux kernel values
(active low is defined as IRQ_TYPE_LEVEL_LOW 0x00000008 in the
kernel).
The ipic driver code and various dts files are evil and store the
linux kernel value inside the DTS file, so they don't do any
conversion whis is EVIL
in my opinion. Watch out for that. (The corresponding DTS files and
drivers should be updated).
Regards,
Roderick Colenbrander
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: OF PCI howto?
2009-04-16 9:03 ` Roderick Colenbrander
@ 2009-04-16 17:03 ` Scott Wood
2009-04-16 19:21 ` Grant Likely
1 sibling, 0 replies; 7+ messages in thread
From: Scott Wood @ 2009-04-16 17:03 UTC (permalink / raw)
To: Roderick Colenbrander; +Cc: linuxppc-dev, Joakim Tjernlund
On Thu, Apr 16, 2009 at 11:03:56AM +0200, Roderick Colenbrander wrote:
> The ipic driver code and various dts files are evil and store the
> linux kernel value inside the DTS file, so they don't do any
> conversion whis is EVIL
> in my opinion. Watch out for that. (The corresponding DTS files and
> drivers should be updated).
We should have made up some *other* arbitrary encoding instead?
Or perhaps reused the MPIC's screwy encoding that doesn't separate bits
for level and sense?
-Scott
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: OF PCI howto?
2009-04-16 9:03 ` Roderick Colenbrander
2009-04-16 17:03 ` Scott Wood
@ 2009-04-16 19:21 ` Grant Likely
1 sibling, 0 replies; 7+ messages in thread
From: Grant Likely @ 2009-04-16 19:21 UTC (permalink / raw)
To: Roderick Colenbrander; +Cc: linuxppc-dev, Joakim Tjernlund
On Thu, Apr 16, 2009 at 3:03 AM, Roderick Colenbrander
<thunderbird2k@gmail.com> wrote:
> On Thu, Apr 16, 2009 at 10:05 AM, Joakim Tjernlund
> <Joakim.Tjernlund@transmode.se> wrote:
>> Kumar Gala <galak@kernel.crashing.org> wrote on 15/04/2009 17:20:21:
>>> On Apr 15, 2009, at 8:08 AM, Wolfram Sang wrote:
>>>
>>> > On Wed, Apr 15, 2009 at 02:54:57PM +0200, Joakim Tjernlund wrote:
>>> >
>>> >> dts fragment correct for my setup? If not, is there a better
>>> >> example I can
>>> >> look at?
>>> >
>>> > Maybe this message/thread can help you:
>>> >
>>> > http://ozlabs.org/pipermail/devicetree-discuss/2009-March/000597.html
>>>
>>> You may also want to take a look at ePAPR on the power.org site
>>
>> Thanks guys
>>
>> Looking in ePAPR I see I should read the IDSEL like this:
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* IDSEL 0x11 AD17 */
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A00x8800 0x0 0x0 0x1 &ipic 20 0x8 /* INTA *=
/
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A00x8800 0x0 0x0 0x2 &ipic 21 0x8 /* INTB *=
/
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A00x8800 0x0 0x0 0x3 &ipic 22 0x8 /* INTC *=
/
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A00x8800 0x0 0x0 0x4 &ipic 23 0x8 /* INTD *=
/
>>
>> grouping the first line into:
>> "0x8800 0x0 0x0" "0x1" "&ipic" "20 0x8" /* INTA */
>>
>> "0x8800 0x0 0x0" =3D child unit address
>> "0x1" =3D child interrupt specifier =3D INTA
>> "&ipic" =3D interrupt parent
>> "20 0x8" =3D parent interrupt specifier
>>
>> Questions:
>> =A0MPC832x appears to only have INTA so why are the INTB,INTC
>> =A0and INTD lines there?
>>
>> =A0I don't understand how IDSEL values are decided. Are IDSEL 0x11-0x18
>> randomly
>> =A0selected or are they fixed for MPC832x?
>
> The idsel values depend on how the pci slots are wired on your board.
> The 0x8800 value is
> in general a function of bus, device and function number. ( bus << 16
> | devfn << 8)
>
> Further I would also watch out with the parent interrupt specifier
> e.g. '20 0x8'. The openfirmware spec
> normally suggests to use a value of '2' for interrupts which are
> active low. During parsing of the interrupt-map
> this value is normally translated using 'xlate' to linux kernel values
> (active low is defined as IRQ_TYPE_LEVEL_LOW =A0 =A0 =A00x00000008 in the
> kernel).
> The ipic driver code and various dts files are evil and store the
> linux kernel value inside the DTS file, so they don't do any
> conversion whis is EVIL
> in my opinion. Watch out for that.
They're just numbers and they are intended to by interrupt controller
specific values. Some IRQ controllers don't even have a 'flags' field
for instance. The binding author is free to choose values he or she
deems suitable for the purpose as long as it is documented and
reviewed.
> (The corresponding DTS files and
> drivers should be updated).
No. The binding is set. We've made a commitment to not change
bindings after they are defined and deployed. In some cases it is not
easy to update the device tree blob in deployed systems.
>
> Regards,
> Roderick Colenbrander
> _______________________________________________
> 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] 7+ messages in thread
end of thread, other threads:[~2009-04-16 19:21 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-15 12:54 OF PCI howto? Joakim Tjernlund
2009-04-15 13:08 ` Wolfram Sang
2009-04-15 15:20 ` Kumar Gala
2009-04-16 8:05 ` Joakim Tjernlund
2009-04-16 9:03 ` Roderick Colenbrander
2009-04-16 17:03 ` Scott Wood
2009-04-16 19:21 ` 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).