Access SPI eeprom from u-boot
Hi All,
We are using imx6q based customize board for our product. In our board we have SPI EEPORM (Part number :25AA010A). We are able to operate SPI EEPROM from kernel space. We don't have any issue.
Now we want to use same SPI EEPROM from u-boot level. I tried to to access it using "sspi" command on u-boot but didn't succeed. Every time I got below error :
sspi [<bus>:]<cs>[.<mode>] <bit_len> <dout> - Send and receive bits
<bus> - Identifies the SPI bus
<cs> - Identifies the chip select
<mode> - Identifies the SPI mode to use
<bit_len> - Number of bits to send (base 10)
<dout> - Hexadecimal string that gets sent
=> sspi 1:0.0 8 3
pre_div = 14, post_div=2
reg_ctrl = 0xe2f1
reg_config = 0x0
spi_xchg_single: bitlen 8 dout 0x8ffa5044 din 0x8ffa5064
Sending SPI 0x30
spi_xchg_single: Timeout!
Error -5 during SPI transaction
Here I have two concerns why it is showing 0x30 even though I write 3 only.
Doesn't matter whatever I write it always shows timeout error.
Can we use this utility as reference to read/write spi eeprom?
I would appreciate if anyone can suggest any other reference code that we can use.
Has any one previously use SPI from u-boot to access SPI slave?
Any suggestion or pointers would be appreciated.
As we have produce demo on 12th April 2016 this is bit crucial for us.
Thanks,
Jemish


Hi Jemish
seems sspi is not working with i.MX as also noted on
https://community.freescale.com/thread/316920
One can use similar codes as for spi-nor, which is supported on
Sabre schematic spf-27392. spi-nor pin definitions are defined in
in ..board/freescale/mx6sabresd/mx6sabresd.c
Supported parts (spi-nor ID) in ..drivers/mtd/spi/sf_params.c
Use uboot command : sf probe, read, write, erase
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Igor,
Thanks for you prompt response!
I tried to use sf probe utility.
I would like to know is there any hardcoding in u-boot related to SPI bus 0.
With "sspi" and "sf" commands I am not getting any error if I have give bus : 0 as an argument.
If I give bus : 1 as an argument I am getting timeout error.
Consider output of below two commands:
=> sf probe 1:0 1000000 0
spi_xchg_single: Timeout!
SF: Failed to get idcodes
Failed to initialize SPI flash at 1:0
=> sf probe 0:0 1000000 0
SF: Unsupported flash IDs: manuf 00, jedec 0000, ext_jedec 0000
Failed to initialize SPI flash at 0:0
Now interesting thing is that we don't have connected anything on SPI bus 0 (No pin mux setting for SPI0). We have SPI EEPROM on SPI bus 1.
Still if you look at the output of above two commands , when I use SPI bus 0 it don't give any timeout error.
If I give bus : 1 it is still giving timeout error.
Can you point out what is going wrong here? Same was the case with sspi command.
Thanks,
Jemish
