Message ID | 20220505153242.1598807-4-paul.barker@sancloud.com |
---|---|
State | Rejected |
Delegated to: | Wolfgang Denk |
Headers | show |
Series | Clarify standalone application support | expand |
On Thu, May 05, 2022 at 03:32:42PM +0000, Paul Barker wrote: > * 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@sancloud.com> Reviewed-by: Tom Rini <trini@konsulko.com>
Dear Paul, In message <20220505153242.1598807-4-paul.barker@sancloud.com> you wrote: > * 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@sancloud.com> > --- > include/_exports.h | 4 ++++ > include/exports.h | 15 ++++++++++++++- > 2 files changed, 18 insertions(+), 1 deletion(-) Sorry, but I disagree here. The SPI functions should have never been part of the export interface. As far as I can see now, they have been added by commit bedd8403f7 export SPI functions to standalone apps While we're here, fix the broken #ifdef handling in _exports.h. Signed-off-by: Mike Frysinger <vapier@gentoo.org> in 2009. Actually I must even have seen them, as I complained about incorrect comment style :-( But no, SPI support should not be inclluded. I2C was there because it was needed for reading the environment from an EEPROM, but then the interface was frozen ano no more new interfices / drivers should be allowed. Viele Grüße, Wolfgang Denk
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;
* 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@sancloud.com> --- include/_exports.h | 4 ++++ include/exports.h | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-)