[U-Boot] [PATCH v2] spi: add new driver for OpenCores tiny_spi

Wolfgang Denk wd at denx.de
Mon Jan 17 22:23:22 CET 2011


Dear Thomas Chou,

In message <1294626279-8601-1-git-send-email-thomas at wytron.com.tw> you wrote:
> This patch adds support for OpenCores tiny_spi.
> 
> http://opencores.org/project,tiny_spi
> 
> Signed-off-by: Thomas Chou <thomas at wytron.com.tw>
> ---
> for u-boot
> v2, use const and clean up as Mike suggested.
...
> +void spi_cs_activate(struct spi_slave *slave)
> +{
> +	struct tiny_spi_slave *tiny_spi = to_tiny_spi_slave(slave);
> +	unsigned int cs = slave->cs;
> +	gpio_set_value(cs, tiny_spi->flg);
> +	debug("%s: SPI_CS_GPIO:%x\n", __func__, gpio_get_value(cs));
> +}

Please separate declartations and code with a blank line. Please fix
globally.

...
> +int spi_claim_bus(struct spi_slave *slave)
> +{
> +	struct tiny_spi_slave *tiny_spi = to_tiny_spi_slave(slave);
> +	const struct tiny_spi_host *host = tiny_spi->host;
> +	debug("%s: bus:%i cs:%i\n", __func__, slave->bus, slave->cs);
> +	gpio_direction_output(slave->cs, !tiny_spi->flg);
> +	writel(tiny_spi->mode, host->base + TINY_SPI_CONTROL);
> +	writel(tiny_spi->baud, host->base + TINY_SPI_BAUD);

Please do not use base + offset notation.  Use a proper C struct
instead.  Please fix globally.


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
A conservative is a man who believes that nothing should be done for
the first time.                                   - Alfred E. Wiggam


More information about the U-Boot mailing list