mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Paul Fertser <fercerpav@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 2/2] imx25: imx_spi: support CSPI v0.7 as found on i.MX25
Date: Mon, 12 Sep 2011 12:21:25 +0200	[thread overview]
Message-ID: <20110912102125.GS31404@pengutronix.de> (raw)
In-Reply-To: <6a487d727c7d0e29b35276f5780fd91e116f79d8.1314685868.git.fercerpav@gmail.com>

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 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2011-09-12 10:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-30  6:20 [PATCH 1/2] imx_spi: rework transfer according to the API, fix compatibility with spi_write_then_read() Paul Fertser
2011-08-30  6:30 ` [PATCH 2/2] imx25: imx_spi: support CSPI v0.7 as found on i.MX25 Paul Fertser
2011-09-12 10:21   ` Sascha Hauer [this message]
2011-08-30  6:30     ` [PATCH] " Paul Fertser
2011-09-12 10:20 ` [PATCH 1/2] imx_spi: rework transfer according to the API, fix compatibility with spi_write_then_read() Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110912102125.GS31404@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=fercerpav@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox