Commit 4806fcea1a4b0143fc57932bc5cbdffdf8afca4e

Authored by Simon Glass
Committed by Bin Meng
1 parent 3937df3d6c

mtd: spi: Export spi_flash_std_probe()

With of-platdata we need to create drivers for particular chips, or at
least drivers that are separate from the standard code, since C structures
are created by dtoc which are private to that driver.

To avoid duplicating the probing code, export this probe function for use
by these drivers.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

Showing 2 changed files with 13 additions and 1 deletions Side-by-side Diff

drivers/mtd/spi/sf_probe.c
... ... @@ -137,7 +137,7 @@
137 137 return spi_flash_cmd_get_sw_write_prot(flash);
138 138 }
139 139  
140   -static int spi_flash_std_probe(struct udevice *dev)
  140 +int spi_flash_std_probe(struct udevice *dev)
141 141 {
142 142 struct spi_slave *slave = dev_get_parent_priv(dev);
143 143 struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev);
... ... @@ -102,6 +102,18 @@
102 102 */
103 103 int spl_flash_get_sw_write_prot(struct udevice *dev);
104 104  
  105 +/**
  106 + * spi_flash_std_probe() - Probe a SPI flash device
  107 + *
  108 + * This is the standard internal method for probing a SPI flash device to
  109 + * determine its type. It can be used in chip-specific drivers which need to
  110 + * do this, typically with of-platdata
  111 + *
  112 + * @dev: SPI-flash device to probe
  113 + * @return 0 if OK, -ve on error
  114 + */
  115 +int spi_flash_std_probe(struct udevice *dev);
  116 +
105 117 int spi_flash_probe_bus_cs(unsigned int busnum, unsigned int cs,
106 118 unsigned int max_hz, unsigned int spi_mode,
107 119 struct udevice **devp);