diff options
author | Tom Rini <trini@konsulko.com> | 2019-09-16 13:13:12 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2019-09-16 13:13:12 -0400 |
commit | 0d6160a340cee36813438484dd9f5766c250f22e (patch) | |
tree | c38c7736816bc25c19322389a1c2c87d0d7c79bf /include | |
parent | a314ec1bfda3d0db0ce8ae02dde1b06650d82e7f (diff) | |
parent | ce704ea11f29b0ee8c195f17370a4048b6be29a9 (diff) | |
download | u-boot-0d6160a340cee36813438484dd9f5766c250f22e.tar.gz u-boot-0d6160a340cee36813438484dd9f5766c250f22e.tar.xz u-boot-0d6160a340cee36813438484dd9f5766c250f22e.zip |
Merge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-spi
- fix mvebu_a3700_spi clock prescale (Marek BehĂșn)
- unmark MXS_SPI, DEPRECATED (Lukasz)
- add spi_write_then_read (Jagan)
- fix SST26* flash ICs (Eugeniy)
- fix soft_spi data abort (Christophe)
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/mtd/spi-nor.h | 4 | ||||
-rw-r--r-- | include/spi.h | 20 |
2 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h index 88e80af579..709b49d393 100644 --- a/include/linux/mtd/spi-nor.h +++ b/include/linux/mtd/spi-nor.h @@ -91,6 +91,10 @@ #define SPINOR_OP_WRDI 0x04 /* Write disable */ #define SPINOR_OP_AAI_WP 0xad /* Auto address increment word program */ +/* Used for SST26* flashes only. */ +#define SPINOR_OP_READ_BPR 0x72 /* Read block protection register */ +#define SPINOR_OP_WRITE_BPR 0x42 /* Write block protection register */ + /* Used for S3AN flashes only */ #define SPINOR_OP_XSE 0x50 /* Sector erase */ #define SPINOR_OP_XPP 0x82 /* Page program */ diff --git a/include/spi.h b/include/spi.h index 378594163b..5eec0c4775 100644 --- a/include/spi.h +++ b/include/spi.h @@ -248,6 +248,26 @@ int spi_set_wordlen(struct spi_slave *slave, unsigned int wordlen); int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout, void *din, unsigned long flags); +/** + * spi_write_then_read - SPI synchronous write followed by read + * + * This performs a half duplex transaction in which the first transaction + * is to send the opcode and if the length of buf is non-zero then it start + * the second transaction as tx or rx based on the need from respective slave. + * + * @slave: The SPI slave device with which opcode/data will be exchanged + * @opcode: opcode used for specific transfer + * @n_opcode: size of opcode, in bytes + * @txbuf: buffer into which data to be written + * @rxbuf: buffer into which data will be read + * @n_buf: size of buf (whether it's [tx|rx]buf), in bytes + * + * Returns: 0 on success, not 0 on failure + */ +int spi_write_then_read(struct spi_slave *slave, const u8 *opcode, + size_t n_opcode, const u8 *txbuf, u8 *rxbuf, + size_t n_buf); + /* Copy memory mapped data */ void spi_flash_copy_mmap(void *data, void *offset, size_t len); |