[PATCH 3/3] exports: Fix export of SPI access functions

Paul Barker paul.barker at sancloud.com
Thu May 5 17:32:42 CEST 2022


* With CONFIG_DM_SPI defined, spi_get_bus_and_cs needs to be used
instead of spi_setup_slave to configure a SPI bus. As spi_setup_slave is
already present in the export list it is reasonable to also export
spi_get_bus_and_cs.

* For the functions listed in the jump table to be callable they must
also be defined in the "exports.h" header. Define the various exported
SPI functions so that they can be used.

Signed-off-by: Paul Barker <paul.barker at sancloud.com>
---
 include/_exports.h |  4 ++++
 include/exports.h  | 15 ++++++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/include/_exports.h b/include/_exports.h
index f6df8b610734..3457a92c95ad 100644
--- a/include/_exports.h
+++ b/include/_exports.h
@@ -60,11 +60,15 @@
 	EXPORT_FUNC(dummy, void, spi_claim_bus, void)
 	EXPORT_FUNC(dummy, void, spi_release_bus, void)
 	EXPORT_FUNC(dummy, void, spi_xfer, void)
+	EXPORT_FUNC(dummy, void, spi_get_bus_and_cs, void)
 #else
 	EXPORT_FUNC(spi_claim_bus, int, spi_claim_bus, struct spi_slave *)
 	EXPORT_FUNC(spi_release_bus, void, spi_release_bus, struct spi_slave *)
 	EXPORT_FUNC(spi_xfer, int, spi_xfer, struct spi_slave *,
 		    unsigned int, const void *, void *, unsigned long)
+	EXPORT_FUNC(spi_get_bus_and_cs, int, spi_get_bus_and_cs, int, int, int,
+			int, const char *, const char *, struct udevice **,
+			struct spi_slave **)
 #endif
 	EXPORT_FUNC(ustrtoul, unsigned long, ustrtoul,
 		    const char *, char **, unsigned int)
diff --git a/include/exports.h b/include/exports.h
index 6f8c9cf4517e..93110d63a235 100644
--- a/include/exports.h
+++ b/include/exports.h
@@ -53,6 +53,19 @@ unsigned long long ustrtoull(const char *cp, char **endp, unsigned int base);
 int i2c_write (uchar, uint, int , uchar* , int);
 int i2c_read (uchar, uint, int , uchar* , int);
 #endif
+#ifdef CONFIG_CMD_SPI
+#ifndef CONFIG_DM_SPI
+struct spi_slave * spi_setup_slave(unsigned int, unsigned int,
+        unsigned int, unsigned int);
+void spi_free_slave(struct spi_slave *);
+#endif
+int spi_claim_bus(struct spi_slave *);
+void spi_release_bus(struct spi_slave *);
+int spi_xfer(struct spi_slave *, unsigned int, const void *, void *,
+        unsigned long);
+int spi_get_bus_and_cs(int, int, int, int, const char *, const char *,
+        struct udevice **, struct spi_slave **);
+#endif
 #ifdef CONFIG_PHY_AQUANTIA
 struct mii_dev *mdio_get_current_dev(void);
 struct phy_device *phy_find_by_mask(struct mii_dev *bus, unsigned phy_mask);
@@ -71,7 +84,7 @@ struct jt_funcs {
 };
 
 
-#define XF_VERSION	9
+#define XF_VERSION	10
 
 #if defined(CONFIG_X86)
 extern gd_t *global_data;
-- 
2.25.1



More information about the U-Boot mailing list