foss-for-synopsys-dwc-arc-processors / linux

Helpful resources for users & developers of Linux kernel for ARC
22 stars 13 forks source link

SPI flash support in Arc Linux kernel #84

Closed cxh2022 closed 2 years ago

cxh2022 commented 2 years ago

Our hardware has SPI flash and we are enabling SPI flash support in Arc Linux kernel. Do you have any document on how to do this? Thanks.

abrodkin commented 2 years ago

What you're asking about is a very generic thing and explanations on how that could be done you may find in multiple places. Basically you need to enable corresponding subsystems, components & drivers in the Linux kernel configuration an also "describe" your hardware in so-called "device tree".

For your reference here's an example of how we did that for our HSDK platfrom:

  1. Add DW SPI controller: https://github.com/torvalds/linux/commit/aab128d006e709954f2a67b5e27a4c587a0584bd
  2. Add SPI NOR Flash IC: https://github.com/torvalds/linux/commit/8ca8fa7f22dcb0a3265490a690b0c3e27de681f9

Note, this all is very specific to your device. I.e. I don't know what kind of SPI controller do you have on your board and type & vendor of your SPI flash. Depending on that you'll need to use different kernel drivers if they already exist for your hardware or create new drivers if your particular HW is not yet supported.

You may find the following ELCE 2027 talk " Groking the Linux SPI Subsystem" http://events17.linuxfoundation.org/sites/events/files/slides/Groking%20the%20Linux%20SPI%20Subsystem.pdf of some interest as well.

cxh2022 commented 2 years ago

Thanks for the info! It's very helpful. Will looking into it.