Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update(spi_nand_flash): handle alignment and DMA requirements for work buffers #426

Merged

Conversation

RathiSonika
Copy link
Collaborator

Currently spi_nand_flash component passes pointers to TX and RX buffers to spi_master driver. However, these pointers sometimes are either not in DMA-capable memory or not aligned properly, and as a result spi_master driver allocates a temporary buffer for every transaction and copies the data to/from it. This also applies to cases when the transaction is just a couple of bytes long.

In this PR:

  1. Handled alignment and DMA requirements for work buffers
  2. For short transactions (4 bytes or less), used txdata/rxdata fields of spi transaction structure instead of pointers.

spi_nand_flash/src/nand.c Fixed Show fixed Hide fixed
@RathiSonika RathiSonika force-pushed the update/nand_flash_work_buf_alignment branch 2 times, most recently from d39fb08 to 48c3abe Compare October 16, 2024 11:20
spi_nand_flash/src/nand.c Outdated Show resolved Hide resolved
spi_nand_flash/src/spi_nand_oper.c Show resolved Hide resolved
spi_nand_flash/src/spi_nand_oper.c Outdated Show resolved Hide resolved
spi_nand_flash/src/spi_nand_oper.c Show resolved Hide resolved
@RathiSonika RathiSonika force-pushed the update/nand_flash_work_buf_alignment branch from 48c3abe to 548138d Compare October 16, 2024 12:10
spi_nand_flash/src/nand.c Dismissed Show dismissed Hide dismissed
spi_nand_flash/src/spi_nand_oper.c Fixed Show fixed Hide fixed
spi_nand_flash/src/spi_nand_oper.c Dismissed Show resolved Hide resolved
@RathiSonika RathiSonika force-pushed the update/nand_flash_work_buf_alignment branch from 548138d to 7630872 Compare October 16, 2024 12:19
@RathiSonika RathiSonika requested a review from igrr October 16, 2024 13:24
spi_nand_flash/src/nand.c Outdated Show resolved Hide resolved
@RathiSonika RathiSonika force-pushed the update/nand_flash_work_buf_alignment branch from 7630872 to 512b347 Compare October 18, 2024 07:15
spi_nand_flash/src/spi_nand_oper.c Dismissed Show dismissed Hide dismissed
@RathiSonika RathiSonika force-pushed the update/nand_flash_work_buf_alignment branch from 512b347 to 3a550d8 Compare October 22, 2024 06:55
Copy link

@pacucha42 pacucha42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, approved. Left 2 minor comments. Thanks @RathiSonika

spi_nand_flash/src/nand.c Show resolved Hide resolved
spi_nand_flash/src/nand.c Show resolved Hide resolved
@RathiSonika RathiSonika merged commit 6c23b9c into espressif:master Oct 22, 2024
48 checks passed
@RathiSonika RathiSonika deleted the update/nand_flash_work_buf_alignment branch October 22, 2024 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants