From: Wolfgang Denk Date: Fri, 21 May 2010 15:13:53 +0200 Subject: [U-Boot] [PATCH] Improve DaVinci SPI speed In-Reply-To: <25096244-C685-4D68-BBF9-6DF2F154AFB8@audioscience.com> References: <25096244-C685-4D68-BBF9-6DF2F154AFB8@audioscience.com> Message-ID: <20100521131353.A50F2CCF026@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Delio Brignoli, In message <25096244-C685-4D68-BBF9-6DF2F154AFB8@audioscience.com> you wrote: > Reduce the number of reads per byte transferred on the BUF register from 2 to 1 and > take advantage of the TX buffer in the SPI module. ... > + /* if data is available */ > + if ((i_cnt < len) && (buf_reg_val & SPIBUF_RXEMPTY_MASK) == 0) { > + /* if there is no read buffer simply ignore the read character */ > + if(rxp) { > + *rxp = buf_reg_val & 0xFF; > + rxp++; > + } Please change into: if (rxp) *rxp++ = buf_reg_val & 0xFF; > + if ((o_cnt < len) && ((buf_reg_val & SPIBUF_TXFULL_MASK) == 0)) { > + /* write the data */ > + data1_reg_val &= ~0xFFFF; > + if(txp) { > + data1_reg_val |= *txp; > + txp++; > + } Same here: if (txp) data1_reg_val |= *txp++; Please fix all other occurrences of "if(" into "if (" as well. > + /* write to DAT1 is required to keep the serial transfer going */ > + /* we just terminate when we reach the end */ Incorrect multiline comment style. > + writel(data1_reg_val & > + ~(1 << SPIDAT1_CSHOLD_SHIFT), &ds->regs->dat1); Line too long. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de The software required `Windows 95 or better', so I installed Linux.