diff options
| author | Haavard Skinnemoen <haavard.skinnemoen@atmel.com> | 2008-12-17 16:53:07 +0100 | 
|---|---|---|
| committer | Haavard Skinnemoen <haavard.skinnemoen@atmel.com> | 2008-12-17 16:53:07 +0100 | 
| commit | cb5473205206c7f14cbb1e747f28ec75b48826e2 (patch) | |
| tree | 8f4808d60917100b18a10b05230f7638a0a9bbcc /drivers/pci/pci.c | |
| parent | baf449fc5ff96f071bb0e3789fd3265f6d4fd9a0 (diff) | |
| parent | 92c78a3bbcb2ce508b4bf1c4a1e0940406a024bb (diff) | |
| download | olio-uboot-2014.01-cb5473205206c7f14cbb1e747f28ec75b48826e2.tar.xz olio-uboot-2014.01-cb5473205206c7f14cbb1e747f28ec75b48826e2.zip | |
Merge branch 'fixes' into cleanups
Conflicts:
	board/atmel/atngw100/atngw100.c
	board/atmel/atstk1000/atstk1000.c
	cpu/at32ap/at32ap700x/gpio.c
	include/asm-avr32/arch-at32ap700x/clk.h
	include/configs/atngw100.h
	include/configs/atstk1002.h
	include/configs/atstk1003.h
	include/configs/atstk1004.h
	include/configs/atstk1006.h
	include/configs/favr-32-ezkit.h
	include/configs/hammerhead.h
	include/configs/mimc200.h
Diffstat (limited to 'drivers/pci/pci.c')
| -rw-r--r-- | drivers/pci/pci.c | 39 | 
1 files changed, 27 insertions, 12 deletions
| diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index b5eea89e7..e2b05d899 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -157,7 +157,7 @@ pci_dev_t pci_find_devices(struct pci_device_id *ids, int index)  	for (hose = hose_head; hose; hose = hose->next)  	{ -#ifdef CFG_SCSI_SCAN_BUS_REVERSE +#ifdef CONFIG_SYS_SCSI_SCAN_BUS_REVERSE  		for (bus = hose->last_busno; bus >= hose->first_busno; bus--)  #else  		for (bus = hose->first_busno; bus <= hose->last_busno; bus++) @@ -218,12 +218,12 @@ pci_dev_t pci_find_device(unsigned int vendor, unsigned int device, int index)   *   */ -unsigned long pci_hose_phys_to_bus (struct pci_controller *hose, +pci_addr_t pci_hose_phys_to_bus (struct pci_controller *hose,  				    phys_addr_t phys_addr,  				    unsigned long flags)  {  	struct pci_region *res; -	unsigned long bus_addr; +	pci_addr_t bus_addr;  	int i;  	if (!hose) { @@ -252,7 +252,7 @@ Done:  }  phys_addr_t pci_hose_bus_to_phys(struct pci_controller* hose, -				 unsigned long bus_addr, +				 pci_addr_t bus_addr,  				 unsigned long flags)  {  	struct pci_region *res; @@ -288,15 +288,17 @@ Done:  int pci_hose_config_device(struct pci_controller *hose,  			   pci_dev_t dev,  			   unsigned long io, -			   unsigned long mem, +			   pci_addr_t mem,  			   unsigned long command)  { -	unsigned int bar_response, bar_size, bar_value, old_command; +	unsigned int bar_response, old_command; +	pci_addr_t bar_value; +	pci_size_t bar_size;  	unsigned char pin;  	int bar, found_mem64; -	debug ("PCI Config: I/O=0x%lx, Memory=0x%lx, Command=0x%lx\n", -		io, mem, command); +	debug ("PCI Config: I/O=0x%lx, Memory=0x%llx, Command=0x%lx\n", +		io, (u64)mem, command);  	pci_hose_write_config_dword (hose, dev, PCI_COMMAND, 0); @@ -319,10 +321,19 @@ int pci_hose_config_device(struct pci_controller *hose,  			io = io + bar_size;  		} else {  			if ((bar_response & PCI_BASE_ADDRESS_MEM_TYPE_MASK) == -				PCI_BASE_ADDRESS_MEM_TYPE_64) -				found_mem64 = 1; +				PCI_BASE_ADDRESS_MEM_TYPE_64) { +				u32 bar_response_upper; +				u64 bar64; +				pci_hose_write_config_dword(hose, dev, bar+4, 0xffffffff); +				pci_hose_read_config_dword(hose, dev, bar+4, &bar_response_upper); -			bar_size = ~(bar_response & PCI_BASE_ADDRESS_MEM_MASK) + 1; +				bar64 = ((u64)bar_response_upper << 32) | bar_response; + +				bar_size = ~(bar64 & PCI_BASE_ADDRESS_MEM_MASK) + 1; +				found_mem64 = 1; +			} else { +				bar_size = (u32)(~(bar_response & PCI_BASE_ADDRESS_MEM_MASK) + 1); +			}  			/* round up region base address to multiple of size */  			mem = ((mem - 1) | (bar_size - 1)) + 1; @@ -332,11 +343,15 @@ int pci_hose_config_device(struct pci_controller *hose,  		}  		/* Write it out and update our limit */ -		pci_hose_write_config_dword (hose, dev, bar, bar_value); +		pci_hose_write_config_dword (hose, dev, bar, (u32)bar_value);  		if (found_mem64) {  			bar += 4; +#ifdef CONFIG_SYS_PCI_64BIT +			pci_hose_write_config_dword(hose, dev, bar, (u32)(bar_value>>32)); +#else  			pci_hose_write_config_dword (hose, dev, bar, 0x00000000); +#endif  		}  	} |