summaryrefslogtreecommitdiffstats
path: root/drivers/net/can
diff options
context:
space:
mode:
authorAlexander Shiyan <shc_work@mail.ru>2013-08-19 15:39:21 +0400
committerMarc Kleine-Budde <mkl@pengutronix.de>2013-08-21 09:28:29 +0200
commitb1ef05a5a20afe50d4188a5b59579bd140758cf0 (patch)
treec59d260cdfb3597ba869fac9fd4598eb09fae283 /drivers/net/can
parentae5d589e5f9f3217656ada632869968178886ac6 (diff)
downloadlinux-stable-b1ef05a5a20afe50d4188a5b59579bd140758cf0.tar.gz
linux-stable-b1ef05a5a20afe50d4188a5b59579bd140758cf0.tar.bz2
linux-stable-b1ef05a5a20afe50d4188a5b59579bd140758cf0.zip
can: mcp251x: Allow tuning SPI mode and limit maximal SPI speed
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> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can')
-rw-r--r--drivers/net/can/mcp251x.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c
index ec84ce163608..fe7dd696957e 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);