Hello,
I'm having problems accessing spi nor flash using u-boot console. Write/read operations are failing unless data size is small.
=> sf probe
SF: Detected W25Q16JV with page size 256 Bytes, erase size 64 KiB, total 2 MiB
=> sf erase 0 0x200000
SF: 2097152 bytes @ 0x0 Erased: OK
=> mw.b 0x00900000 0x0 0x20000
=> mtest 0x00900000 0x0090ffff 0x12345678 0x1
Testing 00900000 ... 0090ffff:
Pattern 12345678 Writing... Reading...Tested 1 iteration(s) with 0 errors.
=>
Write operation:
=> sf write 0x00900000 0x0 0x1000
device 0 offset 0x0, size 0x1000
SF: 4096 bytes @ 0x0 Written: OK
=>

I don't know why this behavior. SPI signal levels should not decrease like that.
Read operation:
=> sf read 0x00910000 0x0 0x1000
device 0 offset 0x0, size 0x1000
SF: 4096 bytes @ 0x0 Read: OK
=>


Comapare OCRAM write buffer vs OCRAM read buffer:
=> cmp 0x00900000 0x00910000 0x1000
word at 0x00900100 (0x123456b8) != word at 0x00910100 (0xffffffff)
Total of 64 word(s) were the same
=>
64 words are ok, the rest not.
Spi nor pads are configured this way:
#ifdef CONFIG_SYS_USE_SPINOR
static iomux_v3_cfg_t const ecspi1_pads[] = {
_MX6_PAD_CSI_DATA06__ECSPI1_MOSI | MUX_PAD_CTRL(SPI_PAD_CTRL),
_MX6_PAD_CSI_DATA04__ECSPI1_SCLK | MUX_PAD_CTRL(SPI_PAD_CTRL),
_MX6_PAD_CSI_DATA07__ECSPI1_MISO | MUX_PAD_CTRL(SPI_PAD_CTRL),
/* CS Pin */
_MX6_PAD_CSI_DATA05__GPIO4_IO26 | MUX_PAD_CTRL(NO_PAD_CTRL),
};
static void setup_spinor(void)
{
imx_iomux_v3_setup_multiple_pads(ecspi1_pads, ARRAY_SIZE(ecspi1_pads));
gpio_direction_output(IMX_GPIO_NR(4, 26), 0);
}
Best regards
Carlos