[U-Boot] [PATCH] Improve DaVinci SPI speed

Wolfgang Denk wd at denx.de
Fri May 21 15:13:53 CEST 2010


Dear Delio Brignoli,

In message <25096244-C685-4D68-BBF9-6DF2F154AFB8 at 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.


More information about the U-Boot mailing list