We have noticed that the spi_mpc83xx.c driver is very slow, the gap
between words are huge.
So I started to optimise it and it still sucks.
However, if I poll the SPIE_NF SPIE_NE bits instead it works MUCH
better, like so:
                struct mpc83xx_spi_reg *regs = mpc83xx_spi->base;
                u32 event=SPIE_NF;

                mpc83xx_spi->tx_count -= 1;
                word = mpc83xx_spi->get_tx(mpc83xx_spi);
                mpc83xx_spi_write_reg(&regs->transmit, word);
                if (len >= 2) { /* FIFO is 2 words */
                        mpc83xx_spi->tx_count -= 1;
                        word = mpc83xx_spi->get_tx(mpc83xx_spi);
                        mpc83xx_spi_write_reg(&regs->transmit, word);
                }
                clear_need_resched();
                do {
                        if (event & SPIE_NE) {
                                word = mpc83xx_spi_read_reg(&regs->receive);
                                mpc83xx_spi->rx_count -= 1;
                                if (mpc83xx_spi->rx)
                                        mpc83xx_spi->get_rx(word, mpc83xx_spi);

                                if ((event & SPIE_NF) && mpc83xx_spi->tx_count) 
{
                                        mpc83xx_spi->tx_count -= 1;
                                        word = mpc83xx_spi->get_tx(mpc83xx_spi);
                                        mpc83xx_spi_write_reg(&regs->transmit, 
word);
                                }

                        } else if (need_resched()){
                                clear_need_resched();
                                schedule();
                                printk("Cond, rx:%d\n", mpc83xx_spi->rx_count);
                        }

                        event = mpc83xx_spi_read_reg(&regs->event);
                        } while (mpc83xx_spi->rx_count);

I am not sure what this polling will do to the system though. Is this really 
bad to do?
The resched() stuff doesn't seem to work, probably becase I don't know how
to use it properly :(

 Jocke



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
spi-devel-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spi-devel-general

Reply via email to