Hi,
Thank you for the response.
My NVRAM driver is implemented by using the standard SPI driver calls (see previous message) for performing read/write operations.
The spi_sync() function implementation, that waits for write completion, is part of standard SPI driver (drivers/spi/spi.c), and thus is applicable for any device connected to the SPI interface.
Refer below code snippet:
static int __spi_sync(struct spi_device *spi, struct spi_message *message, int bus_locked)
{
DECLARE_COMPLETION_ONSTACK(done);
int status;
struct spi_master *master = spi->master;
message->complete = spi_complete;
message->context = &done;
if (!bus_locked)
mutex_lock(&master->bus_lock_mutex);
status = spi_async_locked(spi, message);
if (!bus_locked)
mutex_unlock(&master->bus_lock_mutex);
if (status == 0) {
wait_for_completion(&done);
status = message->status;
}
message->context = NULL;
return status;
}
Please tell me how the implementation specific to NVRAM write completion can be achieved using the Linux SPI driver calls.
Thanks again,
Kingshuk