[PATCH 2/2] imx25: imx_spi: support CSPI v0.7 as found on i.MX25
Sascha Hauer
s.hauer at pengutronix.de
Mon Sep 12 06:21:25 EDT 2011
On Tue, Aug 30, 2011 at 10:30:51AM +0400, Paul Fertser wrote:
> +
> +#if 0
> +/* MX1, MX31, MX35, MX51 CSPI */
> +static unsigned int spi_imx_clkdiv_2(unsigned int fin,
> + unsigned int fspi)
> +{
> + int i, div = 4;
> +
> + for (i = 0; i < 7; i++) {
> + if (fspi * div >= fin)
> + return i;
> + div <<= 1;
> + }
> +
> + return 7;
> +}
> +#endif
> +
> +static void cspi_0_7_chipselect(struct spi_device *spi, int is_active)
> +{
> + struct spi_master *master = spi->master;
> + struct imx_spi *imx = container_of(master, struct imx_spi, master);
> + void __iomem *base = imx->regs;
> + unsigned int cs = 0;
> + int gpio = imx->cs_array[spi->chip_select];
> + unsigned int reg = CSPI_0_7_CTRL_ENABLE | CSPI_0_7_CTRL_MASTER;
> +
> + if (spi->mode & SPI_CS_HIGH)
> + cs = 1;
> +
> + if (!is_active) {
> + if (gpio >= 0)
> + gpio_set_value(gpio, !cs);
> + return;
> + }
> +
> +#if 0
> + reg |= spi_imx_clkdiv_2(166000000, spi->max_speed_hz) <<
> + CSPI_0_7_CTRL_DR_SHIFT;
> +#endif
> + reg |= 7 << CSPI_0_7_CTRL_DR_SHIFT; /* slowest speed */
Can we fix this before merging it? Are there any problems with faster
speeds?
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list