[U-Boot] [PATCH] spi: add new driver for OpenCores tiny_spi
Mike Frysinger
vapier at gentoo.org
Sun Jan 9 02:44:51 CET 2011
On Saturday, January 08, 2011 18:56:03 Thomas Chou wrote:
> + */
> +#include <common.h>
space between comment and includes
> +#include <asm/gpio.h>
> +#define TINY_SPI_RXDATA 0
space between includes and defines
> +static struct tiny_spi_host tiny_spi_host_list[] =
CONFIG_SYS_TINY_SPI_LIST;
i think you only read this, so you'll want to add "const"
> +__attribute__((weak))
> +int spi_cs_is_valid(unsigned int bus, unsigned int cs)
> +
> +__attribute__((weak))
> +void spi_cs_activate(struct spi_slave *slave)
> +
> +__attribute__((weak))
> +void spi_cs_deactivate(struct spi_slave *slave)
only reason i had these marked weak in the Blackfin SPI driver was because i
didn't support GPIO CS's. now that that's fixed, i dropped the weak markings.
either way is fine of course; just giving some background info.
> + tiny_spi->baud = DIV_ROUND_UP(host->freq, hz * 2) - 1;
> + if (tiny_spi->baud > (1 << host->baudwidth) - 1)
> + tiny_spi->baud = (1 << host->baudwidth) - 1;
might be simpler to use:
tiny_spi->baud = max(DIV_ROUND_UP(host->freq, hz * 2),
(1 << host->baudwidth)) - 1;
otherwise code looks fine
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110108/25ee407c/attachment.pgp
More information about the U-Boot
mailing list