From 31f57c28736d9a070fe56c55d57e9da406ee86ba Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 5 Mar 2015 12:25:15 -0700 Subject: x86: Add a x86_ prefix to the x86-specific PCI functions These functions currently use a generic name, but they are for x86 only. This may introduce confusion and prevents U-Boot from using these names more widely. In fact it should be possible to remove these at some point and use generic functions, but for now, rename them. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- arch/x86/cpu/ivybridge/sdram.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'arch/x86/cpu/ivybridge/sdram.c') diff --git a/arch/x86/cpu/ivybridge/sdram.c b/arch/x86/cpu/ivybridge/sdram.c index 766b385c25..672d06999d 100644 --- a/arch/x86/cpu/ivybridge/sdram.c +++ b/arch/x86/cpu/ivybridge/sdram.c @@ -444,7 +444,7 @@ int sdram_initialise(struct pei_data *pei_data) * Send ME init done for SandyBridge here. This is done inside the * SystemAgent binary on IvyBridge */ - done = pci_read_config32(PCH_DEV, PCI_DEVICE_ID); + done = x86_pci_read_config32(PCH_DEV, PCI_DEVICE_ID); done &= BASE_REV_MASK; if (BASE_REV_SNB == done) intel_early_me_init_done(ME_INIT_STATUS_SUCCESS); @@ -615,24 +615,24 @@ static int sdram_find(pci_dev_t dev) */ /* Top of Upper Usable DRAM, including remap */ - touud = pci_read_config32(dev, TOUUD+4); + touud = x86_pci_read_config32(dev, TOUUD+4); touud <<= 32; - touud |= pci_read_config32(dev, TOUUD); + touud |= x86_pci_read_config32(dev, TOUUD); /* Top of Lower Usable DRAM */ - tolud = pci_read_config32(dev, TOLUD); + tolud = x86_pci_read_config32(dev, TOLUD); /* Top of Memory - does not account for any UMA */ - tom = pci_read_config32(dev, 0xa4); + tom = x86_pci_read_config32(dev, 0xa4); tom <<= 32; - tom |= pci_read_config32(dev, 0xa0); + tom |= x86_pci_read_config32(dev, 0xa0); debug("TOUUD %llx TOLUD %08x TOM %llx\n", touud, tolud, tom); /* ME UMA needs excluding if total memory <4GB */ - me_base = pci_read_config32(dev, 0x74); + me_base = x86_pci_read_config32(dev, 0x74); me_base <<= 32; - me_base |= pci_read_config32(dev, 0x70); + me_base |= x86_pci_read_config32(dev, 0x70); debug("MEBASE %llx\n", me_base); @@ -650,7 +650,7 @@ static int sdram_find(pci_dev_t dev) } /* Graphics memory comes next */ - ggc = pci_read_config16(dev, GGC); + ggc = x86_pci_read_config16(dev, GGC); if (!(ggc & 2)) { debug("IGD decoded, subtracting "); @@ -670,7 +670,7 @@ static int sdram_find(pci_dev_t dev) } /* Calculate TSEG size from its base which must be below GTT */ - tseg_base = pci_read_config32(dev, 0xb8); + tseg_base = x86_pci_read_config32(dev, 0xb8); uma_size = (uma_memory_base - tseg_base) >> 10; tomk -= uma_size; uma_memory_base = tomk * 1024ULL; -- cgit From ba4575626eddef71b5a8dc26dc4b267918b9438c Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 26 Mar 2015 09:29:26 -0600 Subject: dm: x86: spi: Convert ICH SPI driver to driver model Convert this driver over to use driver model. Since all x86 platforms use it, move x86 to use driver model for SPI and SPI flash. Adjust all dependent code and remove the old x86 spi_init() function. Note that this does not make full use of the new PCI uclass as yet. We still scan the bus looking for the device. It should move to finding its details in the device tree. Signed-off-by: Simon Glass --- arch/x86/cpu/ivybridge/sdram.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'arch/x86/cpu/ivybridge/sdram.c') diff --git a/arch/x86/cpu/ivybridge/sdram.c b/arch/x86/cpu/ivybridge/sdram.c index 672d06999d..9a6da37d09 100644 --- a/arch/x86/cpu/ivybridge/sdram.c +++ b/arch/x86/cpu/ivybridge/sdram.c @@ -89,11 +89,12 @@ void dram_init_banksize(void) } } -static int get_mrc_entry(struct spi_flash **sfp, struct fmap_entry *entry) +static int get_mrc_entry(struct udevice **devp, struct fmap_entry *entry) { const void *blob = gd->fdt_blob; int node, spi_node, mrc_node; int upto; + int ret; /* Find the flash chip within the SPI controller node */ upto = 0; @@ -112,10 +113,13 @@ static int get_mrc_entry(struct spi_flash **sfp, struct fmap_entry *entry) if (fdtdec_read_fmap_entry(blob, mrc_node, "rm-mrc-cache", entry)) return -EINVAL; - if (sfp) { - *sfp = spi_flash_probe_fdt(blob, node, spi_node); - if (!*sfp) - return -EBADF; + if (devp) { + debug("getting sf\n"); + ret = uclass_get_device_by_of_offset(UCLASS_SPI_FLASH, node, + devp); + debug("ret = %d\n", ret); + if (ret) + return ret; } return 0; @@ -246,7 +250,7 @@ static int sdram_save_mrc_data(void) { struct mrc_data_container *data; struct fmap_entry entry; - struct spi_flash *sf; + struct udevice *sf; int ret; if (!gd->arch.mrc_output_len) @@ -266,7 +270,6 @@ static int sdram_save_mrc_data(void) free(data); err_data: - spi_flash_free(sf); err_entry: if (ret) debug("%s: Failed: %d\n", __func__, ret); -- cgit