Commit Graph

21 Commits

Author SHA1 Message Date
Georgij Cernysiov e6ec77a243 drivers: flash: spi_nor: adds missing PP and Read cmd defines
Adds:
* PP and Read 4-Byte command defines
* PP 1-1-2 define
* Missing 1-2-2 (0xBB) and Read Fast (0x0B) command defines

Re-arranges the commands so that they stay in order.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-06-16 10:29:15 +02:00
Georgij Cernysiov b43741cd5d drivers: flash: spi_nor: add SR3 read and write defines
Adds Status Register 3 read and write opcode defines.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-13 08:44:54 -07:00
Georgij Cernysiov 22c8022b54 drivers: falsh: spi_nor: add PP_1_1_4 and rename 4PP
* Renames 4PP define to PP_1_4_4
* Adds PP_1_1_4 define

That matches linux kernel defines a bit more.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-13 08:44:54 -07:00
Georgij Cernysiov 78ecf65267 drivers: flash: spi_nor: remove not used QE bit define
Removes unused QE bit define.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-13 08:44:54 -07:00
Francois Ramu 5b029377ab drivers: flash: spi nor header includes definition for OSPI commands
With the introduction of the OSPI NOR flash controller
more octal commands and parameters are defined.
It completes the existing SPI commands

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-05-12 14:56:25 -05:00
Gerard Marull-Paretas fb60aab245 drivers: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all drivers to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 19:58:21 +02:00
Zack Cornelius 790e2bdb02 drivers: nrf_qspi_nor: Add support for S2B1 QER
Add support for S2B1 quad-enable-requirements.
Add wrsr call for various QER modes

S2B1v6 mode tested with Winbond W25Q128JV series and pp4o and read4io
commands.

Signed-off-by: Zack Cornelius <zcornelius@securityesys.com>
2022-03-24 14:54:05 +01:00
Lukasz Majewski 5599f1b3ab qspi: stm32: Add support for 4 IO read and program (4READ/4PP)
This change provides support for 4 IO read (via 4READ command) and
program (via 4PP). Flash memory pins SIO[0123], CLK and CS are used.

All of them are controlled by stm32 QSPI IP block.

The instruction code for fast reading as well as number of latency
cycles required are read from SFDP structure provided by flash memory.
The number of required read latency cycles when performing reading
is the sum of SPI-NOR memory mode bits and wait states (also named
as 'dummy cycles').

It also has been assumed that memory, which supports fast read (4READ),
also will support fast programming (4PP command) as this information is
not available in SFDP.

One also need to enable the QUAD IO support in board's device tree by
defining 'spi-bus-width = <4>' property. It is required as it may
happen that not all QSPI dedicated pins are used (for example only two
of them are available).

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2022-01-04 20:47:29 -05:00
Lukasz Majewski c1b60e7fb6 qspi: stm32: Add code to switch flash memory to use 4 SIO pins
For proper operation of QUADSPI IP block, both sides of communication;
NOR flash memory and STM32 controller need to support 4 IO
transmission.

After this change the QSPI stm32 driver is able to program NOR flash
memory to switch itself to use all 4 IO lines (SIO[0123]) to transmit
and receive data.

The QE bit (in SPI-NOR's Status Register) is the non-volatile one, so
setting it is done only once (at first boot of the device).

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2022-01-04 20:47:29 -05:00
Lukasz Majewski 029f49fc99 spi: Provide definition for SPI-NOR flash memory control register
This commit provides define for reading the control register (CR) on
the flash memory.
In that register the information about 4B addressing is stored.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2022-01-04 20:47:29 -05:00
Peter Bigot c26cdb7409 drivers: flash: spi-nor: add support for 4-byte addressing
Add a function that uses the JESD216 SFDP BFP DW16 Enter 4-Byte
Addressing parameter to put the device into 4-byte addressing mode if
one of the entry modes that's supported by the driver is available on
the device.

Perform the transition if SFDP data is provided (either by devicetree
or at runtime), or if a special devicetree property provides the entry
mode descriptor.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-04-27 14:21:15 +02:00
Peter A. Bigot 810920f8d5 drivers: flash: spi_nor: read erase support and page size from SFDP
Use the new SFDP infrastructure to read the supported erase type sizes
and commands from the Basic Flash Parameters block.  This removes the
need for explicit reference to most block sizes from this driver.

We're also seeing devices where the page size is not 256 bytes.
Accommodate them.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-08-17 13:38:14 -04:00
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
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 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
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
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
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
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 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
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