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

MEC172x qmspi ldma fix spi nor support #55129

Conversation

scottwcpg
Copy link
Collaborator

Update Microchip MEC172x QMSPI-LDMA driver to work with Zephyr's SPI NOR flash driver. This PR provides multiple benefits: removal the QMSPI full duplex driver whose only purpose was compatibility with the SPI NOR flash driver, QMSPI-LDMA driver is added to the SPI loopback test and SPI flash sample, and support for Zephyr SPI extended modes for dual and quad. Only minor changes to applications are required to setup the SPI buffers similar to all other SPI drivers. The PR has two commits: first is the driver change and added MEC172x EVB support to the loopback test and SPI flash sample, the second is a custom board specific sample application demonstrating erase, program, and read (single, dual, quad).

@zephyrbot zephyrbot added area: Devicetree Binding PR modifies or adds a Device Tree binding area: SPI SPI bus platform: Microchip MEC Microchip MEC Platform labels Feb 23, 2023
@scottwcpg scottwcpg force-pushed the mec172x_qmspi_ldma_fix_spi_nor2 branch 2 times, most recently from 7b8577d to 18e67f3 Compare February 23, 2023 15:07
Copy link
Collaborator

@galak galak left a comment

Choose a reason for hiding this comment

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

Can the sample work on the mec172xmodular_assy6930 as well?

@scottwcpg
Copy link
Collaborator Author

@galak The sample app uses the shared SPI interface pins and mec172xmodular_assy6930 also uses the same pins. No change to application overlay. The app erases/writes/reads at SPI flash offset 0xC10000. If you have 16MByte flash on the board no problem. The address will wrap on smaller flashes and should work but the actual SPI address will depend upon the SPI flash size.

@MaureenHelm
Copy link
Member

@jvasanth1 @albertofloyd can you take a look please?

@MaureenHelm MaureenHelm assigned jvasanth1 and unassigned tbursztyka Mar 9, 2023
jvasanth1
jvasanth1 previously approved these changes Mar 9, 2023
albertofloyd
albertofloyd previously approved these changes Mar 14, 2023
Copy link
Collaborator

@albertofloyd albertofloyd left a comment

Choose a reason for hiding this comment

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

Just some questions

@carlescufi
Copy link
Member

@scottwcpg please rebase

@scottwcpg scottwcpg dismissed stale reviews from albertofloyd and jvasanth1 via b3aaca0 March 20, 2023 13:59
@scottwcpg scottwcpg force-pushed the mec172x_qmspi_ldma_fix_spi_nor2 branch 2 times, most recently from b3aaca0 to ab1b3ee Compare March 20, 2023 14:15
@scottwcpg
Copy link
Collaborator Author

Hi @carlescufi Rebased fixing YAML formatting, etc.

jvasanth1
jvasanth1 previously approved these changes Mar 20, 2023
@jvasanth1
Copy link
Collaborator

jvasanth1 commented Mar 23, 2023

@albertofloyd can you help to re-approve?

nashif
nashif previously approved these changes Mar 23, 2023
@nashif
Copy link
Member

nashif commented Mar 23, 2023

we have new conflicts, another rebase please.

@scottwcpg scottwcpg dismissed stale reviews from nashif and jvasanth1 via 7e4a457 March 23, 2023 17:50
@scottwcpg scottwcpg force-pushed the mec172x_qmspi_ldma_fix_spi_nor2 branch from ab1b3ee to 7e4a457 Compare March 23, 2023 17:50
nashif
nashif previously approved these changes Mar 23, 2023
@scottwcpg
Copy link
Collaborator Author

@nashif Twister failure is on beagleconnect_freedom board. Beagleconnect_freedom twister spif_flash fails in main branch where this MCHP PR does not exist.

Zephyr SPI driver model for full-duplex operation assumes
data will be transmitted and received during each clock period.
The QMSPI driver for the XEC family also supported dual and
quad I/O use cases which are inherently half-duplex. To
support dual/quad the driver incorrectly processed spi buffers
as all transmit buffers first then all receive buffers. This
worked if only the SPI driver was used. It did not work with
the Zephyr flash SPI NOR driver which assumes SPI drivers
follow the SPI driver model. This commit implements a QMSPI
driver that follows the Zephyr SPI driver model resulting in
a slightly smaller driver. Dual/quad SPI transactions are
supported if the experimental SPI extended mode Zephyr
configuration flag is enabled. We also remove the QMSPI full duplex
driver added previously to support the flash SPI NOR driver.
Added board to spi loop-back test and spi_flash sample.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
Sample code for demonstrating spi buffer usage for single,
dual, and quad SPI transfers.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
@carlescufi
Copy link
Member

@jvasanth1 please take a look

@carlescufi carlescufi merged commit e8f089b into zephyrproject-rtos:main Apr 11, 2023
keith-zephyr added a commit to keith-zephyr/zephyr that referenced this pull request Apr 17, 2023
PR zephyrproject-rtos#55129 deleted the
"port-sel" property.  Delete this property from the MEC1727nsz variant.

Signed-off-by: Keith Short <keithshort@google.com>
keith-zephyr added a commit to keith-zephyr/zephyr that referenced this pull request Apr 17, 2023
PR zephyrproject-rtos#55129 deleted the
"port-sel" property.  Delete this property from remaining Microchip SoC
variants and boards.

Test: west build -b mec172xevb_assy6906 samples/drivers/espi/

Signed-off-by: Keith Short <keithshort@google.com>
coreboot-org-bot pushed a commit to coreboot/zephyr-cros that referenced this pull request Apr 17, 2023
PR zephyrproject-rtos/zephyr#55129 deleted the
"port-sel" property.  Delete this property from remaining Microchip SoC
variants and boards.

Test: west build -b mec172xevb_assy6906 samples/drivers/espi/

Cherry-picked from
zephyrproject-rtos/zephyr#56949

BRANCH=none
BUG=b:278560668
TEST=zmake build mtlrvpp_mchp

Cq-Depend: chromium:4431679
Change-Id: I36d83b453aea765d842055e53f5d8c634fa3efe6
Signed-off-by: Keith Short <keithshort@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/4434469
Tested-by: Keith Short <keithshort@chromium.org>
Reviewed-by: Al Semjonovs <asemjonovs@google.com>
Reviewed-by: Aaron Massey <aaronmassey@google.com>
Commit-Queue: Keith Short <keithshort@chromium.org>
carlescufi pushed a commit that referenced this pull request Apr 18, 2023
PR #55129 deleted the
"port-sel" property.  Delete this property from remaining Microchip SoC
variants and boards.

Test: west build -b mec172xevb_assy6906 samples/drivers/espi/

Signed-off-by: Keith Short <keithshort@google.com>
mkasenberg pushed a commit to mkasenberg/zephyr that referenced this pull request Apr 19, 2023
PR zephyrproject-rtos#55129 deleted the
"port-sel" property.  Delete this property from remaining Microchip SoC
variants and boards.

Test: west build -b mec172xevb_assy6906 samples/drivers/espi/

Signed-off-by: Keith Short <keithshort@google.com>
@scottwcpg scottwcpg deleted the mec172x_qmspi_ldma_fix_spi_nor2 branch June 12, 2024 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Devicetree Binding PR modifies or adds a Device Tree binding area: SPI SPI bus platform: Microchip MEC Microchip MEC Platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants