linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] powerpc: Wii IRQ fixes
@ 2018-05-10 21:59 Jonathan Neuschäfer
  2018-05-10 21:59 ` [PATCH 1/2] powerpc: flipper-pic: Don't match all IRQ domains Jonathan Neuschäfer
  2018-05-10 21:59 ` [PATCH 2/2] powerpc: hlwd-pic: Prevent interrupts from being handled by Starlet Jonathan Neuschäfer
  0 siblings, 2 replies; 4+ messages in thread
From: Jonathan Neuschäfer @ 2018-05-10 21:59 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: linux-kernel, Segher Boessenkool, Joel Stanley,
	Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Mathieu Malaterre, Jonathan Neuschäfer

This series makes it possible to use the SD card on the Wii. The WLAN
now also works on the SDIO level, but fails to connect to a network for
some reason.

Patch 1 seems quite obvious, although I don't know why the code was
broken in this particular way.

Patch 2 might not be the right solution for the problem at hand, but it
works and should only cause problems when both processors in the system
(PPC and ARM) try to use the same interrupt, if at all.

Jonathan Neuschäfer (2):
  powerpc: flipper-pic: Don't match all IRQ domains
  powerpc: hlwd-pic: Prevent interrupts from being handled by Starlet

 arch/powerpc/platforms/embedded6xx/flipper-pic.c | 8 --------
 arch/powerpc/platforms/embedded6xx/hlwd-pic.c    | 5 +++++
 2 files changed, 5 insertions(+), 8 deletions(-)

-- 
2.17.0

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

* [PATCH 1/2] powerpc: flipper-pic: Don't match all IRQ domains
  2018-05-10 21:59 [PATCH 0/2] powerpc: Wii IRQ fixes Jonathan Neuschäfer
@ 2018-05-10 21:59 ` Jonathan Neuschäfer
  2018-05-21 10:01   ` [1/2] " Michael Ellerman
  2018-05-10 21:59 ` [PATCH 2/2] powerpc: hlwd-pic: Prevent interrupts from being handled by Starlet Jonathan Neuschäfer
  1 sibling, 1 reply; 4+ messages in thread
From: Jonathan Neuschäfer @ 2018-05-10 21:59 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: linux-kernel, Segher Boessenkool, Joel Stanley,
	Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Mathieu Malaterre, Jonathan Neuschäfer

On the Wii, there is a secondary IRQ controller (hlwd-pic), so
flipper-pic's match operation should not be hardcoded to return 1.
In fact, the default matching logic is sufficient, and we can completely
omit flipper_pic_match.

Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
---

Note: This shouldn't break Linux on the GameCube, but I've only tested
on the Wii. Some confirmation that I didn't break interrupt handling on
the GC would be nice. (If someone still runs mainline on the GC.)
---
 arch/powerpc/platforms/embedded6xx/flipper-pic.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/arch/powerpc/platforms/embedded6xx/flipper-pic.c b/arch/powerpc/platforms/embedded6xx/flipper-pic.c
index 7206f3f573d4..db0be007fd06 100644
--- a/arch/powerpc/platforms/embedded6xx/flipper-pic.c
+++ b/arch/powerpc/platforms/embedded6xx/flipper-pic.c
@@ -108,16 +108,8 @@ static int flipper_pic_map(struct irq_domain *h, unsigned int virq,
 	return 0;
 }
 
-static int flipper_pic_match(struct irq_domain *h, struct device_node *np,
-			     enum irq_domain_bus_token bus_token)
-{
-	return 1;
-}
-
-
 static const struct irq_domain_ops flipper_irq_domain_ops = {
 	.map = flipper_pic_map,
-	.match = flipper_pic_match,
 };
 
 /*
-- 
2.17.0

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

* [PATCH 2/2] powerpc: hlwd-pic: Prevent interrupts from being handled by Starlet
  2018-05-10 21:59 [PATCH 0/2] powerpc: Wii IRQ fixes Jonathan Neuschäfer
  2018-05-10 21:59 ` [PATCH 1/2] powerpc: flipper-pic: Don't match all IRQ domains Jonathan Neuschäfer
@ 2018-05-10 21:59 ` Jonathan Neuschäfer
  1 sibling, 0 replies; 4+ messages in thread
From: Jonathan Neuschäfer @ 2018-05-10 21:59 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: linux-kernel, Segher Boessenkool, Joel Stanley,
	Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Mathieu Malaterre, Jonathan Neuschäfer

The interrupt controller inside the Wii's Hollywood chip is connected to
two masters, the "Broadway" PowerPC and the "Starlet" ARM926, each with
their own interrupt status and mask registers.

When booting the Wii with mini[1], interrupts from the SD card
controller (IRQ 7) are handled by the ARM, because mini provides SD
access over IPC. Linux however can't currently use or disable this IPC
service, so both sides try to handle IRQ 7 without coordination.

Let's instead make sure that all interrupts that are unmasked on the PPC
side are masked on the ARM side; this will also make sure that Linux can
properly talk to the SD card controller (and potentially other devices).

If access to a device through IPC is desired in the future, interrupts
from that device should not be handled by Linux directly.

[1]: https://github.com/lewurm/mini

Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
---
 arch/powerpc/platforms/embedded6xx/hlwd-pic.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
index e3e3af73e9d8..8112b39879d6 100644
--- a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
+++ b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
@@ -35,6 +35,8 @@
  */
 #define HW_BROADWAY_ICR		0x00
 #define HW_BROADWAY_IMR		0x04
+#define HW_STARLET_ICR		0x08
+#define HW_STARLET_IMR		0x0c
 
 
 /*
@@ -74,6 +76,9 @@ static void hlwd_pic_unmask(struct irq_data *d)
 	void __iomem *io_base = irq_data_get_irq_chip_data(d);
 
 	setbits32(io_base + HW_BROADWAY_IMR, 1 << irq);
+
+	/* Make sure the ARM (aka. Starlet) doesn't handle this interrupt. */
+	clrbits32(io_base + HW_STARLET_IMR, 1 << irq);
 }
 
 
-- 
2.17.0

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

* Re: [1/2] powerpc: flipper-pic: Don't match all IRQ domains
  2018-05-10 21:59 ` [PATCH 1/2] powerpc: flipper-pic: Don't match all IRQ domains Jonathan Neuschäfer
@ 2018-05-21 10:01   ` Michael Ellerman
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2018-05-21 10:01 UTC (permalink / raw)
  To: Jonathan Neuschäfer, linuxppc-dev
  Cc: Mathieu Malaterre, linux-kernel, Jonathan Neuschäfer,
	Paul Mackerras, Joel Stanley

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 494 bytes --]

On Thu, 2018-05-10 at 21:59:18 UTC, =?utf-8?q?Jonathan_Neusch=C3=A4fer?= wrote:
> On the Wii, there is a secondary IRQ controller (hlwd-pic), so
> flipper-pic's match operation should not be hardcoded to return 1.
> In fact, the default matching logic is sufficient, and we can completely
> omit flipper_pic_match.
> 
> Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>

Series applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/c068e6b8caa0c796535cb12f64767c

cheers

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

end of thread, other threads:[~2018-05-21 10:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-10 21:59 [PATCH 0/2] powerpc: Wii IRQ fixes Jonathan Neuschäfer
2018-05-10 21:59 ` [PATCH 1/2] powerpc: flipper-pic: Don't match all IRQ domains Jonathan Neuschäfer
2018-05-21 10:01   ` [1/2] " Michael Ellerman
2018-05-10 21:59 ` [PATCH 2/2] powerpc: hlwd-pic: Prevent interrupts from being handled by Starlet Jonathan Neuschäfer

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).