Commit graph

374 commits

Author SHA1 Message Date
Andrei Gansari b72db6b02e drivers: soc_flash_mcux enabled for LPC
soc_flash_mcux added support for IAP Flash device specific to LPC SoC
families.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2020-01-16 08:19:46 -06:00
Erwan Gouriou fc85361cfe drivers: flash: stm32: Update SR define
Following update of stm32wb package, FLASH_FLAG_SR_ERROR
has been renamed to FLASH_FLAG_SR_ERRORS.
Update driver to fix compilation issue.


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-01-15 08:39:05 -06:00
Benjamin Valentin fc7f458ab3 flash: sam0: Define LOCK_REGIONS in dts
The amount of lock regions differs between different sam0 MCUs.

	saml10:  2
	saml11:  4
	samd2x:	16
	saml2x: 16
	samd5x: 32

ASF does not provide a definition for this, so create a new one
in dts.

Signed-off-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2020-01-14 11:12:33 -05:00
Benjamin Valentin cafc074d06 flash: sam0: Add support for SAME54
This adds support for the flash peripheral found in the SAME5x/SAMD5x
line of MCUs.
The peripheral is very simmilar to the one found on SAMD2x with only
a few register names changed.

Signed-off-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2020-01-14 11:12:33 -05:00
Benoit Leforestier f256625ad4 Driver: Flash STM32: Don't use semaphore if multithreading isn't defined
In STM32 flash driver, don't use semaphore if multithreading
isn't defined.
If multithreading isn't defined, a call to sem_give function
generates a hardware fault exception.

Signed-off-by: Benoit Leforestier <benoit.leforestier@gmail.com>
2020-01-09 19:14:32 +01:00
Marco Peter 1ee99d2568 drivers: flash: Build STM32 flash support only when selected
The current configuration causes the STM32 flash support always to be
built, even if an unrelated flash driver, by example the SPI_NOR driver
is selected.
This behaviour gets especially problematic (build failure) if the flash
hardware of the given MCU is not supported (e.g. STM32F2).
The suggested change should ensure that STM32 flash support only is
built when it actually is selected.

Signed-off-by: Marco Peter <marco@peter-net.ch>
2020-01-06 08:51:18 -05:00
Laczen JMS a91df4a077 drivers/flash: nios2_qspi byte read access
Correct nios2_qspi to allow byte size read access

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2019-12-19 12:53:22 -05:00
Andrzej Puzdrowski 073e0b77d6 drivers/flash: remove NRF flash protection emulation
NRF devices hardware has flash protection which doesn't
reflect flash API definition well. So fare protection
mechanism was emulated by the software and the driver deals
with hardware flash protection on its own.
Recent change to protection behavior requirement allows
to remove flash API behavior emulation at all.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-12-15 10:35:09 -05:00
Feng Cheng ee57c8e749 drivers: flash: Add the flash driver of the stm32f1x family
Most of the code is copied from the stm32f0x family
Tested on stm32f103ze soc

Signed-off-by: Feng Cheng <i@fengch.me>
2019-12-11 12:40:33 -06:00
Ulf Magnusson 984bfae831 global: Remove leading/trailing blank lines in files
Remove leading/trailing blank lines in .c, .h, .py, .rst, .yml, and
.yaml files.

Will avoid failures with the new CI test in
https://github.com/zephyrproject-rtos/ci-tools/pull/112, though it only
checks changed files.

Move the 'target-notes' target in boards/xtensa/odroid_go/doc/index.rst
to get rid of the trailing blank line there. It was probably misplaced.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-12-11 19:17:27 +01:00
Jan Van Winkel cba129ae96 drivers/flash: Removed native posix flash driver
Removed native posix flash driver as functionality is merged with flash
simulator driver.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-12-09 11:56:21 -05:00
Jan Van Winkel 8cd4a817d9 drivers/flash/flash_simulator: Added file back end for posix arch
Extended flash simulator for posix architecture to read/write data
from a binary file on the host file system.

Further enable the flash simulator by default on native_posix(_64)
boards and updated the documentation accordingly.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-12-09 11:56:21 -05:00
Ulf Magnusson 87e917a925 kconfig: Remove redundant 'default n' and 'prompt' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though.

Also replace some

    config
    	prompt "foo"
    	bool/int

with the more common shorthand

    config
    	bool/int "foo"

See the 'Style recommendations and shorthands' section in
https://docs.zephyrproject.org/latest/guides/kconfig/index.html.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-12-09 16:14:50 +01:00
Andrei Gansari 6d1e10635d drivers: flash_handlers fixes stray semicolon
z_vrfy_flash_get_page_count defined as a function prototype in place of
a real function due to a stray semicolon.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2019-11-28 13:39:00 -05:00
Andrzej Puzdrowski dbe56337a0 drivers/flash: nRF driver uses relative addresses
So fare all nRF flash memories had flash base address at 0.
nRF flash driver was implemented in such way that it
really used absolute addresses, while convention are relative
addresses (for flash_map as well), which was not visible as start
address offset was 0.
It will become visible on nRF53 which has networking flash
with non-zero base address.

This patch switch nRF flash driver to use relative addresses for flash.
UICR absolute addressing is kept.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-11-21 13:35:28 +01:00
Peter A. Bigot 2d4d6f05e6 drivers: spi_nor: improve documentation and validation on flash layout size
The smallest region that can be erashed is one sector, so setting
SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=2048 will fail at runtime when the
flash page API is used to erase a single (or misaligned) page.  Add a
compile-time check that the requested layout page size is erasable.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-11-09 15:26:06 +01: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
Peter A. Bigot c2e9441ad5 drivers: spi_nor: refactor device mutex management
Convert the LOCK/UNLOCK macros to acquire/release functions in
preparation for extending those steps to include power management.

Also commit to always allocating a semophore, and use a more clean
way of conditionalizing the operations.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-11-09 15:26:06 +01:00
Peter A. Bigot e4c3729ba7 drivers: spi_nor: generalize support for ULBPR instruction
Replace the hard-coded check for JEDEC IDs with a property that must
be set in the devicetree entry.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-11-09 15:26:06 +01:00
Henrik Brix Andersen 30fc72a50e drivers: flash: native_posix: remove unused mutex
Remove unused mutex in the flash_native_posix driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2019-11-08 18:59:02 +01:00
Erwan Gouriou 0e4dc5f33a drivers/flash: stm32f4: Return error on Dual Bank configuration
Some stm32f4 1MB SoCs support optional Dual Bank configuration.
This is not yet supported by stm32f4 driver, so report an
error when configuration is detected

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-11-05 16:37:25 -06:00
Erwan Gouriou fb979e7ca7 drivers/flash: stm32f4: Offset SNB from sector 12 on 2MB parts
On 2MB parts, on sector 12 and above SNB is offset by 4.

Fixes #20016

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-11-05 16:37:25 -06:00
Ulf Magnusson bd6e04411e kconfig: Clean up header comments and make them consistent
Use this short header style in all Kconfig files:

    # <description>

    # <copyright>
    # <license>

    ...

Also change all <description>s from

    # Kconfig[.extension] - Foo-related options

to just

    # Foo-related options

It's clear enough that it's about Kconfig.

The <description> cleanup was done with this command, along with some
manual cleanup (big letter at the start, etc.)

    git ls-files '*Kconfig*' | \
        xargs sed -i -E '1 s/#\s*Kconfig[\w.-]*\s*-\s*/# /'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-11-04 17:31:27 -05:00
Ulf Magnusson 975de21858 kconfig: Global whitespace/consistency cleanup
Clean up space errors and use a consistent style throughout the Kconfig
files. This makes reading the Kconfig files more distraction-free, helps
with grepping, and encourages the same style getting copied around
everywhere (meaning another pass hopefully won't be needed).

Go for the most common style:

 - Indent properties with a single tab, including for choices.

   Properties on choices work exactly the same syntactically as
   properties on symbols, so not sure how the no-indentation thing
   happened.

 - Indent help texts with a tab followed by two spaces

 - Put a space between 'config' and the symbol name, not a tab. This
   also helps when grepping for definitions.

 - Do '# A comment' instead of '#A comment'

I tweaked Kconfiglib a bit to find most of the stuff.

Some help texts were reflowed to 79 columns with 'gq' in Vim as well,
though not all, because I was afraid I'd accidentally mess up
formatting.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-11-01 15:53:23 +01:00
Ulf Magnusson 677f1e6db9 kconfig: Turn pointless/confusing 'menuconfig's into 'config's
Defining a symbol with 'menuconfig' just tells the menuconfig to display
any dependent symbols that immediately follow it in a separate menu.
'menuconfig' has no effect on symbol values.

Making a symbol that doesn't have any dependent symbols after it a
'menuconfig' should be avoided, because then you end up with an empty
menu, which is shown as e.g.

    [*] Enable foo ---

This is how it would be shown if there were children but they all
happened to be invisible as well.

With a regular 'config', it turns into

    [*] Enable foo

Change all pointless 'menuconfig's to 'config's.

See the section on 'menuconfig' on the Kconfig - Tips and Best Practices
page as well.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-10-22 13:53:06 -05:00
Ulf Magnusson 38866eb3f1 drivers: spi_nor: Remove unused SPI_NOR_{PAGE,SECTOR}_SIZE symbols
Unused since commit 2a590d3fa5 ("drivers/spi_nor: remove configurability
of page/sector/block sizes"). The help texts already say they're unused,
but it probably doesn't hurt to remove them as well.

Found with a script.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-10-21 08:17:50 -05:00
Adam Kondraciuk d7dbb572e3 drivers: flash: nrfx: Modify flash address validation
Modifications in 'is_regular_addr_valid()' function which didn't work
properly when flash base address was different than 0x00000000.
Added calculating address bounds with respect to flash base address.

Signed-off-by: Adam Kondraciuk <adam.kondraciuk@nordicsemi.no>
2019-10-14 21:05:23 +02:00
Richard Osterloh c68e027c28 drivers: flash: Add STM32G4X flash support
Add flash driver support for STM32G4X SoC series.

Signed-off-by: Richard Osterloh <richard.osterloh@gmail.com>
2019-10-04 18:44:24 -07:00
Pavlo Hamov 9bb7da060b drivers: flash: add omitted dependency
FLASH_SHELL must depend on the base SHELL

Signed-off-by: Pavlo Hamov <pavlo_hamov@jabil.com>
2019-10-04 09:19:44 -05:00
Timo Teräs 52453082f8 drivers: spi_nor: support Microchip SPI flash global unblock
Microchip SPI flash require Global unblock command before writing
is allowed.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
2019-09-25 17:41:31 +02:00
Anas Nashif 5a058dc29e drivers: flash: remove qmsi flash driver
No users of this driver after dropping quark platforms.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-18 11:06:18 -05:00
Andy Ross 075c94f6e2 kernel: Port remaining syscalls to new API
These calls are not accessible in CI test, nor do they get built on
common platforms (in at least one case I found a typo which proved the
code was truly unused).  These changes are blind, so live in a
separate commit.  But the nature of the port is mechanical, all other
syscalls in the system work fine, and any errors should be easily
corrected.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-09-12 11:31:50 +08:00
Erwan Gouriou 0381e8cbe9 drivers/flash: stm32l4: Handle pages_per_bank for all variants
Variable pages_per_bank has been introduced to ease page erase
in dual bank configurations. This has been implemented using
FLASH_OPTR_DUALBANK definition.
It happen that this was not taking into account L4+ series that
use FLASH_OPTR_DBANK instead of FLASH_OPTR_DUALBANK. This lead
to compilation issue for this driver in case of L4+ series.
So, this patch is adding the support of FLASH_OPTR_DBANK definition.

Besides, FLASH_OPTR_DUALBANK (as FLASH_OPTR_DBANK) are actually
defining availability of an option byte to configure use of Dual
Bank. So besides of its definition, its value in flash OPTR register
should be checked to ensure Dual Bank configuration is used.
This patch is taking this into account by adding the check of this
byte. Error -ENOTSUP is returned in case Single Bank is configured
since it has not be validated yet (in case Dual Bank is possible but
not configured).

Fixes #18246 for nucleo_l4r5zi

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-08-17 20:05:21 +02:00
Ulf Magnusson cc8cf88e2c drivers: flash: Remove redundant FLASH dep. from FLASH_NATIVE_POSIX
FLASH_NATIVE_POSIX is defined in drivers/flash/Kconfig.native_posix,
which is source'd within an 'if FLASH' in drivers/flash/Kconfig.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-08-07 04:26:48 -04:00
Ulf Magnusson 2d8982d21b drivers: flash: Remove redundant FLASH dep. from FLASH_SIMULATOR
FLASH_SIMULATOR is defined in drivers/flash/Kconfig.simulator, which is
source'd within an 'if FLASH' in drivers/flash/Kconfig.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-08-07 04:26:27 -04:00
Peter A. Bigot d60d16d4cd drivers/spi_nor: de-pessimize reads
SPI NOR devices require that writes be performed within only one page at
a time.  There is no such limitation on reads.  Remove the code that
forced reads to be performed in 256-byte chunks.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-08-05 13:27:49 +02:00
Peter A. Bigot 86dcf3c173 drivers/spi_nor: fix writes across page boundaries
The code failed to increment the address after completing a partial
write, causing writes that cross a page boundary overwrite at a page
level.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-08-05 13:27:49 +02:00
Piotr Mienkowski 707a111ca8 drivers: fix printf formatting in flash drivers
This commit fixes following issues in printf formatting used by flash
drivers:
- cast values of type off_t to long to remove warnings generated when
  compiling with Newlib.
- use 'z' modifier (as in "%zu") to print values of type size_t
- prefix all hex numbers with '0x'

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-08-01 11:33:17 -07:00
Anas Nashif 578ae40761 boards: remove quarl_se_c1000
This board and SoC was discontinued some time ago and is currently not
maintained in the zephyr tree.
Remove all associated configurations and variants from the tree.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-07-29 21:30:25 -07:00
Ioannis Konstantelias 4fffe790be drivers: flash: stm32l4x: Support SOCs with < 1MB
Up to now, the only SOC that was supported in the STM32L496 series was
STM32L496XG with flash of 1MB. With the recent support of STM32L496XE,
this implementation is not correct. This patch adds support for the
other SOCs that come with flashes of 512KB and 256KB.

Signed-off-by: Ioannis Konstantelias <ikonstadel@gmail.com>
2019-07-29 09:53:58 -04:00
Peter A. Bigot 794e0109d6 drivers/spi_nor: enable logging API
Just register it.  For now it's only used in one place where it was
needed to identify a problem.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-07-24 09:20:56 -04:00
Peter A. Bigot 660149b500 drivers/spi_nor: fix writes across page boundaries
The previous code limited the length of a write to the size of a page,
but did not check whether the starting position was far enough into the
page that the write would still cross a page boundary.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-07-24 09:20:56 -04:00
Peter A. Bigot fa10a9640b dts/spi-nor: use bytestring for JEDEC ID
This was always intended to be a bytestring rather than an array, but
full support was missing.  Since that has been addressed switch it to
the preferred format.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-07-24 09:20:56 -04:00
Peter A. Bigot eb3858cbbd drivers/spi_nor: allow application control of flash layout page size
The driver historically used the erase block size (64 KiBy) as the page
size.  There are other viable "sector" sizes, and for some applications
this one may be too large.  Allow the application to specify the desired
flash page size.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-07-24 09:20:56 -04:00
Peter A. Bigot 50550e02c0 drivers/spi_nor: remove write-block-size devicetree property
Devices using this driver do not require any special alignment for
writes.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-07-24 09:20:56 -04:00
Peter A. Bigot 2a590d3fa5 drivers/spi_nor: remove configurability of page/sector/block sizes
The JEDEC API defines the hardware page, sector, and block sizes.
Deprecate the Kconfig settings, remove the `erase-size-block` property,
and add `has-be32k` to indicate that 32K-byte erase is supported.
Rework the driver to use the constants instead of configured values.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-07-24 09:20:56 -04:00
Andrzej Puzdrowski 428c281bc6 drivers/flash/flash_simulator: fix flash size calculation
Flash size calculation was don with assumption that flash page size
is always 1 KB and flash size was parameterized with such granularity.

This patch correct this bug.

Flash pages number under statistic can't be calculated via preprocessor
anymore - thus are parameterized via Kconfig.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-07-17 13:49:26 -07:00
Andrzej Puzdrowski 891ccdc182 drivers/flash/flash_simulator: switch to use DT_FLASH_SIM labels
It Need to start using DT_FLASH_SIM_xxx labels after sim_flash was
un-chosen as zephyr,flash.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-07-17 13:49:26 -07:00
Francois Ramu bfc2ea6dd5 drivers: flash: Add STM32G0XX flash support
Add flash support for STM32G0X SoC series.

Signed-off-by: Philippe Retornaz <philippe@shapescale.com
Signed-off-by: Francois Ramu <francois.ramu@st.com>
2019-07-05 10:35:55 -05:00
Ioannis Konstantelias a1d815ea9b drivers: flash: stm32: Fix insufficient wait time
flash_erase cannot erase a page from the STM32xx SOC flash. It seems
that the erase wait time is not enough and against to what the SOC's
datasheet states. As a result this patch doubles the wait time.

Signed-off-by: Ioannis Konstantelias <ikonstadel@gmail.com>
2019-07-05 10:29:10 +02:00
Anas Nashif a2fd7d70ec cleanup: include/: move misc/util.h to sys/util.h
move misc/util.h to sys/util.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 5eb90ec169 cleanup: include/: move misc/__assert.h to sys/__assert.h
move misc/__assert.h to sys/__assert.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 bd70f6f1ed cleanup: include/: move spi.h to drivers/spi.h
move spi.h to drivers/spi.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 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 17ddd1714c cleanup: include/: move clock_control.h to drivers/clock_control.h
move clock_control.h to drivers/clock_control.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 52e0efac97 cleanup: include/: move stats.h to stats/stats.h
move stats.h to stats/stats.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
Kumar Gala a614a026b7 dts: Rename DT_.*_GPIO_* to DT_.*_GPIOS_*
Convert DT_.*_GPIO_{CONTROLLER,PIN,FLAGS} ->
	DT_.*_GPIOS_{CONTROLLER,PIN,FLAGS)

Used the following commands to make these conversions:

git grep -l DT_.*_GPIO_CONTROLLER | xargs sed -i 's/DT_\(.*\)_GPIO_CONTROLLER/DT_\1_GPIOS_CONTROLLER/g'
git grep -l DT_.*_GPIO_PIN | xargs sed -i 's/DT_\(.*\)_GPIO_PIN/DT_\1_GPIOS_PIN/g'
git grep -l DT_.*_GPIO_FLAGS | xargs sed -i 's/DT_\(.*\)_GPIO_FLAGS/DT_\1_GPIOS_FLAGS/g'

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-27 13:02:34 -05:00
Charles E. Youse 57b46bbc85 soc/x86/intel_quark: remove support for Quark D2000 SoC
Removed Quark D2000 SoC files and first-order related DT bindings.

A few config options have been moved from the CONFIG_* space to
the DT_* space, as they were defined in the D2000 Kconfig files
and "leaked" into the other Quark trees.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-06-25 08:06:43 -04:00
Anas Nashif f2cb20c772 docs: fix misspelling across the tree
Found a few annoying typos and figured I better run script and
fix anything it can find, here are the results...

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-19 15:34:13 -05:00
Kumar Gala a2693975d7 dts: Convert from DT_<COMPAT>_<INSTANCE>_<PROP> to DT_INST...
Change code from using now deprecated DT_<COMPAT>_<INSTANCE>_<PROP>
defines to using DT_INST_<INSTANCE>_<COMPAT>_<PROP>.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-14 08:02:15 -05:00
Anas Nashif 4c32258606 style: add braces around if/while statements
Per guidelines, all statements should have braces around them. We do not
have a CI check for this, so a few went in unnoticed.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-06 15:20:21 +02:00
Lyle Zhu cc2e176bb6 driver: flash: add flash driver for the RV32M1 SOC
Add driver and device tree for the flash controller for the RV32M1 SOC

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2019-06-03 10:43:47 -05:00
Erwan Gouriou 51033a5814 drivers/flash: stm32wb: Add HSEM
Add HSEM for Flash access since shared between 2 cores.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-06-03 09:38:19 -04:00
Erwan Gouriou d777413b19 drivers/flash: stm32wb: Add driver for stm32wb
Add flash driver for stm32wb

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-06-03 09:38:19 -04:00
Ryan C Johnson d9e4512d86 drivers: flash: w25q: erase operations must be erase-size aligned
- Erase operations must be aligned to the erase-size.
 - Don't need to perform an alignment check on a full erase. The offset
   is not used in this case.
 - Don't need to perform alignment check on a sector sized erase, as
   this alignment is checked on entrance to the function.
 - Removed some whitespace.

Signed-off-by: Ryan C Johnson <ryan.johnson@flex.com>
2019-05-30 08:36:14 -04:00
Jan Van Winkel 88964b99ec drivers: flash: Added native POSIX flash driver
Added native POSIX flash driver that writes flash content to a binary
file.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-05-28 21:14:19 -04:00
Radoslaw Koppel 617c6fdb24 drivers/flash/flash_simulator: Allow unaligned read
This commit adds the default configuration to the flash_simualtor
to allow unaligned reads.
Disable this option when testing to increase test coverage.

Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
2019-05-28 11:24:48 +02:00
Kamil Piszczek 42b3bd91e7 drivers: flash: flash_simulator: added max len param
Added a new runtime parameter to the Flash Simulator. It can be used to
ignore part of the data that is written to the simulated flash memory.
This parameter works together with max write calls parameter.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-05-27 12:26:20 +02:00
Kamil Piszczek fefc62887c drivers: flash: flash_simulator: added max erase calls param
Added a new runtime parameter to the Flash Simulator. It can be used to
ignore erases to the simulated flash memory after a certain number
of flash erase calls has been executed.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-05-27 12:26:20 +02:00
Kamil Piszczek 4054d2bacf drivers: flash: flash_simulator: added max write calls param
Added a new runtime parameter to the Flash Simulator. It can be used to
ignore any writes to the simulated flash memory after a certain number
of flash write calls has been executed. This behaviour is useful for
simulating power down during the flash write operation.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-05-13 17:07:28 +02:00
Derek Hageman 4204700ae4 drivers: flash: sam0: Remove defines from dts_fixup.h
Move SAM0 flash to use the raw defines generated from the DTS
parsing.

Signed-off-by: Derek Hageman <hageman@inthat.cloud>
2019-05-03 08:46:57 -05:00
Kamil Piszczek 78a39b80aa drivers: flash: covering more flash page with stats sections
Extended the maximum possible number of sections that track statistics
for each flash page.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-05-01 10:33:17 -04:00
Kamil Piszczek 5fd99f5e6a drivers: flash: simulator Kconfig cleanup
Moved the default selection of Flash simulator for qemu_x86 to the board
Kconfig.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-04-26 04:04:19 -07:00
Piotr Mienkowski df33e5e861 flash_gecko: add support for page layout
This commit adds support for FLASH_PAGE_LAYOUT Kconfig option in the
flash_gecko driver.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-04-26 03:25:08 -07:00
Kamil Piszczek 5895f8d8f1 driver: flash: flash_simulator: moved part of Kconfig to DT
Moved part of the KConfig configuration to the Device Tree.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-04-24 13:05:11 -07:00
Kamil Piszczek 6ae532a328 drivers: flash: flash_simulator enabled by default on qemu
Enabled Flash Simulator on the QEMU x86 platform by default.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-04-24 13:05:11 -07:00
Kamil Piszczek 1c60416135 drivers: flash: fix flash-simulator build crash
Statistic for flash has limitation regards number of pages possible to
be counted. This path introduces check for that in source file as it is
not possible to preserve the limit in Kconfig.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-04-24 13:05:11 -07:00
Kamil Piszczek c837d85c2b drivers: flash: add flash_simulator driver
This commit adds a flash driver implementation that writes to RAM and
exports statistics through stats.h. It can be used to simulate flash
memory for testing purposes.

Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-04-24 13:05:11 -07:00
Benjamin Valentin 4d9486fc22 soc: sam0: Enable generic peripheral selection
Make sure that when e.g. CONFIG_SERIAL is set, CONFIG_UART_SAM0 is
selected automatically when the sam0 SoC family is used.

Signed-off-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2019-04-19 14:37:17 -05:00
Andrzej Puzdrowski 279115e35e drives/flash: provide boundaries info for nRF9160
nRF9160 can't provide FICR data while operation in non-secure
domain.

This patch start using flash layout properties provides by
nrfx API for get flash properties, which resolves problem
described above.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-04-19 11:50:46 +02:00
Andrzej Puzdrowski 560b458a21 drives/flash: use nrfx for nrf
Introduce nrfx_nvmc driver into nordic flash driver implementation.
Thanks to that nrf9160 SoC becomes supported by the driver.

nrfx helps dealing with differences with interface to the NVMC
in secure and non-secure execution modes.

This patch adds NRFX_NVMC Kconfig entry for enabling nrfx_nvmc and
select it along with nordic flash driver.

Disabled UICR operation on nRF9160 for non-secure build
as UICR is not available in this mode.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-04-19 11:50:46 +02:00
Jim Paris 510a6dc5e4 drivers: flash: spi_nor.c: fix typo
This was referencing the wrong DT property, leading to build errors.

Signed-off-by: Jim Paris <jim@jtan.com>
2019-04-11 10:02:44 +02: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
Patrik Flykt 97b3bd11a7 drivers: Rename reserved function names
Rename reserved function names in drivers/ subdirectory. Update
function macros concatenatenating function names with '##'. As
there is a conflict between the existing gpio_sch_manage_callback()
and _gpio_sch_manage_callback() names, leave the latter unmodified.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-04-03 17:31:00 -04:00
Patrik Flykt 21358baa72 all: Update unsigend 'U' suffix due to multiplication
As the multiplication rule is updated, new unsigned suffixes
are added in the code.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-28 17:15:58 -05:00
Patrik Flykt 24d71431e9 all: Add 'U' suffix when using unsigned variables
Add a 'U' suffix to values when computing and comparing against
unsigned variables.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-28 17:15:58 -05:00
Thomas Stenersen db90e24326 drivers: nrf: add support for forcing driver implementation
An external project extending the Zephyr RTOS and its drivers may have
subsystems that must use its own specific driver(s) when active. One
example is the nRF5x NVMC that must be scheduled in between radio
operations. A subsystem may also be dependent on its own drivers for
security, real-time and/or because of hardware constrains.

In order to not introduce non-Zephyr specific code into the Zephyr tree,
an option is added to disable the in-tree drivers in Zephyr. Because
Kconfig does not support a good way of de-selecting other symbols, a
variable on the form `<DRIVER>_FORCE_ALT` is added as a
dependency for each `<DRIVER>`. For example, the out-of-tree subsystem
will select `FLASH_NRF_FORCE_ALT` to disable the in-tree driver. A
solution for issue #8181 would open up for a more general solution,
however #8181 requires significant effort.

Support for out-of-tree drivers is added to Nordic drivers for
clock_control, entropy and flash.

A generic solution for this is desired. Issue #14527 is tracking that
progress.

Signed-off-by: Thomas Stenersen <thomas.stenersen@nordicsemi.no>
2019-03-20 10:27:28 -05:00
Florian Vaussard 2320973fea flash: stm32l4: disable dcache before writting
Disable the data cache before writing to Flash, in order to workaround
silicon errata 2.2.3: "Data cache might be corrupted during Flash memory
read-while-write operation". The data cache is conditionally re-enabled
once the write is completed.

This silicon bug has been encountered while stress testing the
implementation. Here are the events leading to the fault:
- Code is executing from Flash bank 1
- A write to Flash bank 2 is initiated
- The Cortex SysTick interrupt fires while waiting for Flash write
  completion

In that case, the Flash controller will perform a read-while-write
operation in order to execute the ISR code. As the data cache is enabled
by default after reset, a corruption occurs due to the silicon bug,
leading to bizarre data bus faults or unaligned access faults inside
_timer_int_handler() or one of the functions called by the ISR.

Applying the workaround devised by ST fixes the problem.

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
2019-03-19 09:56:01 -05:00
Erwan Gouriou 652efa530f drivers/flash: stm32l4: Prepare for unaligned accesses in flash writes
On STM32L4, flash writes operations are performed 8 bytes at a time.
Though, it is possible that *data in flash_write functions is not
aligned. To avoid issues, use UNALIGNED_GET macro to access *data.

Issue has been detected using settings subsystem on STM32WB, which has
same 8bytes write block size. The patch is extended to STM32L4 series
for same reason.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-03-15 06:43:24 -05:00
Erwan Gouriou f3832a399e drivers/flash: stm32f3/stm32f1: define flash registers as volatile
On STM32F3 devices, a trick was required for normal use of registers.
This was actually an issue in flash registers defintions which should
be defined as volatile.
Fix this and additionaly, fix definition for STM32F1 which was also
lacking the volatile instruction.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-03-15 06:43:24 -05:00
Ramakrishna Pallala e1639b5345 device: Extend device_set_power_state API to support async requests
The existing device_set_power_state() API works only in synchronous
mode and this is not desirable for devices(ex: Gyro) which take
longer time (few 100 mSec) to suspend/resume.

To support async mode, a new callback argument is added to the API.
The device drivers can asynchronously suspend/resume and call the
callback function upon completion of the async request.

This commit adds the missing callback parameter to all the drivers
to make it compliant with the new API.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2019-03-14 14:26:15 +01:00
Thomas Stenersen a3fc1a1f53 drivers: nrf5: Don't force specific drivers from soc/arm/nordic_nrf
Redefining the config will not let another (out-of-source) driver be
chosen instead of the default. The driver is practically forced by the
soc settings. This commit moves default settings from soc/arm/nordic_nrf
into the drivers themselves.

Signed-off-by: Thomas Stenersen <thomas.stenersen@nordicsemi.no>
2019-03-12 19:42:40 +01:00
Thomas Stenersen 7516476386 kconfig: Use depend on instead of select to avoid kconfig loop
Remove use of select to "force" enabling other configs in subsys/fs
and subsys/net/l2. The forcing will cause infinite kconfig recursion.

Signed-off-by: Thomas Stenersen <thomas.stenersen@nordicsemi.no>
2019-03-12 19:42:40 +01:00
Patrik Flykt 4344e27c26 all: Update reserved function names
Update reserved function names starting with one underscore, replacing
them as follows:
   '_k_' with 'z_'
   '_K_' with 'Z_'
   '_handler_' with 'z_handl_'
   '_Cstart' with 'z_cstart'
   '_Swap' with 'z_swap'

This renaming is done on both global and those static function names
in kernel/include and include/. Other static function names in kernel/
are renamed by removing the leading underscore. Other function names
not starting with any prefix listed above are renamed starting with
a 'z_' or 'Z_' prefix.

Function names starting with two or three leading underscores are not
automatcally renamed since these names will collide with the variants
with two or three leading underscores.

Various generator scripts have also been updated as well as perf,
linker and usb files. These are
   drivers/serial/uart_handlers.c
   include/linker/kobject-text.ld
   kernel/include/syscall_handler.h
   scripts/gen_kobject_list.py
   scripts/gen_syscall_header.py

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-11 13:48:42 -04:00
Ulf Magnusson 5102f6a62e kconfig: drivers: flash: Remove redundant FLASH dependencies
These are from source'ing a file within an 'if FLASH', and then adding
another 'depends on FLASH' within it.

'if FOO' is just shorthand for adding 'depends on FOO' to each item
within the 'if'. There are no "conditional includes" in Kconfig, so
'if FOO' has no special meaning around a 'source'. Conditional includes
wouldn't be possible, because an 'if' condition could include (directly
or indirectly) forward references to symbols not defined yet.

Tip: When adding a symbol, check its dependencies in the menuconfig
('ninja menuconfig', then / to jump to the symbol). The menuconfig also
shows how the file with the symbol got included, so if you see
duplicated dependencies, it's easy to hunt down where they come from.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-09 09:56:40 -05:00
Maureen Helm 5ebf6104a2 soc: nxp_kinetis: Add HAS_MCUX_FTFX to conditionalize mcux flash driver
Adds a new config HAS_MCUX_FTFX to conditionalize the mcux flash driver
on socs that support it. Selects HAS_MCUX_FTFX on all kinetis socs
except kw40z, because even though this soc has the relevant hardware,
its CMSIS header file is not compatible with the mcux flash driver in
ext/.

This change also prevents enabling the mcux flash driver on lpc and imx
rt boards.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2019-03-06 21:19:25 -06:00
Ulf Magnusson 40436f730b kconfig: Use a short consistent prompt style
Same change as in commit 8cf8db3a73 ("Kconfig: Use a short, consistent
style for prompts"), fixing stuff that got introduced since then.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-27 09:23:30 +01:00
Krzysztof Chruscinski 3605e48c44 shell: Modify subcommands to use SHELL_STATIC_SUBCMD_SET_CREATE
It is planned to deprecate SHELL_CREATE_STATIC_SUBCMD_SET macro
which is replaced by SHELL_STATIC_SUBCMD_SET_CREATE.

Additionally, removed irrelevant comments about alphabetical
ordering which is no longer needed.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-02-20 07:31:35 -05:00
Erwan Gouriou 9a07a2850b drivers/flash: Rework CMakeLists.txt for stm32 drivers
Optimize CMake rules for STM23 series driver build.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-02-19 07:45:50 -06:00
Erwan Gouriou 82403f68e2 drivers/flash: Move STM32F3 to generic STM32 series driver
A common driver is shared between stm32 chips, which was not the case
for stm32f3 series. As a consequence stm32f3 was not maintained
equally and was missing features such as flash layout or dts based
configuration.
Besides, drivers had some flows such as wrong bus clock and
missing HSI clock activation which lead to issues on boards not
using HSI as main clock.
As a consequence this commit moves stm32f3 series flash driver to
common stm32 flash drivers.

Fixes #4197

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-02-19 07:45:50 -06:00
Sebastian Bøe 1312ca7cc2 kconfig: flash: Move nrf code into it's own file
Cleanup the Kconfig code for the flash driver. Platform-specific
options should be in their own Kconfig files to be consistent and to
not pollute the common configuration.

To this end we move the nrf options into it's own file.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-02-15 14:12:48 -05:00
Sebastian Bøe 1f27a456cd kconfig: flash: Move mcux code into it's own file
Cleanup the Kconfig code for the flash driver. Platform-specific
options should be in their own Kconfig files to be consistent and to
not pollute the common configuration.

To this end we move the mcux options into it's own file.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-02-15 14:12:48 -05:00
Sebastian Bøe ae846dce75 kconfig: flash: Move nios code into it's own file
Cleanup the Kconfig code for the flash driver. Platform-specific
options should be in their own Kconfig files to be consistent and to
not pollute the common configuration.

To this end we move the nios2 options into it's own file.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-02-15 14:12:48 -05:00
Rajavardhan Gundi 95e8a582b4 drivers: flash: spi_nor.c: Correct the calculation of SECTORS_COUNT
The patch 44758977f8 made a change where
SECTORS_COUNT was not calculated properly. This patch corrects it.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2019-02-14 22:18:25 -05:00
Carlos Stuart 75f77db432 include: misc: util.h: Rename min/max to MIN/MAX
There are issues using lowercase min and max macros when compiling a C++
application with a third-party toolchain such as GNU ARM Embedded when
using some STL headers i.e. <chrono>.

This is because there are actual C++ functions called min and max
defined in some of the STL headers and these macros interfere with them.
By changing the macros to UPPERCASE, which is consistent with almost all
other pre-processor macros this naming conflict is avoided.

All files that use these macros have been updated.

Signed-off-by: Carlos Stuart <carlosstuart1970@gmail.com>
2019-02-14 22:16:03 -05:00
Kumar Gala 7b4ee6bd45 flash: spi_nor: Convert FLASH_{WRITE,ERASE}_BLOCK_SIZE to DT_
Convert generic FLASH_{WRITE,ERASE}_BLOCK_SIZE to driver specific
generated define DT_JEDEC_SPI_NOR_0_{WRITE,ERASE}_BLOCK_SIZE.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-08 22:39:07 -06:00
Kumar Gala b0308f7fcd flash: flash_gecko: Convert FLASH_WRITE_BLOCK_SIZE to DT_
Convert generic FLASH_WRITE_BLOCK_SIZE to driver specific generated
define DT_SOC_NV_FLASH_0_WRITE_BLOCK_SIZE.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-08 22:39:07 -06:00
Kumar Gala 73f2466f00 flash: flash_sam: Convert FLASH_{WRITE,ERASE}_BLOCK_SIZE to DT_
Convert generic FLASH_{WRITE,ERASE}_BLOCK_SIZE to driver specific
generated define DT_SOC_NV_FLASH_0_{WRITE,ERASE}_BLOCK_SIZE.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-08 22:39:07 -06:00
Kumar Gala 590b5a08a2 flash: soc_flash_mcux: Convert FLASH_ERASE_BLOCK_SIZE to DT_
Convert generic FLASH_ERASE_BLOCK_SIZE to driver specific generated
define DT_SOC_NV_FLASH_0_ERASE_BLOCK_SIZE.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-08 22:39:07 -06:00
Kumar Gala f6c7e9a997 flash: flash_stm32: Convert FLASH_WRITE_BLOCK_SIZE to DT_
Convert generic FLASH_WRITE_BLOCK_SIZE to driver specific generated
define DT_SOC_NV_FLASH_0_WRITE_BLOCK_SIZE.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-08 22:39:07 -06:00
Anas Nashif 5846697591 flash: shell: fix dependency on FLASH_PAGE_LAYOUT
Fix dependency, it should depend on FLASH_PAGE_LAYOUT rather than
FLASH_HAS_PAGE_LAYOUT.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-04 17:55:40 -05:00
Peter A. Bigot e7303cb09a boards: nrf52840_pca10056: add bindings for on-board serial flash
This board has an on-board 64 Mibit serial flash from Macronix.  Add
bindings to access it.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-02-01 04:21:40 -06:00
Peter A. Bigot 44758977f8 drivers: flash: spi-nor: update towards device-tree support
Use the jedec,spi-nor bindings to configure as much of the device as can
be expressed by device tree.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-02-01 04:21:40 -06:00
Aurelien Jarno 8a7e7407d0 drivers: flash: SAM E70: fix warnings when built with newlib
off_t is int with the minimal libc and long with the newlib libc. The
log messages are assuming that off_t is int, therefore this causes
warnings when building with newlib.

Fix that by casting the offset to the "longer" type, ie long.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-01-30 10:27:09 -06:00
Kumar Gala f054ba2b65 flash: w25qxxdv: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert w25qxxdv driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-28 10:40:31 -06:00
Rajavardhan Gundi f5b60eeca8 Kconfig: spi_nor: Remove Erase configuration from Kconfig
Configuration of Erase command is specified in DTS. Hence
the corresponding changes in Kconfig are removed.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2019-01-16 21:22:56 -05:00
Rajavardhan Gundi 74895bc099 dts: spi_nor: Rename DT_SPI_NOR_SPI_SLAVE to DT_SPI_NOR_SPI_SLAVE_ID
The "_ID" suffix for DT_SPI_NOR_SPI_SLAVE better represents what it
is used for.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2019-01-16 21:22:56 -05:00
Rajavardhan Gundi 7d428bb0a8 flash: spi_nor: Remove Kconfig parameter for SPI_NOR_SECTORS
Number of sectors is now calculated from the flash density
i.e. (Flash size)/(sector size).

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2019-01-16 21:22:56 -05:00
Rajavardhan Gundi 75f6f1b279 drivers: flash: spi_nor: Enable Flash Page Layout and Map
This patch enables the support for FLASH_PAGE_LAYOUT and
FLASH_MAP for the generic spin nor flash driver.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2019-01-16 21:22:56 -05:00
Rajavardhan Gundi f885fd15bf DTS: flash: spi_nor: use DT_ for freq and other parameters
Use DT_ instead of CONFIG_ for spi freq, spi bus name, flash device
name and flash base address.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2019-01-16 21:22:56 -05:00
Varun Sharma 77c643a5a3 drivers: Modify drivers to use DEVICE_AND_API_INIT()
Modified drivers to use DEVICE_AND_API_INIT() instead of DEVICE_INIT()

This will make sure driver_api,is populated at build time and is exposed
to user space

Signed-off-by: Varun Sharma <varun.sharma@intel.com>
2019-01-15 10:39:34 -08:00
Jan Van Winkel a6b286ced4 flash: Remove shell context from flash shell
Remove external declared shell context from flash shell

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-01-09 16:33:15 -05:00
Jan Van Winkel ea3ca125bb flash: Use flash page layout size in flash shell
Use the page size retrieved via page layout in flash erase
shell command in case erase size is not given.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-01-09 16:33:15 -05:00
Kumar Gala a4c3feced4 dts: flash: w25qxxdv: Add Device Tree Support for SPI FLASH w25qxxdv
Convert the w25qxxdv driver to use device tree for SPI device params.
Updated the Arduino 101 config to use device tree to specify the SPI
flash.  Update the arduino_101_sss to drop Kconfig support for the
w25qxxdv flash.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-09 10:26:10 -06:00
Piotr Mienkowski aa2c27d007 soc: silabs_exx32: Add independent Kconfig options for HAL libraries
Zephyr gecko drivers depend on libraries provided by the vendor. The
same libraries may also be used directly by the application code or
RAIL library. To facilitate the latter use case scenario this commit
adds Kconfig options to independently enable compilation of vendor
HAL library modules.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-01-08 13:31:42 -06:00
Olivier Martin 7031d5bdda drivers: flash: w25qxxdv: write across programming pages
Until now spi_flash_wb_write/read functions were only supporting
buffers that fit into a W25Q page (even if there were not checking
the offset was page aligned).
This change allows these function to read/write multiple W25Q page.
This change is required as the caller of these functions are not
aware of flash page size.

Signed-off-by: Johannes Hutter <johannes@proglove.de>
Signed-off-by: Olivier Martin <olivier.martin@proglove.de>
Signed-off-by: Michael Wendland <michael@proglove.de>
2019-01-07 16:09:04 -05:00
Olivier Martin 4bc4bbf350 drivers: flash: w25q: Allow to skip SYNC_LOCK/SYNC_UNLOCK
The next commit will use this new
spi_flash_wb_write_protection_set_with_lock() in
spi_flash_wb_write() that already hold the lock.
To prevent a lock we need to skip the SYNC_LOCK when we want
to disable write protection.

Signed-off-by: Olivier Martin <olivier.martin@proglove.de>
2019-01-07 16:09:04 -05:00
Vinayak Kariappa Chettimada 87fe440f01 Bluetooth: controller: Prepare to introduce LL split architecture
Preparation to introduce the Upper Link Layer (ULL) and
Lower Link Layer (LLL) split architecture.

- Move SoC dependent HAL to vendor specific folder.
- Preparation to split data structures into ULL and LLL
  types.
- Added more role and state conditional compilations.
- Added some work-in-progress implementation of advertising
  extensions, will be used as inspiration in the new split
  architecture work.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-01-07 13:42:01 +01:00
Jan Van Winkel 3a8c2b8ad8 flash: Remove NRF dependency from flash shell
Removed dependency to NRF_FICR CODEPAGESIZE from flash shell erase
command

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-01-07 11:10:34 +01:00
Maureen Helm 011a88c744 ext: mcux: Update to MCUXpresso SDK 2.5.0
Updates the MCUXpresso SDK to version 2.5.0 for applicable SoCs.
Wireless (KW*) and legacy (KL25) SoCs were not included in this
MCUXpresso SDK release and are therefore not updated here.

New in this release is SoC-level and board-level support for external
xip flash in the i.MX RT family.

For RT1050, we are now using the MCUXpresso SDK for the EVKB version of
the board, which correponds to an upgrade from A0 to A1 silicon.
However, we don't yet have Kconfigs in place to support A1 silicon part
numbers, and therefore add a simple cmake hack to convert A0 part
numbers to A1 part numbers.

The SDK flash driver interface also changed slightly in this release,
and thus the zephyr flash shim driver is updated accordingly.

Origin: MCUXpresso SDK
License: BSD 3-Clause
URL: mcux.nxp.com
Purpose: Provide device header files and bare metal peripheral drivers
for Kinetis, LPC, and i.MX SoCs.
Maintained-by: External

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2019-01-03 17:25:28 -05:00
Andrzej Puzdrowski 3f422e2efe drivers: flash: fix the regular access range check
The check was susceptible for overflow.
This patch corrects this malfunction.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-12-19 17:47:08 +01:00
Andrzej Puzdrowski cd4fbdeac8 drivers: flash: support NRF UICR operations
Nordic UICR are non-volatile memory registers for
configuring user-specific settings. Basically it is subset of flash
memory available in the SoC.

Add support for operations on NVM which belongs to UICR.
UICR are written or read as ordinary flash memory.
For erasing UICR it is required to call erase with UICR start
address and its size (this is caused by what hardware supported).

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-12-19 17:47:08 +01:00
Aurelien Jarno 6752b5df3f drivers: flash: add driver for STM32F7x series
This patch adds a flash driver for the STM32F7x series, inspired from
the STM32F4x one. It has been tested on the STM32F723, but should also
work on other SoCs of the family.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-12-17 08:15:59 -06:00
Aurelien Jarno 48d1fbb352 drivers: flash: stm32: pass offset and len to flash_stm32_flush_caches
On SoC families using a Cortex-M7, it is possible to flush only specific
cache lines. Therefore pass the offset and len so that the flush can be
done with more granularity.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-12-17 08:15:59 -06:00
Aurelien Jarno 123b832a02 drivers: flash: stm32: don't flush i-cache after an erase
In general synchronisation between memory and the instruction cache
should be done explicitly, for example this is how it is done for RAM.
It is also done that way for flash writes in the current STM32 flash
driver.

However in case of flash erases, the current STM32 flash driver flushes
the i-cache. It probably doesn't make a big difference for the
Cortex-M3/M4 families as the cache is very small. That said it might
have bigger impact on families based on Cortex-M7 as it has between 4KB
and 16KB of i-cache, that will be added latter in this patch serie.

This patch therefore remove the i-cache flush in
flash_stm32_flush_caches.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-12-17 08:15:59 -06:00
Aurelien Jarno 551f9c38b8 drivers: flash: stm32: always define flash_stm32_flush_caches
This reduces the amount of #ifdef and keep all of them at the same
place. The empty function is then optimized-out by the compiler.

At the same time change the negative test by a positive one to simplify
adding new entries.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-12-17 08:15:59 -06:00
Aurelien Jarno 8e356dbc88 drivers: flash: stm32: improve timeout handling
The timeout handling in the STM32 flash driver is currently a counter
in the busy check loop. This doesn't scale well across the whole STM32
family:
- The duration of the loop depends on the CPU speed, the activation of
  caches.
- The duration of the longest flash operation (a sector erase as the
  driver doesn't support mass erase) can varies a lot mostly depending
  on the sector size, 2K on F0 and L4 families or 128K on the F4 family.

In addition the timeout can change depending if the writing thread is
prempted or not.

Fix that by defining a timeout in ms depending on the family, and using
k_uptime_get to get a precise measurement of the time.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-12-17 08:15:59 -06:00
Anas Nashif 1b48a7a715 drivers: flash_mcux: remove inclusion of sys+log.h
Stray inclusion of old sys_log.h. Nothing uses it in that driver.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-12-10 20:38:09 -05:00
Erwan Gouriou 9062e97a45 drivers: stm32: check clock_control_on return value
Check clock_control_on return value now that it is checking appropriate
bus is used in the request.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-12-07 11:31:48 -05:00
Ramakrishna Pallala a4f933677b drivers: flash: Nios-II QSPI Coccinelle issue
Fixed Coccinelle warning "Unsigned expression compared with zero".

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-12-07 10:42:01 -05:00
Jakub Rzeszutko 3064ca4f2f shell: creating new module for help functionality
1. Created new shell module: shell_help.
2. Simplified command handlers with new shell print macros.
3. Removed help functions from command handlers.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-12-05 15:15:44 +01:00
Jakub Rzeszutko 5451ff2848 shell: remove "options" concept
Removing help "options" from shell API.

Currently SHELL_OPT macro is not used by users. What is more
commit: a89690d10f ignores possible options created in
command handler by the user. As a result they are not printed
in help message.

Second, currntly implemented "options" in command handlers options are
implemented without SHELL_OPT macro.

And last but not least this change will allow to implement
help handler in a way that user will not need to think about calling
functions printing help in a command handler.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-12-05 15:15:44 +01:00
Patrik Flykt 8ff96b5a57 drivers: Add 'U' to unsigned variable assignments
Add 'U' to a value when assigning it to an unsigned variable.
MISRA-C rule 7.2

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2018-12-04 22:51:56 -05:00
Rajavardhan Gundi 7765c1adaf drivers: flash: spi_nor: Remove unused block_size parameter
Only page and sector size is used by the driver.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-12-02 09:27:16 -05:00
Rajavardhan Gundi 826a7cdca8 drivers: flash: spi_nor: Remove page alignment requirement for R/W
For flash R/W, the start address need not be aligned on a page size.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-12-02 09:27:16 -05:00
Himanshu Jha 3bff9b1b50 drivers: flash_gecko: remove unnecessary variable
Remove an unnecessary local variable to store the
return value, instead return directly thereby saving
few bits of memory.

Found using Coccinelle.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-11-28 11:54:01 -08:00
Rajavardhan Gundi 4b3f3ab056 drivers: flash: spi_nor: Correct the return values for R/W
Fixed the return values for read and write APIs for spin_nor.c
which were not inline with what the corresponding interfaces
were meant to return.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-11-24 07:58:05 -05:00
Olivier Martin 184753a4e6 drivers: flash: w25q: Add support for page layout
We use the sector size rather than the page size as some
modules that consumes the flash page layout (such as FCB)
assume the page size is the minimal size they can erase.

Signed-off-by: Olivier Martin <olivier.martin@proglove.de>
2018-11-21 05:08:10 -06:00
Aurelien Jarno 6194b7676c drivers: flash: add flash driver support for Atmel SAM E70
This patch adds a flash driver for the Atmel SAM E70 SoC. The driver has
been kept simple by considering that the flash is only composed of 8-KiB
blocks. Indeed an area at the beginning of the flash might be erased
with a smaller granularity, and the other blocks can also be erased with
a higher granularity. It also only handles the global read/write
protection, not the 128-KiB lock regions. A write error is returned if
a region is locked.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-11-20 14:11:07 -05:00
Savinay Dharmappa 87e5493167 drivers: flash: add a generic spi nor flash driver
This driver is inspired from the w25qxxdv SPI NOR flash driver which was
already implementing the CFI (Common Flash Interface) for its purpose.
To handle other NOR flash a flash id table (as Linux do) which contains
the geometry for a few SPI NOR flash based on their JEDEC ID has been
introduced.
We currently support the following flash:
 - W25Q80
 - W25Q16
 - W25Q32
 - S25FL216K
 - MX25UM512

The read and write functions are able to handle more then one page at a
time and return the number of bytes read or write.
Also because every NOR flash expect to disable the write protection
before writing or erasing, the write enable command is now part of the
write and erase functions.

Signed-off-by: Sebastien Bourdelin <sebastien.bourdelin@savoirfairelinux.com>
Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2018-11-13 18:49:03 -05:00