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

Feature/spi nor flash wp hold pins #58365

Conversation

JPHutchins
Copy link

@JPHutchins JPHutchins commented May 27, 2023

The jedec,spi-nor compatible defines the use of wp-gpios (Write Protect) and hold-gpios (Hold) pins. Only one of the flash drivers, spi_flash_at45.c, initializes and uses wp-gpios and none of them initialize or use hold-gpios.

This PR adds initialization and implementation of wp-gpios to the more general spi_nor.c driver and initializes but does not implement hold-gpios (set to inactive).

Two build tests were added and they can be collected with west twister -c -p nrf52840dk_nrf52840 -T tests/drivers/flash.

spi_nor.c has been formatted with clang-format, so it may be helpful to look at the functional changes only in d551e5b.

Discussions:

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Hello @JPHutchins, and thank you very much for your first pull request to the Zephyr project!

A project maintainer just triggered our CI pipeline to run it against your PR and ensure it's compliant and doesn't cause any issues. You might want to take this opportunity to review the project's Contributor Expectations and make any updates to your pull request if necessary. 😊

@JPHutchins JPHutchins force-pushed the feature/spi_nor_flash_wp_hold_pins branch 2 times, most recently from b6bf6bc to c8e5380 Compare June 2, 2023 00:58
@JPHutchins
Copy link
Author

Hi @de-nordic , can you retrigger the "Run tests with twister / twister-build (8) (pull_request_target)" pipeline when you have chance, none of these changes should impact the failing test case. Thanks!

drivers/flash/spi_nor.c Outdated Show resolved Hide resolved
drivers/flash/spi_nor.c Outdated Show resolved Hide resolved
drivers/flash/spi_nor.c Outdated Show resolved Hide resolved
drivers/flash/spi_nor.c Outdated Show resolved Hide resolved
@de-nordic de-nordic requested a review from anangl June 20, 2023 11:07
@de-nordic
Copy link
Collaborator

Please rebase the PR, there seems to be some problems, with CI, unrelated to the changes.

@JPHutchins JPHutchins force-pushed the feature/spi_nor_flash_wp_hold_pins branch from c8e5380 to ddce183 Compare June 22, 2023 01:51
@JPHutchins
Copy link
Author

@de-nordic @nashif LMK if you have any questions!

drivers/flash/spi_nor.c Outdated Show resolved Hide resolved
@JPHutchins JPHutchins force-pushed the feature/spi_nor_flash_wp_hold_pins branch from a0a8f56 to 5e42235 Compare August 7, 2023 18:43
@JPHutchins JPHutchins force-pushed the feature/spi_nor_flash_wp_hold_pins branch from 5e42235 to dc002fd Compare August 8, 2023 17:43
@JPHutchins
Copy link
Author

I am not certain how to address the pipeline failure. I am going to rebase again and see if it was already fixed.

-- Found BOARD.dts: /__w/zephyr/zephyr/boards/arm/mimxrt1160_evk/mimxrt1160_evk_cm7.dts
devicetree error: 'bus-speed-data' is marked as required in 'properties:' in /__w/zephyr/zephyr/dts/bindings/can/nxp,flexcan-fd.yaml, but does not appear in <Node /soc/can@40c3c000 in '/__w/zephyr/zephyr/misc/empty_file.c'>
-- In: /__w/zephyr/zephyr/twister-out/mimxrt1160_evk_cm7/tests/drivers/flash/common/drivers.flash.common.default/zephyr, command: /usr/bin/python3.10;/__w/zephyr/zephyr/scripts/dts/gen_defines.py;--dts;/__w/zephyr/zephyr/twister-out/mimxrt1160_evk_cm7/tests/drivers/flash/common/drivers.flash.common.default/zephyr/zephyr.dts.pre;--dtc-flags;'';--bindings-dirs;/__w/zephyr/zephyr/dts/bindings;--header-out;/__w/zephyr/zephyr/twister-out/mimxrt1160_evk_cm7/tests/drivers/flash/common/drivers.flash.common.default/zephyr/include/generated/devicetree_generated.h.new;--dts-out;/__w/zephyr/zephyr/twister-out/mimxrt1160_evk_cm7/tests/drivers/flash/common/drivers.flash.common.default/zephyr/zephyr.dts.new;--edt-pickle-out;/__w/zephyr/zephyr/twister-out/mimxrt1160_evk_cm7/tests/drivers/flash/common/drivers.flash.common.default/zephyr/edt.pickle;--edtlib-Werror;--vendor-prefixes;/__w/zephyr/zephyr/dts/bindings/vendor-prefixes.txt
CMake Error at cmake/modules/dts.cmake:276 (message):
  gen_defines.py failed with return code: 1
Call Stack (most recent call first):
  cmake/modules/zephyr_default.cmake:115 (include)
  share/zephyr-package/cmake/ZephyrConfig.cmake:75 (include)
  share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
  cmake/package_helper.cmake:115 (find_package)

Adds the wp-gpios & hold-gpios from jedec,spi-nor compatible to spi_nor.c.

Signed-off-by: J.P. Hutchins <jp@intercreate.io>
Test spi_nor.c driver builds with or without wp-gpios and hold-gpios.

Signed-off-by: J.P. Hutchins <jp@intercreate.io>
-ENODEV returned in 4 cases, logs can distinguish

Signed-off-by: J.P. Hutchins <jp@intercreate.io>
Fixes made running tests/drivers/flash

Signed-off-by: J.P. Hutchins <jp@intercreate.io>
This change sets write-protect pin disabled BEFORE SW write-protect disable
and  write-protect pin enabled AFTER SW write-protect enable.

Signed-off-by: J.P. Hutchins <jp@intercreate.io>
@JPHutchins JPHutchins force-pushed the feature/spi_nor_flash_wp_hold_pins branch from dc002fd to f910020 Compare August 9, 2023 21:11
@carlescufi carlescufi merged commit d731338 into zephyrproject-rtos:main Sep 13, 2023
18 checks passed
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Hi @JPHutchins!
Congratulations on getting your very first Zephyr pull request merged 🎉🥳. This is a fantastic achievement, and we're thrilled to have you as part of our community!

To celebrate this milestone and showcase your contribution, we'd love to award you the Zephyr Technical Contributor badge. If you're interested, please claim your badge by filling out this form: Claim Your Zephyr Badge.

Thank you for your valuable input, and we look forward to seeing more of your contributions in the future! 🪁

@JPHutchins JPHutchins deleted the feature/spi_nor_flash_wp_hold_pins branch January 6, 2024 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants