linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Performance of spi_mpc83xx.c sucks.
@ 2008-10-21 16:19 Joakim Tjernlund
       [not found] ` <1224605947.14078.17.camel-/EMGr9iCeazgSi9v3i4K4Pmbkio/vSLMs0AfqQuZ5sE@public.gmane.org>
  0 siblings, 1 reply; 15+ messages in thread
From: Joakim Tjernlund @ 2008-10-21 16:19 UTC (permalink / raw)
  To: spi-devel-general

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=/

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2008-12-03  8:56 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-21 16:19 Performance of spi_mpc83xx.c sucks Joakim Tjernlund
     [not found] ` <1224605947.14078.17.camel-/EMGr9iCeazgSi9v3i4K4Pmbkio/vSLMs0AfqQuZ5sE@public.gmane.org>
2008-10-21 18:14   ` Peter Korsgaard
     [not found]     ` <877i81rf2g.fsf-uXGAPMMVk8amE9MCos8gUmSdvHPH+/yF@public.gmane.org>
2008-10-21 18:31       ` Joakim Tjernlund
     [not found]     ` <002f01c933ab$4bee9180$e3cbb480$@Tjernlund@transmode.se>
     [not found]       ` <002f01c933ab$4bee9180$e3cbb480$@Tjernlund-SNLAxHN9vbcOP4wsBPIw7w@public.gmane.org>
2008-11-21  4:10         ` David Brownell
     [not found]           ` <200811202010.30845.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-12-02 15:20             ` Joakim Tjernlund
     [not found]               ` <1228231118.9867.108.camel-/EMGr9iCeazgSi9v3i4K4Pmbkio/vSLMs0AfqQuZ5sE@public.gmane.org>
2008-12-02 16:23                 ` Peter Korsgaard
     [not found]                   ` <87d4gav94h.fsf-uXGAPMMVk8amE9MCos8gUmSdvHPH+/yF@public.gmane.org>
2008-12-02 18:20                     ` Joakim Tjernlund
     [not found]                   ` <040001c954aa$a00e3930$e02aab90$@Tjernlund@transmode.se>
     [not found]                     ` <040001c954aa$a00e3930$e02aab90$@Tjernlund-SNLAxHN9vbcOP4wsBPIw7w@public.gmane.org>
2008-12-02 18:31                       ` David Brownell
     [not found]                         ` <200812021031.26711.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-12-02 18:58                           ` Joakim Tjernlund
     [not found]                         ` <041201c954af$f32ad3d0$d9807b70$@Tjernlund@transmode.se>
     [not found]                           ` <041201c954af$f32ad3d0$d9807b70$@Tjernlund-SNLAxHN9vbcOP4wsBPIw7w@public.gmane.org>
2008-12-02 20:46                             ` David Brownell
     [not found]                               ` <200812021246.27884.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-12-02 22:12                                 ` Joakim Tjernlund
     [not found]                               ` <041e01c954cb$15c0f030$4142d090$@Tjernlund@transmode.se>
     [not found]                                 ` <041e01c954cb$15c0f030$4142d090$@Tjernlund-SNLAxHN9vbcOP4wsBPIw7w@public.gmane.org>
2008-12-03  8:56                                   ` David Brownell
2008-12-02 18:17                 ` David Brownell
     [not found]                   ` <200812021017.11880.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-12-02 18:25                     ` Joakim Tjernlund
     [not found]                   ` <040601c954ab$554cff20$ffe6fd60$@Tjernlund@transmode.se>
     [not found]                     ` <040601c954ab$554cff20$ffe6fd60$@Tjernlund-SNLAxHN9vbcOP4wsBPIw7w@public.gmane.org>
2008-12-02 19:10                       ` David Brownell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).