| Age | Commit message (Collapse) | Author |
|
The stm_is_locked_sr() function is picked from Linux kernel. For reason
unknown, the 64bit data types used by the function and present in Linux
were replaced with 32bit unsigned ones, which causes trouble.
The testcase performed was done using ST M25P80 chip.
The command used was:
=> sf protect unlock 0 0x10000
The call chain starts in stm_unlock(), which calls stm_is_locked_sr()
with negative ofs argument. This works fine in Linux, where the "ofs"
is loff_t, which is signed long long, while this fails in U-Boot, where
"ofs" is u32 (unsigned int). Because of this signedness problem, the
expression past the return statement to be incorrectly evaluated to 1,
which in turn propagates back to stm_unlock() and results in -EINVAL.
The correction is very simple, just use the correctly sized data types
with correct signedness in the function to make it work as intended.
Signed-off-by: Marek Vasut <[email protected]>
Cc: Simon Glass <[email protected]>
Reviewed-by: Jagan Teki <[email protected]>
|
|
When an error number is provided we should use it, not change it. This fixes
the SPI and SPI flash tests.
One of these is long-standing. The other seems to have been introduced by
commit 1e90d9fd (sf: Move read_id code to sf_ops).
Signed-off-by: Simon Glass <[email protected]>
Fixes: 1e90d9fd (sf: Move read_id code to sf_ops)
Reviewed-by: Jagan Teki <[email protected]>
Tested-by: Jagan Teki <[email protected]>
|
|
We must not free data that is managed by driver mode. Remove this line,
which is a hangover from the pre-driver-model code.
This fixes a problem where 'sf probe' crashes U-Boot if the backing file
for the SPI flash cannot be found.
Signed-off-by: Simon Glass <[email protected]>
Reviewed-by: Jagan Teki <[email protected]>
Tested-by: Jagan Teki <[email protected]>
Reviewed-by: Tom Rini <[email protected]>
|
|
Add a little more debugging to help when things go wrong.
Signed-off-by: Simon Glass <[email protected]>
Reviewed-by: Jagan Teki <[email protected]>
Tested-by: Jagan Teki <[email protected]>
|
|
Add dma memcpy api to the default spi_flash_copy_mmap(), so that
dma will be used to copy data when CONFIG_DMA is defined for the
platform.
Signed-off-by: Mugunthan V N <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
Reviewed-by: Jagan Teki <[email protected]>
|
|
This function currently searches the entire device tree for a node that
it thinks is relevant. But the node is known and is passed in. Correct the
code and enable it only with driver model, since only driver-model boards
will use it.
This avoids bringing in a large number of strings from fdtdec.
Signed-off-by: Simon Glass <[email protected]>
|
|
For SPL we don't really need sprintf() and with tiny-printf this is not
available. Allow this to be dropped in SPL when using tiny-printf.
Signed-off-by: Simon Glass <[email protected]>
|
|
SLOW, FAST, DUAL, DUAL_IO, QUAD, QUAD_IO changed order to
SLOW, FAST, DUAL, QUAD, DUAL_IO, QUAD_IO
Cc: Simon Glass <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Siva Durga Prasad Paladugu <[email protected]>
Tested-by: Jagan Teki <[email protected]>
Reviewed-by: Bin Meng <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
|
|
Since spi rx mode macro's are renamed to simple and
meaninfull, this patch will rename the respective
structure members.
Cc: Simon Glass <[email protected]>
Cc: Bin Meng <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Siva Durga Prasad Paladugu <[email protected]>
Tested-by: Mugunthan V N <[email protected]>
Tested-by: Jagan Teki <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
|
|
While setting quad bit on spansion, macronix code
is writing only particular quad bit this may give
wrong functionality with other register bits,
So this patch fix the issue where it with write
previous read reg status along particular quad bit.
Cc: Vignesh R <[email protected]>
Cc: Mugunthan V N <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Bin Meng <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Siva Durga Prasad Paladugu <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
|
|
One macronix quad bit set using SR, it's good to
read back and check the written bit and also if
it's already been set check for the bit and return.
Cc: Vignesh R <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Bin Meng <[email protected]>
Tested-by: Mugunthan V N <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
|
|
One spansion quad bit set using CR, it's good to
read back and check the written bit and also if
it's already been set check for the bit and return.
Cc: Vignesh R <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Bin Meng <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Siva Durga Prasad Paladugu <[email protected]>
Tested-by: Mugunthan V N <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
|
|
Setting up quad bit for micron devices need to do the
same way as other flash devices like spansion, winbond
etc does using enhanced volatile config register so this
patch adds this support instead of printing "QEB is volatile"
Cc: Simon Glass <[email protected]>
Cc: Bin Meng <[email protected]>
Cc: Peter Pan <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Siva Durga Prasad Paladugu <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
|
|
Used BIT macro like 1 << nr as BIT(nr) where nr is 0...n
Reviewed-by: Bin Meng <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
|
|
- Tab space
- Place all read commands at one place.
- Re-arrange write commands.
Reviewed-by: Bin Meng <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
|
|
Use direct call to device_remove instead of exctra
spi_flash_remove defination.
Reviewed-by: Simon Glass <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
|
|
bar_end gives more meaningfull compared to bank_end and
spi_flash_write_bar uses bar_end so replaced bank_end with
bar_end in spi_flash_read_bar
Signed-off-by: Jagan Teki <[email protected]>
|
|
Since quad_mode functions are local to spi flash core,
rename them to a meaningful and readable names.
Signed-off-by: Jagan Teki <[email protected]>
|
|
Since spi_read_cmds_array is used locally in
spi_flash_scan, so move array to locally used
function instead of defining global array.
Tested-by: Jagan Teki <[email protected]>
Reviewed-by: Bin Meng <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
|
|
Since SPI_TX_* are spi_slave{} members so use spi protocol
notation instead spi flash programming, like
SPI_TX_BP => SPI_TX_BYTE
SPI_TX_QPP => SPI_TX_QUAD
Cc: Simon Glass <[email protected]>
Tested-by: Jagan Teki <[email protected]>
Tested-by: Bin Meng <[email protected]>
Reviewed-by: Bin Meng <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
|
|
Used mode member from spi_slave{} instead of op_mode_tx.
Cc: Simon Glass <[email protected]>
Tested-by: Jagan Teki <[email protected]>
Tested-by: Bin Meng <[email protected]>
Reviewed-by: Bin Meng <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
|
|
For better code readabilty, get the spi pointer from
spi_flash{} locally and use it instead of direct
dereferring spi pinter as flash->spi->*
Tested-by: Jagan Teki <[email protected]>
Tested-by: Bin Meng <[email protected]>
Reviewed-by: Bin Meng <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
|
|
stm_is_locked_sr() takes the status register (SR) value as the last
parameter, not the second.
Based on a patch from Brian Norris for the linux kernel:
http://git.infradead.org/linux-mtd.git/commit/a32d5b726ff8cf32bf491522b0ac8ae2545a063e
Signed-off-by: Fabio Estevam <[email protected]>
Reviewed-by: Jagan Teki <[email protected]>
|
|
Since all spi-flash core operations are moved into
sf_ops.c then it's better to renamed as spi-flash.c
Reviewed-by: Bin Meng <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
|
|
Used static for file-scope functions in sf_probe.c
Reviewed-by: Bin Meng <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
|
|
Since spi_slave is a spi pointer in spi_flash{} then assign
spi_slave{} pointer to flash->spi and remove spi_slave
pointer argument to
- spi_flash_probe_slave
- spi_flash_scan
Tested-by: Jagan Teki <[email protected]>
Tested-by: Bin Meng <[email protected]>
Reviewed-by: Bin Meng <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
|
|
For assigning read_bar commands in spansion case, break
is missing this patch add that break.
Reviewed-by: Simon Glass <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
|
|
SST parts added on sf_params.c supports both SST_WR which consits
of both BP and WP and there is a spi controller ich which supports
only BP so the relevent _write hook set based on "slave->op_mode_tx"
hence there is no respective change required from flash side hance
removed these.
Tested-by: Bin Meng <[email protected]>
Reviewed-by: Bin Meng <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
|
|
Removed unneeded header includes in sf_ops and sf_probe
Reviewed-by: Bin Meng <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
|
|
Using macro's for flash power up read-only access code
leads wrong behaviour hence use idcode0 for runtime
detection, hence the flash which require this functionality
gets detected at runtime.
Tested-by: Jagan Teki <[email protected]>
Reviewed-by: Bin Meng <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
|
|
Most of the register access function are static,
so used simple name to represent each.
Tested-by: Jagan Teki <[email protected]>
Reviewed-by: Bin Meng <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
|
|
This patch removes unneeded ifdef and fixed accordingly.
Reviewed-by: Bin Meng <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
|
|
Use static for file-scope functions and removed
them from header files.
Tested-by: Jagan Teki <[email protected]>
Reviewed-by: Bin Meng <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
|
|
- Move bar read code below the bar write hance both
at once place, hence it easy for #ifdef macro only
once and readable.
- Move read_cmd_array at top
Tested-by: Jagan Teki <[email protected]>
Reviewed-by: Bin Meng <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
|
|
read_id code is related to spi_flash stuff
hence moved to sf_ops.
Tested-by: Jagan Teki <[email protected]>
Tested-by: Bin Meng <[email protected]>
Reviewed-by: Bin Meng <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
|
|
Intension is that sf_ops should deals all spi_flash
related stuff and sf_probe (which should renamed future)
should be an interface layer for spi_flash versus spi drivers.
sf_ops => spi_flash interface
sf_probe => interface layer vs spi_flash(sf_probe) to spi drivers
Tested-by: Jagan Teki <[email protected]>
Tested-by: Bin Meng <[email protected]>
Reviewed-by: Bin Meng <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
|
|
Rename spi_flash_validate_params to spi_flash_scan
as this code not only deals with params setup but
also configure all spi_flash attributes.
And also moved all flash related code into
spi_flash_scan for future functionality addition.
Tested-by: Jagan Teki <[email protected]>
Tested-by: Bin Meng <[email protected]>
Reviewed-by: Bin Meng <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
|
|
|
|
It is follow up patch based on
"dm: Add support for all targets which requires MANUAL_RELOC"
(sha1: 484fdf5ba058b07be5ca82763aa2b72063540ef3)
to update function pointers for DM.
Using post_bind is not ideal but it is one on current option what can be
used. Variable reloc_done has to be used do not call relocation after
every bind. Maybe new core functions should be introduced for this case.
Signed-off-by: Michal Simek <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
|
|
Make spl_*_load_image() functions return a value instead of
hanging if a problem is encountered. This enables main spl code
to make the decision whether to hang or not, thus preparing
it to support alternative boot devices.
Some boot devices (namely nand and spi) do not hang on error.
Instead, they return normally and SPL proceeds to boot the
contents of the load address. This is considered a bug and
is rectified by hanging on error for these devices as well.
Signed-off-by: Nikita Kiryanov <[email protected]>
Cc: Igor Grinberg <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Ian Campbell <[email protected]>
Cc: Hans De Goede <[email protected]>
Cc: Albert Aribaud <[email protected]>
Cc: Jagan Teki <[email protected]>
Reviewed-by: Tom Rini <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
|
|
flash->flags for SST flash should be updated for both DM and non-DM
flash drivers.
Signed-off-by: Bin Meng <[email protected]>
Reviewed-by: Jagan Teki <[email protected]>
|
|
We should check the return value from spi_flash_cmd_read_status() and
propagate it in the case of error.
This fixes a defect caught by Coverity.
Reported-by: Tom Rini <[email protected]>
Signed-off-by: Fabio Estevam <[email protected]>
Reviewed-by: Jagan Teki <[email protected]>
|
|
SST SPI NOR flash has the same locking programming bits
as ST Micro - added support for it.
Signed-off-by: Fabio Estevam <[email protected]>
[Minor change on commit message]
Signed-off-by: Jagan Teki <[email protected]>
Reviewed-by: Jagan Teki <[email protected]>
|
|
The relevent boards which used this driver got zapped
in previous release and the driver is never used in the
code and also it doesn't use/do any spi-flash operations.
Commit details for relevent removed boards:
"ARM: at91: remove non-generic boards"
(sha1: f6b42c140387589ded24749781ce565571092eac)
Cc: Tom Rini <[email protected]>
Cc: Albin Tonnerre <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
|
|
commit c3c016c "sf: Add SPI NOR protection mechanism" introduced
flash_lock()/flash_unlock()/flash_is_locked() methods for SPI flash,
but not every flash driver supplies these. We should test these
methods against NULL before actually calling them.
Signed-off-by: Bin Meng <[email protected]>
Reviewed-by: Fabio Estevam <[email protected]>
Reviewed-by: Jagan Teki <[email protected]>
|
|
Many SPI flashes have protection bits (BP2, BP1 and BP0) in the
status register that can protect selected regions of the SPI NOR.
Take these bits into account when performing erase operations,
making sure that the protected areas are skipped.
Tested on a mx6qsabresd:
=> sf probe
SF: Detected M25P32 with page size 256 Bytes, erase size 64 KiB, total 4 MiB
=> sf protect lock 0x3f0000 0x10000
=> sf erase 0x3f0000 0x10000
offset 0x3f0000 is protected and cannot be erased
SF: 65536 bytes @ 0x3f0000 Erased: ERROR
=> sf protect unlock 0x3f0000 0x10000
=> sf erase 0x3f0000 0x10000
SF: 65536 bytes @ 0x3f0000 Erased: OK
Signed-off-by: Fabio Estevam <[email protected]>
[re-worked to fit the lock common to dm and non-dm]
Signed-off-by: Jagan Teki <[email protected]>
Reviewed-by: Tom Rini <[email protected]>
Reviewed-by: Heiko Schocher <[email protected]>
Reviewed-by: Jagan Teki <[email protected]>
|
|
Add the SPI NOR protection mechanism from the kernel.
This code is based on the work from
Brian Norris <[email protected]>
Here is the commit details:
"mtd: spi-nor: refactor block protection functions"
(sha1: 62593cf40b23b523b9fc9334ca61ba6c595ebb09)
Signed-off-by: Fabio Estevam <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
Reviewed-by: Tom Rini <[email protected]>
Reviewed-by: Heiko Schocher <[email protected]>
Reviewed-by: Jagan Teki <[email protected]>
Signed-off-by: Fabio Estevam <[email protected]>
|
|
|
|
This patch adds flag status register reading support to
spi_flash_cmd_wait_ready.
Cc: Simon Glass <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Siva Durga Prasad Paladugu <[email protected]>
Cc: Stefan Roese <[email protected]>
Cc: Tom Warren <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Hou Zhiqiang <[email protected]>
Tested-by: Jagan Teki <[email protected]>
Tested-by: Bin Meng <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
|
|
Current flash wait_ready logic is not modular to add new
register status check, hence updated the status check for
adding few more register checks in future.
Below are the sf speed runs with 'sf update' on whole flash, 16MiB.
=> sf update 0x100 0x0 0x1000000
device 0 whole chip
16777216 bytes written, 0 bytes skipped in 59.564s, speed 289262 B/s
=> sf update 0x100 0x0 0x1000000
device 0 whole chip
16777216 bytes written, 0 bytes skipped in 62.549s, speed 275036 B/s
=> sf update 0x100 0x0 0x1000000
device 0 whole chip
16777216 bytes written, 0 bytes skipped in 61.276s, speed 284359 B/s
Cc: Simon Glass <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Siva Durga Prasad Paladugu <[email protected]>
Cc: Stefan Roese <[email protected]>
Cc: Tom Warren <[email protected]>
Cc: Tom Rini <[email protected]>
Tested-by: Jagan Teki <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
Tested-by: Bin Meng <[email protected]>
|