On Tue, Sep 14, 2010 at 03:59:49AM +0200, Carl-Daniel Hailfinger wrote:
SPI bitbanging on devices which speak SPI natively has a dual-use problem: We need to shut down normal SPI operations to do the bitbanging ourselves. Once we're done, it makes a lot of sense to reenable "normal" SPI operations again. Add request_bus/release_bus functions to struct bitbang_spi_master. Add a bitbang shutdown function (not used yet). Change MCP SPI and Intel NIC SPI to use the new request/release bus infrastructure.
There are multiple possible strategies for bus request/release:
- Request at the start of a SPI command, release immediately afterwards.
- Request at the start of a SPI multicommand, release once all commands
of the multicommand are done.
- Request on programmer init, release on shutdown.
Each strategy has its own advantages. For now, we will stay with the first strategy which worked fine so far.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Acked-by: Uwe Hermann uwe@hermann-uwe.de
int bitbang_spi_init(const struct bitbang_spi_master *master, int halfperiod) { /* BITBANG_SPI_INVALID is 0, so if someone forgot to initialize ->type, @@ -61,19 +73,44 @@ */ if (!master || master->type == BITBANG_SPI_INVALID || !master->set_cs || !master->set_sck || !master->set_mosi || !master->get_miso) {
msg_perr("Incomplete bitbanging SPI master setting! Please "
"report a bug at flashrom@flashrom.org\n");
msg_perr("Incomplete SPI bitbang master setting! "
"Please report a bug at flashrom@flashrom.org\n");
Replace "! " with "!\n" please to make the output fit in 80 chars/line. Ditto for a few other msg_* functions below.
Or maybe "Incomplete SPI bitbang master setting, please report a bug!", not sure if we need to mention the email address every time, it's listed in the manpage and also not hard to find out anyway.
Uwe.