Connecting the SB600's i8259 controller rather in pasemi's pci.c than in pasemi's setup.c.
PATCH 1/1 Connecting the SB600's i8259 controller rather in pasemi's pci.c than in pasemi's setup.c.
"pas_pci_init" was before "nemo_init_IRQ".
Now "pas_pci_init" is after "nemo_init_IRQ" in the official kernel source code.
I think "pas_pci_init" scans (discovers) the PCI(e) devices and after that, "nemo_init_IRQ" assigns interrupt numbers
to these devices if required.
It's not possible to assigns interrupt numbers to PCI(e) devices which have not been discovered yet.
--- arch/powerpc/platforms/pasemi/pci.c | 7 +++++++ arch/powerpc/platforms/pasemi/setup.c | 7 ++++--- 2 files changed, 11 insertions(+), 3 deletions(-)
arch/powerpc/platforms/pasemi/pci.c +7 -0
@@ -25,6 +25,8 @@#define PA_PXP_CFA (bus, devfn, off) (((bus) << 20) | ((devfn) << 12) | (off)) +extern void nemo_init_IRQ (void ); +static inline int pa_pxp_offset_valid (u8 bus,u8 devfn,int offset) {/* Device 0 Function 0 is special: It's config space spans function 1 as
@@ -265,6 +267,11 @@ static int __init pas_add_bridge(struct device_node *dev)*/ isa_bridge_find_early (hose); +/* +* ISA bridge is now active, add the i8259 cascade (if needed) +*/ +nemo_init_IRQ (); +return 0 ; }
arch/powerpc/platforms/pasemi/setup.c +4 -3
@@ -214,10 +214,12 @@ static void sb600_8259_cascade(struct irq_desc *desc) chip->irq_eoi (&desc->irq_data); } -static void __init nemo_init_IRQ (struct mpic *mpic) +void 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,6 +230,7 @@ static void __init nemo_init_IRQ(struct mpic *mpic)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); }
@@ -298,8 +301,6 @@ static __init void pas_init_IRQ(void)mpic_unmask_irq (irq_get_irq_data (nmi_virq)); } -nemo_init_IRQ (mpic); -of_node_put (mpic_node);of_node_put (root); }
Signature · 1 line
2.55.0.windows.1
The Nemo board [1] doesn’t boot without this patch. Darren explained it really well:
Originally we initialised the PCI-e ports in setup arch, this is quite early, and it seems uses some kernel functions that were not recommended (They changed a whole lot of different platforms at the same time for the same reason)
After this we added the ISA bridge, then the kernel would init the IRQ contollers.
The patch that broke booting on the X1000 moved the pas_pci_init to a node in the machine description, where it called later in the boot sequence. Unfortunately this is after we've tried to add the i8259 contoller from the pas_init_IRQ. Since our ISA bridge can't be found until we've connected the PCI-e ports the system tries to write to registers that aren't yet mapped - result a kernel panic, but before console I/O has been initialised so it appears to be a hang. We had a similar problem when they were introducing Radix support.
My patch changes our code so that it works with the new kernel code in place. Basically I moved the code that adds the i8259 cascade to after we've scanned for the ISA bridge where I know it will work.
Hopefully this makes sense, shout out if it doesn't
Regards
Darren
[1] https://en.wikipedia.org/wiki/AmigaOne_X1000
Quoted 80 lines · Christian Zigotzky
"
pas_pci_init" was before "nemo_init_IRQ".
Now "pas_pci_init" is after "nemo_init_IRQ" in the official kernel source code.
I think "pas_pci_init" scans (discovers) the PCI(e) devices and after that, "nemo_init_IRQ" assigns interrupt numbers
to these devices if required.
It's not possible to assigns interrupt numbers to PCI(e) devices which have not been discovered yet.Signed-off-by Christian Zigotzky <[email protected]>---
arch/powerpc/platforms/pasemi/pci.c| 7 +++++++arch/powerpc/platforms/pasemi/setup.c| 7 ++++---2 files changed, 11 insertions(+), 3 deletions(-)arch/powerpc/platforms/pasemi/pci.c +7
-0@@ -25,6 +25,8 @@#define PA_PXP_CFA (bus, devfn, off) (((bus) << 20) | ((devfn) << 12) | (off)) +extern void nemo_init_IRQ (void ); +static inline int pa_pxp_offset_valid (u8 bus,u8 devfn,int offset) {/* Device 0 Function 0 is special: It's config space spans function 1 as @@ -265,6 +267,11 @@ static int __init pas_add_bridge(struct device_node *dev)*/ isa_bridge_find_early (hose); +/* +* ISA bridge is now active, add the i8259 cascade (if needed) +*/ +nemo_init_IRQ (); +return 0 ; }arch/powerpc/platforms/pasemi/setup.c +4
-4@@ -214,10 +214,12 @@ static void sb600_8259_cascade(struct irq_desc *desc) chip->irq_eoi (&desc->irq_data); } -static void __init nemo_init_IRQ (struct mpic *mpic) +void 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,6 +230,7 @@ static void __init nemo_init_IRQ(struct mpic *mpic)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); }@@ -298,8 +301,6 @@ static __init void pas_init_IRQ(void)mpic_unmask_irq (irq_get_irq_data (nmi_virq)); } -nemo_init_IRQ (mpic); -of_node_put (mpic_node);of_node_put (root); } --2.55.0.windows.1
PATCH 1/1 Connecting the SB600's i8259 controller rather in pasemi's pci.c than in pasemi's setup.c.
In reply to Christian ZigotzkyAny comments about this patch?
-- Christian
Quoted 75 lines · Christian Zigotzky
"
pas_pci_init" was before "nemo_init_IRQ".
Now "pas_pci_init" is after "nemo_init_IRQ" in the official kernel source code.
I think "pas_pci_init" scans (discovers) the PCI(e) devices and after that, "nemo_init_IRQ" assigns interrupt numbers
to these devices if required.
It's not possible to assigns interrupt numbers to PCI(e) devices which have not been discovered yet.Signed-off-by Christian Zigotzky <[email protected]>---
arch/powerpc/platforms/pasemi/pci.c | 7 +++++++arch/powerpc/platforms/pasemi/setup.c| 7 ++++---2 files changed, 11 insertions(+), 3 deletions(-)arch/powerpc/platforms/pasemi/pci.c +7
-0@@ -25,6 +25,8 @@ #define PA_PXP_CFA(bus, devfn, off) (((bus) << 20) | ((devfn) << 12) | (off)) +extern void nemo_init_IRQ (void ); + static inline int pa_pxp_offset_valid(u8 bus, u8 devfn, int offset) { /* Device 0 Function 0 is special: It's config space spans function 1 as@@ -265,6 +267,11 @@ static int __init pas_add_bridge(struct device_node *dev)*/ isa_bridge_find_early(hose); + /* + * ISA bridge is now active, add the i8259 cascade (if needed) + */ + nemo_init_IRQ(); + return 0; }arch/powerpc/platforms/pasemi/setup.c +4
-3@@ -214,10 +214,12 @@ static void sb600_8259_cascade(struct irq_desc *desc) chip->irq_eoi(&desc->irq_data); } -static void __init nemo_init_IRQ (struct mpic *mpic) +void 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,6 +230,7 @@ static void __init nemo_init_IRQ(struct mpic *mpic) 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); }@@ -298,8 +301,6 @@ static __init void pas_init_IRQ(void) mpic_unmask_irq(irq_get_irq_data(nmi_virq)); } - nemo_init_IRQ(mpic); - of_node_put(mpic_node); of_node_put(root); }
Signature · 1 line
Sent with BrassMonkey 34.2.2 (https://github.com/chzigotzky/Web-Browsers-and-Suites-for-Linux-PPC/releases/tag/BrassMonkey_34.2.2)
PATCH 1/1 Connecting the SB600's i8259 controller rather in pasemi's pci.c than in pasemi's setup.c.
Is this patch OK? My P.A. Semi Nemo board boots with the patched kernel.
-- Christian
Quoted 85 lines · Christian Zigotzky
Any comments about this patch?
Tested-by Christian Zigotzky <[email protected]>-- Christian
Quoted 75 lines · Christian Zigotzky
"
pas_pci_init" was before "nemo_init_IRQ".
Now "pas_pci_init" is after "nemo_init_IRQ" in the official kernel source code.
I think "pas_pci_init" scans (discovers) the PCI(e) devices and after that, "nemo_init_IRQ" assigns interrupt numbers
to these devices if required.
It's not possible to assigns interrupt numbers to PCI(e) devices which have not been discovered yet.Signed-off-by Christian Zigotzky <[email protected]>---
arch/powerpc/platforms/pasemi/pci.c | 7 +++++++arch/powerpc/platforms/pasemi/setup.c| 7 ++++---2 files changed, 11 insertions(+), 3 deletions(-)arch/powerpc/platforms/pasemi/pci.c +7
-0@@ -25,6 +25,8 @@ #define PA_PXP_CFA(bus, devfn, off) (((bus) << 20) | ((devfn) << 12) | (off)) +extern void nemo_init_IRQ (void ); + static inline int pa_pxp_offset_valid(u8 bus, u8 devfn, int offset) { /* Device 0 Function 0 is special: It's config space spans function 1 as@@ -265,6 +267,11 @@ static int __init pas_add_bridge(struct device_node *dev)*/ isa_bridge_find_early(hose); + /* + * ISA bridge is now active, add the i8259 cascade (if needed) + */ + nemo_init_IRQ(); + return 0; }arch/powerpc/platforms/pasemi/setup.c +4
-3@@ -214,10 +214,12 @@ static void sb600_8259_cascade(struct irq_desc *desc) chip->irq_eoi(&desc->irq_data); } -static void __init nemo_init_IRQ (struct mpic *mpic) +void 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,6 +230,7 @@ static void __init nemo_init_IRQ(struct mpic *mpic) 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); }@@ -298,8 +301,6 @@ static __init void pas_init_IRQ(void) mpic_unmask_irq(irq_get_irq_data(nmi_virq)); } - nemo_init_IRQ(mpic); - of_node_put(mpic_node); of_node_put(root); }
Signature · 1 line
Sent with BrassMonkey 34.2.2 (https://github.com/chzigotzky/Web-Browsers-and-Suites-for-Linux-PPC/releases/tag/BrassMonkey_34.2.2)