Re: mcp251x: probing unreliable, MCP251X_OST_DELAY_MS too low.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

Given we've not found a direct solution and multiple people still have
problems with this, would it be acceptable to expose the delay as a
module parameter for the time being so people experiencing issues can
work around it without having to rebuild the kernel for now?

Patch attached.

Regards,
Andreas Henriksson
>From 2476da179345108909f9722b6d30322904fc987b Mon Sep 17 00:00:00 2001
From: Andreas Henriksson <andreas.henriksson@xxxxxxxxx>
Date: Thu, 24 Jan 2019 19:17:13 +0100
Subject: [PATCH] mcp251x: make reset delay a module parameter

---
 drivers/net/can/spi/mcp251x.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/spi/mcp251x.c b/drivers/net/can/spi/mcp251x.c
index e90817608645..9195f4ca3af3 100644
--- a/drivers/net/can/spi/mcp251x.c
+++ b/drivers/net/can/spi/mcp251x.c
@@ -219,6 +219,10 @@
 
 #define DEVICE_NAME "mcp251x"
 
+static int mcp251x_ost_delay_ms = MCP251X_OST_DELAY_MS;
+module_param(mcp251x_ost_delay_ms, int, 0444);
+MODULE_PARM_DESC(mcp251x_ost_delay_ms, "SPI reset delay in milliseconds");
+
 static int mcp251x_enable_dma; /* Enable SPI DMA. Default: 0 (Off) */
 module_param(mcp251x_enable_dma, int, 0444);
 MODULE_PARM_DESC(mcp251x_enable_dma, "Enable SPI DMA. Default: 0 (Off)");
@@ -630,7 +634,7 @@ static int mcp251x_hw_reset(struct spi_device *spi)
 	int ret;
 
 	/* Wait for oscillator startup timer after power up */
-	mdelay(MCP251X_OST_DELAY_MS);
+	mdelay(mcp251x_ost_delay_ms);
 
 	priv->spi_tx_buf[0] = INSTRUCTION_RESET;
 	ret = mcp251x_spi_trans(spi, 1);
@@ -638,7 +642,7 @@ static int mcp251x_hw_reset(struct spi_device *spi)
 		return ret;
 
 	/* Wait for oscillator startup timer after reset */
-	mdelay(MCP251X_OST_DELAY_MS);
+	mdelay(mcp251x_ost_delay_ms);
 	
 	reg = mcp251x_read_reg(spi, CANSTAT);
 	if ((reg & CANCTRL_REQOP_MASK) != CANCTRL_REQOP_CONF)
-- 
2.20.1


[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux