
Hi Jagan,
$subject: s/redundent/redundant
On 09/07/20 4:47 pm, Jagan Teki wrote:
[...]
index b09046fec3..44cdb3151d 100644 --- a/drivers/mtd/spi/sf-uclass.c +++ b/drivers/mtd/spi/sf-uclass.c @@ -122,7 +122,7 @@ static int spi_flash_std_erase(struct udevice *dev, u32 offset, size_t len) return mtd->_erase(mtd, &instr); }
-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 spi_flash *flash; @@ -164,6 +164,32 @@ static int spi_flash_std_remove(struct udevice *dev) return 0; }
+/*
- Manually set the parent of the SPI flash to SPI, since dtoc doesn't. We also
- need to allocate the parent_platdata since by the time this function is
- called device_bind() has already gone past that step.
- */
+static int spi_flash_std_bind(struct udevice *dev) +{
- if (CONFIG_IS_ENABLED(OF_PLATDATA)) {
struct dm_spi_slave_platdata *plat;
struct udevice *spi;
int ret;
ret = uclass_first_device_err(UCLASS_SPI, &spi);
if (ret)
return ret;
dev->parent = spi;
Hmm... How does this association work in case of multiple flash devices in the system on multiple SPI buses? Seems like fixup works only for first SPI bus?
Regards Vignesh
plat = calloc(sizeof(*plat), 1);
if (!plat)
return -ENOMEM;
dev->parent_platdata = plat;
- }
- return 0;
+}
static const struct dm_spi_flash_ops spi_flash_std_ops = { .read = spi_flash_std_read, .write = spi_flash_std_write, @@ -180,6 +206,7 @@ U_BOOT_DRIVER(spi_flash_std) = { .id = UCLASS_SPI_FLASH, .of_match = spi_flash_std_ids, .probe = spi_flash_std_probe,
- .bind = spi_flash_std_bind, .remove = spi_flash_std_remove, .priv_auto_alloc_size = sizeof(struct spi_flash), .ops = &spi_flash_std_ops,
diff --git a/include/spi_flash.h b/include/spi_flash.h index 41cf4b0670..24759944eb 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -75,18 +75,6 @@ int spi_flash_write_dm(struct udevice *dev, u32 offset, size_t len, */ int spi_flash_erase_dm(struct udevice *dev, u32 offset, size_t len);
-/**
- spi_flash_std_probe() - Probe a SPI flash device
- This is the standard internal method for probing a SPI flash device to
- determine its type. It can be used in chip-specific drivers which need to
- do this, typically with of-platdata
- @dev: SPI-flash device to probe
- @return 0 if OK, -ve on error
- */
-int spi_flash_std_probe(struct udevice *dev);
static inline int spi_flash_read(struct spi_flash *flash, u32 offset, size_t len, void *buf) {