Calling PCI Autoconfig again

Wyse, Chris chris.wyse at windriver.com
Wed Mar 8 06:25:54 EST 2006


Hi Kumar,

Thanks for the response.  Also, I apologize to the group - I didn't mean
to CC: the list with the last note.  However, I am glad that it got a
response from you.

Regarding the FPGA address assignment - it doesn't matter at all to me,
I just need to be able to access it on the PCI once the load is
complete.

As for the FPGA loader, the intent is that it will make the call to
rescan the PCI after the load is complete.  In fact, I intend to use it
as a way of determining if the load completed successfully, since we
don't have access to the DONE signal from the FPGA (we ran out of GPIO
pins).  

If you missed this link from a previous post, please check it out.  It
implements a rescan of the PCI.

http://marc.theaimsgroup.com/?l=linux-hotplug-devel&m=101318310111131&w=
2 

I see that you have a requirement for a fixed BAR address.  I think you
could modify the code from the above link to load a new BAR address
after the PCI has been rescanned.  You could probably add a routine to
register a BAR address for a device, and change the check_hw() routine
to see if a BAR address is registered.  If so, it would free the
allocated space for the device, allocate space at the desired address,
then write the new address to the BAR.

Hope this helps.  I'll be monitoring your thread for future
developments.


Chris Wyse
Member of Technical Staff
Embedded Technologies
860-749-1556 office
860-978-0849 cell
413-778-9101 fax
http://www.windriver.com
  


-----Original Message-----
From: Kumar Gala [mailto:galak at kernel.crashing.org] 
Sent: Tuesday, March 07, 2006 11:27 AM
To: Wyse, Chris
Cc: Touron, Emmanuel; McComb, Michael; linuxppc-embedded at ozlabs.org
Subject: Re: Calling PCI Autoconfig again


On Mar 7, 2006, at 8:17 AM, Wyse, Chris wrote:

> Hi,
>
> This code will do the rescan of the PCI that we need for the FPGA.
> However, it currently only supports a single execution after the FPGA 
> gets loaded.  Additional calls will continue to add FPGA devices to 
> the PCI device list data structure.  I'm going to make some changes to

> it to handle multiple calls and to support multiple device ids.  I'm 
> expecting it to take a day or two, but I'll make an initial cut at it 
> today that will let us load the Spartan FPGA (only once).  This driver

> will be loaded when the kernel boots, so I believe that we'll just 
> need to make a call into it (we won't have to dynamically load it like

> the phob driver).

I'm dealing with this exact same situation and having a discussion on
lkml regarding the proper way to do this.  In your case, do you care
what addresses the FPGA is assigned at?

http://marc.theaimsgroup.com/?l=linux-kernel&m=114140791428032&w=2

> Michael,
>
> For the FPGA loader, you should load the FPGA, then make a call to
> pci_rescan_bus0() (I'm renaming check_hw() to pci_rescan_bus0()).   
> Next,
> you need to do a pci_find_device() to detect the newly loaded FPGA.  
> If the pci_find_device() fails, assume that the FPGA load has not 
> completed, so delay for some time frame (100 ms??), then rescan again.
> If still not found, rescan up to MAX_PCI_RESCANS (probably set it to 
> 3) times, then return an error that the FPGA load failed.

Do you not know when the FPGA load is done?  I assume its under software
control so the "fpga loader" should just call the PCI setup code once it
has completed successfully.

- kumar




More information about the Linuxppc-embedded mailing list