|
iPXE
|
SPI devices. More...
Go to the source code of this file.
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| static unsigned int | spi_command (unsigned int command, unsigned int address, int munge_address) |
| Munge SPI device address into command. More... | |
| static int | spi_wait (struct spi_device *device) |
| Wait for SPI device to complete operation. More... | |
| int | spi_read (struct nvs_device *nvs, unsigned int address, void *data, size_t len) |
| Read data from SPI device. More... | |
| int | spi_write (struct nvs_device *nvs, unsigned int address, const void *data, size_t len) |
| Write data to SPI device. More... | |
SPI devices.
Definition in file spi.c.
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
inlinestatic |
Munge SPI device address into command.
| command | SPI command |
| address | Address |
| munge_address | Device requires address munging |
| command | Actual SPI command to use |
Some devices with 9-bit addresses (e.g. AT25040A EEPROM) use bit 3 of the command byte as address bit A8, rather than having a two-byte address. This function takes care of generating the appropriate command.
Definition at line 50 of file spi.c.
References address.
Referenced by spi_read(), and spi_write().
|
static |
Wait for SPI device to complete operation.
| device | SPI device |
| rc | Return status code |
Definition at line 62 of file spi.c.
References bus, DBG, ETIMEDOUT, NULL, rc, SPI_RDSR, SPI_STATUS_NRDY, status, and udelay().
Referenced by spi_write().
| int spi_read | ( | struct nvs_device * | nvs, |
| unsigned int | address, | ||
| void * | data, | ||
| size_t | len | ||
| ) |
Read data from SPI device.
| nvs | NVS device |
| address | Address from which to read |
| data | Data buffer |
| len | Length of data buffer |
| rc | Return status code |
Definition at line 89 of file spi.c.
References address, bus, data, DBG, len, NULL, spi_device::nvs, rc, spi_command(), and SPI_READ.
| int spi_write | ( | struct nvs_device * | nvs, |
| unsigned int | address, | ||
| const void * | data, | ||
| size_t | len | ||
| ) |
Write data to SPI device.
| nvs | NVS device |
| address | Address from which to read |
| data | Data buffer |
| len | Length of data buffer |
| rc | Return status code |
Definition at line 116 of file spi.c.
References address, bus, data, DBG, len, NULL, spi_device::nvs, rc, spi_command(), spi_wait(), SPI_WREN, and SPI_WRITE.
1.8.15