netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] net: dsa: mv88e6xxx: novice fixes and irq handling
@ 2018-03-19 10:05 Uwe Kleine-König
  2018-03-19 10:05 ` [PATCH 1/4] net: dsa: mv88e6xxx: Fix name of switch 88E6141 Uwe Kleine-König
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Uwe Kleine-König @ 2018-03-19 10:05 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Marc Zyngier, Thomas Gleixner
  Cc: kernel, Florian Fainelli, netdev, Gregory CLEMENT

Hello,

this is a set of patches I created while I tried to understand how DSA
works. I don't claim I already got there and so the first 3 fixes are
trivial only.

I tried to make the switch on the espressobin SBC use the interrupt line
and needed the fourth patch to make this work. Given I don't have access
to the documentation of the Marvell switch, the patch is probably not
correct though (and so doesn't have a S-o-b).

When I first added the irq as:

	interrupt-parent = <&gpiosb>;
	interrupts = <23 IRQ_TYPE_LEVEL_LOW>;

to the switch of the espressobin's dtb, the irq couldn't be used. The
reason is the interaction of several things:

 - On the first try to probe the switch, the driver did:

	irq = of_irq_get(np, 0);
	request_threaded_irq(irq, NULL, func, IRQF_ONESHOT | IRQF_TRIGGER_FALLING, ...);

   and then later aborted with -EPROBE_DEFER because another resource
   wasn't available yet. This correctly undid the request_threaded_irq
   above using free_irq.

 - When the probe routine was entered again, the call to of_irq_get(np, 0)
   failed becauce the irq code remembered that the irq was requested
   using edge triggered logic with:

	irq: type mismatch, failed to map hwirq-23 for gpio!

   (kernel/irq/irqdomain.c, line 801)

Any of the following changes would make the problem disappear:

 - use IRQ_TYPE_EDGE_FALLING in the device tree;
 - drop IRQF_TRIGGER_FALLING from the driver's use of
   request_threaded_irq() (I think, see below); and
 - make the irq code forget the trigger type when the last action is
   removed

I think both the second and the third should be done.

For the third, after a quick look into kernel/irq I didn't find a
suitable place where to do that and so it would be great to get some
feedback from Marc or Thomas here.

Regarding the first one: Is the irq of the switch really edge sensitive?
I didn't see the line reset to 1 after an irq was triggered. (And again,
I don't have access on the documentation of the switch.) When I tested
the second change however the driver still failed because the
gpio controller doesn't support level sensitive irqs. :-|

Looking forward to your comments
Uwe Kleine-Köníg

Uwe Kleine-König (4):
  net: dsa: mv88e6xxx: Fix name of switch 88E6141
  net: dsa: mv88e6xxx: Fix typo in a comment
  net: dsa: mv88e6xxx: Fix interrupt name for g2 irq
  net: dsa: mv88e6xxx: Guess number of g1 irqs

 drivers/net/dsa/mv88e6xxx/chip.c    | 6 ++++--
 drivers/net/dsa/mv88e6xxx/global2.c | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

-- 
2.16.2

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

end of thread, other threads:[~2018-03-20  9:30 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-19 10:05 [PATCH 0/4] net: dsa: mv88e6xxx: novice fixes and irq handling Uwe Kleine-König
2018-03-19 10:05 ` [PATCH 1/4] net: dsa: mv88e6xxx: Fix name of switch 88E6141 Uwe Kleine-König
2018-03-19 11:58   ` Andrew Lunn
2018-03-19 10:05 ` [PATCH 2/4] net: dsa: mv88e6xxx: fix typo in a comment Uwe Kleine-König
2018-03-19 11:58   ` Andrew Lunn
2018-03-19 10:05 ` [PATCH 3/4] net: dsa: mv88e6xxx: fix interrupt name for g2 irq Uwe Kleine-König
2018-03-19 11:59   ` Andrew Lunn
2018-03-19 10:05 ` [PATCH 4/4] net: dsa: mv88e6xxx: guess number of g1 irqs Uwe Kleine-König
2018-03-19 12:01   ` Andrew Lunn
2018-03-19 12:24 ` [PATCH 0/4] net: dsa: mv88e6xxx: novice fixes and irq handling Andrew Lunn
2018-03-19 16:37 ` Andrew Lunn
2018-03-20  9:30   ` Uwe Kleine-König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).