LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Zigotzky <chzigotzky@xenosoft.de>
To: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
	Madhavan Srinivasan <maddy@linux.ibm.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Nicholas Piggin <npiggin@gmail.com>,
	Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>,
	"open list:LINUX FOR POWERPC (32-BIT AND 64-BIT)"
	<linuxppc-dev@lists.ozlabs.org>,
	open list <linux-kernel@vger.kernel.org>
Cc: "R.T.Dickinson" <rtd2@xtra.co.nz>,
	mad skateman <madskateman@gmail.com>,
	Damien Stewart <hypexed@yahoo.com.au>,
	Darren Stevens <darren@stevens-zone.net>,
	Christian Zigotzky <info@xenosoft.de>
Subject: Re: [PATCH] Connecting the SB600's i8259 controller rather in pasemi's pci.c than in pasemi's setup.c.
Date: Tue, 28 Jul 2026 14:50:04 +0200	[thread overview]
Message-ID: <f5ed5a79-4235-31b6-5bd9-c68d1a6b50cf@xenosoft.de> (raw)
In-Reply-To: <656742f7-ff8f-43f5-829d-5b5f0f6c8c95@kernel.org>

On 27/07/26 15:43, Christophe Leroy (CS GROUP) wrote:
 >
 > Should be better in arch/powerpc/platforms/pasemi/pasemi.h
 >

Hello Christophe,

Thank you for your answer. I modified the patch today. The Nemo board 
boots without any problems if I compile the RC5 of kernel 7.2 with this 
patch.

Could you please check the following modified patch?

Thanks,
Christian

---

powerpc/pasemi: Move Nemo i8259 initialization to pci.c

The Nemo board requires the PCIe ports to be initialized before the
SB600 ISA bridge can be accessed.

Since pas_pci_init() is now called later during boot, the i8259
initialization in pas_init_IRQ() happens too early and accesses
registers that are not yet mapped, preventing the board from booting.

Move the Nemo-specific i8259 initialization to pas_add_bridge(),
after the ISA bridge has been discovered.

Suggested-by: Darren Stevens <darren@stevens-zone.net>
Tested-by: Christian Zigotzky <chzigotzky@xenosoft.de>
Signed-off-by: Christian Zigotzky <chzigotzky@xenosoft.de>

---
v2:
- Move Nemo i8259 initialization out of pas_init_IRQ() and into
   pas_add_bridge() after the ISA bridge has been discovered.
- Change nemo_init_IRQ() to no longer depend on the MPIC instance passed
   from the IRQ setup path.
- Move the nemo_init_IRQ() declaration to pasemi.h and add a no-op stub
   for non-Nemo builds.
- Fix missing prototype warning reported by Christophe Leroy.
- Fix indentation and clean up the commit message.

diff -rupN a/arch/powerpc/platforms/pasemi/pasemi.h 
b/arch/powerpc/platforms/pasemi/pasemi.h
--- a/arch/powerpc/platforms/pasemi/pasemi.h    2026-07-26 
23:45:48.000000000 +0200
+++ b/arch/powerpc/platforms/pasemi/pasemi.h    2026-07-28 
07:44:31.924168227 +0200
@@ -7,6 +7,12 @@ extern void pas_pci_init(void);
  struct pci_dev;
  extern void pas_pci_dma_dev_setup(struct pci_dev *dev);

+#ifdef CONFIG_PPC_PASEMI_NEMO
+extern void __init nemo_init_IRQ(void);
+#else
+static inline void __init nemo_init_IRQ(void) { }
+#endif
+
  void __iomem *__init pasemi_pci_getcfgaddr(struct pci_dev *dev, int 
offset);

  extern void __init pasemi_map_registers(void);
diff -rupN a/arch/powerpc/platforms/pasemi/pci.c 
b/arch/powerpc/platforms/pasemi/pci.c
--- a/arch/powerpc/platforms/pasemi/pci.c    2026-07-26 
23:45:48.000000000 +0200
+++ b/arch/powerpc/platforms/pasemi/pci.c    2026-07-28 
07:34:37.036634023 +0200
@@ -265,6 +265,11 @@ static int __init pas_add_bridge(struct
       */
      isa_bridge_find_early(hose);

+    /*
+     * ISA bridge is now active, add the i8259 cascade (if needed)
+     */
+    nemo_init_IRQ();
+
      return 0;
  }

diff -rupN a/arch/powerpc/platforms/pasemi/setup.c 
b/arch/powerpc/platforms/pasemi/setup.c
--- a/arch/powerpc/platforms/pasemi/setup.c    2026-07-26 
23:45:48.000000000 +0200
+++ b/arch/powerpc/platforms/pasemi/setup.c    2026-07-28 
07:54:54.147863161 +0200
@@ -214,10 +214,12 @@ static void sb600_8259_cascade(struct ir
      chip->irq_eoi(&desc->irq_data);
  }

-static void __init nemo_init_IRQ(struct mpic *mpic)
+void __init nemo_init_IRQ(void)
  {
      struct device_node *np;
      int gpio_virq;
+    struct mpic *mpic;
+
      /* Connect the SB600's legacy i8259 controller */
      np = of_find_node_by_path("/pxp@0,e0000000");
      i8259_init(np, 0);
@@ -228,14 +230,10 @@ static void __init nemo_init_IRQ(struct
      irq_set_chained_handler(gpio_virq, sb600_8259_cascade);
      mpic_unmask_irq(irq_get_irq_data(gpio_virq));

+    mpic = irq_get_chip_data(gpio_virq);
      irq_set_default_domain(mpic->irqhost);
  }

-#else
-
-static inline void nemo_init_IRQ(struct mpic *mpic)
-{
-}
  #endif

  static __init void pas_init_IRQ(void)
@@ -297,9 +295,7 @@ static __init void pas_init_IRQ(void)
          irq_set_irq_type(nmi_virq, IRQ_TYPE_EDGE_RISING);
          mpic_unmask_irq(irq_get_irq_data(nmi_virq));
      }
-
-    nemo_init_IRQ(mpic);
-
+
      of_node_put(mpic_node);
      of_node_put(root);
  }





  reply	other threads:[~2026-07-28 12:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-01 12:59 [PATCH] Connecting the SB600's i8259 controller rather in pasemi's pci.c than in pasemi's setup.c Christian Zigotzky
2026-07-27 13:43 ` Christophe Leroy (CS GROUP)
2026-07-28 12:50   ` Christian Zigotzky [this message]
2026-07-31 16:33     ` Christophe Leroy (CS GROUP)
  -- strict thread matches above, loose matches on Subject: below --
2026-07-01 10:54 Christian Zigotzky
2026-07-01 11:14 ` Christian Zigotzky
2026-07-07  4:31 ` Christian Zigotzky
2026-07-13 16:18   ` Christian Zigotzky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f5ed5a79-4235-31b6-5bd9-c68d1a6b50cf@xenosoft.de \
    --to=chzigotzky@xenosoft.de \
    --cc=chleroy@kernel.org \
    --cc=darren@stevens-zone.net \
    --cc=hypexed@yahoo.com.au \
    --cc=info@xenosoft.de \
    --cc=krzysztof.kozlowski@oss.qualcomm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=madskateman@gmail.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=rtd2@xtra.co.nz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox