Hello,
I am proposing the introduction of a new programmer type based on Bit-banging SPI using generic GPIO lines that are available on most SoCs. While there is existing support for linux_spi, creating a software-based SPI device using GPIOs currently involves complex configurations with the device-tree or sysfs, which can be quite cumbersome and technical.
I noticed there is a file named bitbang_spi.c within the source that performs similar functionality. It might only be necessary to map the lower layer to the appropriate functions from libgpiod to achieve this and the most complicated may be the parsing of cmdline parameters.
I initially considered writing a patch directly and contributing it to this project. However, given my limited familiarity with the current codebase structure, I am not very confident in my ability to implement this feature without guidance.
Thank you for considering this Request.
Best regards,
Hello Pierre,
Thank you for sharing your idea!
I wanted to ask, which phase is your idea currently? Do you have something working locally, or have you tried?
If you can make something working and share it as a patch, we can then look at it and think of structure etc. The patch doesn't have to be perfect from the very beginning, especially if you are looking for guidance and open to advice and comments. Sometimes patches get transformed a lot during code review.
If you can try to put what's in your head into a code and make it work (your second paragraph)? What do you think?
On Thu, Mar 6, 2025 at 6:46 PM Pierre Colombier pierre@abeille.com wrote:
Hello,
I am proposing the introduction of a new programmer type based on Bit-banging SPI using generic GPIO lines that are available on most SoCs. While there is existing support for linux_spi, creating a software-based SPI device using GPIOs currently involves complex configurations with the device-tree or sysfs, which can be quite cumbersome and technical.
I noticed there is a file named bitbang_spi.c within the source that performs similar functionality. It might only be necessary to map the lower layer to the appropriate functions from libgpiod to achieve this and the most complicated may be the parsing of cmdline parameters.
I initially considered writing a patch directly and contributing it to this project. However, given my limited familiarity with the current codebase structure, I am not very confident in my ability to implement this feature without guidance.
Thank you for considering this Request.
Best regards,
flashrom mailing list -- flashrom@flashrom.org To unsubscribe send an email to flashrom-leave@flashrom.org
Hi,
At this stage, this is still just an idea.
I initially thought I could dive into the Flashrom source code and easily clone/modify an existing bitbang programmer, but the project turned out to be much more complex than I expected, and I got lost navigating through numerous files and trying to guess their purpose.
Could you point me to a file defining one of the simplest existing bitbang SPI programmers? That way, I can use its structure as a reference while just replacing the low-level routines.
Thanks in advance for your help!
Le 17/03/2025 à 13:15, Anastasia Klimchuk a écrit :
Hello Pierre,
Thank you for sharing your idea!
I wanted to ask, which phase is your idea currently? Do you have something working locally, or have you tried?
If you can make something working and share it as a patch, we can then look at it and think of structure etc. The patch doesn't have to be perfect from the very beginning, especially if you are looking for guidance and open to advice and comments. Sometimes patches get transformed a lot during code review.
If you can try to put what's in your head into a code and make it work (your second paragraph)? What do you think?
On Thu, Mar 6, 2025 at 6:46 PM Pierre Colombier pierre@abeille.com wrote:
Hello,
I am proposing the introduction of a new programmer type based on Bit-banging SPI using generic GPIO lines that are available on most SoCs. While there is existing support for linux_spi, creating a software-based SPI device using GPIOs currently involves complex configurations with the device-tree or sysfs, which can be quite cumbersome and technical.
I noticed there is a file named bitbang_spi.c within the source that performs similar functionality. It might only be necessary to map the lower layer to the appropriate functions from libgpiod to achieve this and the most complicated may be the parsing of cmdline parameters.
I initially considered writing a patch directly and contributing it to this project. However, given my limited familiarity with the current codebase structure, I am not very confident in my ability to implement this feature without guidance.
Thank you for considering this Request.
Best regards,
flashrom mailing list -- flashrom@flashrom.org To unsubscribe send an email to flashrom-leave@flashrom.org
Hi Pierre,
Before the begining: I don’t want to disrupt your idea - sorry. My intention is simply to inspire you So, the main thesis is: bitbanging is slow. Within your design, it is even slower. Writing a 128MB flash this way will put you to sleep - I’ve already done it) You are placing the controlling logic too high. Just imagine: your software will take a long journey with every level change - Soft ↔ libgpio ↔ kernel IPC ↔ GPIO controller ↔ GPIO pin. And you have to do this because you need to track error codes. GPIO is slow, especially when controlling multiple pins. With this approach, you must provide an interface that allows the user to configure any GPIO in the system. Otherwise, it will be both impractical and confusing. This means you will need to manage multiple GPIO controllers and synchronize them as well - but it won’t necessarily speed things up.
But even bitbang is useful when you do not have another way to do the job. And you already mentioned the solution. Linux has already bitbang drivers for i2c ( https://www.kernel.org/doc/Documentation/devicetree/bindings/i2c/i2c-gpio.tx... ) and spi( https://www.kernel.org/doc/Documentation/devicetree/bindings/spi/spi-gpio.tx... ). Moreover flashrom has interfaces to work with standard linux buses (though I'm not sure about the status of i2c). As you said you just need to configure them. And I agree that it could be boring. I’m suggesting that it would be great to have a script or a top-level application that configures the system and Flashrom to work with bitbanging through just a few clicks or a simple configuration. For example, the application could detect the system it is running on, check dependencies, generate a device tree (DT) overlay, install it for the next boot, and either provide the necessary command-line instructions or launch Flashrom as needed. This approach might only save 2–3 steps, but those are the slowest ones. But maybe you are talking about not linux devices, so hope you have direct access to gpios there.
Answering your question: pony_spi.c looks like a good example if you’re interested. But you will have to study bitbang_spi.c as well and its register_spi_bitbang_master you need to implement minimum set of function: set_cs, set_sck, set_mosi, get_miso So copy pony, register its as a new programmer in programmers_table.c, cut everything around pony's serial and implement 4 bitbanging functions
Good luck Dmitry
On Sun, Mar 23, 2025 at 8:29 PM Pierre Colombier pierre@abeille.com wrote:
Hi,
At this stage, this is still just an idea.
I initially thought I could dive into the Flashrom source code and easily clone/modify an existing bitbang programmer, but the project turned out to be much more complex than I expected, and I got lost navigating through numerous files and trying to guess their purpose.
Could you point me to a file defining one of the simplest existing bitbang SPI programmers? That way, I can use its structure as a reference while just replacing the low-level routines.
Thanks in advance for your help!
Le 17/03/2025 à 13:15, Anastasia Klimchuk a écrit :
Hello Pierre,
Thank you for sharing your idea!
I wanted to ask, which phase is your idea currently? Do you have something working locally, or have you tried?
If you can make something working and share it as a patch, we can then look at it and think of structure etc. The patch doesn't have to be perfect from the very beginning, especially if you are looking for guidance and open to advice and comments. Sometimes patches get transformed a lot during code review.
If you can try to put what's in your head into a code and make it work (your second paragraph)? What do you think?
On Thu, Mar 6, 2025 at 6:46 PM Pierre Colombier pierre@abeille.com
wrote:
Hello,
I am proposing the introduction of a new programmer type based on Bit-banging SPI using generic GPIO lines that are available on most SoCs. While there is existing support for linux_spi, creating a software-based SPI device using GPIOs currently involves complex configurations with the device-tree or sysfs, which can be quite cumbersome and technical.
I noticed there is a file named bitbang_spi.c within the source that performs similar functionality. It might only be necessary to map the lower layer to the appropriate functions from libgpiod to achieve this and the most complicated may be the parsing of cmdline parameters.
I initially considered writing a patch directly and contributing it to this project. However, given my limited familiarity with the current codebase structure, I am not very confident in my ability to implement this feature without guidance.
Thank you for considering this Request.
Best regards,
flashrom mailing list -- flashrom@flashrom.org To unsubscribe send an email to flashrom-leave@flashrom.org
flashrom mailing list -- flashrom@flashrom.org To unsubscribe send an email to flashrom-leave@flashrom.org