linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: shc_work@mail.ru (Alexander Shiyan)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 3/3] can: mcp251x: Allow tuning SPI mode and limit maximal SPI speed
Date: Mon, 19 Aug 2013 15:39:21 +0400	[thread overview]
Message-ID: <1376912361-22133-3-git-send-email-shc_work@mail.ru> (raw)
In-Reply-To: <1376912361-22133-1-git-send-email-shc_work@mail.ru>

Patch allow to use different mode settings for SPI (MODE3 for example)
and limit maximal speed according to IC datasheet.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/net/can/mcp251x.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c
index a48d3df..c08edc7 100644
--- a/drivers/net/can/mcp251x.c
+++ b/drivers/net/can/mcp251x.c
@@ -1082,7 +1082,11 @@ static int mcp251x_can_probe(struct spi_device *spi)
 	SET_NETDEV_DEV(net, &spi->dev);
 
 	/* Configure the SPI bus */
-	spi->mode = SPI_MODE_0;
+	spi->mode = spi->mode ? : SPI_MODE_0;
+	if (mcp251x_is_2510(spi))
+		spi->max_speed_hz = spi->max_speed_hz ? : 5 * 1000 * 1000;
+	else
+		spi->max_speed_hz = spi->max_speed_hz ? : 10 * 1000 * 1000;
 	spi->bits_per_word = 8;
 	spi_setup(spi);
 
-- 
1.8.1.5

  parent reply	other threads:[~2013-08-19 11:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-19 11:39 [PATCH v2 1/3] can: mcp251x: Replace power callbacks with regulator API Alexander Shiyan
2013-08-19 11:39 ` [PATCH v2 2/3] can: mcp251x: Eliminate irq_flags from driver platform_data Alexander Shiyan
2013-08-20  8:58   ` Marc Kleine-Budde
2013-08-19 11:39 ` Alexander Shiyan [this message]
2013-08-20  8:59   ` [PATCH v2 3/3] can: mcp251x: Allow tuning SPI mode and limit maximal SPI speed Marc Kleine-Budde
2013-08-20  8:46 ` [PATCH v2 1/3] can: mcp251x: Replace power callbacks with regulator API Marc Kleine-Budde

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=1376912361-22133-3-git-send-email-shc_work@mail.ru \
    --to=shc_work@mail.ru \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).