Commit Graph

79 Commits

Author SHA1 Message Date
Francois Ramu 3402dfb3da samples: drivers: stm32h7 octospi enables DMA
Adds the dma transfer for the octoSPI on NOR octo Flash
of the stm32h7b3i and stm32h735g disco kits.
The channel for the MDMA is 0-15.
The MDMA request is 0x16 for the OCTOSPI1 fifo threshold

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-09-08 10:07:21 +00:00
Francois Ramu 446b09361a samples: drivers: stm32l562 octospi enables DMA
Adds the dma transfer for the octoSPI on NOR octo Flash
of the stm32l562e_dk disco kit.
The channel for the DMAMUX is 0-15 (0-7 for DMA1, 8-15 for DMA2)
The DMAMUX request is 41 for the OCTOSPI.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-09-08 10:07:21 +00:00
Gerard Marull-Paretas 79e6b0e0f6 includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h>
As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>.
This patch proposes to then include <zephyr/kernel.h> instead of
<zephyr/zephyr.h> since it is more clear that you are including the
Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a
catch-all header that may be confusing. Most applications need to
include a bunch of other things to compile, e.g. driver headers or
subsystem headers like BT, logging, etc.

The idea of a catch-all header in Zephyr is probably not feasible
anyway. Reason is that Zephyr is not a library, like it could be for
example `libpython`. Zephyr provides many utilities nowadays: a kernel,
drivers, subsystems, etc and things will likely grow. A catch-all header
would be massive, difficult to keep up-to-date. It is also likely that
an application will only build a small subset. Note that subsystem-level
headers may use a catch-all approach to make things easier, though.

NOTE: This patch is **NOT** removing the header, just removing its usage
in-tree. I'd advocate for its deprecation (add a #warning on it), but I
understand many people will have concerns.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-05 16:31:47 +02:00
Francois Ramu 8aa3960874 samples: drivers flash add a test case for stm32h7 octospi
This add a removes the SPI config
for the stm32H735 and stm32H7b3 disco boards
when testing the octoSPI.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-07-27 18:46:25 +02:00
Benjamin Björnsson 84649d2d83 samples: drivers: spi_flash: Update sample to use alias
Simplify driver by using DT_ALIAS instead of DT_LABEL.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-22 19:15:13 +00:00
Kumar Gala 4415a3bd3c samples: drivers: spi_flash: Exclude hifive_unmatched
hifive_unmatched has a jedec,spi-nor flash node, however we have no
SPI driver for the controller so exclude the platform from this sample.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-08 09:36:43 +02:00
Kumar Gala 3cfc8d5875 samples: spi_flash: Convert to use DEVICE_DT_GET
Move to use DEVICE_DT_GET instead of device_get_binding as
we work on phasing out use of DTS 'label' property.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-08 09:36:43 +02:00
Francois Ramu 9a29f182c3 samples: drivers: spi_flash rename definitions
This commits prefixes all the definitions
with 'SPI_' to be used by the sample application.
This will avoid compilation conflict especially
on FLASH_SECTOR_SIZE.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-06-29 10:25:16 +02:00
Francois Ramu ffa1532be2 samples: drivers flash add a test case for stm32 octospi
This add a new sample application to test and validate
the stm32 octospi driver on the NOR octo-flash present on
stm32 disco kits
There should be a special case to erase the complete flash.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-05-12 14:56:25 -05:00
Gerard Marull-Paretas c7b5b3c419 samples: migrate includes to contain <zephyr/...> prefix
In order to bring consistency in-tree, migrate all samples to the use
the new prefix <zephyr/...>. Note that the conversion has been scripted:

```python
from pathlib import Path
import re

EXTENSIONS = ("c", "h", "cpp", "rst")

for p in Path(".").glob("samples/**/*"):
    if not p.is_file() or p.suffix and p.suffix[1:] not in EXTENSIONS:
        continue

    content = ""
    with open(p) as f:
        for line in f:
            m = re.match(r"^(.*)#include <(.*)>(.*)$", line)
            if (m and
                not m.group(2).startswith("zephyr/") and
                (Path(".") / "include" / "zephyr" / m.group(2)).exists()):
                content += (
                    m.group(1) +
                    "#include <zephyr/" + m.group(2) +">" +
                    m.group(3) + "\n"
                )
            else:
                content += line

    with open(p, "w") as f:
        f.write(content)
```

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 11:29:59 +02:00
HaiLong Yang 823b468890 samples: spi_flash: add gd32f450i_eval and gd32vf103v_eval boards
This add gd32f450i_eval and gd32vf103v_eval boards to spi_flash sample.

Signed-off-by: HaiLong Yang <cameledyang@pm.me>
2022-03-29 10:21:15 -05:00
Benjamin Björnsson ab6f5cf077 boards: arm: Add support for Arduino Nicla Sense ME
This commit adds support for the Arduino Nicla Sense ME board.
The board functionality has been tested using the samples:
- hello_world
- philosophers
- peripheral_dis
- spi_flash

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-03-21 18:37:05 +01:00
Jun Lin ef995dfbdc samples: drivers: spi_flash: add support for the NPCX EVB
This commit adds the support to run the SPI NOR sample code on the
npcx7m6fb_evb and npcx9m6f_evb boards.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
Change-Id: I780c5dfcf53f3ac537da946673fc03f5ee24e90c
2021-11-01 21:48:20 -04:00
Katsuhiro Suzuki 4f0c7141b3 samples: drivers: spi_flash: fix printf warning on 64bit environment
This patch fixes printf format specifier "%u" -> "%zu" for printing
an argument of size_t on 64bit environment.

Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net>
2021-09-03 09:52:26 -04:00
Torsten Rasmussen 1cccc8a8fe cmake: increase minimal required version to 3.20.0
Move to CMake 3.20.0.

At the Toolchain WG it was decided to move to CMake 3.20.0.

The main reason for increasing CMake version is better toolchain
support.

Better toolchain support is added in the following CMake versions:
- armclang, CMake 3.15
- Intel oneAPI, CMake 3.20
- IAR, CMake 3.15 and 3.20

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-08-20 09:47:34 +02:00
Alex Tsamakos 0b7e661a92 samples: add actinius_icarus_bee config in spi_flash and fs
Add configuration for the Actinius Icarus Bee in the spi_flash
and fs samples.

Signed-off-by: Alex Tsamakos <alex@actinius.com>
2021-05-06 15:03:32 +02:00
Andrzej Puzdrowski c5cc990cb3 samples/tree-wide: remove flash_write_protection_set() usage
This patch removes scenario which was testing deprecated
API behaviors. Needed as As flash_write_protection_set() was
deprecated and became no-operation.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Erwan Gouriou e2ff107cf2 samples: spi_flash: Add compatibility with st,stm32-qspi-nor
Enable using st,stm32-qspi-nor compatible driver for this
sample.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-01-15 10:29:30 -05:00
Andrzej Głąbek be02edb050 drivers/flash/nrf_qspi_nor: Add support for nRF53 Series SoCs
Improve the way the nrf_qspi_nor driver configures the SCK frequency,
to properly support QSPI also on nRF53 Series SoCs that use a different
base clock frequency (96 MHz).
Add also a relevant configuration in the spi_flash sample so that it
can run on the nRF5340 DK.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-11-10 21:01:37 +02:00
Stephane D'Alu 9ee2aff917 nrf52840_mdk: support qspi flash
Added support for installed MX25R64 QSPI NOR flash.

Signed-off-by: Stephane D'Alu <sdalu@sdalu.com>
2020-10-21 17:34:26 +02:00
Henrik Brix Andersen aab95f09f2 samples: drivers: spi_flash: add support for arty_a7_arm_designstart_m3
Add support for running the JEDEC SPI NOR flash sample on the ARM
Cortex-M3 DesignStart FPGA reference implementation.

Special care is needed to avoid overwriting part of the FPGA
configuration bitstream, which is stored in the onboard QSPI flash.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2020-09-02 15:02:03 +02:00
Tomasz Bursztyka e18fcbba5a device: Const-ify all device driver instance pointers
Now that device_api attribute is unmodified at runtime, as well as all
the other attributes, it is possible to switch all device driver
instance to be constant.

A coccinelle rule is used for this:

@r_const_dev_1
  disable optional_qualifier
@
@@
-struct device *
+const struct device *

@r_const_dev_2
 disable optional_qualifier
@
@@
-struct device * const
+const struct device *

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Peter Bigot e81e88e52e samples: spi_flash: add README
Basic example of basic flash API use when selecting a serial flash
memory.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-27 12:39:43 -04:00
Peter Bigot 77aa89bcb5 drivers: flash: remove W25QXXDV driver
The spi_flash_w25qxxdv driver has been superseded by the generic
spi_nor driver for over a year.  The only non-refactoring change to
the W25Q driver in the last 18 months was done to support a backport
to 1.14.

All devices supported by spi_flash_w25qxxdv driver are expected to be
supported by the spi_nor driver, using the standard `jedec,spi-nor`
devicetree compatible.  No in-tree devicetree files make use of this
driver.

Remove the confusion about which driver to select by removing the
unmaintained redundant driver.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-27 17:39:21 +02:00
Henrik Brix Andersen 5210b82bd6 samples: drivers: spi_flash: add support for arty_a7_arm_designstart_m1
Add support for running the JEDEC SPI NOR flash sample on the ARM
Cortex-M1 DesignStart FPGA reference implementation.

Special care is needed to avoid overwriting part of the FPGA
configuration bitstream, which is stored in the onboard QSPI flash.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2020-08-26 12:32:27 +02:00
Gerard Marull-Paretas 82e58a0707 boards: arm: adafruit_feather_nrf52840: add support for QSPI flash
Add DT entry for the embedded QSPI NOR flash (GD25Q16) in the Adafruit
nRF52840 feather. Also added support for the spi_flash sample, which has
been used to verify the device.

NOTE: Device seems to fail when using high clock frequencies (e.g.
maximum QSPI frequency). It may be due to PCB layout issues.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-08-19 15:43:57 -05:00
Christian Taedcke 29caf10800 samples/drivers/spi_flash: add some efr32 boards
The boards efr32_radio_brd4104a, efr32_radio_brd4250b and
efr32mg_sltb004a have an on-board nor flash. It is already present in
the device tree, only the driver needs to be enabled.

Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
2020-08-14 10:23:56 -05:00
Jared Wolff 11966acdd3 boards: arm: nrf: Adding Circuit Dojo nRF9160 Feather definitions.
Adding the Circuit Dojo nRF9160 Feather device tree definitions.
Both secure and non secure targets.

Signed-off-by: Jared Wolff <hello@jaredwolff.com>
2020-07-10 17:56:00 +02:00
Christian Taedcke b5fb9497b6 samples/drivers/spi_flash: fix sample regex
The sample.yml regex did not match the implementation anymore.

Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
2020-06-28 23:51:23 -04:00
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Marc Herbert 2cd51a33ce samples: make find_package(Zephyr...) REQUIRED
This provides a better error message when building with CMake and
forgetting ZEPHYR_BASE or not registering Zephyr in the CMake package
registry. See parent commit for more details (split from parent for
better readability).

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-05-29 10:47:25 +02:00
Martí Bolívar 6e8775ff84 devicetree: remove DT_HAS_NODE_STATUS_OKAY
Several reviewers agreed that DT_HAS_NODE_STATUS_OKAY(...) was an
undesirable API for the following reasons:

- it's inconsistent with the rest of the DT_NODE_HAS_FOO names
- DT_NODE_HAS_FOO_BAR_BAZ(node) was agreed upon as a shorthand
  for macros which are equivalent to
  DT_NODE_HAS_FOO(node) && DT_NODE_HAS_BAR(node) &&
- DT_NODE_HAS_BAZ(node), and DT_HAS_NODE_STATUS_OKAY is an odd duck
- DT_NODE_HAS_STATUS(..., okay) was viewed as more readable anyway
- it is seen as a somewhat aesthetically challenged name

Replace all users with DT_NODE_HAS_STATUS(..., okay), which is
semantically equivalent.

This is mostly done with sed, but a few remaining cases were done by
hand, along with whitespace, docs, and comment changes. These special
cases include the Nordic SOC static assert files.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-13 18:24:42 +02:00
Kumar Gala fdd85d5ad7 dts: Rename DT_HAS_NODE macro to DT_HAS_NODE_STATUS_OKAY
Rename DT_HAS_NODE to DT_HAS_NODE_STATUS_OKAY so the semantics are
clear.  As going forward DT_HAS_NODE will report if a NODE exists
regardless of its status.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-06 05:25:41 -05:00
Bjarne Steinsbo 4034ef0633 boards: arm: black_f407ve: Add support for on-board SPI flash
This board contains an on-board Winbond W25Q16.
The chip is connected to spi1 using PB3-PB5 and PB0 as CS.

Signed-off-by: Bjarne Steinsbo <bjarne@gmail.com>
2020-04-15 13:15:29 -05:00
Richard Osterloh 3f8c83a591 boards: adafruit_feather_stm32f405: Add SPI flash
Added SPI flash definition on SPI1.

Signed-off-by: Richard Osterloh <richard.osterloh@gmail.com>
2020-04-13 11:53:59 -05:00
Kumar Gala d8432ce8da samples: drivers: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-31 07:12:30 -05:00
Torsten Rasmussen 407b49b35c cmake: use find_package to locate Zephyr
Using find_package to locate Zephyr.

Old behavior was to use $ENV{ZEPHYR_BASE} for inclusion of boiler plate
code.

Whenever an automatic run of CMake happend by the build system / IDE
then it was required that ZEPHYR_BASE was defined.
Using ZEPHYR_BASE only to locate the Zephyr package allows CMake to
cache the base variable and thus allowing subsequent invocation even
if ZEPHYR_BASE is not set in the environment.

It also removes the risk of strange build results if a user switchs
between different Zephyr based project folders and forgetting to reset
ZEPHYR_BASE before running ninja / make.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-03-27 16:23:46 +01:00
Andrzej Głąbek 4253eae005 boards: nrf52840_pca10056: Rename board to nrf52840dk_nrf52840
The nRF52840 DK board target, so far known as nrf52840_pca10056,
is renamed to nrf52840dk_nrf52840.
Its documentation and all references to its name in the tree are
updated accordingly. Overlay and configuration files specific to
this board are also renamed, to match the new board name.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-03-27 09:14:08 +01:00
Peter Bigot bd56c2ecf2 samples: drivers: spi_flash: use printf argument consistent with format
Coverity thinks this is a long because FLASH_TEST_REGION_OFFSET is a
signed value.  Zephyr doesn't use standard types so make it a u32_t.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-03-10 19:06:38 -04:00
Peter A. Bigot 046bae60b6 samples: drivers: spi_flash: switch nrf52840_pca10056 to Nordic QSPI
Adjust the configuration file, disable the SPI
driver and enable the QSPI driver and flash node.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Signed-off-by: Kamil Lazowski <Kamil.Lazowski@nordicsemi.no>
2020-01-29 15:15:49 +01:00
Peter Bigot bc2ecad363 samples: drivers: spi_flash: increase test data length
Some drivers may be unable to write less than 4 bytes.  Increase the
test to use at least 4 bytes and refactor so the logic is no longer
explicitly size-dependent.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-12-19 12:37:31 +01:00
Anas Nashif 70758c4374 tests: fix test identifiers
The seasonal overhaul of test identifiers aligning the terms being used
and creating a structure. This is hopefully the last time we do this,
plan is to document the identifiers and enforce syntax.

The end-goal is to be able to generate a testsuite description from the
existing tests and sync it frequently with the testsuite in Testrail.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-12-09 15:53:44 -05:00
Peter A. Bigot 98a344fe21 drivers: spi_nor: support deep-power-down mode
Add internal API to enter and exit deep power-down mode.  Add Kconfig
option to return to DPD whenever device is not active.

When device power management becomes more mature it should be possible
to implement it, which would allow use of DPD without having to enter
and exit DPD between consecutive transactions.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-11-09 15:26:06 +01:00
Karsten Koenig 8a6fd43439 boards: riscv: rv32m1_vega: Add onboard SPI flash
Enable the MX25R32 SPI NOR Flash on the VEGAboard and provide board
config file for the spi_flash sample.

Signed-off-by: Karsten Koenig <karsten.koenig.030@gmail.com>
2019-11-04 14:11:18 -06:00
Kumar Gala 4cc91fdd00 sample/tests: replace DT_ define filters with dt_ functions
convert sample and test yaml filters that utilize a DT_ define to
instead use a dt_ function.  The intent is to remove the Kconfig
generated DT defines and just make directy queries into the device tree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-11-04 09:02:14 -05:00
Peter A. Bigot 7f2edeef6c samples/drivers/spi_flash: add board overrides
Particle mesh feather devices, and Nordic PCA10056, can both run
this example with the on-board JEDEC SPI NOR device if the driver
is enabled.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-07-24 09:20:56 -04:00
Peter A. Bigot 0e338efb3c samples/drivers/spi_flash: fix device naming
There are multiple flash implementations.  This sample was originally
written for the W25QXXDV driver, but has since been used for
jedec,spi-nor.  The sample should work with multiple drivers.

Add device name sources for several drivers, falling back to spi-nor
which was recently used as a test filter.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-07-24 09:20:56 -04:00
Anas Nashif db5aa49978 samples: spi_flash: remove whitelisting
Instead of whitelisting, use filtering on configured SPI Flash device.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-07-12 05:54:16 -07:00
Anas Nashif fe051a9055 cleanup: include/: move flash.h to drivers/flash.h
move flash.h to drivers/flash.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 3ae52624ff license: cleanup: add SPDX Apache-2.0 license identifier
Update the files which contain no license information with the
'Apache-2.0' SPDX license identifier.  Many source files in the tree are
missing licensing information, which makes it harder for compliance
tools to determine the correct license.

By default all files without license information are under the default
license of Zephyr, which is Apache version 2.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-04-07 08:45:22 -04:00