Re: MPC5200 PCI Issues

2009-02-06 Thread Tobias Knutsson
Hi Andre,

I started the development with 2.6.28. Thanks for all of your
suggestions but I managed to find the solution today. The problem was
that the PCI-cards did not have class specified. Adding a fixup hook
to the cards in quirks.c resolved the issue.

On Fri, Feb 6, 2009 at 14:34, Andre Schwarz
 wrote:
> Tobias,
>
> are you starting with 2.6.28 or are you upgrading ?
> My system runs very fine with 2.6.27 
>
> Tobias Knutsson wrote:
>>
>> I am currently trying to get an MPC5200-based board to run Linux
>> 2.6.28. Most of the devices are working, however i have some issues
>> with the PCI-bus. More precisely, the issue is that all of
>> the cards' IO-regions are mapped to address 0x0.
>>  In my device tree I have the following:
>>
>>   p...@fd00 {
>>   #interrupt-cells = <1>;
>>   #size-cells = <2>;
>>   #address-cells = <3>;
>>   device_type = "pci";
>>   compatible = "fsl,mpc5200b-pci","fsl,mpc5200-pci";
>>   reg = <0xfd00 0x100>;
>>   interrupt-map-mask = <0xf800 0 0 7>;
>>   interrupt-map = <0xb000 0 0 1 &mpc5200_pic 0 0 3 // MPC5200
>>0xb000 0 0 2 &mpc5200_pic 0 0 3
>>0xb000 0 0 3 &mpc5200_pic 0 0 3
>>0xb000 0 0 4 &mpc5200_pic 0 0 3
>>
>
> What's this ? Is the MPC5200 interrupting itself ?

No, the PCI-bridge is connected to IRQ0

>>
>>0xb800 0 0 1 &mpc5200_pic 1 1 3 // c64x0
>>0xb800 0 0 2 &mpc5200_pic 1 1 3
>>0xb800 0 0 3 &mpc5200_pic 1 1 3
>>0xb800 0 0 4 &mpc5200_pic 1 1 3
>>
>
> Have you connected 4 IRQ lines to each c64x device ?

No, this is just some copy-paste leftovers that should be trimmed down
after some examination of the schematics.

>>
>>0xc000 0 0 1 &mpc5200_pic 1 1 3 // c64x1
>>0xc000 0 0 2 &mpc5200_pic 1 1 3
>>0xc000 0 0 3 &mpc5200_pic 1 1 3
>>0xc000 0 0 4 &mpc5200_pic 1 1 3
>>
>>0xc800 0 0 1 &mpc5200_pic 1 1 3 // c64x2
>>0xc800 0 0 2 &mpc5200_pic 1 1 3
>>0xc800 0 0 3 &mpc5200_pic 1 1 3
>>0xc800 0 0 4 &mpc5200_pic 1 1 3
>>
>>0xd000 0 0 1 &mpc5200_pic 1 1 3 // c64x3
>>0xd000 0 0 2 &mpc5200_pic 1 1 3
>>0xd000 0 0 3 &mpc5200_pic 1 1 3
>>0xd000 0 0 4 &mpc5200_pic 1 1 3
>>
>>0xd800 0 0 1 &mpc5200_pic 1 1 3 // c64x4
>>0xd800 0 0 2 &mpc5200_pic 1 1 3
>>0xd800 0 0 3 &mpc5200_pic 1 1 3
>>0xd800 0 0 4 &mpc5200_pic 1 1 3>;
>>
>>
>
> I'm using an external FPGA and an e1000 NIC connectedt to IRQ2 and IRQ3 :
>
>   interrupt-map = <0x5800 0 0 1 &mpc5200_pic 1 2 3
>0x5000 0 0 1 &mpc5200_pic 1 3
> 3>;
>
>
>>   clock-frequency = <0x1e84800>;  //<0>; // From boot loader
>>   interrupts = <2 8 0 2 9 0 2 10 0>;
>>   interrupt-parent = <&mpc5200_pic>;
>>   bus-range = <0 0>;
>>   ranges = <0x0200 0 0x5000 0x5000 0 0x1000
>> 0x0100 0 0x 0x6000 0 0x0100>;
>>   };
>>
>
> I'm using a 3 liner :
>
>   ranges = <0x4200 0 0x8000 0x8000 0 0x2000
>   0x0200 0 0xa000 0xa000 0 0x1000
>   0x0100 0 0x 0xb000 0 0x0100>;
>
>> The cards' memory regions are mapped out fine to different addresses
>> in the 0x5000-0x6000 range. However, the IO regions are all mapped
>> to zero.
>>
>>
>
> Are you c64x devices responding properly ? Is IO access enabled in the PCI
> command register ?
> Are they announcing a reasonable window ? How man KBytes ?
>>
>> Do you have any idea on what could be wrong or in which direction I
>> should be looking?
>>
>>
>>
>
> Hopefully something is useful to you.
>
> regards,
> Andre
>
>
> MATRIX VISION GmbH, Talstraße 16, DE-71570 Oppenweiler
> Registergericht: Amtsgericht Stuttgart, HRB 271090
> Geschäftsführer: Gerhard Thullner, Werner Armingeon, Uwe Furtner,
> Hans-Joachim Reich
>



-- 

Hälsningar/Regards
Tobias Knutsson
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: MPC5200 PCI Issues

2009-02-06 Thread Andre Schwarz

Tobias,

are you starting with 2.6.28 or are you upgrading ?
My system runs very fine with 2.6.27 

Tobias Knutsson wrote:

I am currently trying to get an MPC5200-based board to run Linux
2.6.28. Most of the devices are working, however i have some issues
with the PCI-bus. More precisely, the issue is that all of
the cards' IO-regions are mapped to address 0x0.
  
In my device tree I have the following:


   p...@fd00 {
   #interrupt-cells = <1>;
   #size-cells = <2>;
   #address-cells = <3>;
   device_type = "pci";
   compatible = "fsl,mpc5200b-pci","fsl,mpc5200-pci";
   reg = <0xfd00 0x100>;
   interrupt-map-mask = <0xf800 0 0 7>;
   interrupt-map = <0xb000 0 0 1 &mpc5200_pic 0 0 3 // MPC5200
0xb000 0 0 2 &mpc5200_pic 0 0 3
0xb000 0 0 3 &mpc5200_pic 0 0 3
0xb000 0 0 4 &mpc5200_pic 0 0 3
  

What's this ? Is the MPC5200 interrupting itself ?

0xb800 0 0 1 &mpc5200_pic 1 1 3 // c64x0
0xb800 0 0 2 &mpc5200_pic 1 1 3
0xb800 0 0 3 &mpc5200_pic 1 1 3
0xb800 0 0 4 &mpc5200_pic 1 1 3
  

Have you connected 4 IRQ lines to each c64x device ?

0xc000 0 0 1 &mpc5200_pic 1 1 3 // c64x1
0xc000 0 0 2 &mpc5200_pic 1 1 3
0xc000 0 0 3 &mpc5200_pic 1 1 3
0xc000 0 0 4 &mpc5200_pic 1 1 3

0xc800 0 0 1 &mpc5200_pic 1 1 3 // c64x2
0xc800 0 0 2 &mpc5200_pic 1 1 3
0xc800 0 0 3 &mpc5200_pic 1 1 3
0xc800 0 0 4 &mpc5200_pic 1 1 3

0xd000 0 0 1 &mpc5200_pic 1 1 3 // c64x3
0xd000 0 0 2 &mpc5200_pic 1 1 3
0xd000 0 0 3 &mpc5200_pic 1 1 3
0xd000 0 0 4 &mpc5200_pic 1 1 3

0xd800 0 0 1 &mpc5200_pic 1 1 3 // c64x4
0xd800 0 0 2 &mpc5200_pic 1 1 3
0xd800 0 0 3 &mpc5200_pic 1 1 3
0xd800 0 0 4 &mpc5200_pic 1 1 3>;

  

I'm using an external FPGA and an e1000 NIC connectedt to IRQ2 and IRQ3 :

   interrupt-map = <0x5800 0 0 1 &mpc5200_pic 1 2 3
0x5000 0 0 1 
&mpc5200_pic 1 3 3>;




   clock-frequency = <0x1e84800>;  //<0>; // From boot loader
   interrupts = <2 8 0 2 9 0 2 10 0>;
   interrupt-parent = <&mpc5200_pic>;
   bus-range = <0 0>;
   ranges = <0x0200 0 0x5000 0x5000 0 0x1000
 0x0100 0 0x 0x6000 0 0x0100>;
   };
  

I'm using a 3 liner :

   ranges = <0x4200 0 0x8000 0x8000 0 0x2000
   0x0200 0 0xa000 0xa000 0 0x1000
   0x0100 0 0x 0xb000 0 0x0100>;


The cards' memory regions are mapped out fine to different addresses
in the 0x5000-0x6000 range. However, the IO regions are all mapped
to zero.

  
Are you c64x devices responding properly ? Is IO access enabled in the 
PCI command register ?

Are they announcing a reasonable window ? How man KBytes ?

Do you have any idea on what could be wrong or in which direction I
should be looking?


  


Hopefully something is useful to you.

regards,
Andre


MATRIX VISION GmbH, Talstraße 16, DE-71570 Oppenweiler
Registergericht: Amtsgericht Stuttgart, HRB 271090
Geschäftsführer: Gerhard Thullner, Werner Armingeon, Uwe Furtner, Hans-Joachim 
Reich
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: MPC5200 PCI Issues

2009-02-06 Thread Tobias Knutsson
I have now found drivers/pci/quirks.c which seems to be the place for
these types of things. However, since this code is unlikely to ever
make it to mainline, is it possible to register a fixup hook in a
platform setup file (lite5200.c and friends)?


On Fri, Feb 6, 2009 at 12:46, Tobias Knutsson  wrote:
> Ok, I have had a breakthrough. I was trying to find out where the
> resources were supposed to be allocated and that was when i found this
> section of code in pbus_assign_resources_sorted() in
> drivers/pci/setup-bus.c:
>
>/* Don't touch classless devices or host bridges or ioapics.  
> */
>if (class == PCI_CLASS_NOT_DEFINED ||
>class == PCI_CLASS_BRIDGE_HOST)
>continue;
>
> After that i took a quick look at the PCI-info reported by u-boot.
> Sure enough, all boards were reported having class 0. At first i tried
> to write a different class type, but as i suspected, the register
> seems to be read-only. Therefore I simply commented out the first part
> of the if-statement and now the resources seems to get allocated
> properly.
>
> However, I do realize that this is not the proper way of solving this
> issue. Any ideas on how to fix it without modifying any kernel code?
>
>
> On Thu, Feb 5, 2009 at 21:03, Tobias Knutsson  
> wrote:
>>
>> Hi,
>>
>> That is exactly what the bootlog shows. Debug output on in both
>> mpc52xx_pci.c and in pci-common.c. And the discussed code section enabled.
>>
>> Hälsningar / Regards
>> Tobias Knutsson
>>
>> On 5 feb 2009, at 17.44, Grant Likely  wrote:
>>
>>> On Thu, Feb 5, 2009 at 12:06 AM, Tobias Knutsson
>>>  wrote:

 When enabling the debug-printouts, it came to me that I forgot to
 mention something kind of important. Using the standard mpc52xx_pci.c,
 even the memory resources are mapped to zero.

 After disabling this code block, the memory regions are mapped out
 fine (but still no IO):
>>>
>>> Reenable this code, enable debug in arch/powerpc/kernel/pci-common.c,
>>> and post the results.
>>>
>>> When this code is disabled then you're just getting the leftovers from
>>> U-Boot's scan of the PCI bus.  For MPC5200 support Linux does its own
>>> scan and its own allocation of memory/IO address space and this code
>>> is needed to make sure that happens.
>>>
>>> g.
>>>

 static void
 mpc52xx_pci_fixup_resources(struct pci_dev *dev)
 {
  int i;

  pr_debug("mpc52xx_pci_fixup_resources() %.4x:%.4x\n",
   dev->vendor, dev->device);

  /* We don't rely on boot loader for PCI and resets all
 devices */
  for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
  struct resource *res = &dev->resource[i];
  if (res->end > res->start) {/* Only valid resources */
  res->end -= res->start;
  res->start = 0;
  res->flags |= IORESOURCE_UNSET;
  }
  }

 What is the purpose of this code? Since all resources are reset here,
 where are they inteded to be re-allocated?

 Here is the bootlog with the aforementioned code enabled:


 reading cuImage.lite5200b

 1833699 bytes read
 ## Booting kernel from Legacy Image at 00201400 ...
  Image Name:   Linux-2.6.28
  Created:  2009-02-05   6:54:20 UTC
  Image Type:   PowerPC Linux Kernel Image (gzip compressed)
  Data Size:1833635 Bytes =  1.7 MB
  Load Address: 0040
  Entry Point:  004005a0
  Verifying Checksum ... OK
  Uncompressing Kernel Image ... OK
 [0.00] Using lite5200 machine description
 [0.00] Linux version 2.6.28 (tknuts...@ztn-ubuntu) (gcc
 version 4.3.2 (Sourcery G++ Lite 4.3-50) ) #66 Thu Feb 5 07:51:46 CET
 2009
 [0.00] Adding MPC52xx PCI host bridge /p...@fd00
 [0.00] PCI host bridge /p...@fd00 (primary) ranges:
 [0.00]  MEM 0x5000..0x5fff ->
 0x5000
 [0.00]   IO 0x6000..0x60ff ->
 0x
 [0.00] mpc52xx_pci_setup(hose=c03ec000, pci_regs=fdffad00)
 [0.00] mem_resource[0] = {.start=5000, .end=5fff,
 .flags=200}
 [0.00] .io_resource={.start=0,.end=ff,.flags=100}
 .io_base_phys=0x6000
 [0.00] Zone PFN ranges:
 [0.00]   DMA  0x -> 0x4000
 [0.00]   Normal   0x4000 -> 0x4000
 [0.00] Movable zone start PFN for each node
 [0.00] early_node_map[1] active PFN ranges
 [0.00] 0: 0x -> 0x4000
 [0.00] Built 1 zonelists in Zone order, mobility grouping on.
 Total pages: 16256
 [0.00] Kernel command line: console=ttyPSC0,115200 root=/dev/sda2
 rw
 [0.00] MPC52xx PIC is up and 

Re: MPC5200 PCI Issues

2009-02-06 Thread Tobias Knutsson
Ok, I have had a breakthrough. I was trying to find out where the
resources were supposed to be allocated and that was when i found this
section of code in pbus_assign_resources_sorted() in
drivers/pci/setup-bus.c:

/* Don't touch classless devices or host bridges or ioapics.  */
if (class == PCI_CLASS_NOT_DEFINED ||
class == PCI_CLASS_BRIDGE_HOST)
continue;

After that i took a quick look at the PCI-info reported by u-boot.
Sure enough, all boards were reported having class 0. At first i tried
to write a different class type, but as i suspected, the register
seems to be read-only. Therefore I simply commented out the first part
of the if-statement and now the resources seems to get allocated
properly.

However, I do realize that this is not the proper way of solving this
issue. Any ideas on how to fix it without modifying any kernel code?


On Thu, Feb 5, 2009 at 21:03, Tobias Knutsson  wrote:
>
> Hi,
>
> That is exactly what the bootlog shows. Debug output on in both
> mpc52xx_pci.c and in pci-common.c. And the discussed code section enabled.
>
> Hälsningar / Regards
> Tobias Knutsson
>
> On 5 feb 2009, at 17.44, Grant Likely  wrote:
>
>> On Thu, Feb 5, 2009 at 12:06 AM, Tobias Knutsson
>>  wrote:
>>>
>>> When enabling the debug-printouts, it came to me that I forgot to
>>> mention something kind of important. Using the standard mpc52xx_pci.c,
>>> even the memory resources are mapped to zero.
>>>
>>> After disabling this code block, the memory regions are mapped out
>>> fine (but still no IO):
>>
>> Reenable this code, enable debug in arch/powerpc/kernel/pci-common.c,
>> and post the results.
>>
>> When this code is disabled then you're just getting the leftovers from
>> U-Boot's scan of the PCI bus.  For MPC5200 support Linux does its own
>> scan and its own allocation of memory/IO address space and this code
>> is needed to make sure that happens.
>>
>> g.
>>
>>>
>>> static void
>>> mpc52xx_pci_fixup_resources(struct pci_dev *dev)
>>> {
>>>  int i;
>>>
>>>  pr_debug("mpc52xx_pci_fixup_resources() %.4x:%.4x\n",
>>>   dev->vendor, dev->device);
>>>
>>>  /* We don't rely on boot loader for PCI and resets all
>>> devices */
>>>  for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
>>>  struct resource *res = &dev->resource[i];
>>>  if (res->end > res->start) {/* Only valid resources */
>>>  res->end -= res->start;
>>>  res->start = 0;
>>>  res->flags |= IORESOURCE_UNSET;
>>>  }
>>>  }
>>>
>>> What is the purpose of this code? Since all resources are reset here,
>>> where are they inteded to be re-allocated?
>>>
>>> Here is the bootlog with the aforementioned code enabled:
>>>
>>>
>>> reading cuImage.lite5200b
>>>
>>> 1833699 bytes read
>>> ## Booting kernel from Legacy Image at 00201400 ...
>>>  Image Name:   Linux-2.6.28
>>>  Created:  2009-02-05   6:54:20 UTC
>>>  Image Type:   PowerPC Linux Kernel Image (gzip compressed)
>>>  Data Size:1833635 Bytes =  1.7 MB
>>>  Load Address: 0040
>>>  Entry Point:  004005a0
>>>  Verifying Checksum ... OK
>>>  Uncompressing Kernel Image ... OK
>>> [0.00] Using lite5200 machine description
>>> [0.00] Linux version 2.6.28 (tknuts...@ztn-ubuntu) (gcc
>>> version 4.3.2 (Sourcery G++ Lite 4.3-50) ) #66 Thu Feb 5 07:51:46 CET
>>> 2009
>>> [0.00] Adding MPC52xx PCI host bridge /p...@fd00
>>> [0.00] PCI host bridge /p...@fd00 (primary) ranges:
>>> [0.00]  MEM 0x5000..0x5fff ->
>>> 0x5000
>>> [0.00]   IO 0x6000..0x60ff ->
>>> 0x
>>> [0.00] mpc52xx_pci_setup(hose=c03ec000, pci_regs=fdffad00)
>>> [0.00] mem_resource[0] = {.start=5000, .end=5fff,
>>> .flags=200}
>>> [0.00] .io_resource={.start=0,.end=ff,.flags=100}
>>> .io_base_phys=0x6000
>>> [0.00] Zone PFN ranges:
>>> [0.00]   DMA  0x -> 0x4000
>>> [0.00]   Normal   0x4000 -> 0x4000
>>> [0.00] Movable zone start PFN for each node
>>> [0.00] early_node_map[1] active PFN ranges
>>> [0.00] 0: 0x -> 0x4000
>>> [0.00] Built 1 zonelists in Zone order, mobility grouping on.
>>> Total pages: 16256
>>> [0.00] Kernel command line: console=ttyPSC0,115200 root=/dev/sda2
>>> rw
>>> [0.00] MPC52xx PIC is up and running!
>>> [0.00] PID hash table entries: 256 (order: 8, 1024 bytes)
>>> [0.00] clocksource: timebase mult[7d0] shift[22] registered
>>> [0.000263] console [ttyPSC0] enabled
>>> [0.121690] Dentry cache hash table entries: 8192 (order: 3, 32768
>>> bytes)
>>> [0.129012] Inode-cache hash table entries: 4096 (order: 2, 16384
>>> bytes)
>>> [0.147433] Memory: 60844k/65536k available (3704k kernel code,
>>

Re: MPC5200 PCI Issues

2009-02-05 Thread Tobias Knutsson


Hi,

That is exactly what the bootlog shows. Debug output on in both  
mpc52xx_pci.c and in pci-common.c. And the discussed code section  
enabled.


Hälsningar / Regards
Tobias Knutsson

On 5 feb 2009, at 17.44, Grant Likely  wrote:


On Thu, Feb 5, 2009 at 12:06 AM, Tobias Knutsson
 wrote:

When enabling the debug-printouts, it came to me that I forgot to
mention something kind of important. Using the standard  
mpc52xx_pci.c,

even the memory resources are mapped to zero.

After disabling this code block, the memory regions are mapped out
fine (but still no IO):


Reenable this code, enable debug in arch/powerpc/kernel/pci-common.c,
and post the results.

When this code is disabled then you're just getting the leftovers from
U-Boot's scan of the PCI bus.  For MPC5200 support Linux does its own
scan and its own allocation of memory/IO address space and this code
is needed to make sure that happens.

g.



static void
mpc52xx_pci_fixup_resources(struct pci_dev *dev)
{
  int i;

  pr_debug("mpc52xx_pci_fixup_resources() %.4x:%.4x\n",
   dev->vendor, dev->device);

  /* We don't rely on boot loader for PCI and resets all
 devices */
  for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
  struct resource *res = &dev->resource[i];
  if (res->end > res->start) {/* Only valid  
resources */

  res->end -= res->start;
  res->start = 0;
  res->flags |= IORESOURCE_UNSET;
  }
  }

What is the purpose of this code? Since all resources are reset here,
where are they inteded to be re-allocated?

Here is the bootlog with the aforementioned code enabled:


reading cuImage.lite5200b

1833699 bytes read
## Booting kernel from Legacy Image at 00201400 ...
 Image Name:   Linux-2.6.28
 Created:  2009-02-05   6:54:20 UTC
 Image Type:   PowerPC Linux Kernel Image (gzip compressed)
 Data Size:1833635 Bytes =  1.7 MB
 Load Address: 0040
 Entry Point:  004005a0
 Verifying Checksum ... OK
 Uncompressing Kernel Image ... OK
[0.00] Using lite5200 machine description
[0.00] Linux version 2.6.28 (tknuts...@ztn-ubuntu) (gcc
version 4.3.2 (Sourcery G++ Lite 4.3-50) ) #66 Thu Feb 5 07:51:46 CET
2009
[0.00] Adding MPC52xx PCI host bridge /p...@fd00
[0.00] PCI host bridge /p...@fd00 (primary) ranges:
[0.00]  MEM 0x5000..0x5fff ->  
0x5000
[0.00]   IO 0x6000..0x60ff ->  
0x

[0.00] mpc52xx_pci_setup(hose=c03ec000, pci_regs=fdffad00)
[0.00] mem_resource[0] =  
{.start=5000, .end=5fff, .flags=200}

[0.00] .io_resource={.start=0,.end=ff,.flags=100}
.io_base_phys=0x6000
[0.00] Zone PFN ranges:
[0.00]   DMA  0x -> 0x4000
[0.00]   Normal   0x4000 -> 0x4000
[0.00] Movable zone start PFN for each node
[0.00] early_node_map[1] active PFN ranges
[0.00] 0: 0x -> 0x4000
[0.00] Built 1 zonelists in Zone order, mobility grouping on.
Total pages: 16256
[0.00] Kernel command line: console=ttyPSC0,115200 root=/ 
dev/sda2 rw

[0.00] MPC52xx PIC is up and running!
[0.00] PID hash table entries: 256 (order: 8, 1024 bytes)
[0.00] clocksource: timebase mult[7d0] shift[22]  
registered

[0.000263] console [ttyPSC0] enabled
[0.121690] Dentry cache hash table entries: 8192 (order: 3,  
32768 bytes)
[0.129012] Inode-cache hash table entries: 4096 (order: 2,  
16384 bytes)

[0.147433] Memory: 60844k/65536k available (3704k kernel code,
4624k reserved, 156k data, 117k bss, 180k init)
[0.157672] SLUB: Genslabs=12, HWalign=32, Order=0-3,  
MinObjects=0,

CPUs=1, Nodes=1
[0.165373] Calibrating delay loop... 63.87 BogoMIPS (lpj=127744)
[0.236265] Mount-cache hash table entries: 512
[0.245719] net_namespace: 288 bytes
[0.250237] NET: Registered protocol family 16
[0.284887] PCI: Probing PCI hardware
[0.289670] mpc52xx_pci_fixup_resources() 1057:5809
[0.294799] PCI::00:17.0 Resource 0
5040-507f [21208] fixup...
[0.303180] PCI::00:17.0 
5040-507f

[0.309998] PCI::00:17.0 Resource 1
5080-50ff [20200] fixup...
[0.318262] PCI::00:17.0 
5080-50ff

[0.325062] PCI::00:17.0 Resource 2
6000-600f [20101] fixup...
[0.26] PCI::00:17.0 
6000-600f

[0.340124] mpc52xx_pci_fixup_resources() 104c:9065
[0.345242] PCI::00:18.0 Resource 0
5100-513f [21208] fixup...
[0.353519] PCI::00:18.0 
5100-513f

[0.360319] PCI::00:18.0 Resource 1
5180-51ff [20200] fixup...
[0.3

Re: MPC5200 PCI Issues

2009-02-05 Thread Grant Likely
On Thu, Feb 5, 2009 at 12:06 AM, Tobias Knutsson
 wrote:
> When enabling the debug-printouts, it came to me that I forgot to
> mention something kind of important. Using the standard mpc52xx_pci.c,
> even the memory resources are mapped to zero.
>
> After disabling this code block, the memory regions are mapped out
> fine (but still no IO):

Reenable this code, enable debug in arch/powerpc/kernel/pci-common.c,
and post the results.

When this code is disabled then you're just getting the leftovers from
U-Boot's scan of the PCI bus.  For MPC5200 support Linux does its own
scan and its own allocation of memory/IO address space and this code
is needed to make sure that happens.

g.

>
> static void
> mpc52xx_pci_fixup_resources(struct pci_dev *dev)
> {
>int i;
>
>pr_debug("mpc52xx_pci_fixup_resources() %.4x:%.4x\n",
> dev->vendor, dev->device);
>
>/* We don't rely on boot loader for PCI and resets all
>   devices */
>for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
>struct resource *res = &dev->resource[i];
>if (res->end > res->start) {/* Only valid resources */
>res->end -= res->start;
>res->start = 0;
>res->flags |= IORESOURCE_UNSET;
>}
>}
>
> What is the purpose of this code? Since all resources are reset here,
> where are they inteded to be re-allocated?
>
> Here is the bootlog with the aforementioned code enabled:
>
>
> reading cuImage.lite5200b
>
> 1833699 bytes read
> ## Booting kernel from Legacy Image at 00201400 ...
>   Image Name:   Linux-2.6.28
>   Created:  2009-02-05   6:54:20 UTC
>   Image Type:   PowerPC Linux Kernel Image (gzip compressed)
>   Data Size:1833635 Bytes =  1.7 MB
>   Load Address: 0040
>   Entry Point:  004005a0
>   Verifying Checksum ... OK
>   Uncompressing Kernel Image ... OK
> [0.00] Using lite5200 machine description
> [0.00] Linux version 2.6.28 (tknuts...@ztn-ubuntu) (gcc
> version 4.3.2 (Sourcery G++ Lite 4.3-50) ) #66 Thu Feb 5 07:51:46 CET
> 2009
> [0.00] Adding MPC52xx PCI host bridge /p...@fd00
> [0.00] PCI host bridge /p...@fd00 (primary) ranges:
> [0.00]  MEM 0x5000..0x5fff -> 
> 0x5000
> [0.00]   IO 0x6000..0x60ff -> 
> 0x
> [0.00] mpc52xx_pci_setup(hose=c03ec000, pci_regs=fdffad00)
> [0.00] mem_resource[0] = {.start=5000, .end=5fff, .flags=200}
> [0.00] .io_resource={.start=0,.end=ff,.flags=100}
> .io_base_phys=0x6000
> [0.00] Zone PFN ranges:
> [0.00]   DMA  0x -> 0x4000
> [0.00]   Normal   0x4000 -> 0x4000
> [0.00] Movable zone start PFN for each node
> [0.00] early_node_map[1] active PFN ranges
> [0.00] 0: 0x -> 0x4000
> [0.00] Built 1 zonelists in Zone order, mobility grouping on.
> Total pages: 16256
> [0.00] Kernel command line: console=ttyPSC0,115200 root=/dev/sda2 rw
> [0.00] MPC52xx PIC is up and running!
> [0.00] PID hash table entries: 256 (order: 8, 1024 bytes)
> [0.00] clocksource: timebase mult[7d0] shift[22] registered
> [0.000263] console [ttyPSC0] enabled
> [0.121690] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
> [0.129012] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
> [0.147433] Memory: 60844k/65536k available (3704k kernel code,
> 4624k reserved, 156k data, 117k bss, 180k init)
> [0.157672] SLUB: Genslabs=12, HWalign=32, Order=0-3, MinObjects=0,
> CPUs=1, Nodes=1
> [0.165373] Calibrating delay loop... 63.87 BogoMIPS (lpj=127744)
> [0.236265] Mount-cache hash table entries: 512
> [0.245719] net_namespace: 288 bytes
> [0.250237] NET: Registered protocol family 16
> [0.284887] PCI: Probing PCI hardware
> [0.289670] mpc52xx_pci_fixup_resources() 1057:5809
> [0.294799] PCI::00:17.0 Resource 0
> 5040-507f [21208] fixup...
> [0.303180] PCI::00:17.05040-507f
> [0.309998] PCI::00:17.0 Resource 1
> 5080-50ff [20200] fixup...
> [0.318262] PCI::00:17.05080-50ff
> [0.325062] PCI::00:17.0 Resource 2
> 6000-600f [20101] fixup...
> [0.26] PCI::00:17.06000-600f
> [0.340124] mpc52xx_pci_fixup_resources() 104c:9065
> [0.345242] PCI::00:18.0 Resource 0
> 5100-513f [21208] fixup...
> [0.353519] PCI::00:18.05100-513f
> [0.360319] PCI::00:18.0 Resource 1
> 5180-51ff [20200] fixup...
> [0.368583] PCI::00:18.05180-51ff

Re: MPC5200 PCI Issues

2009-02-04 Thread Tobias Knutsson
When enabling the debug-printouts, it came to me that I forgot to
mention something kind of important. Using the standard mpc52xx_pci.c,
even the memory resources are mapped to zero.

After disabling this code block, the memory regions are mapped out
fine (but still no IO):

static void
mpc52xx_pci_fixup_resources(struct pci_dev *dev)
{
int i;

pr_debug("mpc52xx_pci_fixup_resources() %.4x:%.4x\n",
 dev->vendor, dev->device);

/* We don't rely on boot loader for PCI and resets all
   devices */
for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
struct resource *res = &dev->resource[i];
if (res->end > res->start) {/* Only valid resources */
res->end -= res->start;
res->start = 0;
res->flags |= IORESOURCE_UNSET;
}
}

What is the purpose of this code? Since all resources are reset here,
where are they inteded to be re-allocated?

Here is the bootlog with the aforementioned code enabled:


reading cuImage.lite5200b

1833699 bytes read
## Booting kernel from Legacy Image at 00201400 ...
   Image Name:   Linux-2.6.28
   Created:  2009-02-05   6:54:20 UTC
   Image Type:   PowerPC Linux Kernel Image (gzip compressed)
   Data Size:1833635 Bytes =  1.7 MB
   Load Address: 0040
   Entry Point:  004005a0
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
[0.00] Using lite5200 machine description
[0.00] Linux version 2.6.28 (tknuts...@ztn-ubuntu) (gcc
version 4.3.2 (Sourcery G++ Lite 4.3-50) ) #66 Thu Feb 5 07:51:46 CET
2009
[0.00] Adding MPC52xx PCI host bridge /p...@fd00
[0.00] PCI host bridge /p...@fd00 (primary) ranges:
[0.00]  MEM 0x5000..0x5fff -> 0x5000
[0.00]   IO 0x6000..0x60ff -> 0x
[0.00] mpc52xx_pci_setup(hose=c03ec000, pci_regs=fdffad00)
[0.00] mem_resource[0] = {.start=5000, .end=5fff, .flags=200}
[0.00] .io_resource={.start=0,.end=ff,.flags=100}
.io_base_phys=0x6000
[0.00] Zone PFN ranges:
[0.00]   DMA  0x -> 0x4000
[0.00]   Normal   0x4000 -> 0x4000
[0.00] Movable zone start PFN for each node
[0.00] early_node_map[1] active PFN ranges
[0.00] 0: 0x -> 0x4000
[0.00] Built 1 zonelists in Zone order, mobility grouping on.
Total pages: 16256
[0.00] Kernel command line: console=ttyPSC0,115200 root=/dev/sda2 rw
[0.00] MPC52xx PIC is up and running!
[0.00] PID hash table entries: 256 (order: 8, 1024 bytes)
[0.00] clocksource: timebase mult[7d0] shift[22] registered
[0.000263] console [ttyPSC0] enabled
[0.121690] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[0.129012] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[0.147433] Memory: 60844k/65536k available (3704k kernel code,
4624k reserved, 156k data, 117k bss, 180k init)
[0.157672] SLUB: Genslabs=12, HWalign=32, Order=0-3, MinObjects=0,
CPUs=1, Nodes=1
[0.165373] Calibrating delay loop... 63.87 BogoMIPS (lpj=127744)
[0.236265] Mount-cache hash table entries: 512
[0.245719] net_namespace: 288 bytes
[0.250237] NET: Registered protocol family 16
[0.284887] PCI: Probing PCI hardware
[0.289670] mpc52xx_pci_fixup_resources() 1057:5809
[0.294799] PCI::00:17.0 Resource 0
5040-507f [21208] fixup...
[0.303180] PCI::00:17.05040-507f
[0.309998] PCI::00:17.0 Resource 1
5080-50ff [20200] fixup...
[0.318262] PCI::00:17.05080-50ff
[0.325062] PCI::00:17.0 Resource 2
6000-600f [20101] fixup...
[0.26] PCI::00:17.06000-600f
[0.340124] mpc52xx_pci_fixup_resources() 104c:9065
[0.345242] PCI::00:18.0 Resource 0
5100-513f [21208] fixup...
[0.353519] PCI::00:18.05100-513f
[0.360319] PCI::00:18.0 Resource 1
5180-51ff [20200] fixup...
[0.368583] PCI::00:18.05180-51ff
[0.375383] PCI::00:18.0 Resource 2
6010-601f [20101] fixup...
[0.383647] PCI::00:18.06010-601f
[0.390444] mpc52xx_pci_fixup_resources() 104c:9065
[0.395549] PCI::00:19.0 Resource 0
5200-523f [21208] fixup...
[0.403826] PCI::00:19.05200-523f
[0.410626] PCI::00:19.0 Resource 1
5280-52ff [20200] fixup...
[0.418889] PCI::00:19.05280-52ff
[

MPC5200 PCI Issues

2009-02-04 Thread Tobias Knutsson
I am currently trying to get an MPC5200-based board to run Linux
2.6.28. Most of the devices are working, however i have some issues
with the PCI-bus. More precisely, the issue is that all of
the cards' IO-regions are mapped to address 0x0.

In my device tree I have the following:

   p...@fd00 {
   #interrupt-cells = <1>;
   #size-cells = <2>;
   #address-cells = <3>;
   device_type = "pci";
   compatible = "fsl,mpc5200b-pci","fsl,mpc5200-pci";
   reg = <0xfd00 0x100>;
   interrupt-map-mask = <0xf800 0 0 7>;
   interrupt-map = <0xb000 0 0 1 &mpc5200_pic 0 0 3 // MPC5200
0xb000 0 0 2 &mpc5200_pic 0 0 3
0xb000 0 0 3 &mpc5200_pic 0 0 3
0xb000 0 0 4 &mpc5200_pic 0 0 3

0xb800 0 0 1 &mpc5200_pic 1 1 3 // c64x0
0xb800 0 0 2 &mpc5200_pic 1 1 3
0xb800 0 0 3 &mpc5200_pic 1 1 3
0xb800 0 0 4 &mpc5200_pic 1 1 3

0xc000 0 0 1 &mpc5200_pic 1 1 3 // c64x1
0xc000 0 0 2 &mpc5200_pic 1 1 3
0xc000 0 0 3 &mpc5200_pic 1 1 3
0xc000 0 0 4 &mpc5200_pic 1 1 3

0xc800 0 0 1 &mpc5200_pic 1 1 3 // c64x2
0xc800 0 0 2 &mpc5200_pic 1 1 3
0xc800 0 0 3 &mpc5200_pic 1 1 3
0xc800 0 0 4 &mpc5200_pic 1 1 3

0xd000 0 0 1 &mpc5200_pic 1 1 3 // c64x3
0xd000 0 0 2 &mpc5200_pic 1 1 3
0xd000 0 0 3 &mpc5200_pic 1 1 3
0xd000 0 0 4 &mpc5200_pic 1 1 3

0xd800 0 0 1 &mpc5200_pic 1 1 3 // c64x4
0xd800 0 0 2 &mpc5200_pic 1 1 3
0xd800 0 0 3 &mpc5200_pic 1 1 3
0xd800 0 0 4 &mpc5200_pic 1 1 3>;

   clock-frequency = <0x1e84800>;  //<0>; // From boot loader
   interrupts = <2 8 0 2 9 0 2 10 0>;
   interrupt-parent = <&mpc5200_pic>;
   bus-range = <0 0>;
   ranges = <0x0200 0 0x5000 0x5000 0 0x1000
 0x0100 0 0x 0x6000 0 0x0100>;
   };

The cards' memory regions are mapped out fine to different addresses
in the 0x5000-0x6000 range. However, the IO regions are all mapped
to zero.

Do you have any idea on what could be wrong or in which direction I
should be looking?


-- 

Hälsningar/Regards
Tobias Knutsson
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: MPC5200 PCI Issues

2009-02-04 Thread Grant Likely
On Wed, Feb 4, 2009 at 9:53 AM, Tobias Knutsson
 wrote:
>   clock-frequency = <0x1e84800>;  //<0>; // From boot loader
>   interrupts = <2 8 0 2 9 0 2 10 0>;
>   interrupt-parent = <&mpc5200_pic>;
>   bus-range = <0 0>;
>   ranges = <0x0200 0 0x5000 0x5000 0 0x1000
> 0x0100 0 0x 0x6000 0 0x0100>;
>   };
>
> The cards' memory regions are mapped out fine to different addresses
> in the 0x5000-0x6000 range. However, the IO regions are all mapped
> to zero.
>
> Do you have any idea on what could be wrong or in which direction I
> should be looking?

Hmmm.  Your ranges property looks okay to me.  The MPC5200 setup code
may be doing the wrong thing.  Turn on debug at the top of
arch/powerpc/platforms/mpc52xx/mpc52xx_pci.c and post your kernel
output.

g.

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