drivers/eeprom/spi_xx25xx: Multi-device SPI bus support

Adds a device ID to ee25xx_initialize, which is stored in the
ee25xx_dev_s structure. This ID is used when calling SPI_SELECT.

The implementation is based on the handling of the chip select in
mtd/ramtron.c

This change is NOT backward compatible: the function signature has changed

Signed-off-by: Antoine Juckler <6445757+ajuckler@users.noreply.github.com>
This commit is contained in:
Antoine Juckler 2025-11-11 15:09:33 +09:00 committed by Alan C. Assis
parent 81550800d4
commit 224afcb77b
2 changed files with 48 additions and 24 deletions

View file

@ -90,14 +90,25 @@ enum eeprom_25xx_e
/****************************************************************************
* Name: ee25xx_initialize
*
* Description: Bind a EEPROM driver to an SPI bus. The user MUST provide
* a description of the device geometry, since it is not possible to read
* this information from the device (contrary to the SPI flash devices).
* Description:
* Bind an EEPROM driver to an SPI bus. The user MUST provide a description
* of the device geometry, since it is not possible to read this
* information from the device (contrary to the SPI flash devices).
*
* Parameters:
* dev - Pointer to the SPI device instance
* spi_devid - SPI device ID to manage CS lines in board
* devname - Device name
* devtype - 25xx device type, the geometry is derived from it
* readonly - Sets driver to be readonly
*
* Returned Values:
* OK on success; A negated errno value is returned on any failure.
*
****************************************************************************/
struct spi_dev_s;
int ee25xx_initialize(FAR struct spi_dev_s *dev, FAR char *devname,
int devtype, int readonly);
int ee25xx_initialize(FAR struct spi_dev_s *dev, uint16_t spi_devid,
FAR char *devname, int devtype, int readonly);
#endif /* __INCLUDE_NUTTX_EEPROM_SPI_XX25XX_H */