From: Alexander Shiyan Date: Mon, 19 Aug 2013 11:39:21 +0000 (+0400) Subject: can: mcp251x: Allow tuning SPI mode and limit maximal SPI speed X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b1ef05a5a20afe50d4188a5b59579bd140758cf0;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git 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 Signed-off-by: Marc Kleine-Budde --- 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);