All of lore.kernel.org
 help / color / mirror / Atom feed
* [imx27 - mcp251x] MCP251x does not work in static ?
@ 2013-04-10 13:07 Mylene Josserand
  2013-04-10 13:39 ` Marc Kleine-Budde
  0 siblings, 1 reply; 19+ messages in thread
From: Mylene Josserand @ 2013-04-10 13:07 UTC (permalink / raw)
  To: linux-can

Hi everyone,


I have posted in December 2012 a post about "[mcp251x - spi] Blocked to 
"wait_for_completion"".

To resolve the problem of CAN/spi and others, I am currently updating 
our kernel to the version 3.8.2 ! The SoC is a IMX27 and the CAN 
controller is MCP2515.

Currently, I have another problem with the MCP251x driver.

When I compile the driver in static, the kernel stopped booting. With 
some printk, the driver is blocked at the function "spi_write" of the 
function "mcp251x_hw_reset". The dmesg with my outputs :

"
spi_imx imx27-cspi.0: master is unqueued, this is deprecated
spi_imx imx27-cspi.0: probed
CAN device driver interface
mcp251x_can_init
mcp251x_clean
mcp251x_can_probe
mcp251x_hw_probe
mcp251x_hw_reset
mcp251x_hw_reset : spi_write : start
"

I thought that it was a spi problem because of the warning "master is 
unqueued, this is deprecated" but in fact the spi works.
One surprising thing (for me) is that the MCP251x compiled in module is 
probed ! (I did not test it yet)

"
root@navocap:~# modprobe mcp251x
mcp251x_can_init
sdrv->probe = bf09047c
sdrv->remove = bf08f348
mcp251x_clean
mcp251x_can_probe
mcp251x_hw_probe
mcp251x_hw_reset
mcp251x_hw_reset : spi_write : start
mcp251x_hw_reset : spi_write : end
mcp251x_read_reg
mcp251x_spi_trans
mcp251x_hw_reset : end
mcp251x_hw_probe : hw_reset done
mcp251x_read_reg
mcp251x_spi_trans
mcp251x_read_reg
mcp251x_spi_trans
mcp251x_hw_sleep
mcp251x_write_reg
mcp251x_spi_trans
mcp251x spi0.0: probed
"

I do not understand why is it probed in module and not in static.
Do you have a suggestion ?
I thought that maybe the spi has not finished to be configured but how 
know that ?
Do you think that it is a spi problem and not a MCP251x problem ?

Best regards,

-- 
Mylène JOSSERAND
Navocap

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [imx27 - mcp251x] MCP251x does not work in static ?
  2013-04-10 13:07 [imx27 - mcp251x] MCP251x does not work in static ? Mylene Josserand
@ 2013-04-10 13:39 ` Marc Kleine-Budde
  2013-04-10 14:11   ` Mylene Josserand
  0 siblings, 1 reply; 19+ messages in thread
From: Marc Kleine-Budde @ 2013-04-10 13:39 UTC (permalink / raw)
  To: Mylene Josserand; +Cc: linux-can

[-- Attachment #1: Type: text/plain, Size: 1669 bytes --]

On 04/10/2013 03:07 PM, Mylene Josserand wrote:
> When I compile the driver in static, the kernel stopped booting. With 
> some printk, the driver is blocked at the function "spi_write" of the 
> function "mcp251x_hw_reset". The dmesg with my outputs :
> 
> "
> spi_imx imx27-cspi.0: master is unqueued, this is deprecated
> spi_imx imx27-cspi.0: probed
> CAN device driver interface
> mcp251x_can_init
> mcp251x_clean
> mcp251x_can_probe
> mcp251x_hw_probe
> mcp251x_hw_reset
> mcp251x_hw_reset : spi_write : start
> "

Does it hang here?

http://lxr.linux.no/linux+v3.8.6/drivers/net/can/mcp251x.c#L624

Is this the first spi transfer that occurs in the driver?

> I thought that it was a spi problem because of the warning "master is 
> unqueued, this is deprecated" but in fact the spi works.
> One surprising thing (for me) is that the MCP251x compiled in module is 
> probed ! (I did not test it yet)

If it's the first spi transfer in the driver that hangs and if the
mcp251x works if loaded as a module, there is probably some
initialisation missing. Look for stuff that gets initialized after the
mcp251x would have been loaded if compiled into the kernel. Make a
"diff" between the bootload with mcp251x compiled into the kernel and
without. Other usual suspects are: clocks, pinmux (spi _and_ the mcp251x
dedicated IRQ line), gpio setup.

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [imx27 - mcp251x] MCP251x does not work in static ?
  2013-04-10 13:39 ` Marc Kleine-Budde
@ 2013-04-10 14:11   ` Mylene Josserand
  2013-04-10 15:30     ` Marc Kleine-Budde
  0 siblings, 1 reply; 19+ messages in thread
From: Mylene Josserand @ 2013-04-10 14:11 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: linux-can

Hi Marc Kleine-Budde,

It is again you who answers my questions :) Thank you again for your help.

Le 10/04/2013 15:39, Marc Kleine-Budde a écrit :
> On 04/10/2013 03:07 PM, Mylene Josserand wrote:
>> When I compile the driver in static, the kernel stopped booting. With
>> some printk, the driver is blocked at the function "spi_write" of the
>> function "mcp251x_hw_reset". The dmesg with my outputs :
>>
>> "
>> spi_imx imx27-cspi.0: master is unqueued, this is deprecated
>> spi_imx imx27-cspi.0: probed
>> CAN device driver interface
>> mcp251x_can_init
>> mcp251x_clean
>> mcp251x_can_probe
>> mcp251x_hw_probe
>> mcp251x_hw_reset
>> mcp251x_hw_reset : spi_write : start
>> "
>
> Does it hang here?
>
> http://lxr.linux.no/linux+v3.8.6/drivers/net/can/mcp251x.c#L624

Yes it hangs here. It did not print "reset failed: ret = X" or anything 
else.

>
> Is this the first spi transfer that occurs in the driver?

I think yes. It is the first time MCP251x uses spi transfer function.

>
>> I thought that it was a spi problem because of the warning "master is
>> unqueued, this is deprecated" but in fact the spi works.
>> One surprising thing (for me) is that the MCP251x compiled in module is
>> probed ! (I did not test it yet)
>
> If it's the first spi transfer in the driver that hangs and if the
> mcp251x works if loaded as a module, there is probably some
> initialisation missing. Look for stuff that gets initialized after the
> mcp251x would have been loaded if compiled into the kernel. Make a
> "diff" between the bootload with mcp251x compiled into the kernel and
> without. Other usual suspects are: clocks, pinmux (spi _and_ the mcp251x
> dedicated IRQ line), gpio setup.

Thanks for the advice and the ideas to look at ! I have already compared 
the bootload and I have seen no differences (maybe I will check that 
another time). I will search about clocks, pinmux and gpio setup and I 
will update you if I found how to fix that.

>
> Marc
>

Best regards,


-- 
Mylène JOSSERAND
Navocap

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [imx27 - mcp251x] MCP251x does not work in static ?
  2013-04-10 14:11   ` Mylene Josserand
@ 2013-04-10 15:30     ` Marc Kleine-Budde
  2013-04-11  7:39       ` Mylene Josserand
  0 siblings, 1 reply; 19+ messages in thread
From: Marc Kleine-Budde @ 2013-04-10 15:30 UTC (permalink / raw)
  To: Mylene Josserand; +Cc: linux-can

[-- Attachment #1: Type: text/plain, Size: 1454 bytes --]

On 04/10/2013 04:11 PM, Mylene Josserand wrote:

>> If it's the first spi transfer in the driver that hangs and if the
>> mcp251x works if loaded as a module, there is probably some
>> initialisation missing. Look for stuff that gets initialized after the
>> mcp251x would have been loaded if compiled into the kernel. Make a
>> "diff" between the bootload with mcp251x compiled into the kernel and
>> without. Other usual suspects are: clocks, pinmux (spi _and_ the mcp251x
>> dedicated IRQ line), gpio setup.
> 
> Thanks for the advice and the ideas to look at ! I have already compared 
> the bootload and I have seen no differences (maybe I will check that 
> another time). I will search about clocks, pinmux and gpio setup and I 
> will update you if I found how to fix that.

Save the bootlog of a system start with the driver compiled as a module
into file bootlog-module.txt. Make a second bootlog with the driver
compiled into the kernel, save as bootlog-builtin.txt. Then:

    diff -u bootlog-module.txt bootlog-builtin.txt

Look for the stuff that would have been initialized _after_ the system
hangs. The diff should show you this.

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [imx27 - mcp251x] MCP251x does not work in static ?
  2013-04-10 15:30     ` Marc Kleine-Budde
@ 2013-04-11  7:39       ` Mylene Josserand
  2013-04-11  7:49         ` Marc Kleine-Budde
  0 siblings, 1 reply; 19+ messages in thread
From: Mylene Josserand @ 2013-04-11  7:39 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: linux-can

Hi Marc,

Le 10/04/2013 17:30, Marc Kleine-Budde a écrit :
> On 04/10/2013 04:11 PM, Mylene Josserand wrote:
>
>>> If it's the first spi transfer in the driver that hangs and if the
>>> mcp251x works if loaded as a module, there is probably some
>>> initialisation missing. Look for stuff that gets initialized after the
>>> mcp251x would have been loaded if compiled into the kernel. Make a
>>> "diff" between the bootload with mcp251x compiled into the kernel and
>>> without. Other usual suspects are: clocks, pinmux (spi _and_ the mcp251x
>>> dedicated IRQ line), gpio setup.
>>
>> Thanks for the advice and the ideas to look at ! I have already compared
>> the bootload and I have seen no differences (maybe I will check that
>> another time). I will search about clocks, pinmux and gpio setup and I
>> will update you if I found how to fix that.
>
> Save the bootlog of a system start with the driver compiled as a module
> into file bootlog-module.txt. Make a second bootlog with the driver
> compiled into the kernel, save as bootlog-builtin.txt. Then:
>
>      diff -u bootlog-module.txt bootlog-builtin.txt
>
> Look for the stuff that would have been initialized _after_ the system
> hangs. The diff should show you this.
>
> Marc
>

Thank you for the help.
I have done it and instead of having the mcp configuration, in the 
bootlog-module, there is the libphy fec_net_mii_bus driver probed and 
other boot configurations.

"
  spi_imx imx27-cspi.0: master is unqueued, this is deprecated
  spi_imx imx27-cspi.0: probed
  CAN device driver interface
-mcp251x_can_init
-mcp251x_clean
-mcp251x_can_probe
-mcp251x_hw_probe
-mcp251x_hw_reset
-mcp251x_hw_reset : spi_write : start
+libphy: fec_enet_mii_bus: probed
+PPP generic driver version 2.4.2
+PPP BSD Compression module registered
+PPP Deflate Compression module registered
+PPP MPPE Compression module registered
+ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
+ehci-mxc: Freescale On-Chip EHCI Host driver
+mxc-ehci mxc-ehci.2: initializing i.MX USB Controller
[...]
"

If the MCP 251x is compiled as module, will it use the init configuration ?

I think I have a problem with the irq because I have tried to use it as 
module and when I do "ifconfig can0 up", I get :
"
root@navocap:~# ifconfig can0 up
genirq: Threaded irq requested with handler=NULL and !ONESHOT for irq 201
mcp251x spi0.0: failed to acquire irq 201
ifconfig: SIOCSIFFLAGS: Invalid argument
"

I will continue to search how to fix it.

Best regards,

-- 
Mylène JOSSERAND
Navocap

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [imx27 - mcp251x] MCP251x does not work in static ?
  2013-04-11  7:39       ` Mylene Josserand
@ 2013-04-11  7:49         ` Marc Kleine-Budde
  2013-04-11  8:04           ` Mylene Josserand
  2013-04-11  8:36           ` RFC: [PATCH] can: mcp251x: add missing IRQF_ONESHOT to request_threaded_irq Marc Kleine-Budde
  0 siblings, 2 replies; 19+ messages in thread
From: Marc Kleine-Budde @ 2013-04-11  7:49 UTC (permalink / raw)
  To: Mylene Josserand; +Cc: linux-can

[-- Attachment #1: Type: text/plain, Size: 3043 bytes --]

On 04/11/2013 09:39 AM, Mylene Josserand wrote:
> Hi Marc,
> 
> Le 10/04/2013 17:30, Marc Kleine-Budde a écrit :
>> On 04/10/2013 04:11 PM, Mylene Josserand wrote:
>>
>>>> If it's the first spi transfer in the driver that hangs and if the
>>>> mcp251x works if loaded as a module, there is probably some
>>>> initialisation missing. Look for stuff that gets initialized after the
>>>> mcp251x would have been loaded if compiled into the kernel. Make a
>>>> "diff" between the bootload with mcp251x compiled into the kernel and
>>>> without. Other usual suspects are: clocks, pinmux (spi _and_ the mcp251x
>>>> dedicated IRQ line), gpio setup.
>>>
>>> Thanks for the advice and the ideas to look at ! I have already compared
>>> the bootload and I have seen no differences (maybe I will check that
>>> another time). I will search about clocks, pinmux and gpio setup and I
>>> will update you if I found how to fix that.
>>
>> Save the bootlog of a system start with the driver compiled as a module
>> into file bootlog-module.txt. Make a second bootlog with the driver
>> compiled into the kernel, save as bootlog-builtin.txt. Then:
>>
>>      diff -u bootlog-module.txt bootlog-builtin.txt
>>
>> Look for the stuff that would have been initialized _after_ the system
>> hangs. The diff should show you this.
>>
>> Marc
>>
> 
> Thank you for the help.
> I have done it and instead of having the mcp configuration, in the 
> bootlog-module, there is the libphy fec_net_mii_bus driver probed and 
> other boot configurations.
> 
> "
>   spi_imx imx27-cspi.0: master is unqueued, this is deprecated
>   spi_imx imx27-cspi.0: probed
>   CAN device driver interface
> -mcp251x_can_init
> -mcp251x_clean
> -mcp251x_can_probe
> -mcp251x_hw_probe
> -mcp251x_hw_reset
> -mcp251x_hw_reset : spi_write : start
> +libphy: fec_enet_mii_bus: probed
> +PPP generic driver version 2.4.2
> +PPP BSD Compression module registered
> +PPP Deflate Compression module registered
> +PPP MPPE Compression module registered
> +ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
> +ehci-mxc: Freescale On-Chip EHCI Host driver
> +mxc-ehci mxc-ehci.2: initializing i.MX USB Controller
> [...]
> "
> 
> If the MCP 251x is compiled as module, will it use the init configuration ?
> 
> I think I have a problem with the irq because I have tried to use it as 
> module and when I do "ifconfig can0 up", I get :
> "
> root@navocap:~# ifconfig can0 up
> genirq: Threaded irq requested with handler=NULL and !ONESHOT for irq 201
> mcp251x spi0.0: failed to acquire irq 201

It's a bug in the driver....which was introduced in v3.5[1]. I'm looking
for a fix.

Marc

[1] 1c6c695 genirq: Reject bogus threaded irq requests

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [imx27 - mcp251x] MCP251x does not work in static ?
  2013-04-11  7:49         ` Marc Kleine-Budde
@ 2013-04-11  8:04           ` Mylene Josserand
  2013-04-11  8:39             ` Marc Kleine-Budde
  2013-04-11  8:36           ` RFC: [PATCH] can: mcp251x: add missing IRQF_ONESHOT to request_threaded_irq Marc Kleine-Budde
  1 sibling, 1 reply; 19+ messages in thread
From: Mylene Josserand @ 2013-04-11  8:04 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: linux-can



Le 11/04/2013 09:49, Marc Kleine-Budde a écrit :
> On 04/11/2013 09:39 AM, Mylene Josserand wrote:
>> Hi Marc,
>>
>> Le 10/04/2013 17:30, Marc Kleine-Budde a écrit :
>>> On 04/10/2013 04:11 PM, Mylene Josserand wrote:
>>>
>>>>> If it's the first spi transfer in the driver that hangs and if the
>>>>> mcp251x works if loaded as a module, there is probably some
>>>>> initialisation missing. Look for stuff that gets initialized after the
>>>>> mcp251x would have been loaded if compiled into the kernel. Make a
>>>>> "diff" between the bootload with mcp251x compiled into the kernel and
>>>>> without. Other usual suspects are: clocks, pinmux (spi _and_ the mcp251x
>>>>> dedicated IRQ line), gpio setup.
>>>>
>>>> Thanks for the advice and the ideas to look at ! I have already compared
>>>> the bootload and I have seen no differences (maybe I will check that
>>>> another time). I will search about clocks, pinmux and gpio setup and I
>>>> will update you if I found how to fix that.
>>>
>>> Save the bootlog of a system start with the driver compiled as a module
>>> into file bootlog-module.txt. Make a second bootlog with the driver
>>> compiled into the kernel, save as bootlog-builtin.txt. Then:
>>>
>>>       diff -u bootlog-module.txt bootlog-builtin.txt
>>>
>>> Look for the stuff that would have been initialized _after_ the system
>>> hangs. The diff should show you this.
>>>
>>> Marc
>>>
>>
>> Thank you for the help.
>> I have done it and instead of having the mcp configuration, in the
>> bootlog-module, there is the libphy fec_net_mii_bus driver probed and
>> other boot configurations.
>>
>> "
>>    spi_imx imx27-cspi.0: master is unqueued, this is deprecated
>>    spi_imx imx27-cspi.0: probed
>>    CAN device driver interface
>> -mcp251x_can_init
>> -mcp251x_clean
>> -mcp251x_can_probe
>> -mcp251x_hw_probe
>> -mcp251x_hw_reset
>> -mcp251x_hw_reset : spi_write : start
>> +libphy: fec_enet_mii_bus: probed
>> +PPP generic driver version 2.4.2
>> +PPP BSD Compression module registered
>> +PPP Deflate Compression module registered
>> +PPP MPPE Compression module registered
>> +ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
>> +ehci-mxc: Freescale On-Chip EHCI Host driver
>> +mxc-ehci mxc-ehci.2: initializing i.MX USB Controller
>> [...]
>> "
>>
>> If the MCP 251x is compiled as module, will it use the init configuration ?
>>
>> I think I have a problem with the irq because I have tried to use it as
>> module and when I do "ifconfig can0 up", I get :
>> "
>> root@navocap:~# ifconfig can0 up
>> genirq: Threaded irq requested with handler=NULL and !ONESHOT for irq 201
>> mcp251x spi0.0: failed to acquire irq 201
>
> It's a bug in the driver....which was introduced in v3.5[1]. I'm looking
> for a fix.
>
> Marc
>
> [1] 1c6c695 genirq: Reject bogus threaded irq requests
>

Okay.

In this
http://markmail.org/thread/uc2adurel247yitp#query:+page:1+mid:uc2adurel247yitp+state:results 
and this 
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=44&t=7027&start=150 
posts, they set the irq_flags to IRQF_ONESHOT.

I have tested it and I did not have the error anymore. Maybe it is not a 
good way to fix that ? (I don't know what is a "one shot" IRQ) but in 
case it could help.
However, it did not fix my static-mcp251x boot hang.

Best regards,


-- 
Mylène JOSSERAND
Navocap

^ permalink raw reply	[flat|nested] 19+ messages in thread

* RFC: [PATCH] can: mcp251x: add missing IRQF_ONESHOT to request_threaded_irq
  2013-04-11  7:49         ` Marc Kleine-Budde
  2013-04-11  8:04           ` Mylene Josserand
@ 2013-04-11  8:36           ` Marc Kleine-Budde
  2013-04-12 11:16             ` Marc Kleine-Budde
  1 sibling, 1 reply; 19+ messages in thread
From: Marc Kleine-Budde @ 2013-04-11  8:36 UTC (permalink / raw)
  To: linux-can; +Cc: Mylene.Josserand, Marc Kleine-Budde

Since commit:

    1c6c695 genirq: Reject bogus threaded irq requests

threaded irqs must provide a primary handler or set the IRQF_ONESHOT flag.
Since the mcp251x driver doesn't make use of a primary handler set the
IRQF_ONESHOT flag.

/* Cc: linux-stable <stable@vger.kernel.org> # >= v3.5 */
Reported-by: Mylene Josserand <Mylene.Josserand@navocap.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/mcp251x.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c
index f32b9fc..9aa0c64 100644
--- a/drivers/net/can/mcp251x.c
+++ b/drivers/net/can/mcp251x.c
@@ -929,6 +929,7 @@ static int mcp251x_open(struct net_device *net)
 	struct mcp251x_priv *priv = netdev_priv(net);
 	struct spi_device *spi = priv->spi;
 	struct mcp251x_platform_data *pdata = spi->dev.platform_data;
+	unsigned long flags;
 	int ret;
 
 	ret = open_candev(net);
@@ -945,9 +946,14 @@ static int mcp251x_open(struct net_device *net)
 	priv->tx_skb = NULL;
 	priv->tx_len = 0;
 
+	flags = IRQF_ONESHOT;
+	if (pdata->irq_flags)
+		flags |= pdata->irq_flags;
+	else
+		flags |= IRQF_TRIGGER_FALLING;
+
 	ret = request_threaded_irq(spi->irq, NULL, mcp251x_can_ist,
-		  pdata->irq_flags ? pdata->irq_flags : IRQF_TRIGGER_FALLING,
-		  DEVICE_NAME, priv);
+				   flags, DEVICE_NAME, priv);
 	if (ret) {
 		dev_err(&spi->dev, "failed to acquire irq %d\n", spi->irq);
 		if (pdata->transceiver_enable)
-- 
1.8.2.rc2


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [imx27 - mcp251x] MCP251x does not work in static ?
  2013-04-11  8:04           ` Mylene Josserand
@ 2013-04-11  8:39             ` Marc Kleine-Budde
  2013-04-11  9:22               ` Mylene Josserand
  0 siblings, 1 reply; 19+ messages in thread
From: Marc Kleine-Budde @ 2013-04-11  8:39 UTC (permalink / raw)
  To: Mylene Josserand; +Cc: linux-can

[-- Attachment #1: Type: text/plain, Size: 1220 bytes --]

On 04/11/2013 10:04 AM, Mylene Josserand wrote:
>>> root@navocap:~# ifconfig can0 up
>>> genirq: Threaded irq requested with handler=NULL and !ONESHOT for irq 201
>>> mcp251x spi0.0: failed to acquire irq 201
>>
>> It's a bug in the driver....which was introduced in v3.5[1]. I'm looking
>> for a fix.
>>
>> Marc
>>
>> [1] 1c6c695 genirq: Reject bogus threaded irq requests
>>
> 
> Okay.
> 
> In this
> http://markmail.org/thread/uc2adurel247yitp#query:+page:1+mid:uc2adurel247yitp+state:results 
> and this 
> http://www.raspberrypi.org/phpBB3/viewtopic.php?f=44&t=7027&start=150 
> posts, they set the irq_flags to IRQF_ONESHOT.
> 
> I have tested it and I did not have the error anymore. Maybe it is not a 
> good way to fix that ? (I don't know what is a "one shot" IRQ) but in 
> case it could help.
> However, it did not fix my static-mcp251x boot hang.

Can you test my patch and give me a Tested-by?

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [imx27 - mcp251x] MCP251x does not work in static ?
  2013-04-11  8:39             ` Marc Kleine-Budde
@ 2013-04-11  9:22               ` Mylene Josserand
  2013-04-11  9:49                 ` Marc Kleine-Budde
  0 siblings, 1 reply; 19+ messages in thread
From: Mylene Josserand @ 2013-04-11  9:22 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: linux-can

Le 11/04/2013 10:39, Marc Kleine-Budde a écrit :
> On 04/11/2013 10:04 AM, Mylene Josserand wrote:
>>>> root@navocap:~# ifconfig can0 up
>>>> genirq: Threaded irq requested with handler=NULL and !ONESHOT for irq 201
>>>> mcp251x spi0.0: failed to acquire irq 201
>>>
>>> It's a bug in the driver....which was introduced in v3.5[1]. I'm looking
>>> for a fix.
>>>
>>> Marc
>>>
>>> [1] 1c6c695 genirq: Reject bogus threaded irq requests
>>>
>>
>> Okay.
>>
>> In this
>> http://markmail.org/thread/uc2adurel247yitp#query:+page:1+mid:uc2adurel247yitp+state:results
>> and this
>> http://www.raspberrypi.org/phpBB3/viewtopic.php?f=44&t=7027&start=150
>> posts, they set the irq_flags to IRQF_ONESHOT.
>>
>> I have tested it and I did not have the error anymore. Maybe it is not a
>> good way to fix that ? (I don't know what is a "one shot" IRQ) but in
>> case it could help.
>> However, it did not fix my static-mcp251x boot hang.
>
> Can you test my patch and give me a Tested-by?
>
> Marc
>

I tested your patch and it works ! (As module), I can UP the can 
interface and set an IP adress. I did not test much (cansend / candump, 
...).

Sorry, it is the first time I take part of a kernel patch (thank you for 
that !) so I don't know what the "procedure" to give you a "Tested-by" ? :)


Best regards,


-- 
Mylène JOSSERAND
Navocap

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [imx27 - mcp251x] MCP251x does not work in static ?
  2013-04-11  9:22               ` Mylene Josserand
@ 2013-04-11  9:49                 ` Marc Kleine-Budde
  2013-04-11 14:39                   ` Mylene Josserand
  0 siblings, 1 reply; 19+ messages in thread
From: Marc Kleine-Budde @ 2013-04-11  9:49 UTC (permalink / raw)
  To: Mylene Josserand; +Cc: linux-can

[-- Attachment #1: Type: text/plain, Size: 2038 bytes --]

On 04/11/2013 11:22 AM, Mylene Josserand wrote:
> Le 11/04/2013 10:39, Marc Kleine-Budde a écrit :
>> On 04/11/2013 10:04 AM, Mylene Josserand wrote:
>>>>> root@navocap:~# ifconfig can0 up
>>>>> genirq: Threaded irq requested with handler=NULL and !ONESHOT for irq 201
>>>>> mcp251x spi0.0: failed to acquire irq 201
>>>>
>>>> It's a bug in the driver....which was introduced in v3.5[1]. I'm looking
>>>> for a fix.
>>>>
>>>> Marc
>>>>
>>>> [1] 1c6c695 genirq: Reject bogus threaded irq requests
>>>>
>>>
>>> Okay.
>>>
>>> In this
>>> http://markmail.org/thread/uc2adurel247yitp#query:+page:1+mid:uc2adurel247yitp+state:results
>>> and this
>>> http://www.raspberrypi.org/phpBB3/viewtopic.php?f=44&t=7027&start=150
>>> posts, they set the irq_flags to IRQF_ONESHOT.
>>>
>>> I have tested it and I did not have the error anymore. Maybe it is not a
>>> good way to fix that ? (I don't know what is a "one shot" IRQ) but in
>>> case it could help.
>>> However, it did not fix my static-mcp251x boot hang.
>>
>> Can you test my patch and give me a Tested-by?
>>
>> Marc
>>
> 
> I tested your patch and it works ! (As module), I can UP the can 
> interface and set an IP adress. I did not test much (cansend / candump, 
> ...).

Err... don't set IP addresses on CAN interfaces, that's wrong.

> Sorry, it is the first time I take part of a kernel patch (thank you for 
> that !) so I don't know what the "procedure" to give you a "Tested-by" ? :)

Please do a "real test" and and send and receive some 10k frames. Reply
to the patch and say something like:

"I've tested your patch and successfully send and received 10000
CAN-Frames. You can add my Tested-by: Mylene Josserand
<Mylene.Josserand@navocap.com>"

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [imx27 - mcp251x] MCP251x does not work in static ?
  2013-04-11  9:49                 ` Marc Kleine-Budde
@ 2013-04-11 14:39                   ` Mylene Josserand
  2013-04-11 15:09                     ` Marc Kleine-Budde
  2013-04-12  9:36                     ` Marc Kleine-Budde
  0 siblings, 2 replies; 19+ messages in thread
From: Mylene Josserand @ 2013-04-11 14:39 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: linux-can

Le 11/04/2013 11:49, Marc Kleine-Budde a écrit :
> On 04/11/2013 11:22 AM, Mylene Josserand wrote:
>> Le 11/04/2013 10:39, Marc Kleine-Budde a écrit :
>>> On 04/11/2013 10:04 AM, Mylene Josserand wrote:
>>>>>> root@navocap:~# ifconfig can0 up
>>>>>> genirq: Threaded irq requested with handler=NULL and !ONESHOT for irq 201
>>>>>> mcp251x spi0.0: failed to acquire irq 201
>>>>>
>>>>> It's a bug in the driver....which was introduced in v3.5[1]. I'm looking
>>>>> for a fix.
>>>>>
>>>>> Marc
>>>>>
>>>>> [1] 1c6c695 genirq: Reject bogus threaded irq requests
>>>>>
>>>>
>>>> Okay.
>>>>
>>>> In this
>>>> http://markmail.org/thread/uc2adurel247yitp#query:+page:1+mid:uc2adurel247yitp+state:results
>>>> and this
>>>> http://www.raspberrypi.org/phpBB3/viewtopic.php?f=44&t=7027&start=150
>>>> posts, they set the irq_flags to IRQF_ONESHOT.
>>>>
>>>> I have tested it and I did not have the error anymore. Maybe it is not a
>>>> good way to fix that ? (I don't know what is a "one shot" IRQ) but in
>>>> case it could help.
>>>> However, it did not fix my static-mcp251x boot hang.
>>>
>>> Can you test my patch and give me a Tested-by?
>>>
>>> Marc
>>>
>>
>> I tested your patch and it works ! (As module), I can UP the can
>> interface and set an IP adress. I did not test much (cansend / candump,
>> ...).
>
> Err... don't set IP addresses on CAN interfaces, that's wrong.

Yes, I even do not know why I set the IP address !

>
>> Sorry, it is the first time I take part of a kernel patch (thank you for
>> that !) so I don't know what the "procedure" to give you a "Tested-by" ? :)
>
> Please do a "real test" and and send and receive some 10k frames. Reply
> to the patch and say something like:
>
> "I've tested your patch and successfully send and received 10000
> CAN-Frames. You can add my Tested-by: Mylene Josserand
> <Mylene.Josserand@navocap.com>"
>
> Marc
>

Bad news for me.

I think that your patch works but I have the same error as my first post 
: the CAN / spi is blocked after some frames sent/received.

Currently, I use a CAN232 and a small program which send CAN frames 
through the 232 to the CAN. Then, In the same time, I read the CAN 
frames sent with "candump can0".

I received the good message sent (00 01 02 03 04) :

"
root@navocap:~# candump can0
interface = can0, family = 29, type = 3, proto = 1
<0x001> [5] 00 01 02 03 04
<0x001> [5] 00 01 02 03 04
<0x001> [5] 00 01 02 03 04
<0x001> [5] 00 01 02 03 04
<0x001> [5] 00 01 02 03 04
<0x001> [5] 00 01 02 03 04
<0x001> [5] 00 01 02 03 04
<0x001> [5] 00 01 02 03 04
<0x001> [5] 00 01 02 03 04
<0x001> [5] 00 01 02 03 04
[...]
"

I have read 15 383 frames but after 15 834, it hangs. And after that, I 
can not act on the CAN anymore. A "ifconfig can0 down" hangs the kernel 
(even with ^C) and I have to restart the board to use the CAN again !

I really think that it is not linked to your patch (do you want me to 
send the "Tested by" anyway ?) but to my first problem. The kernel 
update did not seem to fix that.
Could you help me to try to fix it ? Because I really do not know how to 
debug / fix it.
For CAN bus, which is the most CAN chip used ? Do you think that the 
MCP2515 is a good choice ?

Thank you in advance,

-- 
Mylène JOSSERAND
Navocap

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [imx27 - mcp251x] MCP251x does not work in static ?
  2013-04-11 14:39                   ` Mylene Josserand
@ 2013-04-11 15:09                     ` Marc Kleine-Budde
  2013-04-12  9:24                       ` Mylene Josserand
  2013-04-12  9:36                     ` Marc Kleine-Budde
  1 sibling, 1 reply; 19+ messages in thread
From: Marc Kleine-Budde @ 2013-04-11 15:09 UTC (permalink / raw)
  To: Mylene Josserand; +Cc: linux-can

[-- Attachment #1: Type: text/plain, Size: 3161 bytes --]

On 04/11/2013 04:39 PM, Mylene Josserand wrote:
>> Err... don't set IP addresses on CAN interfaces, that's wrong.
> Yes, I even do not know why I set the IP address !

might be the usual habit of giving network interfaces IP addresses  :)

[...]

> Bad news for me.
> 
> I think that your patch works but I have the same error as my first post 
> : the CAN / spi is blocked after some frames sent/received.
> 
> Currently, I use a CAN232 and a small program which send CAN frames 
> through the 232 to the CAN. Then, In the same time, I read the CAN 
> frames sent with "candump can0".
> 
> I received the good message sent (00 01 02 03 04) :
> 
> "
> root@navocap:~# candump can0
> interface = can0, family = 29, type = 3, proto = 1
> <0x001> [5] 00 01 02 03 04
> <0x001> [5] 00 01 02 03 04
> <0x001> [5] 00 01 02 03 04
> <0x001> [5] 00 01 02 03 04
> <0x001> [5] 00 01 02 03 04
> <0x001> [5] 00 01 02 03 04
> <0x001> [5] 00 01 02 03 04
> <0x001> [5] 00 01 02 03 04
> <0x001> [5] 00 01 02 03 04
> <0x001> [5] 00 01 02 03 04
> [...]
> "
> 
> I have read 15 383 frames but after 15 834, it hangs. And after that, I 
> can not act on the CAN anymore. A "ifconfig can0 down" hangs the kernel 
> (even with ^C) and I have to restart the board to use the CAN again !

Ohhh, not good.

Activate "MAGIC_SYSRQ" in the kernel via "make menuconfog" (Kernel
hacking -> Magic SysRq key) and bring your system to hang again. Then
connect via serial line to your embedded system and send a "break". (See
documentation of your terminal program.). After the "break" send a
normal "?" to get the help. If I remember correctly, use "break" +  "d"
to create a stackdump (see
http://lxr.linux.no/linux+v3.8.6/Documentation/sysrq.txt for more
documentation). You might want to try the magic sys request if your
system is still alive to test if your setup is working.

With the stack trace you might figure out what the system is doing.

> I really think that it is not linked to your patch (do you want me to 
> send the "Tested by" anyway ?) but to my first problem. The kernel 
> update did not seem to fix that.
> Could you help me to try to fix it ? Because I really do not know how to 
> debug / fix it.
> For CAN bus, which is the most CAN chip used ? Do you think that the 
> MCP2515 is a good choice ?

No, mcp2515 is the second worst choice if CAN chips I know, just the
mcp2510 is worse. If you can change your processor switch to a imx25 or
imx35, they have a CAN controller built-in. If you can redesign your
hardware, you can add a sja1000 to the external memory interface of the
imx27. But you need 3.3V -> 5V level shifters, as AFAIK the sja1000 is
only available with 5V io voltage. The easiest option is to add an USB
based CAN adapter to your system. Have a look at the kernel which USB
adapters are supported.

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [imx27 - mcp251x] MCP251x does not work in static ?
  2013-04-11 15:09                     ` Marc Kleine-Budde
@ 2013-04-12  9:24                       ` Mylene Josserand
  2013-04-12  9:49                         ` Marc Kleine-Budde
  0 siblings, 1 reply; 19+ messages in thread
From: Mylene Josserand @ 2013-04-12  9:24 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: linux-can

Hi Marc,

Le 11/04/2013 17:09, Marc Kleine-Budde a écrit :
> On 04/11/2013 04:39 PM, Mylene Josserand wrote:
>>> Err... don't set IP addresses on CAN interfaces, that's wrong.
>> Yes, I even do not know why I set the IP address !
>
> might be the usual habit of giving network interfaces IP addresses  :)

Yes, maybe ;)

>
> [...]
>
>> Bad news for me.
>>
>> I think that your patch works but I have the same error as my first post
>> : the CAN / spi is blocked after some frames sent/received.
>>
>> Currently, I use a CAN232 and a small program which send CAN frames
>> through the 232 to the CAN. Then, In the same time, I read the CAN
>> frames sent with "candump can0".
>>
>> I received the good message sent (00 01 02 03 04) :
>>
>> "
>> root@navocap:~# candump can0
>> interface = can0, family = 29, type = 3, proto = 1
>> <0x001>  [5] 00 01 02 03 04
>> <0x001>  [5] 00 01 02 03 04
>> <0x001>  [5] 00 01 02 03 04
>> <0x001>  [5] 00 01 02 03 04
>> <0x001>  [5] 00 01 02 03 04
>> <0x001>  [5] 00 01 02 03 04
>> <0x001>  [5] 00 01 02 03 04
>> <0x001>  [5] 00 01 02 03 04
>> <0x001>  [5] 00 01 02 03 04
>> <0x001>  [5] 00 01 02 03 04
>> [...]
>> "
>>
>> I have read 15 383 frames but after 15 834, it hangs. And after that, I
>> can not act on the CAN anymore. A "ifconfig can0 down" hangs the kernel
>> (even with ^C) and I have to restart the board to use the CAN again !
>
> Ohhh, not good.
>
> Activate "MAGIC_SYSRQ" in the kernel via "make menuconfog" (Kernel
> hacking ->  Magic SysRq key) and bring your system to hang again. Then
> connect via serial line to your embedded system and send a "break". (See
> documentation of your terminal program.). After the "break" send a
> normal "?" to get the help. If I remember correctly, use "break" +  "d"
> to create a stackdump (see
> http://lxr.linux.no/linux+v3.8.6/Documentation/sysrq.txt for more
> documentation). You might want to try the magic sys request if your
> system is still alive to test if your setup is working.
>
> With the stack trace you might figure out what the system is doing.


Oouuhhhaaa ! Very useful ! It did not know the sysrq and it seems to be 
very powerful ! Thanks ! :D


About serious things, the "d" command did not work (it prints the help) 
but the "w" command ["dump tasks that are uninterruptable (blocked) 
state"] shows interesting things :

---- when not blocked (so nothing in there) :
"
SysRq : Show Blocked State
   task                PC stack   pid father
Sched Debug Version: v0.10, 3.8.2-9-can-modules+ #1
[...]
"

---- when blocked :
"
SysRq : Show Blocked State
   task                PC stack   pid father
kworker/u:0     D c03d6b20     0     6      2 0x00000000
[<c03d6b20>] (__schedule+0x298/0x434) from [<c03d59c8>] 
(schedule_timeout+0x170/0x1c0)
[<c03d59c8>] (schedule_timeout+0x170/0x1c0) from [<c03d70d4>] 
(wait_for_common+0x148/0x1a4)
[<c03d70d4>] (wait_for_common+0x148/0x1a4) from [<c0287078>] 
(spi_imx_transfer+0x70/0x84)
[<c0287078>] (spi_imx_transfer+0x70/0x84) from [<c0285284>] 
(bitbang_work+0x130/0x390)
[<c0285284>] (bitbang_work+0x130/0x390) from [<c002ee44>] 
(process_one_work+0x28c/0x504)
[<c002ee44>] (process_one_work+0x28c/0x504) from [<c002f688>] 
(worker_thread+0x1f0/0x648)
[<c002f688>] (worker_thread+0x1f0/0x648) from [<c0036894>] 
(kthread+0xa0/0xac)
[<c0036894>] (kthread+0xa0/0xac) from [<c00093b0>] (ret_from_fork+0x14/0x24)
irq/201-mcp251x D c03d6b20     0   950      2 0x00000000
[<c03d6b20>] (__schedule+0x298/0x434) from [<c03d59c8>] 
(schedule_timeout+0x170/0x1c0)
[<c03d59c8>] (schedule_timeout+0x170/0x1c0) from [<c03d70d4>] 
(wait_for_common+0x148/0x1a4)
[<c03d70d4>] (wait_for_common+0x148/0x1a4) from [<c02839b0>] 
(__spi_sync+0x58/0x9c)
[<c02839b0>] (__spi_sync+0x58/0x9c) from [<bf08f138>] 
(mcp251x_spi_trans+0xa4/0xd0 [mcp251x])
[<bf08f138>] (mcp251x_spi_trans+0xa4/0xd0 [mcp251x]) from [<bf090140>] 
(mcp251x_can_ist+0x60/0x348 [mcp251x])
[<bf090140>] (mcp251x_can_ist+0x60/0x348 [mcp251x]) from [<c005bbf4>] 
(irq_thread_fn+0x1c/0x34)
[<c005bbf4>] (irq_thread_fn+0x1c/0x34) from [<c005bce4>] 
(irq_thread+0xd8/0x148)
[<c005bce4>] (irq_thread+0xd8/0x148) from [<c0036894>] (kthread+0xa0/0xac)
[<c0036894>] (kthread+0xa0/0xac) from [<c00093b0>] (ret_from_fork+0x14/0x24)
Sched Debug Version: v0.10, 3.8.2-9-can-modules+ #1
[...]
"

We can see that the problem is during the spi transfer.
Do you think it is a hardware problem ?
What is the "kworker" task ?
How fix it ?


>
>> I really think that it is not linked to your patch (do you want me to
>> send the "Tested by" anyway ?) but to my first problem. The kernel
>> update did not seem to fix that.
>> Could you help me to try to fix it ? Because I really do not know how to
>> debug / fix it.
>> For CAN bus, which is the most CAN chip used ? Do you think that the
>> MCP2515 is a good choice ?
>
> No, mcp2515 is the second worst choice if CAN chips I know, just the
> mcp2510 is worse. If you can change your processor switch to a imx25 or
> imx35, they have a CAN controller built-in. If you can redesign your
> hardware, you can add a sja1000 to the external memory interface of the
> imx27. But you need 3.3V ->  5V level shifters, as AFAIK the sja1000 is
> only available with 5V io voltage. The easiest option is to add an USB
> based CAN adapter to your system. Have a look at the kernel which USB
> adapters are supported.

Thank you for the advice ! I will talk about it with hardware guys and 
see if we can change it for future design. For USB-CAN, I don't know if 
it is a good idea because, unfortunately, we have many problems with USB !


>
> Marc
>

-- 
Mylène JOSSERAND
Navocap

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [imx27 - mcp251x] MCP251x does not work in static ?
  2013-04-11 14:39                   ` Mylene Josserand
  2013-04-11 15:09                     ` Marc Kleine-Budde
@ 2013-04-12  9:36                     ` Marc Kleine-Budde
  2013-04-12  9:40                       ` Mylene Josserand
  1 sibling, 1 reply; 19+ messages in thread
From: Marc Kleine-Budde @ 2013-04-12  9:36 UTC (permalink / raw)
  To: Mylene Josserand; +Cc: linux-can

[-- Attachment #1: Type: text/plain, Size: 803 bytes --]

On 04/11/2013 04:39 PM, Mylene Josserand wrote:
[...]

> I have read 15 383 frames but after 15 834, it hangs. And after that, I 
> can not act on the CAN anymore. A "ifconfig can0 down" hangs the kernel 
> (even with ^C) and I have to restart the board to use the CAN again !
> 
> I really think that it is not linked to your patch (do you want me to 
> send the "Tested by" anyway ?) but to my first problem. The kernel 

Can I add your Tested-by to the patch? I hope the patch will go into 3.9
release.

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [imx27 - mcp251x] MCP251x does not work in static ?
  2013-04-12  9:36                     ` Marc Kleine-Budde
@ 2013-04-12  9:40                       ` Mylene Josserand
  2013-04-12  9:48                         ` Marc Kleine-Budde
  0 siblings, 1 reply; 19+ messages in thread
From: Mylene Josserand @ 2013-04-12  9:40 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: linux-can



Le 12/04/2013 11:36, Marc Kleine-Budde a écrit :
> On 04/11/2013 04:39 PM, Mylene Josserand wrote:
> [...]
>
>> I have read 15 383 frames but after 15 834, it hangs. And after that, I
>> can not act on the CAN anymore. A "ifconfig can0 down" hangs the kernel
>> (even with ^C) and I have to restart the board to use the CAN again !
>>
>> I really think that it is not linked to your patch (do you want me to
>> send the "Tested by" anyway ?) but to my first problem. The kernel
>
> Can I add your Tested-by to the patch? I hope the patch will go into 3.9
> release.
>
> Marc
>
Yes no problem !

Do you want me to reply to the patch or just like that is okay ?

-- 
Mylène JOSSERAND
Navocap

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [imx27 - mcp251x] MCP251x does not work in static ?
  2013-04-12  9:40                       ` Mylene Josserand
@ 2013-04-12  9:48                         ` Marc Kleine-Budde
  0 siblings, 0 replies; 19+ messages in thread
From: Marc Kleine-Budde @ 2013-04-12  9:48 UTC (permalink / raw)
  To: Mylene Josserand; +Cc: linux-can

[-- Attachment #1: Type: text/plain, Size: 1069 bytes --]

On 04/12/2013 11:40 AM, Mylene Josserand wrote:
> 
> 
> Le 12/04/2013 11:36, Marc Kleine-Budde a écrit :
>> On 04/11/2013 04:39 PM, Mylene Josserand wrote:
>> [...]
>>
>>> I have read 15 383 frames but after 15 834, it hangs. And after that, I
>>> can not act on the CAN anymore. A "ifconfig can0 down" hangs the kernel
>>> (even with ^C) and I have to restart the board to use the CAN again !
>>>
>>> I really think that it is not linked to your patch (do you want me to
>>> send the "Tested by" anyway ?) but to my first problem. The kernel
>>
>> Can I add your Tested-by to the patch? I hope the patch will go into 3.9
>> release.
>>
>> Marc
>>
> Yes no problem !
> 
> Do you want me to reply to the patch or just like that is okay ?

I think it's okay so :)

Marc
-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [imx27 - mcp251x] MCP251x does not work in static ?
  2013-04-12  9:24                       ` Mylene Josserand
@ 2013-04-12  9:49                         ` Marc Kleine-Budde
  0 siblings, 0 replies; 19+ messages in thread
From: Marc Kleine-Budde @ 2013-04-12  9:49 UTC (permalink / raw)
  To: Mylene Josserand; +Cc: linux-can

[-- Attachment #1: Type: text/plain, Size: 4723 bytes --]

On 04/12/2013 11:24 AM, Mylene Josserand wrote:
>>> I have read 15 383 frames but after 15 834, it hangs. And after that, I
>>> can not act on the CAN anymore. A "ifconfig can0 down" hangs the kernel
>>> (even with ^C) and I have to restart the board to use the CAN again !
>>
>> Ohhh, not good.
>>
>> Activate "MAGIC_SYSRQ" in the kernel via "make menuconfog" (Kernel
>> hacking ->  Magic SysRq key) and bring your system to hang again. Then
>> connect via serial line to your embedded system and send a "break". (See
>> documentation of your terminal program.). After the "break" send a
>> normal "?" to get the help. If I remember correctly, use "break" +  "d"
>> to create a stackdump (see
>> http://lxr.linux.no/linux+v3.8.6/Documentation/sysrq.txt for more
>> documentation). You might want to try the magic sys request if your
>> system is still alive to test if your setup is working.
>>
>> With the stack trace you might figure out what the system is doing.
> 
> 
> Oouuhhhaaa ! Very useful ! It did not know the sysrq and it seems to be 
> very powerful ! Thanks ! :D

You're welcome.

> About serious things, the "d" command did not work (it prints the help) 
> but the "w" command ["dump tasks that are uninterruptable (blocked) 
> state"] shows interesting things :

Maybe it was not 'd', but you've found the interesting information.

> ---- when not blocked (so nothing in there) :
> "
> SysRq : Show Blocked State
>    task                PC stack   pid father
> Sched Debug Version: v0.10, 3.8.2-9-can-modules+ #1
> [...]
> "
> 
> ---- when blocked :
> "
> SysRq : Show Blocked State
>    task                PC stack   pid father
> kworker/u:0     D c03d6b20     0     6      2 0x00000000
> [<c03d6b20>] (__schedule+0x298/0x434) from [<c03d59c8>] 
> (schedule_timeout+0x170/0x1c0)
> [<c03d59c8>] (schedule_timeout+0x170/0x1c0) from [<c03d70d4>] 
> (wait_for_common+0x148/0x1a4)
> [<c03d70d4>] (wait_for_common+0x148/0x1a4) from [<c0287078>] 
> (spi_imx_transfer+0x70/0x84)
> [<c0287078>] (spi_imx_transfer+0x70/0x84) from [<c0285284>] 
> (bitbang_work+0x130/0x390)

The spi driver is waiting for a transfer to finish, it hangs in the
wait_for_completion():

http://lxr.linux.no/linux+v3.8.6/drivers/spi/spi-imx.c#L712

The corresponding function (i.e. complete()) is called from the
interrupt handler, once a transfer ins completed:

http://lxr.linux.no/linux+v3.8.6/drivers/spi/spi-imx.c#L649

> [<c0285284>] (bitbang_work+0x130/0x390) from [<c002ee44>] 
> (process_one_work+0x28c/0x504)
> [<c002ee44>] (process_one_work+0x28c/0x504) from [<c002f688>] 
> (worker_thread+0x1f0/0x648)
> [<c002f688>] (worker_thread+0x1f0/0x648) from [<c0036894>] 
> (kthread+0xa0/0xac)
> [<c0036894>] (kthread+0xa0/0xac) from [<c00093b0>] (ret_from_fork+0x14/0x24)
> irq/201-mcp251x D c03d6b20     0   950      2 0x00000000
> [<c03d6b20>] (__schedule+0x298/0x434) from [<c03d59c8>] 
> (schedule_timeout+0x170/0x1c0)
> [<c03d59c8>] (schedule_timeout+0x170/0x1c0) from [<c03d70d4>] 
> (wait_for_common+0x148/0x1a4)
> [<c03d70d4>] (wait_for_common+0x148/0x1a4) from [<c02839b0>] 
> (__spi_sync+0x58/0x9c)
> [<c02839b0>] (__spi_sync+0x58/0x9c) from [<bf08f138>] 
> (mcp251x_spi_trans+0xa4/0xd0 [mcp251x])
> [<bf08f138>] (mcp251x_spi_trans+0xa4/0xd0 [mcp251x]) from [<bf090140>] 
> (mcp251x_can_ist+0x60/0x348 [mcp251x])
> [<bf090140>] (mcp251x_can_ist+0x60/0x348 [mcp251x]) from [<c005bbf4>] 
> (irq_thread_fn+0x1c/0x34)
> [<c005bbf4>] (irq_thread_fn+0x1c/0x34) from [<c005bce4>] 
> (irq_thread+0xd8/0x148)
> [<c005bce4>] (irq_thread+0xd8/0x148) from [<c0036894>] (kthread+0xa0/0xac)
> [<c0036894>] (kthread+0xa0/0xac) from [<c00093b0>] (ret_from_fork+0x14/0x24)
> Sched Debug Version: v0.10, 3.8.2-9-can-modules+ #1
> [...]
> "
> 
> We can see that the problem is during the spi transfer.
> Do you think it is a hardware problem ?

Maybe a hardware problem, a driver problem or a problem in the hardware
triggering a bug in the driver.

> What is the "kworker" task ?
> How fix it ?

The "kworker" is some infrastructure task in that parts of the imx spi
driver "live". Here the scenario is:

- The spi_imx_transfer() is waiting for a transfer to finish.
- The finish of the transfer is signaled via the
  complete() <-> wait_for_completion()
- An Interrupt will call complete()
- Did we get an Interrupt? Did we miss the Interrupt?

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: RFC: [PATCH] can: mcp251x: add missing IRQF_ONESHOT to request_threaded_irq
  2013-04-11  8:36           ` RFC: [PATCH] can: mcp251x: add missing IRQF_ONESHOT to request_threaded_irq Marc Kleine-Budde
@ 2013-04-12 11:16             ` Marc Kleine-Budde
  0 siblings, 0 replies; 19+ messages in thread
From: Marc Kleine-Budde @ 2013-04-12 11:16 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: linux-can, Mylene.Josserand

[-- Attachment #1: Type: text/plain, Size: 842 bytes --]

On 04/11/2013 10:36 AM, Marc Kleine-Budde wrote:
> Since commit:
> 
>     1c6c695 genirq: Reject bogus threaded irq requests
> 
> threaded irqs must provide a primary handler or set the IRQF_ONESHOT flag.
> Since the mcp251x driver doesn't make use of a primary handler set the
> IRQF_ONESHOT flag.
> 
> /* Cc: linux-stable <stable@vger.kernel.org> # >= v3.5 */
> Reported-by: Mylene Josserand <Mylene.Josserand@navocap.com>
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

Mylène, added your Tested-by and send a pull request to David.

Marc
-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2013-04-12 11:16 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-10 13:07 [imx27 - mcp251x] MCP251x does not work in static ? Mylene Josserand
2013-04-10 13:39 ` Marc Kleine-Budde
2013-04-10 14:11   ` Mylene Josserand
2013-04-10 15:30     ` Marc Kleine-Budde
2013-04-11  7:39       ` Mylene Josserand
2013-04-11  7:49         ` Marc Kleine-Budde
2013-04-11  8:04           ` Mylene Josserand
2013-04-11  8:39             ` Marc Kleine-Budde
2013-04-11  9:22               ` Mylene Josserand
2013-04-11  9:49                 ` Marc Kleine-Budde
2013-04-11 14:39                   ` Mylene Josserand
2013-04-11 15:09                     ` Marc Kleine-Budde
2013-04-12  9:24                       ` Mylene Josserand
2013-04-12  9:49                         ` Marc Kleine-Budde
2013-04-12  9:36                     ` Marc Kleine-Budde
2013-04-12  9:40                       ` Mylene Josserand
2013-04-12  9:48                         ` Marc Kleine-Budde
2013-04-11  8:36           ` RFC: [PATCH] can: mcp251x: add missing IRQF_ONESHOT to request_threaded_irq Marc Kleine-Budde
2013-04-12 11:16             ` Marc Kleine-Budde

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.