projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
dm: core: Add flags parameter to device_remove()
[oweals/u-boot.git]
/
drivers
/
mtd
/
spi
/
sf_probe.c
diff --git
a/drivers/mtd/spi/sf_probe.c
b/drivers/mtd/spi/sf_probe.c
index e35b91760fc7c9813fe6c9b0a00acb77970d0999..7b296378d2be4fa20a274219a63ae93fee95eae4 100644
(file)
--- a/
drivers/mtd/spi/sf_probe.c
+++ b/
drivers/mtd/spi/sf_probe.c
@@
-11,24
+11,21
@@
#include <common.h>
#include <dm.h>
#include <errno.h>
#include <common.h>
#include <dm.h>
#include <errno.h>
-#include <fdtdec.h>
#include <malloc.h>
#include <malloc.h>
-#include <mapmem.h>
#include <spi.h>
#include <spi_flash.h>
#include <spi.h>
#include <spi_flash.h>
-#include <asm/io.h>
#include "sf_internal.h"
/**
* spi_flash_probe_slave() - Probe for a SPI flash device on a bus
*
#include "sf_internal.h"
/**
* spi_flash_probe_slave() - Probe for a SPI flash device on a bus
*
- * @spi: Bus to probe
* @flashp: Pointer to place to put flash info, which may be NULL if the
* space should be allocated
*/
* @flashp: Pointer to place to put flash info, which may be NULL if the
* space should be allocated
*/
-
int spi_flash_probe_slave(struct spi_slave *spi,
struct spi_flash *flash)
+
static int spi_flash_probe_slave(
struct spi_flash *flash)
{
{
+ struct spi_slave *spi = flash->spi;
int ret;
/* Setup spi_slave */
int ret;
/* Setup spi_slave */
@@
-44,11
+41,9
@@
int spi_flash_probe_slave(struct spi_slave *spi, struct spi_flash *flash)
return ret;
}
return ret;
}
- ret = spi_flash_scan(spi, flash);
- if (ret) {
- ret = -EINVAL;
+ ret = spi_flash_scan(flash);
+ if (ret)
goto err_read_id;
goto err_read_id;
- }
#ifdef CONFIG_SPI_FLASH_MTD
ret = spi_flash_mtd_register(flash);
#ifdef CONFIG_SPI_FLASH_MTD
ret = spi_flash_mtd_register(flash);
@@
-60,7
+55,7
@@
err_read_id:
}
#ifndef CONFIG_DM_SPI_FLASH
}
#ifndef CONFIG_DM_SPI_FLASH
-struct spi_flash *spi_flash_probe_tail(struct spi_slave *bus)
+st
atic st
ruct spi_flash *spi_flash_probe_tail(struct spi_slave *bus)
{
struct spi_flash *flash;
{
struct spi_flash *flash;
@@
-71,7
+66,8
@@
struct spi_flash *spi_flash_probe_tail(struct spi_slave *bus)
return NULL;
}
return NULL;
}
- if (spi_flash_probe_slave(bus, flash)) {
+ flash->spi = bus;
+ if (spi_flash_probe_slave(flash)) {
spi_free_slave(bus);
free(flash);
return NULL;
spi_free_slave(bus);
free(flash);
return NULL;
@@
-123,14
+119,14
@@
static int spi_flash_std_read(struct udevice *dev, u32 offset, size_t len,
return spi_flash_cmd_read_ops(flash, offset, len, buf);
}
return spi_flash_cmd_read_ops(flash, offset, len, buf);
}
-int spi_flash_std_write(struct udevice *dev, u32 offset, size_t len,
+
static
int spi_flash_std_write(struct udevice *dev, u32 offset, size_t len,
const void *buf)
{
struct spi_flash *flash = dev_get_uclass_priv(dev);
#if defined(CONFIG_SPI_FLASH_SST)
if (flash->flags & SNOR_F_SST_WR) {
const void *buf)
{
struct spi_flash *flash = dev_get_uclass_priv(dev);
#if defined(CONFIG_SPI_FLASH_SST)
if (flash->flags & SNOR_F_SST_WR) {
- if (flash->spi->
op_mode_tx & SPI_OPM_TX_BP
)
+ if (flash->spi->
mode & SPI_TX_BYTE
)
return sst_write_bp(flash, offset, len, buf);
else
return sst_write_wp(flash, offset, len, buf);
return sst_write_bp(flash, offset, len, buf);
else
return sst_write_wp(flash, offset, len, buf);
@@
-140,14
+136,14
@@
int spi_flash_std_write(struct udevice *dev, u32 offset, size_t len,
return spi_flash_cmd_write_ops(flash, offset, len, buf);
}
return spi_flash_cmd_write_ops(flash, offset, len, buf);
}
-int spi_flash_std_erase(struct udevice *dev, u32 offset, size_t len)
+
static
int spi_flash_std_erase(struct udevice *dev, u32 offset, size_t len)
{
struct spi_flash *flash = dev_get_uclass_priv(dev);
return spi_flash_cmd_erase_ops(flash, offset, len);
}
{
struct spi_flash *flash = dev_get_uclass_priv(dev);
return spi_flash_cmd_erase_ops(flash, offset, len);
}
-int spi_flash_std_probe(struct udevice *dev)
+
static
int spi_flash_std_probe(struct udevice *dev)
{
struct spi_slave *slave = dev_get_parent_priv(dev);
struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev);
{
struct spi_slave *slave = dev_get_parent_priv(dev);
struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev);
@@
-155,8
+151,9
@@
int spi_flash_std_probe(struct udevice *dev)
flash = dev_get_uclass_priv(dev);
flash->dev = dev;
flash = dev_get_uclass_priv(dev);
flash->dev = dev;
+ flash->spi = slave;
debug("%s: slave=%p, cs=%d\n", __func__, slave, plat->cs);
debug("%s: slave=%p, cs=%d\n", __func__, slave, plat->cs);
- return spi_flash_probe_slave(
slave,
flash);
+ return spi_flash_probe_slave(flash);
}
static const struct dm_spi_flash_ops spi_flash_std_ops = {
}
static const struct dm_spi_flash_ops spi_flash_std_ops = {