diff mbox

[v2,3/3] can: mcp251x: Allow tuning SPI mode and limit maximal SPI speed

Message ID 1376912361-22133-3-git-send-email-shc_work@mail.ru (mailing list archive)
State New, archived
Headers show

Commit Message

Alexander Shiyan Aug. 19, 2013, 11:39 a.m. UTC
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(-)

Comments

Marc Kleine-Budde Aug. 20, 2013, 8:59 a.m. UTC | #1
On 08/19/2013 01:39 PM, Alexander Shiyan wrote:
> 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>

Applied to linux-can-next/testing

tnx,
Marc
diff mbox

Patch

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);