Re: Fwd: Ethernet controller not starting

From: Christian Riesch
Date: Tue Mar 04 2014 - 09:06:30 EST


Hi Jon,

[Now also cc'ed Prabhakar Lad]

--On March 04, 2014 07:34 -0500 Jon Ringle <jon@xxxxxxxxxx> wrote:

On Tue, Mar 4, 2014 at 4:06 AM, Christian Riesch
<christian.riesch@xxxxxxxxxx> wrote:
[cc'ed netdev and davinci-linux-open-source]


--On March 03, 2014 19:39 -0500 Jon Ringle <jon@xxxxxxxxxx> wrote:

On Mon, Mar 3, 2014 at 6:43 PM, Rafael J. Wysocki <rjw@xxxxxxxxxxxxx>
wrote:

On Monday, March 03, 2014 02:41:01 PM Jon Ringle wrote:

I'm working on porting an ARM board from linux-3.10 to linux-3.12 (now
the latest LTS kernel).
I found that Ethernet controller on the board no longer comes up on
linux-3.12. I was able to bisect the issue I'm having to the following
commit:

> 45f0a85c8258741d11bda25c0a5669c06267204a is the first bad commit
> commit 45f0a85c8258741d11bda25c0a5669c06267204a
> Author: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
> Date: Mon Jun 3 21:49:52 2013 +0200
>
[...]

Can anyone offer any suggestions on what I should be looking for to
fix this on my board?


Any pointers to the driver in question?


drivers/net/ethernet/ti/davinci_emac.c


Hi Jon,
I have successfully used the davinci_emac driver on a custom board with
an AM1808 SoC with Kernel 3.13 a few weeks ago. So at least 3.13 should
work. Did you try more recent kernel versions than 3.12?

I have not tried 3.13, but will do so today. Could I get a copy of
your .config for comparison purposes?


I would like to apologize, apparently my testing with 3.13 was quite bad. Ethernet comes up on my board and works fine after booting, but I can easily reproduce your problem by just doing ifconfig eth0 down /ifconfig eth0 up (which should call emac_dev_stop/emac_dev_open).

# ifconfig eth0 up
genirq: Flags mismatch irq 33. .....

So probably one of your start scripts (or dhcp or similar) does some ifconfig down/up, which then fails.

I had a look at the code again, emac_dev_open requests the interrupts, whereas emac_dev_stop does not free them. If emac_dev_open is then called again by ifconfig eth0 up, it tries to request the interrupts again, resulting in the error above.

I think the problem is a regression caused by

Commit 6892b41d9701283085b655c6086fb57a5d63fa47
net: davinci: emac: Convert to devm_* api
Signed-off-by: Lad, Prabhakar <prabhakar.csengg@xxxxxxxxx>

This patch replaces request_irq() by devm_request_irq() in emac_dev_open and removes free_irq() from emac_dev_stop. But since emac_dev_open is called every time we do an ifconfig eth0 up, it tries to request the interrupts again and again and again (and fails).

So I guess the correct solution would be to move the calls of devm_request_irq() to davinci_emac_probe(). I will send a patch to netdev, it solves the problem on my board.

Christian










--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/