Skip to content

Commit faa3e6d

Browse files
Revert "[nrf fromlist] drivers: flash: nrf_qspi_nor: support read of sub-word"
This reverts commit bebd83b. Signed-off-by: Martí Bolívar <[email protected]>
1 parent 9908c44 commit faa3e6d

File tree

1 file changed

+8
-20
lines changed

1 file changed

+8
-20
lines changed

drivers/flash/nrf_qspi_nor.c

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -491,22 +491,16 @@ static inline int qspi_nor_read_id(struct device *dev,
491491
static int qspi_nor_read(struct device *dev, off_t addr, void *dest,
492492
size_t size)
493493
{
494-
void *dptr = dest;
495-
size_t dlen = size;
496-
497-
u8_t __aligned(4) buf[4];
498-
499-
if (!dest || (size == 0)) {
494+
if (!dest) {
500495
return -EINVAL;
501496
}
502497

503-
/* Since the QSPI driver requires data to be at least 4 bytes we need
504-
* to use a 4 byte buffer for reads smaller than 4 bytes.
505-
*/
506-
if (size < 4U) {
507-
dest = buf;
508-
size = sizeof(buf);
509-
} else if ((size % 4U) != 0) {
498+
/* read size must be non-zero multiple of 4 bytes */
499+
if (((size % 4U) != 0) || (size == 0)) {
500+
return -EINVAL;
501+
}
502+
/* address must be 4-byte aligned */
503+
if ((addr % 4U) != 0) {
510504
return -EINVAL;
511505
}
512506

@@ -529,13 +523,7 @@ static int qspi_nor_read(struct device *dev, off_t addr, void *dest,
529523

530524
qspi_wait_for_completion(dev, res);
531525

532-
int rc = qspi_get_zephyr_ret_code(res);
533-
534-
if ((rc == 0) && (dest != dptr)) {
535-
memcpy(dptr, dest, dlen);
536-
}
537-
538-
return rc;
526+
return qspi_get_zephyr_ret_code(res);
539527
}
540528

541529
static int qspi_nor_write(struct device *dev, off_t addr, const void *src,

0 commit comments

Comments
 (0)