summaryrefslogtreecommitdiff
path: root/drivers/mtd/spi/sf_probe.c
diff options
context:
space:
mode:
authorTom Rini <trini@ti.com>2013-12-10 09:36:23 -0500
committerTom Rini <trini@ti.com>2013-12-10 09:36:23 -0500
commit65b7fe28a12bbaccc7a0c076f5f9f213150030e7 (patch)
tree96be894262501d04c9bb637a837180b7708e49e8 /drivers/mtd/spi/sf_probe.c
parente1e3de79515b95712a41f52c86a0181530f2fc03 (diff)
parentca9a501953ce945da8e76d86a0ddf070a7f729b8 (diff)
downloadu-boot-imx-65b7fe28a12bbaccc7a0c076f5f9f213150030e7.zip
u-boot-imx-65b7fe28a12bbaccc7a0c076f5f9f213150030e7.tar.gz
u-boot-imx-65b7fe28a12bbaccc7a0c076f5f9f213150030e7.tar.bz2
Merge branch 'spi' of git://git.denx.de/u-boot-x86
Diffstat (limited to 'drivers/mtd/spi/sf_probe.c')
-rw-r--r--drivers/mtd/spi/sf_probe.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
index 5eb8ffe..c1eb754 100644
--- a/drivers/mtd/spi/sf_probe.c
+++ b/drivers/mtd/spi/sf_probe.c
@@ -13,6 +13,7 @@
#include <malloc.h>
#include <spi.h>
#include <spi_flash.h>
+#include <asm/io.h>
#include "sf_internal.h"
@@ -279,22 +280,19 @@ int spi_flash_decode_fdt(const void *blob, struct spi_flash *flash)
debug("%s: Memory map must cover entire device\n", __func__);
return -1;
}
- flash->memory_map = (void *)addr;
+ flash->memory_map = map_sysmem(addr, size);
return 0;
}
#endif /* CONFIG_OF_CONTROL */
-struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
- unsigned int max_hz, unsigned int spi_mode)
+static struct spi_flash *spi_flash_probe_slave(struct spi_slave *spi)
{
- struct spi_slave *spi;
struct spi_flash *flash = NULL;
u8 idcode[5];
int ret;
/* Setup spi_slave */
- spi = spi_setup_slave(bus, cs, max_hz, spi_mode);
if (!spi) {
printf("SF: Failed to set up slave\n");
return NULL;
@@ -358,6 +356,26 @@ err_claim_bus:
return NULL;
}
+struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
+ unsigned int max_hz, unsigned int spi_mode)
+{
+ struct spi_slave *spi;
+
+ spi = spi_setup_slave(bus, cs, max_hz, spi_mode);
+ return spi_flash_probe_slave(spi);
+}
+
+#ifdef CONFIG_OF_SPI_FLASH
+struct spi_flash *spi_flash_probe_fdt(const void *blob, int slave_node,
+ int spi_node)
+{
+ struct spi_slave *spi;
+
+ spi = spi_setup_slave_fdt(blob, slave_node, spi_node);
+ return spi_flash_probe_slave(spi);
+}
+#endif
+
void spi_flash_free(struct spi_flash *flash)
{
spi_free_slave(flash->spi);