Commit graph

372 commits

Author SHA1 Message Date
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
Andrzej Głąbek 20202902f2 dts_fixups: Use DT_ prefix in all defined labels not related to Kconfig
These changes were obtained by running a script  created by
Ulf Magnusson <Ulf.Magnusson@nordicsemi.no> for the following
specification:

1. Read the contents of all dts_fixup.h files in Zephyr
2. Check the left-hand side of the #define macros (i.e. the X in
   #define X Y)
3. Check if that name is also the name of a Kconfig option
   3.a If it is, then do nothing
   3.b If it is not, then replace CONFIG_ with DT_ or add DT_ if it
       has neither of these two prefixes
4. Replace the use of the changed #define in the code itself
   (.c, .h, .ld)

Additionally, some tweaks had to be added to this script to catch some
of the macros used in the code in a parameterized form, e.g.:
- CONFIG_GPIO_STM32_GPIO##__SUFFIX##_BASE_ADDRESS
- CONFIG_UART_##idx##_TX_PIN
- I2C_SBCON_##_num##_BASE_ADDR
and to prevent adding DT_ prefix to the following symbols:
- FLASH_START
- FLASH_SIZE
- SRAM_START
- SRAM_SIZE
- _ROM_ADDR
- _ROM_SIZE
- _RAM_ADDR
- _RAM_SIZE
which are surprisingly also defined in some dts_fixup.h files.

Finally, some manual corrections had to be done as well:
- name##_IRQ -> DT_##name##_IRQ in uart_stm32.c

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-11-13 10:44:42 -06:00
Piotr Mienkowski d9e2171aa9 drivers: flash_gecko: Add flash driver for SiLabs Gecko SoCs
Tested with SLWSTK6061A / BRD4250B wireless starter kit.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2018-11-08 17:56:44 -05:00
Jakub Rzeszutko 147122e77f shell: examples unification
Updating examples according to new return value of function
shell_cmd_precheck.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-10-19 13:35:56 +02:00
Anas Nashif 3aa2a1c6db flash: make flash shell generic
This shell command was tied to bluetooth and the bluetooth shell and
also had messages all related to nordic ICs.
Make it generic and put it under drivers/flash/ so it can be included by
anyone and independently of bluetooth.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-19 11:49:18 +02:00
Anas Nashif 518ec097eb drivers: soc_flash_nios2_qspi: fix logging formatting
Fix formatting in logging messages. Remove newline.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-10 15:46:52 -04:00
Anas Nashif ffb75da2ea drivers: flash: move to new logger
Move drivers to new logger and change samples enabling logging in
prj.conf.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-10 10:22:01 -04:00
Anas Nashif 6b8bbc7d07 drivers: flash: fix Kconfig dependencies
Use top level conditional and remove 'depends on FLASH'

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-10 10:22:01 -04:00
Pushpal Sidhu 5bc5bb2c7f flash: stm32l4x: Correct getting page number from STM32L4R/S devices
These devices increase the page size from 2k (standard STM32L4) to 4K,
so we must account for this.

Signed-off-by: Pushpal Sidhu <psidhu.devel@gmail.com>
2018-10-08 12:52:00 -04:00
Mark Ruvald Pedersen d67096da05 portability: Avoid void* arithmetics which is a GNU extension
Under GNU C, sizeof(void) = 1. This commit merely makes it explicit u8.

Pointer arithmetics over void types is:
 * A GNU C extension
 * Not supported by Clang
 * Illegal across all ISO C standards

See also: https://gcc.gnu.org/onlinedocs/gcc/Pointer-Arith.html

Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
2018-09-28 07:57:28 +05:30
Vinayak Kariappa Chettimada 9da6a85c8c drivers: flash: nrf5: Use faster write interval with BT sync
Use a lower slot duration than the used erase slot duration
to speed up the interval of write operations when in sync
with active Bluetooth connections.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2018-09-21 13:15:54 +02:00
Flavio Ceolin 67ca176754 headers: Fix headers across the project
Any word started with underscore followed by and uppercase letter or a
second underscore is a reserved word according with C99.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-17 15:49:26 -04:00
Flavio Ceolin 0866d18d03 irq: Fix irq_lock api usage
irq_lock returns an unsigned int, though, several places was using
signed int. This commit fix this behaviour.

In order to avoid this error happens again, a coccinelle script was
added and can be used to check violations.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-08-16 19:47:41 -07:00
Ulf Magnusson 8cf8db3a73 Kconfig: Use a short, consistent style for prompts
Consistently use

    config FOO
            bool/int/hex/string "Prompt text"

instead of

    config FOO
            bool/int/hex/string
            prompt "Prompt text"

(...and a bunch of other variations that e.g. swapped the order of the
type and the 'prompt', or put other properties between them).

The shorthand is fully equivalent to using 'prompt'. It saves lines and
avoids tricking people into thinking there is some semantic difference.

Most of the grunt work was done by a modified version of
https://unix.stackexchange.com/questions/26284/
how-can-i-use-sed-to-replace-a-multi-line-string/26290#26290, but some
of the rarer variations had to be converted manually.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-15 04:10:10 -07:00
Ulf Magnusson ec3eff57e0 Kconfig: Use the first default with a satisfied condition
Up until now, Zephyr has patched Kconfig to use the last 'default' with
a satisfied condition, instead of the first one. I'm not sure why the
patch was added (it predates Kconfiglib), but I suspect it's related to
Kconfig.defconfig files.

There are at least three problems with the patch:

  1. It's inconsistent with how Kconfig works in other projects, which
     might confuse newcomers.

  2. Due to oversights, earlier 'range' properties are still preferred,
     as well as earlier 'default' properties on choices.

     In addition to being inconsistent, this makes it impossible to
     override 'range' properties and choice 'default' properties if the
     base definition of the symbol/choice already has 'range'/'default'
     properties.

     I've seen errors caused by the inconsistency, and I suspect there
     are more.

  3. A fork of Kconfiglib that adds the patch needs to be maintained.

Get rid of the patch and go back to standard Kconfig behavior, as
follows:

  1. Include the Kconfig.defconfig files first instead of last in
     Kconfig.zephyr.

  2. Include boards/Kconfig and arch/<arch>/Kconfig first instead of
     last in arch/Kconfig.

  3. Include arch/<arch>/soc/*/Kconfig first instead of last in
     arch/<arch>/Kconfig.

  4. Swap a few other 'source's to preserve behavior for some scattered
     symbols with multiple definitions.

     Swap 'source's in some no-op cases too, where it might match the
     intent.

  5. Reverse the defaults on symbol definitions that have more than one
     default.

     Skip defaults that are mutually exclusive, e.g. where each default
     has an 'if <some board>' condition. They are already safe.

  6. Remove the prefer-later-defaults patch from Kconfiglib.

Testing was done with a Python script that lists all Kconfig
symbols/choices with multiple defaults, along with a whitelist of fixed
symbols. The script also verifies that there are no "unreachable"
defaults hidden by defaults without conditions

As an additional test, zephyr/.config was generated before and after the
change for several samples and checked to be identical (after sorting).

This commit includes some default-related cleanups as well:

  - Simplify some symbol definitions, e.g. where a default has 'if FOO'
    when the symbol already has 'depends on FOO'.

  - Remove some redundant 'default ""' for string symbols. This is the
    implicit default.

Piggyback fixes for swapped ranges on BT_L2CAP_RX_MTU and
BT_L2CAP_TX_MTU (caused by confusing inconsistency).

Piggyback some fixes for style nits too, e.g. unindented help texts.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-10 12:38:28 -07:00
Olivier Martin a07d98a62f drivers: flash: w25q: Fix typo
'commands' was mispelled in all the file 'spi_flash_w25qxxdv_defs.h'

Signed-off-by: Olivier Martin <olivier.martin@proglove.de>
2018-07-17 08:27:04 -04:00
Ulf Magnusson 00f363e4c8 drivers: flash: Kconfig: Remove redundant 'default n' 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, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Jamie McCrae 23ce6f44b5 drivers: flash: w25qxxdv: Add options for delay and device ID
Adds support for configuring the CS toggling delay and using a
different device ID so that compatible flash chips can also be
used by this driver.

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdtech.com>
2018-06-22 12:27:40 -04:00
Johannes Hutter 392da5baee drivers: flash: w25qxxdv: Avoid locking when not threaded
When using CONFIG_MULTITHREADING=n, the semaphore primitives are
non-functional and useless. Remove their usage when this option is
enabled.

Signed-off-by: Johannes Hutter <johannes@proglove.de>
2018-06-18 12:31:06 -04:00
Carles Cufi 408ea1464b drivers: flash: nrf: Avoid locking when not threaded
When using CONFIG_MULTITHREADING=n, the semaphore primitives are
non-functional and useless. Remove their usage when this option is
enabled.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-06-16 12:03:22 +02:00
Tomasz Bursztyka 2fe51996db drivers/flash: Remove irrelevant option in w25qxxdv driver
CONFIG_SPI_FLASH_W25QXXDV_MAX_DATA_LEN is a left-over from old SPI API
usage. Now, there is no limit (besides the flash size) in SPI data
transaction.

Fixes #8327

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-06-14 14:41:52 -04:00
Tomasz Bursztyka a88a98665b drivers/flags: W25QXXDW internal erase logic fix
The old way of erasing was not completely moved to the new SPI access
function, thus always sending useless dummy bytes that could lead to
error (aka: erasing more than requested).

Fixes #8065

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-06-04 08:25:42 -04:00
Tomasz Bursztyka 002031d87f drivers/flash: Cleaning up Kconfig
Splitting to dedicated Kconfig for w25qxxdv and qmsi.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-29 16:21:08 -04:00
Tomasz Bursztyka a6d8378377 drivers/flash: A support for SPI gpio-cs logic into w25qxxdv driver
Up to SPI API user code to handle providing the right SPI GPIO-CS
parameters now.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-29 16:21:08 -04:00
Adithya Baglody 5f5e9fb968 drivers: flash: Remove usage of zephyr_library_ifdef
Phasing out the usage of this cmake macro from the drivers/flash
folder.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-05-28 13:23:13 -04:00
Andrew Boie 8345e5ebf0 syscalls: remove policy from handler checks
The various macros to do checks in system call handlers all
implictly would generate a kernel oops if a check failed.
This is undesirable for a few reasons:

* System call handlers that acquire resources in the handler
  have no good recourse for cleanup if a check fails.
* In some cases we may want to propagate a return value back
  to the caller instead of just killing the calling thread,
  even though the base API doesn't do these checks.

These macros now all return a value, if nonzero is returned
the check failed. K_OOPS() now wraps these calls to generate
a kernel oops.

At the moment, the policy for all APIs has not changed. They
still all oops upon a failed check/

The macros now use the Z_ notation for private APIs.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-17 23:34:03 +03:00
Adithya Baglody b0db28b512 drivers: Cmake: Add __ZEPHYR_SUPERVISOR__ macro for driver files.
Normally a syscall would check the current privilege level and then
decide to go to _impl_<syscall> directly or go through a
_handler_<syscall>.
__ZEPHYR_SUPERVISOR__ is a compiler optimization flag which will
make all the system calls from the driver files directly link
to the _impl_<syscall>. Thereby reducing the overhead of checking the
privileges.

In the previous implementation all the source files would be compiled
by zephyr_source() rule. This means that zephyr_* is a catchall CMake
library for source files that can be built purely with the include
paths, defines, and other compiler flags that all zephyr source
files uses. This states that adding one extra compiler flag for only
one complete directory would fail.
This limitation can be overcome by using zephyr_libray* APIs. This
creates a library for the required directories and it also supports
directory level properties.
Hence we use zephyr_library* to create a new library with
macro _ZEPHYR_SUPERVISOR_ for the optimization.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-05-15 17:48:18 +03:00
Leandro Pereira c200367b68 drivers: Perform a runtime check if a driver is capable of an operation
Driver APIs might not implement all operations, making it possible for
a user thread to get the kernel to execute a function at 0x00000000.

Perform runtime checks in all the driver handlers, checking if they're
capable of performing the requested operation.

Fixes #6907.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-04-26 02:57:12 +05:30
Henrik Brix Andersen 8c5b16cc79 drivers: flash: atmel sam0: Fix compilation without page layout support
The sam0 flash driver has support for retrieving flash page layout
information.  This commit fixes compilation when
CONFIG_FLASH_PAGE_LAYOUT is disabled.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2018-04-12 17:26:54 -05:00
David Leach 51a2090780 newlib: Fix compiler warning when using Newlib
- There is a mismatch when interfacing with external code where a
  uint32_t is defined as a parameter and internal Zephyr code attempts
  to use u32_t. If NewLib is used, the typedef for u32_t is
  'unsigned int' which is not a portable match to uint32_t as
  'unsigned int' is not a common size across architectures so gcc will
  output a warning.
- The mcux flash code calls NXP supplied functions that expect a
  uint32_t.
- openthread.c ot_state_changed_handler has a uint32_t flag as a
  parameter.

Signed-off-by: David Leach <david.leach@nxp.com>
2018-04-11 16:57:12 +03:00
Tomasz Bursztyka 16cb7ab883 drivers/flash: Switch W25QXXDV driver to new SPI API
This saves quite some memory.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Tomasz Bursztyka 324265420b api/spi: Disable legacy API by default
Let's start deprecation work of the SPI legacy API.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-04 19:02:35 +02:00
Carles Cufi 8aa9a37902 drivers: flash: nrf: Rename nrf5 to nrf
With upcoming ICs that are not in the nRF5x family, rename the flash
driver and all its dependencies from nrf5 to nrf.

Should also fix the issue introduced by f49150cab6 which broke the
assignment of the flash device due to a partial rename.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-03-20 20:07:09 +01:00
Carles Cufi f49150cab6 arch: arm: nrf: Rename nrf5 SoC Family to nrf
Upcoming Nordic ICs that share many of the peripherals and architecture
with the currently supported nRF5x ones are no longer part of the nRF5
family. In order to accomodate that, rename the SoC family from nrf5 to
nrf, so that it can contain all of the members of the wider Nordic
family.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-03-20 11:57:14 +01:00
Ilya Tagunov 48a5fbcaa9 drivers: flash: stm32f0: remove CONFIG_FLASH_PAGE_SIZE
STM32F0 flash driver already uses FLASH_PAGE_SIZE from HAL
in flash layout part, so CONFIG_FLASH_PAGE_SIZE is redundant
and confusing.

Signed-off-by: Ilya Tagunov <tagunil@gmail.com>
2018-03-18 17:02:53 -04:00
Andrzej Puzdrowski c788f84f25 drivers: flash: move FLASH_HAS_PAGE_LAYOUT Kconfig from arch
Keyword FLASH_HAS_PAGE_LAYOUT is related to flash and should
be declared in its Kconfig.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-03-08 10:18:57 +01:00
Andrzej Puzdrowski 80a99fa450 subsys: storage: flash_map: enable only if any flash driver is enable
It was possible to have enable flash module while no flash driver
implementation was enabled. This cause coverity issues and unnecessary
initialization call.

This pat introduce FLASH_HAS_DRIVER_ENABLED Kconfig keyword which is
selected once any flash driver is enabled. flash_map switch its
dependency to this keyword.


Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-03-08 10:18:57 +01:00
Ramakrishna Pallala 43d323ee9e drivers: flash: Fix Nios-II QSPI flash Coverity issue
Fix Coverity "Memory - corruptions (ARRAY_VS_SINGLETON)"
issue by type casting word_to_write to u8_t pointer and
adding a length check before memcpy operation.

Coverity CID: 182779

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-03-06 10:36:39 -08:00
Vinayak Kariappa Chettimada 3637d50c25 drivers: flash: nRF5x: Fix co-operation with Bluetooth controller
Fixed incorrect comparison of FLASH_SLOT in microseconds
with ticks elapsed.

This caused Bluetooth controller to try scheduling events
beyond the acceptable soft real-time design limits, due to
the CPU halted for flash erase operation.

Fixes #6229.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-02-16 12:03:05 +01:00
Vinayak Kariappa Chettimada 4c123a5162 Bluetooth: controller: Refactor ticker integration into hal
Refactor ticker execution context dependency out into HAL
folder. This decouples ticker from mayfly, enabling porting
towards a more tasklet (if and when kernel gets the support)
style execution contexts type implementation support.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-02-13 13:26:37 +01:00
Marti Bolivar 4e6e7374c4 flash: mcux: implement software write protection (HACK)
Write protection is currently not supported by the mcux flash
driver. This prevents it from working with the DFU subsystem, which
checks the error codes from the write protect routine. Hack it for now
with a semaphore.

Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
2018-02-06 15:39:45 -06:00
Ramakrishna Pallala c02a2bed61 drivers: flash: Add Nios-II QSPI flash driver
Add Altera Nios-II QSPI Flash controller driver which has
has 1024 blocks or sectors wich each sector size being 64K bytes.
This driver supports flash erase, write, read and lock operations.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-02-05 06:30:50 -08:00
Maureen Helm 262595f09f drivers: flash: Implement flash page layout api in mcux driver
Uses the new flash erase-block-size dts property to implement the flash
page layout api in the mcux flash driver.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-01-31 16:43:40 -06:00
Kumar Gala a394693d2f drivers: flash: NXP k6x/kw2xd: Convert to use device tree
Convert NXP k6x and kw2xd flash driver to use device tree to get the
flash controller name from device tree.  We introduce yaml bindings for
the "nxp,kinetis-ftfe" and "nxp,kinetis-ftfl" devices.

Fixes: #5788

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-29 16:34:49 -06:00
Kumar Gala 2dfee62a5e drivers: flash: atmel sam0: Convert to use device tree
Convert Atmel SAM0 flash driver to use device tree to get the flash
controller name and base address.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-27 21:09:28 -06:00
Kumar Gala dc98605f4a drivers: flash: stm32: Convert to use device tree
Convert STM32 flash drivers to use device tree to get the flash
controller name and base address.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-26 09:25:57 -06:00
Kumar Gala 26e4da52cf arm: nordic: flash: Use FLASH_DEV_NAME define
We want to move to use a common FLASH_DEV_NAME across the various flash
drivers. So samples, tests, or other code can be a bit more generic.  So
replace CONFIG_SOC_FLASH_NRF5_DEV_NAME with FLASH_DEV_NAME.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-25 15:23:00 -06:00
Andrzej Puzdrowski ff7dfc4fb4 dts: bindings: add support for the flash driver name
So far, DT did not support the flash driver name.
Any flash-controller should have the appropriate
flash driver that should be identified by its name.

This path adds generic support for extract the description
from the flash-controller node,
adds implementation of this property for all nrf5x targets.


Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-01-23 12:29:50 -06:00
Erwan Gouriou 5ef0019a24 drivers: flash: stm32: get write block size from device tree
In flash driver init, write_block_size could be initialized
with FLASH_WRITE_BLOCK_SIZE which is generated from device
tree parsing (dts property: "write-block-size")
Fixes #5305
If not defined, generate a compilation error.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-01-19 12:16:00 -06:00
Michael Hope cd92dd139b flash: add a driver for the internal flash on the SAM0 series.
The SAM0 has a 64 byte page (the programing unit) with 4 pages to a
row (the erase unit).  This driver implements a read/modify/write to
emulate the byte level writes used by NFFS.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-01-11 19:03:52 -05:00
Carles Cufi 7d764b35f3 cmake: Use path-corrected version of ZEPHYR_BASE
Instead of accessing the environment variable ZEPHYR_BASE every time we
require accessing the source code root, use an intermediate variable
that has OS path separators correctly set to '/' to avoid issues on
Windows.

Note: This removes the ZEPHYR_SOURCE_DIR CMake variable. External
applications using that will need to change to use the new ZEPHYR_BASE
variable.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-01-11 14:59:03 -05:00
Andrzej Puzdrowski d095963e73 drivers: flash: Assert implementation of Flash Page Layout
Some drivers doesn't implement flash API page layout extension
which is causing the application crash once the API was calling.
This patch introduce system termination for this in those drivers
which doesn't implement extension. This will help to discover this
problem early.

It is not done by preprocessor check because it is possible to have
enabled a driver which support and a driver which doesn't support
this API simultaneously.

Now FLASH_PAGE_LAYOUT configuration option is accessible only in case
that at last one driver which implements mentioned API is enabled.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2017-12-12 14:23:50 -06:00
Neil Armstrong 32cb3f0220 flash: stm32: add support for STM32F0 flash controller
Add the STM32F0 Embedded Flash support in the flash_stm32 driver
interface.
The STM32F0 has a particularity or use the HSI as clock source
for the flash controller interface, so this clock must be
enabled directly in the case HSE or another clock is used by
the system clock.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2017-12-12 12:36:08 -06:00
Neil Armstrong 958acd1b4e flash: stm32l4x: fix build
Fix build since current file directly is no more in the include path.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2017-12-04 10:53:12 -06:00
Michael Hope 21b94bacd9 flash: minor documentation improvements.
This patch makes minor improvements to the flash documentation:

* spi -> SPI
* Capitialise the first word in a sentance
* Adding the, and, all, etc where appropriate.

Signed-off-by: Michael Hope <mlhx@google.com>
2017-11-28 12:25:19 -05:00
Sebastian Bøe 0829ddfe9a kbuild: Removed KBuild
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
Sebastian Bøe 12f8f76165 Introduce cmake-based rewrite of KBuild
Introducing CMake is an important step in a larger effort to make
Zephyr easy to use for application developers working on different
platforms with different development environment needs.

Simplified, this change retains Kconfig as-is, and replaces all
Makefiles with CMakeLists.txt. The DSL-like Make language that KBuild
offers is replaced by a set of CMake extentions. These extentions have
either provided simple one-to-one translations of KBuild features or
introduced new concepts that replace KBuild concepts.

This is a breaking change for existing test infrastructure and build
scripts that are maintained out-of-tree. But for FW itself, no porting
should be necessary.

For users that just want to continue their work with minimal
disruption the following should suffice:

Install CMake 3.8.2+

Port any out-of-tree Makefiles to CMake.

Learn the absolute minimum about the new command line interface:

$ cd samples/hello_world
$ mkdir build && cd build
$ cmake -DBOARD=nrf52_pca10040 ..

$ cd build
$ make

PR: zephyrproject-rtos#4692
docs: http://docs.zephyrproject.org/getting_started/getting_started.html

Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
Andrew Boie b7442a0a6b drivers: fix handler filenames
Fixes: #4654

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-31 12:51:22 -07:00
Andrew Boie 66aefcfcf4 drivers: flash: add system calls
The page_layout API returns pointers to kernel memory and is not
exposed to user mode. This is fine for flash_get_page_count()
and flash_get_page_info APIs since these copy the values, but some
redesign work will be needed to get flash_page_foreach() working in
user mode since we do not want the callback running in a privileged
state.

Due to the way that (even unimplemented) system call prototypes are
generated, the definition of struct flash_pages_info needed to be
moved outside of the #ifdef.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-30 13:20:19 -07:00
Sebastian Bøe b7eaeb9f0a cleanup: Use quote include instead of system include
When the header file is located in the same directory as the source
file it is better to use a relative quote-include, e.g.

than a system include like

Avoiding the use of system includes in these cases is beneficial
because;

* The source code will be easier to build because there will be fewer
system include paths.

* It is easier for a user to determine where a quote-include header
  file is located than where a system include is located.

* You are less likely to encounter aliasing issues if the list of
  system include paths is minimized.

Authors:
Anas Nashif
Sebastian Bøe

Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-28 07:11:53 -04:00
Leandro Pereira 5e2303d54e drivers: flash: stm32f4x: rc should be declared as int
`rc` gets assigned values from function returning `int` and not
`u32_t`.

Fixes #4051.

Coverity-ID: 177219
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-10-24 00:15:11 +02:00
Andrzej Puzdrowski 296a355af5 drivers: flash: Add write-block-size values for SoCs
Write-block-size values were filled for nRF5, STM32, QMSI, MCUX and
w25qxxdv devices.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2017-10-11 11:19:15 -05:00
Marti Bolivar 4f8081b5e4 drivers: flash: add flash_page_foreach()
This patch adds a routine which can be used to iterate over all flash
pages on the device.

This can be also done by using flash_get_page_info_by_idx(), but that
would add an unnecessary loop over the layout array for each page.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-06 22:12:23 -04:00
Marti Bolivar c0672938da flash: stm32: stm32l4: add page layout support
L4 parts have a constant page size, so just rely on the HAL defines
that provide it, along with a read to the register which contains this
SoC's total size.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-09-11 11:41:57 -04:00
Marti Bolivar 32482e9cb8 flash: stm32: stm32f4: add page layout support
Add flash page layout support for STM32F4 SoCs.

This almost eliminates the need for flash_map.h, except for
STM32F4X_SECTOR_MASK, so delete the file and move the define into the
F4 implementation, to keep things simple.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-09-11 11:41:57 -04:00
Marti Bolivar 4fea6dfe76 flash: stm32: clean up L4/F4 internal API
This is a prep work commit for adding flash page layout support.

The internal flash APIs for STM32 on L4 and F4 are a bit
inconsistent. Some routines take a pointer to the private data, others
don't. Those that do take it as a last argument instead of a
first. Additionally, some APIs are declared in flash_stm32.h that
aren't ever used by the family-specific files.

Clean this up by making everything take a struct device*, and marking
routines static in the common driver code when possible.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-09-11 11:41:57 -04:00
Andrzej Puzdrowski a7863f2362 Drivers: flash: nrf5: Implement flash layout APIs
Added implementation of the flash layout API for the nRF5x series.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2017-09-11 11:41:57 -04:00
Andrzej Puzdrowski ce9f0b571e Drivers: flash: New API to obtain the flash layout
Added an internal function to obtain the flash page layout in
run-length encoded format. The API is simple and allows the actual
public API implementations to be simple and maintainable.
This feature can be enabled by using the FLASH_PAGE_LAYOUT Kconfig
option. This API is required for the implementation of flash file
system.

Added a public API to get flash page information (size and start offset)
by offset within the flash and by index of the page.
Added a generic implementation of the internal flash_get_page_info API.
Added an additional public API call to get the total count of pages in
the flash memory and its generic implementation.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2017-09-11 11:41:57 -04:00
Andrzej Kaczmarek 8f5420ff23 drivers: flash: Fix write_op unaligned access
data_addr is not guaranteed to be word-aligned so we need to read it in
a safe way, otherwise this can trigger hardfault on nRF51.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2017-08-17 10:54:37 -04:00
Andrzej Kaczmarek 246f4ee7db drivers: flash: Fix checking for radio idle state
ll_radio_state_is_idle() returns bool, not an error value - this means
it is non-zero on success.

Jira: ZEP-2445

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2017-08-14 11:08:17 -04:00
Carles Cufi d5c13a7530 Bluetooth: controller: Rename Kconfig prefix
Rename the BT_CONTROLLER prefix used in all of the Kconfig variables
related to the Bluetooth controller to BT_CTLR.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-08-14 15:44:56 +03:00
Johan Hedberg 2975ca0754 Bluetooth: Kconfig: Rename CONFIG_BLUETOOTH_* to CONFIG_BT_*
The API name space for Bluetooth is bt_* and BT_* so it makes sense to
align the Kconfig name space with this. The additional benefit is that
this also makes the names shorter. It is also in line with what Linux
uses for Bluetooth Kconfig entries.

Some Bluetooth-related Networking Kconfig defines are renamed as well
in order to be consistent, such as NET_L2_BLUETOOTH.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-08-09 11:14:19 +03:00
Leandro Pereira 732424f065 drivers, net: Clean up semaphore initialization
Change the common "init with 0" + "give" idiom to "init with 1".  This
won't change the behavior or performance, but should decrease the size
ever so slightly.

This change has been performed mechanically with the following
Coccinelle script:

    @@
    expression SEM;
    expression LIMIT;
    expression TIMEOUT;
    @@

    - k_sem_init(SEM, 0, LIMIT);
    - k_sem_give(SEM);
    + k_sem_init(SEM, 1, LIMIT);

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-07-27 15:23:07 -04:00
Andrzej Puzdrowski 8b7a8448ab Drivers: flash: NRF5x: synchronous mode for co-operation with BLE radio
In added mode flash operation are performed in timeslice
(in radio idle time).
Kconfig for mode enabling CONFIG_SOC_FLASH_NRF5_RADIO_SYNC.

Erase and write API implementations were rewritten and preserved against
concurrent execution.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-06-28 12:29:50 +02:00
Kumar Gala 4b82e2bc75 flash: stm32l4x: Cleanup use of C99 types
We introduced some see C99 types, so convert them over to the Zephyr
types.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-06-22 13:47:28 -04:00
Michel Jaouen e9153979f0 flash: stm32: distinguish read/write for flash range valid
L4 write access requires 64 bits alignment
while L4 read access does not require any alignment.
To support specific check according to read/write,erase
a parameter is added to stm32_valid_range.

Signed-off-by: Michel Jaouen <michel.jaouen@st.com>
2017-06-16 16:18:12 -04:00
Michel Jaouen 8ba73a79b3 flash: stm32: fix for l4 writing wrong data
L4 have 64 bits write access.
The cast to 64 bits data address in write_dword
requires 3 right shifts on i (byte index) else the
data taken are wrong for i different from 0

Signed-off-by: Michel Jaouen <michel.jaouen@st.com>
2017-06-16 16:18:12 -04:00
Neil Armstrong a9183cd518 flash: Rework and add flash device support for STM32L4x SoCs
The STM32L4x SoCs embeds a slightly different embedded flash controller
from the STM32F4x SoCs.

This particular controller has the following properties :
 - Up to 2 512KiB banks divided in 2KiB pages
 - Flash can be accessed in any sizes
 - Flash must be written in 64bit aligned 64bit double-words

The drivers/flash/flash_stm32f4x.c is refactored into a new common
drivers/flash/flash_stm32.c and drivers/flash/flash_stm32l4x.c is
created with the STM32L4x specific functions.

To ease the refactoring and keep common functions, the STM32L4x flash
headers are slightly modified to match the hardware reference naming
and solve compilation issues.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2017-05-19 10:06:48 -04:00
Neil Armstrong 7a8452c38b flash_stm32f4: bits were badly unset in erase and write functions
A typo was present ion the erase and write function were bit were
uncorrectly unset but all other bit except the mask were unset.
The code still worked because the two typos fixed themselves.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2017-05-19 10:06:48 -04:00
Neil Armstrong 6da68d214e flash_stm32f4: RDERR is not present on STM32F407
The RDERR bit is not present on F4x5 and F4x7 SoCs, so only use it when
available in the HAL.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2017-05-19 10:06:48 -04:00
David B. Kinder 93e4d7258d spell: fix Kconfig help typos: /boards /drivers
Fix misspellings in Kconfig help text

Change-Id: I3ae28a5d23d8e266612114bc0eb8a6e158129dc7
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-04-21 21:31:30 +00:00
Kumar Gala ccad5bf3e3 drivers: convert to using newly introduced integer sized types
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.

Jira: ZEP-2051

Change-Id: I08f51e2bfd475f6245771c1bd2df7ffc744c48c4
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 10:06:48 -05:00
Michael R Rosen ce4f942011 flash: enable flash bank 1 for arc on quark se c1000
Change-Id: Ide95d7f21290b1effb759b1f2e7a014ce21ef1bf
Signed-off-by: Michael R Rosen <michael.r.rosen@intel.com>
2017-04-14 01:35:40 +00:00
Jorge Ramirez-Ortiz 29a8e0292e flash/stm32: driver for STM32F4x series
Change-Id: I0f90bcda7a694de81c594a6616da0faf40306702
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
2017-02-22 18:08:57 -06:00
Jorge Ramirez-Ortiz 28e60ef7ed flash/nrf5: fix invalid write access
Requesting a flash_write with a length of 0 results in a flash
position being written. Instead we should return 0 unless there is
some other input parameter that is invalid.

Change-Id: Ife6e6e2314bbee2bde7d0b69db3122ca00c361e0
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
2017-02-15 00:08:33 +00:00
Erwan Gouriou 726d4dc437 drivers: stm32: clean up after stm23cube based clock control
After activation of cube based driver support on L4 and F3 series,
this commits performs the clean up of F3 and L4 relative code to
native clock control drivers.
Indirectly, it makes pwm driver supported de facto on F3 series

Change-Id: Idac17103a9b5ef6eab540719343cc8f5865f15fa
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-02-10 14:47:41 -06:00
Erwan Gouriou 221087a72e flash: update stm32 flash_f3x to support LL clock control driver
After introducing STM32Cube based clock control driver for
stm32 family, update stm32f3xx flash driver to support it.
Clean up will be done afterwards.

Change-Id: I3260bb063f714fa29adbc71d8036f20479a99b34
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-02-10 14:47:41 -06:00
Juan Solano ee623d21de drivers: Remove unnecessary CONFIG_SYS_POWER_DEEP_SLEEP
This commit removes unnecessary CONFIG_SYS_POWER_DEEP_SLEEP protection
in shim drivers as QMSI 1.4 has introduced empty context save/restore
functions that can be called in Quark D2000, therefore keeping common
code at the shim driver level for Quark SE and D2000.

Change-Id: Ia2a466327f999668c6511c0193014e9151bff6ae
Signed-off-by: Juan Solano <juanx.solano.menacho@intel.com>
2017-02-10 16:27:32 +00:00
Kuo-Lang Tseng 74f7da1bb4 drivers: QMSI SOC flash: simplify driver reentrancy code using IS_ENABLED
This is one the series patches that simplifies the driver code by
using the IS_ENABLED macro. This removes the need of the const
variable and the wrapper functions on semaphore APIs.

Jira: ZEP-1251

Change-Id: I59802cf9f482337656b0fdc4b272f3b1ddc6cbda
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
2017-02-08 19:07:42 +00:00
Maureen Helm ec5ee8b33d flash: Update mcux shim to new mcux version
The newer version of mcux changes its flash api slightly, so update the
Zephyr shim accordingly.

Change-Id: I0c974fc3e82b9f40372c636f0b805ed143be2198
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-01-30 11:02:35 -06:00
Erwan Gouriou 8890b73b6e license: Replace Apache boilerplate with SPDX tag
Apply JIRA: ZEP-1457 to STM32F3X family porting patchset.

Change-Id: I352267a47847143e557a4016de12bb9a14a20067
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-23 15:15:53 -06:00
Adam Podogrocki 61cc74c425 flash/stm32: flash driver for STM32F3x series microcontrollers
Change-Id: I0b41a50507a09a513a67d13374323d831a0ec86a
Signed-off-by: Adam Podogrocki <adam.podogrocki@rndity.com>
2017-01-23 15:15:52 -06:00
David B. Kinder ac74d8b652 license: Replace Apache boilerplate with SPDX tag
Replace the existing Apache 2.0 boilerplate header with an SPDX tag
throughout the zephyr code tree. This patch was generated via a
script run over the master branch.

Also updated doc/porting/application.rst that had a dependency on
line numbers in a literal include.

Manually updated subsys/logging/sys_log.c that had a malformed
header in the original file.  Also cleanup several cases that already
had a SPDX tag and we either got a duplicate or missed updating.

Jira: ZEP-1457

Change-Id: I6131a1d4ee0e58f5b938300c2d2fc77d2e69572c
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-19 03:50:58 +00:00
Maureen Helm e17adf377b flash: Rename ksdk to mcux
Renames the ksdk soc flash driver to mcux.

Change-Id: I835e36f25d8bc3e3aa6286718452528174378907
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-01-12 09:46:26 -06:00
Flavio Santes 501dd224ad drivers: Add the ARG_UNUSED macro
Add the ARG_UNUSED macro to avoid compiler warnings.

Change-Id: Ia62125b5e93671aa0ab0891c92ae9fa06fadb09b
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-21 12:54:52 +00:00
Anas Nashif a9e879e273 logging: move sys_log to subsys/logging
Move logging out of misc/ to its own subsystem. Anything related to
logging and any new logging features or backends could be added here
instead of the generic location in misc/ which is overcrowded with
options that are not related to eachother.

Jira: ZEP-1467
Change-Id: If6a3ea625c3a3562a7a61a0ba5fd7e6ca75518ba
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-19 19:58:39 +00:00
Flavio Santes b04cdcd6e6 drivers: Remove legacy nanokernel.h include
This commit replaces the nanokernel.h include by kernel.h.

Change-Id: Ib42fbf2d9f77a73c0831f569b3dbbfb342ea2e1d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-04 14:59:37 -06:00
Baohong Liu a282872c78 drivers: spi_flash: add erase boundary check and correct an error
Add spi flash erase boundary check. The erase boundary must be
4K-aligned. So, the flash chip will round down an non-4K aligned
address to the nearest 4K boundary automatically. As a result of
this, the erase area will start from a different address (if the
API caller specifies an non-4K alighed address), even though the
size of the erased area is the same as what is specified by the
API caller. Let's add a boundary check to make sure the starting
address (from the API caller) is 4K aligned.

Correct an error in the highest address check. Because of the
error, the erase api call will fail if the flash's highest
address byte is involved.

Jira: ZEP-1277 ZEP-1278

Change-Id: I8b6be57cc8f636f94e5fe67d5a492841a8555005
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-12 01:37:00 +00:00
Baohong Liu 8cc98d71cd drivers: flash: update to unified kernel
Use new semaphore APIs from unified kernel.

Change-Id: I430a239afdb49bfbbd7829442bbdd17c7d736663
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-10 01:59:24 +00:00
Andrew Boie 0b474eef9c kernel: deprecate old init levels
PRIMARY, SECONDARY, NANOKERNEL, MICROKERNEL init levels are now
deprecated.

New init levels introduced: PRE_KERNEL_1, PRE_KERNEL_2, POST_KERNEL
to replace them.

Most existing code has instances of PRIMARY replaced with PRE_KERNEL_1,
SECONDARY with POST_KERNEL as SECONDARY has had a longstanding bug
where the documentation specified SECONDARY ran before the kernel started
up, but actually ran afterwards.

Change-Id: I771bc634e9caf7f17dbf214a270bc9967eed7d32
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-11-09 17:59:44 +00:00
Jorge Ramirez-Ortiz 27ecd5d8f3 drivers: flash: SoC KSDK
This KSDK flash shim driver supports the device in the FRDM K64F
platform (enabled with this commit).

WARNING: the driver disables the system interrupts for potentially
long periods of time. This is required to avoid Read-While-Write
issues since most platforms run in XIP mode.

For more detailed information see the link below:
http://cache.freescale.com/files/32bit/doc/app_note/AN4695.pdf

Change-Id: I70f8d09080251033ce2f45be0c2eb95c19fded08
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
2016-11-07 18:43:16 +00:00
Iván Briano 9ea1b4c15b flash qmsi: Add support for device power management
Add the necessary infrstructure to support power management for the
QMSI Flash driver. If deep sleep is supported, this driver supports
saving its context to be restored on resume.

Jira: ZEP-1006
Change-Id: Ied88e86d13ef9e4e62bd6ac9d8454d9a9a3d2962
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-11-03 11:14:51 +00:00
Marcus Shawcroft 113bf7c44e driver/flash/w25qxxdv: Limit name space, add static.
Change-Id: I207438d08ab109a448b83e937b19d9503acbbcfb
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:06 +00:00
Marcus Shawcroft fb11feeef5 drivers/soc_flash_qmsi: Make driver_api const.
Change-Id: Id2b2056748c8b50b80fc2224d501e19c15c5e56b
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:50:58 +00:00
Marcus Shawcroft 6cec26caef drivers/soc_flash_nrf5: Make driver_api const.
Change-Id: Ie894304c2f4047eba83730f0553df10b0f0144e1
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:50:57 +00:00
Ricardo Salveti c7e607656b flash/nrf5: support non word-aligned write
Change-Id: Ia63344dcfd4a5c44c97c54101684cbba720f0103
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2016-10-25 00:34:28 +00:00
Anas Nashif 5363d14a9e boards: rename Quark SE Devboard to Quark SE C1000
This board now has an official name and will be available soon:

http://www.intel.com/content/www/us/en/embedded/products/quark/mcu/se-soc/overview.html

Jira: ZEP-758
Change-Id: Ia16d33722308cf81471321c3063bdc75055a4d50
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-16 03:10:31 +00:00
Kuo-Lang Tseng d30fd7ce82 driver: spi_flash_w25qxxdv: remove an incorrect erase size definition
The W25QXXDV_PAGE_SIZE is not a valid erase size supported by
the flash component (section 7.2.23 - 7.2.26 of datasheet
https://www.winbond.com/resource-files/w25q16dv_revi_nov1714_web.pdf)
and it is not used by any code so remove it.

Jira: ZEP-615

Change-Id: I4315fa082d5cbceda65ae8567e0a77e2d4066ef1
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
2016-09-07 02:50:31 +00:00
Kuo-Lang Tseng 2f4975b625 qmsi: flash: Improved reentrancy of the soc flash driver
Calls to flash write or erase operations can get preempted
in the middle of the API call if a concurrent call (from
other fiber or task) to the same API is made. The patch ensures
concurrent API calls from other fiber/task is put on hold until
the current operation is completed.

The mechanism is by default not activated. To enable
it, the following flag needs to be defined:

CONFIG_SOC_FLASH_QMSI_API_REENTRANCY

Jira: ZEP-414

Change-Id: I39429e40cb6ed446123dd1a1d7c7acc1b12417aa
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
2016-07-31 16:58:08 +00:00
Ricardo Salveti 9d033295ee drivers: Nordic nRF5 flash support
Change-Id: I366910fd55755602fd887e3ae47ae70144e4c99e
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2016-07-28 13:56:25 +00:00
Kumar Gala 9ec2f3be80 Cleanup whitespace in Kconfig files
Convert leading whitespace into tabs in Kconfig files.  Also replaced
double spaces between config and <prompt>.

Change-Id: I341c718ecf4143529b477c239bbde88e18f37062
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-05-25 13:28:07 -05:00
ktseng be4ac5a3e9 flash: update API documentation
Fixed doxygen comments for flash API usage. Clarified the use of
flash_write_protection_set API for write and erase operations.

Jira: ZEP-383
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
Change-Id: I6a323915c63a393b7be8f96fe3fcd9616a9b21d1
2016-05-25 13:30:41 +00:00
Anas Nashif f35d6e04e3 qmsi: update qmsi to 1.1 alpha
Change-Id: Ib35ebcb32954f764ef8e33f6a1c11ad9f63931bc
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-23 21:30:04 +00:00
Anas Nashif a91b35b506 qmsi: flash: use built-in qmsi driver
Change-Id: I7e9fa271956c4e02998fa7f9cf19afcc3372f46f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-22 20:55:36 -04:00
Baohong Liu d45eab2a7c drivers: Quark flash support
Quark flash sub-driver. It is based on the QMSI driver.

In order to enable this driver, the following options
must be set.

CONFIG_QMSI_DRIVERS
CONFIG_QMSI_INSTALL_PATH
CONFIG_FLASH
CONFIG_SOC_FLASH_QMSI

Origin: Original

Change-Id: Iffbea3b17624c755e367677b76d7216c2fba2ca1
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-04-16 02:01:25 +00:00
Daniel Leung 756b90b01f flash/spi_flash_w25qxxdv: do not set driver_api if init fails
If the driver fails initializations, do not set the driver_api.
This follows the idea that device_get_binding() will not return
a reference to the driver instance when driver init fails.

Change-Id: Iff56b4150658a76567928b1fd166bde5d2848d52
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-12 23:52:10 +00:00
Andre Guedes aca7cb1efd drivers: Replace DEV_NO_SUPPORT by -ENODEV
This patch replaces all occurences of the macro DEV_NO_SUPPORT by
-ENODEV at the driver level. So this patch touch the files under
drivers/, include/ and samples/drivers/ when applicable.

This patch is part of the effort to transition from DEV_* codes to
errno.h codes.

Change-Id: I03007527367b03e6fd72a85004b7d3b81046a6a6
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-16 19:30:04 -04:00
Andre Guedes 245e140da6 drivers: Replace DEV_INVALID_OP by -ENOTSUP
This patch replaces all occurences of the macro DEV_INVALID_OP by
-ENOTSUP at the driver level. So this patch touch the files under
drivers/, include/ and samples/drivers/ when applicable.

This patch is part of the effort to transition from DEV_* codes to
errno.h codes.

Change-Id: I46aec3c65963018c479b01602e4a3eec8650eaff
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-16 19:30:04 -04:00
Andre Guedes 7c956d2ece drivers: Replace DEV_FAIL by -EIO
This patch replaces all occurences of the macro DEV_FAIL by -EIO
at the driver level. So this patch touch the files under drivers/,
include/ and samples/drivers/ when applicable.

This patch is part of the effort to transition from DEV_* codes to
errno.h codes.

Change-Id: I0594ab5dbe667e074c250129e7c13ce512ac940f
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-16 19:30:04 -04:00
Andre Guedes 024cfe754e drivers: Replace DEV_OK by 0
This patch replaces all occurences of the macro DEV_OK by the actual
value 0 at the driver level. So this patch touch the files under
drivers/, include/ and samples/drivers/.

This patch is part of the effort to transition from DEV_* codes to
errno.h codes.

Change-Id: I69980ecb9755f2fb026de5668ae9c21a4ae62d1e
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-03-16 19:30:04 -04:00
Johan Hedberg 092289ffb5 flash: Use off_t for offset parameters
Now that the internal libc has the off_t type it's the natural choice
for the offset parameters in the flash API.

Change-Id: I69999999625b46634f6d3008fe1b3f82c17d357c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-03-11 01:09:56 +00:00
Johan Hedberg a82ed2d905 flash: Reorder data & len parameters
This makes the ordering consistent e.g. with SPI, Bluetooth and
Networking APIs. This also follows the order of parameters in the
POSIX read/write APIs.

Change-Id: I4f11c8c90ccadf176d79f6a7bbd98aac61c26cf5
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-03-10 23:29:22 +00:00
Johan Hedberg d625e920f8 flash: Use size_t & void * for the read/write parameters
size_t is the natural type for any integer that describes a number of
bytes. For the actual data use void pointers to avoid callers having
to do explicit typecasts if the data doesn't originate in a uint8_t
array. Also use a const pointer for writing to avoid typecasts for
data that originates in a const location.

Change-Id: Idbfc14b2d61ca6189411b211c3727f857dbd4059
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-03-10 23:29:12 +00:00
Baohong Liu f3da05f4cb drivers: WinBond SPI flash support
SPI flash sub-driver to support WinBond SPI flash.
It is based on the generic flash driver framework.

Change-Id: I58202e38445a052fa0556b03f854e75ef836e2dd
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-03-07 19:07:50 +00:00
Baohong Liu 29c8f95ec4 drivers: framework for a generic flash driver
The framework for a generic flash driver.

Change-Id: I030eb6d88338f4d6611fc6e5cae42ac586cfdb12
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-03-07 16:13:15 +00:00