Skip to contentSkip to conversation

powerpc/85xx: p2020: Create one unified machine description

PATCH In review Christophe Leroy 3 participants 21 messages Feb 22, 2023 – Feb 23, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v4 cover powerpc/85xx: p2020: Create one unified machine description

This patch series unifies all P2020 boards and machine descriptions into one generic unified P2020 machine description. With this generic machine description, kernel can boot on any P2020-based board with correct DTS file.

Tested on CZ.NIC Turris 1.1 board with has Freescale P2020 processor. Kernel during booting correctly detects P2020 and prints:

[    0.000000] Using Freescale P2020 machine description

Changes in v4:
* Added several preparatory cleanup patchs
* Minimised churn by not duplicating helpers at the first place
* Split main patch in two
* Dropped patchs 1 and 2
* Untested beyond basic build test

Changes in v3:
* Use 'if (IS_ENABLED(CONFIG_PPC_I8259))' instead of '#ifdef CONFIG_PPC_I8259'
* Simplify p2020_probe()
* Patches generated by -M and -C git options

Link to v2: https://lore.kernel.org/linuxppc-dev/[email protected]/

Changes in v2:
* Added patch "p2020: Move i8259 code into own function" (separated from the next one)
* Renamed CONFIG_P2020 to CONFIG_PPC_P2020
* Fixed descriptions

Link to v1: https://lore.kernel.org/linuxppc-dev/[email protected]/

Christophe Leroy (9):
powerpc/fsl_uli1575: Misc cleanup
powerpc/85xx: Rename setup_arch and pic_init on p1023 powerpc/85xx: Remove DBG() macro
powerpc/85xx: Remove #ifdefs CONFIG_PCI in mpc85xx_ds powerpc/85xx: mpc85xx_{ds/rdb} compact the call to mpic_alloc() powerpc/85xx: mpc85xx_{ds/rdb} replace BUG_ON() by WARN_ON() powerpc/85xx: mpc85xx_{ds/rdb} replace prink by pr_xxx macro powerpc/85xx: Remove #ifdefs CONFIG_PPC_I8259 in mpc85xx_ds powerpc/85xx: Remove #ifdef CONFIG_QUICC_ENGINE in mpc85xx_rdb

Pali Rohár (8):
powerpc/85xx: p2020: Move all P2020 DS machine descriptions to p2020.c powerpc/85xx: p2020: Move all P2020 RDB machine descriptions to

    p2020.c
  powerpc/85xx: p2020: Move i8259 code into own function
  powerpc/85xx: mpc85xx_ds: Move PCI code into own file
  powerpc/85xx: p2020: Unify .setup_arch and .init_IRQ callbacks
  powerpc/85xx: p2020: Define just one machine description
  powerpc/85xx: p2020: Enable boards by new config option
    CONFIG_PPC_P2020

powerpc: dts: turris1x.dts: Remove "fsl,P2020RDB-PC" compatible string

 arch/powerpc/boot/dts/turris1x.dts         |   2 +-
 arch/powerpc/include/asm/ppc-pci.h         |   2 +
 arch/powerpc/platforms/85xx/Kconfig        |  22 +++-
 arch/powerpc/platforms/85xx/Makefile       |   5 +-
 arch/powerpc/platforms/85xx/mpc85xx.h      |  12 ++
 arch/powerpc/platforms/85xx/mpc85xx_8259.c |  78 ++++++++++++
 arch/powerpc/platforms/85xx/mpc85xx_ds.c   | 133 ++-------------------
 arch/powerpc/platforms/85xx/mpc85xx_mds.c  |   7 --
 arch/powerpc/platforms/85xx/mpc85xx_rdb.c  |  79 ++----------
 arch/powerpc/platforms/85xx/mpc85xx_uli.c  |  64 ++++++++++
 arch/powerpc/platforms/85xx/p1023_rdb.c    |   8 +-
 arch/powerpc/platforms/85xx/p2020.c        |  95 +++++++++++++++
 arch/powerpc/platforms/fsl_uli1575.c       |   6 +-
 13 files changed, 301 insertions(+), 212 deletions(-)
 create mode 100644 arch/powerpc/platforms/85xx/mpc85xx_8259.c
 create mode 100644 arch/powerpc/platforms/85xx/mpc85xx_uli.c
 create mode 100644 arch/powerpc/platforms/85xx/p2020.c
Signature · 1 line
2.39.1
#7 lore raw

PATCH v4 7/17 powerpc/85xx: mpc85xx_{ds/rdb} replace prink by pr_xxx macro

Use pr_debug() instead of printk(KERN_DEBUG Use pr_err() instead of printk(KERN_ERR
Use pr_info() instead of printk(KERN_INFO or printk("

---
 arch/powerpc/platforms/85xx/mpc85xx_ds.c  | 6 +++---
 arch/powerpc/platforms/85xx/mpc85xx_rdb.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
arch/powerpc/platforms/85xx/mpc85xx_ds.c +3 -3
index 60d473d9b8ee..e995c939c14d 100644
@@ -76,13 +76,13 @@ void __init mpc85xx_ds_pic_init(void)
 	}
 
 	if (cascade_node == NULL) {
-		printk(KERN_DEBUG "Could not find i8259 PIC\n");
+		pr_debug("Could not find i8259 PIC\n");
 		return;
 	}
 
 	cascade_irq = irq_of_parse_and_map(cascade_node, 0);
 	if (!cascade_irq) {
-		printk(KERN_ERR "Failed to map cascade interrupt\n");
+		pr_err("Failed to map cascade interrupt\n");
 		return;
 	}
 
@@ -140,7 +140,7 @@ static void __init mpc85xx_ds_setup_arch(void)
 	mpc85xx_ds_uli_init();
 	mpc85xx_smp_init();
 
-	printk("MPC85xx DS board from Freescale Semiconductor\n");
+	pr_info("MPC85xx DS board from Freescale Semiconductor\n");
 }
 
 /*
arch/powerpc/platforms/85xx/mpc85xx_rdb.c +1 -1
index 34b65441661e..8b0d81f0e1c9 100644
@@ -92,7 +92,7 @@ static void __init mpc85xx_rdb_setup_arch(void)
 #endif
 #endif	/* CONFIG_QUICC_ENGINE */
 
-	printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n");
+	pr_info("MPC85xx RDB board from Freescale Semiconductor\n");
 }
 
 machine_arch_initcall(p2020_rdb, mpc85xx_common_publish_devices);
Signature · 1 line
2.39.1
#16 lore raw

PATCH v4 16/17 powerpc/85xx: p2020: Enable boards by new config option CONFIG_PPC_P2020

In reply to Christophe Leroy

From: Pali Rohár <[email protected]>

Generic unified P2020 machine description which supports all P2020-based boards is now in separate file p2020.c. So create a separate config option CONFIG_PPC_P2020 for it.

Previously machine descriptions for P2020 boards were enabled by CONFIG_MPC85xx_DS or CONFIG_MPC85xx_RDB option. So set CONFIG_PPC_P2020 to be enabled by default when one of those option is enabled.

This allows to compile support for P2020 boards without need to have enabled support for older mpc85xx boards. And to compile kernel for old mpc85xx boards without having enabled support for new P2020 boards.

---
 arch/powerpc/platforms/85xx/Kconfig  | 22 ++++++++++++++++++----
 arch/powerpc/platforms/85xx/Makefile |  5 +++--
 2 files changed, 21 insertions(+), 6 deletions(-)
arch/powerpc/platforms/85xx/Kconfig +18 -4
index b92cb2b4d54d..90665882143b 100644
@@ -78,16 +78,16 @@ config MPC8536_DS
 	  This option enables support for the MPC8536 DS board
 
 config MPC85xx_DS
-	bool "Freescale MPC8544 DS / MPC8572 DS / P2020 DS"
+	bool "Freescale MPC8544 DS / MPC8572 DS"
 	select PPC_I8259
 	select DEFAULT_UIMAGE
 	select FSL_ULI1575 if PCI
 	select SWIOTLB
 	help
-	  This option enables support for the MPC8544 DS, MPC8572 DS and P2020 DS boards
+	  This option enables support for the MPC8544 DS and MPC8572 DS boards
 
 config MPC85xx_RDB
-	bool "Freescale P102x MBG/UTM/RDB and P2020 RDB"
+	bool "Freescale P102x MBG/UTM/RDB"
 	select PPC_I8259
 	select DEFAULT_UIMAGE
 	select FSL_ULI1575 if PCI
@@ -95,7 +95,21 @@ config MPC85xx_RDB
 	help
 	  This option enables support for the P1020 MBG PC, P1020 UTM PC,
 	  P1020 RDB PC, P1020 RDB PD, P1020 RDB, P1021 RDB PC, P1024 RDB,
-	  P1025 RDB, P2020 RDB and P2020 RDB PC boards
+	  and P1025 RDB boards
+
+config PPC_P2020
+	bool "Freescale P2020"
+	default y if MPC85xx_DS || MPC85xx_RDB
+	select DEFAULT_UIMAGE
+	select SWIOTLB
+	imply PPC_I8259
+	imply FSL_ULI1575 if PCI
+	help
+	  This option enables generic unified support for any board with the
+	  Freescale P2020 processor.
+
+	  For example: P2020 DS board, P2020 RDB board, P2020 RDB PC board or
+	  CZ.NIC Turris 1.x boards.
 
 config P1010_RDB
 	bool "Freescale P1010 RDB"
arch/powerpc/platforms/85xx/Makefile +3 -2
index 65abd5a161c0..82cf7d5b4913 100644
@@ -18,13 +18,14 @@ obj-$(CONFIG_MPC85xx_CDS) += mpc85xx_cds.o
 obj-$(CONFIG_MPC8536_DS)  += mpc8536_ds.o
 obj8259-$(CONFIG_PPC_I8259)   += mpc85xx_8259.o
 objpci-$(CONFIG_PCI)   += mpc85xx_uli.o
-obj-$(CONFIG_MPC85xx_DS)  += mpc85xx_ds.o p2020.o $(obj8259-y) $(objpci-y)
+obj-$(CONFIG_MPC85xx_DS)  += mpc85xx_ds.o $(obj8259-y) $(objpci-y)
 obj-$(CONFIG_MPC85xx_MDS) += mpc85xx_mds.o
-obj-$(CONFIG_MPC85xx_RDB) += mpc85xx_rdb.o p2020.o
+obj-$(CONFIG_MPC85xx_RDB) += mpc85xx_rdb.o
 obj-$(CONFIG_P1010_RDB)   += p1010rdb.o
 obj-$(CONFIG_P1022_DS)    += p1022_ds.o
 obj-$(CONFIG_P1022_RDK)   += p1022_rdk.o
 obj-$(CONFIG_P1023_RDB)   += p1023_rdb.o
+obj-$(CONFIG_PPC_P2020)   += p2020.o $(obj8259-y) $(objpci-y)
 obj-$(CONFIG_TWR_P102x)   += twr_p102x.o
 obj-$(CONFIG_CORENET_GENERIC)   += corenet_generic.o
 obj-$(CONFIG_FB_FSL_DIU)	+= t1042rdb_diu.o
Signature · 1 line
2.39.1
#4 lore raw

PATCH v4 4/17 powerpc/85xx: Remove #ifdefs CONFIG_PCI in mpc85xx_ds

In reply to Christophe Leroy

All necessary items are declared all the time, no need to use a #ifdef CONFIG_PCI.

---
 arch/powerpc/platforms/85xx/mpc85xx_ds.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
arch/powerpc/platforms/85xx/mpc85xx_ds.c +3 -4
index 26257509aabf..f385cd288a76 100644
@@ -99,7 +99,6 @@ void __init mpc85xx_ds_pic_init(void)
 #endif	/* CONFIG_PPC_I8259 */
 }
 
-#ifdef CONFIG_PCI
 static struct device_node *pci_with_uli;
 
 static int mpc85xx_exclude_device(struct pci_controller *hose,
@@ -110,13 +109,14 @@ static int mpc85xx_exclude_device(struct pci_controller *hose,
 
 	return PCIBIOS_SUCCESSFUL;
 }
-#endif	/* CONFIG_PCI */
 
 static void __init mpc85xx_ds_uli_init(void)
 {
-#ifdef CONFIG_PCI
 	struct device_node *node;
 
+	if (!IS_ENABLED(CONFIG_PCI))
+		return;
+
 	/* See if we have a ULI under the primary */
 
 	node = of_find_node_by_name(NULL, "uli1575");
@@ -129,7 +129,6 @@ static void __init mpc85xx_ds_uli_init(void)
 			break;
 		}
 	}
-#endif
 }
 
 /*
Signature · 1 line
2.39.1
#10 lore raw

PATCH v4 10/17 powerpc/85xx: p2020: Move all P2020 DS machine descriptions to p2020.c

In reply to Christophe Leroy

From: Pali Rohár <[email protected]>

This moves machine descriptions and all related code for all P2020 boards into new p2020.c source file.
This is preparation for code de-duplication and
providing one unified machine description for all P2020 boards. In follow-up patches would be copied functions refactored and simplified to be specific just for P2020 boards.

[chleroy: Split in two patches: one for DS, one for RDB and keep helpers out]
---
 arch/powerpc/platforms/85xx/Makefile     |  2 +-
 arch/powerpc/platforms/85xx/mpc85xx.h    |  3 ++
 arch/powerpc/platforms/85xx/mpc85xx_ds.c | 25 +---------
 arch/powerpc/platforms/85xx/p2020.c      | 59 ++++++++++++++++++++++++
 4 files changed, 64 insertions(+), 25 deletions(-)
 create mode 100644 arch/powerpc/platforms/85xx/p2020.c
arch/powerpc/platforms/85xx/Makefile +1 -1
index 260fbad7967b..1f54623db9b7 100644
@@ -16,7 +16,7 @@ obj-$(CONFIG_MPC8540_ADS) += mpc85xx_ads.o
 obj-$(CONFIG_MPC8560_ADS) += mpc85xx_ads.o
 obj-$(CONFIG_MPC85xx_CDS) += mpc85xx_cds.o
 obj-$(CONFIG_MPC8536_DS)  += mpc8536_ds.o
-obj-$(CONFIG_MPC85xx_DS)  += mpc85xx_ds.o
+obj-$(CONFIG_MPC85xx_DS)  += mpc85xx_ds.o p2020.o
 obj-$(CONFIG_MPC85xx_MDS) += mpc85xx_mds.o
 obj-$(CONFIG_MPC85xx_RDB) += mpc85xx_rdb.o
 obj-$(CONFIG_P1010_RDB)   += p1010rdb.o
arch/powerpc/platforms/85xx/mpc85xx.h +3 -0
index cb84c5c56c36..ca8b39e6b05a 100644
@@ -15,4 +15,7 @@ extern void mpc85xx_qe_par_io_init(void);
 static inline void __init mpc85xx_qe_par_io_init(void) {}
 #endif
 
+void __init mpc85xx_ds_pic_init(void);
+void __init mpc85xx_ds_setup_arch(void);
+
 #endif
arch/powerpc/platforms/85xx/mpc85xx_ds.c +1 -24
index 2b3e9aecb3ad..8594862ab3a4 100644
@@ -133,7 +133,7 @@ static void __init mpc85xx_ds_uli_init(void)
 /*
  * Setup the architecture
  */
-static void __init mpc85xx_ds_setup_arch(void)
+void __init mpc85xx_ds_setup_arch(void)
 {
 	if (ppc_md.progress)
 		ppc_md.progress("mpc85xx_ds_setup_arch()", 0);
@@ -156,7 +156,6 @@ static int __init mpc8544_ds_probe(void)
 
 machine_arch_initcall(mpc8544_ds, mpc85xx_common_publish_devices);
 machine_arch_initcall(mpc8572_ds, mpc85xx_common_publish_devices);
-machine_arch_initcall(p2020_ds, mpc85xx_common_publish_devices);
 
 /*
  * Called very early, device-tree isn't unflattened
@@ -166,14 +165,6 @@ static int __init mpc8572_ds_probe(void)
 	return !!of_machine_is_compatible("fsl,MPC8572DS");
 }
 
-/*
- * Called very early, device-tree isn't unflattened
- */
-static int __init p2020_ds_probe(void)
-{
-	return !!of_machine_is_compatible("fsl,P2020DS");
-}
-
 define_machine(mpc8544_ds) {
 	.name			= "MPC8544 DS",
 	.probe			= mpc8544_ds_probe,
@@ -201,17 +192,3 @@ define_machine(mpc8572_ds) {
 	.calibrate_decr		= generic_calibrate_decr,
 	.progress		= udbg_progress,
 };
-
-define_machine(p2020_ds) {
-	.name			= "P2020 DS",
-	.probe			= p2020_ds_probe,
-	.setup_arch		= mpc85xx_ds_setup_arch,
-	.init_IRQ		= mpc85xx_ds_pic_init,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
-};
arch/powerpc/platforms/85xx/p2020.c new file +59 -0

59 lines not on this page · raw message

Signature · 1 line
2.39.1
#1 lore raw

PATCH v4 1/17 powerpc/fsl_uli1575: Misc cleanup

In reply to Christophe Leroy

Use a single line for uli_exclude_device()

Add uli_exclude_device() prototype in ppc-pci.h

Remove that prototype from mpc85xx_ds.c

Make uli_pirq_to_irq[] static as it is used only in that file.

---
 arch/powerpc/include/asm/ppc-pci.h       | 2 ++
 arch/powerpc/platforms/85xx/mpc85xx_ds.c | 4 +---
 arch/powerpc/platforms/fsl_uli1575.c     | 6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)
arch/powerpc/include/asm/ppc-pci.h +2 -0
index f6cf0159024e..1e9a7f8b05c9 100644
@@ -57,6 +57,8 @@ void eeh_sysfs_remove_device(struct pci_dev *pdev);
 
 #endif /* CONFIG_EEH */
 
+int uli_exclude_device(struct pci_controller *hose, u_char bus, u_char devfn);
+
 #define PCI_BUSNO(bdfn) ((bdfn >> 8) & 0xff)
 
 #else /* CONFIG_PCI */
arch/powerpc/platforms/85xx/mpc85xx_ds.c +1 -3
index f8d2c97f39bd..97e441878409 100644
@@ -26,6 +26,7 @@
 #include <asm/mpic.h>
 #include <asm/i8259.h>
 #include <asm/swiotlb.h>
+#include <asm/ppc-pci.h>
 
 #include <sysdev/fsl_soc.h>
 #include <sysdev/fsl_pci.h>
@@ -107,9 +108,6 @@ void __init mpc85xx_ds_pic_init(void)
 }
 
 #ifdef CONFIG_PCI
-extern int uli_exclude_device(struct pci_controller *hose,
-				u_char bus, u_char devfn);
-
 static struct device_node *pci_with_uli;
 
 static int mpc85xx_exclude_device(struct pci_controller *hose,
arch/powerpc/platforms/fsl_uli1575.c +3 -3
index 84afae7a2561..a32f9cef7845 100644
@@ -13,6 +13,7 @@
 #include <linux/of_irq.h>
 
 #include <asm/pci-bridge.h>
+#include <asm/ppc-pci.h>
 
 #define ULI_PIRQA	0x08
 #define ULI_PIRQB	0x09
@@ -36,7 +37,7 @@
 #define ULI_8259_IRQ14	0x0d
 #define ULI_8259_IRQ15	0x0f
 
-u8 uli_pirq_to_irq[8] = {
+static u8 uli_pirq_to_irq[8] = {
 	ULI_8259_IRQ9,		/* PIRQA */
 	ULI_8259_IRQ10,		/* PIRQB */
 	ULI_8259_IRQ11,		/* PIRQC */
@@ -341,8 +342,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5288, hpcd_quirk_uli5288);
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229, hpcd_quirk_uli5229);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, 0x5288, hpcd_final_uli5288);
 
-int uli_exclude_device(struct pci_controller *hose,
-			u_char bus, u_char devfn)
+int uli_exclude_device(struct pci_controller *hose, u_char bus, u_char devfn)
 {
 	if (bus == (hose->first_busno + 2)) {
 		/* exclude Modem controller */
Signature · 1 line
2.39.1
#8 lore raw

PATCH v4 8/17 powerpc/85xx: Remove #ifdefs CONFIG_PPC_I8259 in mpc85xx_ds

In reply to Christophe Leroy

All necessary items are declared all the time, no need to use a #ifdef CONFIG_PPC_I8259.

Refactor CONFIG_PPC_I8259 actions into a dedicated init function.

---
 arch/powerpc/platforms/85xx/mpc85xx_ds.c | 37 +++++++++++++-----------
 1 file changed, 20 insertions(+), 17 deletions(-)
arch/powerpc/platforms/85xx/mpc85xx_ds.c +20 -17
index e995c939c14d..2b3e9aecb3ad 100644
@@ -34,7 +34,6 @@
 
 #include "mpc85xx.h"
 
-#ifdef CONFIG_PPC_I8259
 static void mpc85xx_8259_cascade(struct irq_desc *desc)
 {
 	struct irq_chip *chip = irq_desc_get_chip(desc);
@@ -45,29 +44,16 @@ static void mpc85xx_8259_cascade(struct irq_desc *desc)
 	}
 	chip->irq_eoi(&desc->irq_data);
 }
-#endif	/* CONFIG_PPC_I8259 */
 
-void __init mpc85xx_ds_pic_init(void)
+static void __init mpc85xx_8259_init(void)
 {
-	struct mpic *mpic;
-	int flags = MPIC_BIG_ENDIAN | MPIC_SINGLE_DEST_CPU;
-#ifdef CONFIG_PPC_I8259
 	struct device_node *np;
 	struct device_node *cascade_node = NULL;
 	int cascade_irq;
-#endif
 
-	if (of_machine_is_compatible("fsl,MPC8572DS-CAMP"))
-		flags |= MPIC_NO_RESET;
-
-	mpic = mpic_alloc(NULL, 0, flags, 0, 256, " OpenPIC  ");
-
-	if (WARN_ON(!mpic))
+	if (!IS_ENABLED(CONFIG_PPC_I8259))
 		return;
 
-	mpic_init(mpic);
-
-#ifdef CONFIG_PPC_I8259
 	/* Initialize the i8259 controller */
 	for_each_node_by_type(np, "interrupt-controller")
 	    if (of_device_is_compatible(np, "chrp,iic")) {
@@ -92,7 +78,24 @@ void __init mpc85xx_ds_pic_init(void)
 	of_node_put(cascade_node);
 
 	irq_set_chained_handler(cascade_irq, mpc85xx_8259_cascade);
-#endif	/* CONFIG_PPC_I8259 */
+}
+
+void __init mpc85xx_ds_pic_init(void)
+{
+	struct mpic *mpic;
+	int flags = MPIC_BIG_ENDIAN | MPIC_SINGLE_DEST_CPU;
+
+	if (of_machine_is_compatible("fsl,MPC8572DS-CAMP"))
+		flags |= MPIC_NO_RESET;
+
+	mpic = mpic_alloc(NULL, 0, flags, 0, 256, " OpenPIC  ");
+
+	if (WARN_ON(!mpic))
+		return;
+
+	mpic_init(mpic);
+
+	mpc85xx_8259_init();
 }
 
 static struct device_node *pci_with_uli;
Signature · 1 line
2.39.1
#17 lore raw

PATCH v4 17/17 powerpc: dts: turris1x.dts: Remove "fsl,P2020RDB-PC" compatible string

In reply to Christophe Leroy

From: Pali Rohár <[email protected]>

"fsl,P2020RDB-PC" compatible string was present in Turris 1.x DTS file just because Linux kernel required it for proper detection of P2020 processor during boot.

This was quite a hack as CZ.NIC Turris 1.x is not compatible with Freescale P2020-RDB-PC board.

Now when kernel has generic unified support for boards with P2020 processors, there is no need to have this "hack" in turris1x.dts file.

So remove incorrect "fsl,P2020RDB-PC" compatible string from turris1x.dts.

---
 arch/powerpc/boot/dts/turris1x.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/boot/dts/turris1x.dts +1 -1
index e9cda34a140e..a95857de6858 100644
@@ -15,7 +15,7 @@
 
 / {
 	model = "Turris 1.x";
-	compatible = "cznic,turris1x", "fsl,P2020RDB-PC"; /* fsl,P2020RDB-PC is required for booting Linux */
+	compatible = "cznic,turris1x";
 
 	aliases {
 		ethernet0 = &enet0;
Signature · 1 line
2.39.1
#14 lore raw

PATCH v4 14/17 powerpc/85xx: p2020: Unify .setup_arch and .init_IRQ callbacks

In reply to Christophe Leroy

From: Pali Rohár <[email protected]>

Make just one .setup_arch and one .init_IRQ callback implementation for all P2020 board code. This deduplicate repeated and same code.

---
 arch/powerpc/platforms/85xx/mpc85xx.h     |  5 ---
 arch/powerpc/platforms/85xx/mpc85xx_rdb.c |  4 +--
 arch/powerpc/platforms/85xx/p2020.c       | 38 +++++++++++++++++++----
 3 files changed, 34 insertions(+), 13 deletions(-)
arch/powerpc/platforms/85xx/mpc85xx.h +0 -5
index b77bb9e7e79c..0be681526a1a 100644
@@ -27,9 +27,4 @@ void __init mpc85xx_ds_uli_init(void);
 static inline void __init mpc85xx_ds_uli_init(void) {}
 #endif
 
-void __init mpc85xx_ds_pic_init(void);
-void __init mpc85xx_ds_setup_arch(void);
-void __init mpc85xx_rdb_setup_arch(void);
-void __init mpc85xx_rdb_pic_init(void);
-
 #endif
arch/powerpc/platforms/85xx/mpc85xx_rdb.c +2 -2
index d1f497e086ed..aee12e68e46d 100644
@@ -29,7 +29,7 @@
 
 #include "mpc85xx.h"
 
-void __init mpc85xx_rdb_pic_init(void)
+static void __init mpc85xx_rdb_pic_init(void)
 {
 	struct mpic *mpic;
 	int flags = MPIC_BIG_ENDIAN | MPIC_SINGLE_DEST_CPU;
@@ -48,7 +48,7 @@ void __init mpc85xx_rdb_pic_init(void)
 /*
  * Setup the architecture
  */
-void __init mpc85xx_rdb_setup_arch(void)
+static void __init mpc85xx_rdb_setup_arch(void)
 {
 	if (ppc_md.progress)
 		ppc_md.progress("mpc85xx_rdb_setup_arch()", 0);
arch/powerpc/platforms/85xx/p2020.c +32 -6
index 1b0def607749..684ad1ea7362 100644
@@ -34,6 +34,32 @@
 
 #include "mpc85xx.h"
 
+static void __init p2020_pic_init(void)
+{
+	struct mpic *mpic;
+	int flags = MPIC_BIG_ENDIAN | MPIC_SINGLE_DEST_CPU;
+
+	mpic = mpic_alloc(NULL, 0, flags, 0, 256, " OpenPIC  ");
+
+	if (WARN_ON(!mpic))
+		return;
+
+	mpic_init(mpic);
+	mpc85xx_8259_init();
+}
+
+/*
+ * Setup the architecture
+ */
+static void __init p2020_setup_arch(void)
+{
+	swiotlb_detect_4g();
+	fsl_pci_assign_primary();
+	mpc85xx_ds_uli_init();
+	mpc85xx_smp_init();
+	mpc85xx_qe_par_io_init();
+}
+
 #ifdef CONFIG_MPC85xx_DS
 machine_arch_initcall(p2020_ds, mpc85xx_common_publish_devices);
 #endif /* CONFIG_MPC85xx_DS */
@@ -73,8 +99,8 @@ static int __init p2020_rdb_pc_probe(void)
 define_machine(p2020_ds) {
 	.name			= "P2020 DS",
 	.probe			= p2020_ds_probe,
-	.setup_arch		= mpc85xx_ds_setup_arch,
-	.init_IRQ		= mpc85xx_ds_pic_init,
+	.setup_arch		= p2020_setup_arch,
+	.init_IRQ		= p2020_pic_init,
 #ifdef CONFIG_PCI
 	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
 	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
@@ -89,8 +115,8 @@ define_machine(p2020_ds) {
 define_machine(p2020_rdb) {
 	.name			= "P2020 RDB",
 	.probe			= p2020_rdb_probe,
-	.setup_arch		= mpc85xx_rdb_setup_arch,
-	.init_IRQ		= mpc85xx_rdb_pic_init,
+	.setup_arch		= p2020_setup_arch,
+	.init_IRQ		= p2020_pic_init,
 #ifdef CONFIG_PCI
 	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
 	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
@@ -103,8 +129,8 @@ define_machine(p2020_rdb) {
 define_machine(p2020_rdb_pc) {
 	.name			= "P2020RDB-PC",
 	.probe			= p2020_rdb_pc_probe,
-	.setup_arch		= mpc85xx_rdb_setup_arch,
-	.init_IRQ		= mpc85xx_rdb_pic_init,
+	.setup_arch		= p2020_setup_arch,
+	.init_IRQ		= p2020_pic_init,
 #ifdef CONFIG_PCI
 	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
 	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
Signature · 1 line
2.39.1
#6 lore raw

PATCH v4 6/17 powerpc/85xx: mpc85xx_{ds/rdb} replace BUG_ON() by WARN_ON()

In reply to Christophe Leroy

No need to BUG() in case mpic_alloc() fails. Use WARN_ON().

---
 arch/powerpc/platforms/85xx/mpc85xx_ds.c  | 4 +++-
 arch/powerpc/platforms/85xx/mpc85xx_rdb.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
arch/powerpc/platforms/85xx/mpc85xx_ds.c +3 -1
index 1e6e89136948..60d473d9b8ee 100644
@@ -62,7 +62,9 @@ void __init mpc85xx_ds_pic_init(void)
 
 	mpic = mpic_alloc(NULL, 0, flags, 0, 256, " OpenPIC  ");
 
-	BUG_ON(mpic == NULL);
+	if (WARN_ON(!mpic))
+		return;
+
 	mpic_init(mpic);
 
 #ifdef CONFIG_PPC_I8259
arch/powerpc/platforms/85xx/mpc85xx_rdb.c +3 -1
index 110365d7b997..34b65441661e 100644
@@ -39,7 +39,9 @@ void __init mpc85xx_rdb_pic_init(void)
 
 	mpic = mpic_alloc(NULL, 0, flags, 0, 256, " OpenPIC  ");
 
-	BUG_ON(mpic == NULL);
+	if (WARN_ON(!mpic))
+		return;
+
 	mpic_init(mpic);
 }
 
Signature · 1 line
2.39.1
#3 lore raw

PATCH v4 3/17 powerpc/85xx: Remove DBG() macro

In reply to Christophe Leroy

DBG() macro is defined at three places while used only one time at one place.

Replace its only use by a pr_debug() and remove the macro.

---
 arch/powerpc/platforms/85xx/mpc85xx_ds.c  | 10 +---------
 arch/powerpc/platforms/85xx/mpc85xx_mds.c |  7 -------
 arch/powerpc/platforms/85xx/mpc85xx_rdb.c |  9 ---------
 3 files changed, 1 insertion(+), 25 deletions(-)
arch/powerpc/platforms/85xx/mpc85xx_ds.c +1 -9
index 97e441878409..26257509aabf 100644
@@ -34,14 +34,6 @@
 
 #include "mpc85xx.h"
 
-#undef DEBUG
-
-#ifdef DEBUG
-#define DBG(fmt, args...) printk(KERN_ERR "%s: " fmt, __func__, ## args)
-#else
-#define DBG(fmt, args...)
-#endif
-
 #ifdef CONFIG_PPC_I8259
 static void mpc85xx_8259_cascade(struct irq_desc *desc)
 {
@@ -98,7 +90,7 @@ void __init mpc85xx_ds_pic_init(void)
 		return;
 	}
 
-	DBG("mpc85xxds: cascade mapped to irq %d\n", cascade_irq);
+	pr_debug("mpc85xxds: cascade mapped to irq %d\n", cascade_irq);
 
 	i8259_init(cascade_node, 0);
 	of_node_put(cascade_node);
arch/powerpc/platforms/85xx/mpc85xx_mds.c +0 -7
index 3a2ac410af18..540ce17f0577 100644
@@ -49,13 +49,6 @@
 
 #include "mpc85xx.h"
 
-#undef DEBUG
-#ifdef DEBUG
-#define DBG(fmt...) udbg_printf(fmt)
-#else
-#define DBG(fmt...)
-#endif
-
 #if IS_BUILTIN(CONFIG_PHYLIB)
 
 #define MV88E1111_SCR	0x10
arch/powerpc/platforms/85xx/mpc85xx_rdb.c +0 -9
index d99aba158235..b5e9a6374edb 100644
@@ -29,15 +29,6 @@
 
 #include "mpc85xx.h"
 
-#undef DEBUG
-
-#ifdef DEBUG
-#define DBG(fmt, args...) printk(KERN_ERR "%s: " fmt, __func__, ## args)
-#else
-#define DBG(fmt, args...)
-#endif
-
-
 void __init mpc85xx_rdb_pic_init(void)
 {
 	struct mpic *mpic;
Signature · 1 line
2.39.1
#2 lore raw

PATCH v4 2/17 powerpc/85xx: Rename setup_arch and pic_init on p1023

In reply to Christophe Leroy

Avoid conflict with other functions, rename mpc85xx_rdb_setup_arch() to p1023_rdb_setup_arch(), same for mpc85xx_rdb_pic_init().

---
 arch/powerpc/platforms/85xx/p1023_rdb.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/powerpc/platforms/85xx/p1023_rdb.c +4 -4
index c04868eb2eb1..5d434ee96445 100644
@@ -37,7 +37,7 @@
  * Setup the architecture
  *
  */
-static void __init mpc85xx_rdb_setup_arch(void)
+static void __init p1023_rdb_setup_arch(void)
 {
 	struct device_node *np;
 
@@ -83,7 +83,7 @@ static void __init mpc85xx_rdb_setup_arch(void)
 
 machine_arch_initcall(p1023_rdb, mpc85xx_common_publish_devices);
 
-static void __init mpc85xx_rdb_pic_init(void)
+static void __init p1023_rdb_pic_init(void)
 {
 	struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN |
 		MPIC_SINGLE_DEST_CPU,
@@ -103,8 +103,8 @@ static int __init p1023_rdb_probe(void)
 define_machine(p1023_rdb) {
 	.name			= "P1023 RDB",
 	.probe			= p1023_rdb_probe,
-	.setup_arch		= mpc85xx_rdb_setup_arch,
-	.init_IRQ		= mpc85xx_rdb_pic_init,
+	.setup_arch		= p1023_rdb_setup_arch,
+	.init_IRQ		= p1023_rdb_pic_init,
 	.get_irq		= mpic_get_irq,
 	.calibrate_decr		= generic_calibrate_decr,
 	.progress		= udbg_progress,
Signature · 1 line
2.39.1
#15 lore raw

PATCH v4 15/17 powerpc/85xx: p2020: Define just one machine description

In reply to Christophe Leroy

From: Pali Rohár <[email protected]>

Combine machine descriptions and code of all P2020 boards into just one generic unified P2020 machine description. This allows kernel to boot on any P2020-based board with P2020 DTS file without need to patch kernel and define a new machine description in 85xx powerpc platform directory.

---
 arch/powerpc/platforms/85xx/p2020.c | 77 ++++++-----------------------
 1 file changed, 15 insertions(+), 62 deletions(-)
arch/powerpc/platforms/85xx/p2020.c +15 -62
index 684ad1ea7362..21584d81f3d9 100644
@@ -60,83 +60,36 @@ static void __init p2020_setup_arch(void)
 	mpc85xx_qe_par_io_init();
 }
 
-#ifdef CONFIG_MPC85xx_DS
-machine_arch_initcall(p2020_ds, mpc85xx_common_publish_devices);
-#endif /* CONFIG_MPC85xx_DS */
-
-#ifdef CONFIG_MPC85xx_RDB
-machine_arch_initcall(p2020_rdb, mpc85xx_common_publish_devices);
-machine_arch_initcall(p2020_rdb_pc, mpc85xx_common_publish_devices);
-#endif /* CONFIG_MPC85xx_RDB */
+machine_arch_initcall(p2020, mpc85xx_common_publish_devices);
 
 /*
  * Called very early, device-tree isn't unflattened
  */
-#ifdef CONFIG_MPC85xx_DS
-static int __init p2020_ds_probe(void)
+static int __init p2020_probe(void)
 {
-	return !!of_machine_is_compatible("fsl,P2020DS");
-}
-#endif /* CONFIG_MPC85xx_DS */
+	struct device_node *p2020_cpu;
 
-#ifdef CONFIG_MPC85xx_RDB
-static int __init p2020_rdb_probe(void)
-{
-	if (of_machine_is_compatible("fsl,P2020RDB"))
-		return 1;
-	return 0;
-}
+	/*
+	 * There is no common compatible string for all P2020 boards.
+	 * The only common thing is "PowerPC,P2020@0" cpu node.
+	 * So check for P2020 board via this cpu node.
+	 */
+	p2020_cpu = of_find_node_by_path("/cpus/PowerPC,P2020@0");
+	of_node_put(p2020_cpu);
 
-static int __init p2020_rdb_pc_probe(void)
-{
-	if (of_machine_is_compatible("fsl,P2020RDB-PC"))
-		return 1;
-	return 0;
+	return !!p2020_cpu;
 }
-#endif /* CONFIG_MPC85xx_RDB */
-
-#ifdef CONFIG_MPC85xx_DS
-define_machine(p2020_ds) {
-	.name			= "P2020 DS",
-	.probe			= p2020_ds_probe,
-	.setup_arch		= p2020_setup_arch,
-	.init_IRQ		= p2020_pic_init,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
-};
-#endif /* CONFIG_MPC85xx_DS */
-
-#ifdef CONFIG_MPC85xx_RDB
-define_machine(p2020_rdb) {
-	.name			= "P2020 RDB",
-	.probe			= p2020_rdb_probe,
-	.setup_arch		= p2020_setup_arch,
-	.init_IRQ		= p2020_pic_init,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
-};
 
-define_machine(p2020_rdb_pc) {
-	.name			= "P2020RDB-PC",
-	.probe			= p2020_rdb_pc_probe,
+define_machine(p2020) {
+	.name			= "Freescale P2020",
+	.probe			= p2020_probe,
 	.setup_arch		= p2020_setup_arch,
 	.init_IRQ		= p2020_pic_init,
 #ifdef CONFIG_PCI
 	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
+	.pcibios_fixup_phb	= fsl_pcibios_fixup_phb,
 #endif
 	.get_irq		= mpic_get_irq,
 	.calibrate_decr		= generic_calibrate_decr,
 	.progress		= udbg_progress,
 };
-#endif /* CONFIG_MPC85xx_RDB */
Signature · 1 line
2.39.1
#13 lore raw

PATCH v4 13/17 powerpc/85xx: mpc85xx_ds: Move PCI code into own file

In reply to Christophe Leroy

From: Pali Rohár <[email protected]>

In order to share between DS and P2020.

---
 arch/powerpc/platforms/85xx/Makefile      |  3 +-
 arch/powerpc/platforms/85xx/mpc85xx.h     |  6 +++
 arch/powerpc/platforms/85xx/mpc85xx_ds.c  | 32 ------------
 arch/powerpc/platforms/85xx/mpc85xx_uli.c | 64 +++++++++++++++++++++++
 4 files changed, 72 insertions(+), 33 deletions(-)
 create mode 100644 arch/powerpc/platforms/85xx/mpc85xx_uli.c
arch/powerpc/platforms/85xx/Makefile +2 -1
index 0a0011e8c63c..65abd5a161c0 100644
@@ -17,7 +17,8 @@ obj-$(CONFIG_MPC8560_ADS) += mpc85xx_ads.o
 obj-$(CONFIG_MPC85xx_CDS) += mpc85xx_cds.o
 obj-$(CONFIG_MPC8536_DS)  += mpc8536_ds.o
 obj8259-$(CONFIG_PPC_I8259)   += mpc85xx_8259.o
-obj-$(CONFIG_MPC85xx_DS)  += mpc85xx_ds.o p2020.o $(obj8259-y)
+objpci-$(CONFIG_PCI)   += mpc85xx_uli.o
+obj-$(CONFIG_MPC85xx_DS)  += mpc85xx_ds.o p2020.o $(obj8259-y) $(objpci-y)
 obj-$(CONFIG_MPC85xx_MDS) += mpc85xx_mds.o
 obj-$(CONFIG_MPC85xx_RDB) += mpc85xx_rdb.o p2020.o
 obj-$(CONFIG_P1010_RDB)   += p1010rdb.o
arch/powerpc/platforms/85xx/mpc85xx.h +6 -0
index e792907ee3d5..b77bb9e7e79c 100644
@@ -21,6 +21,12 @@ void __init mpc85xx_8259_init(void);
 static inline void __init mpc85xx_8259_init(void) {}
 #endif
 
+#ifdef CONFIG_PCI
+void __init mpc85xx_ds_uli_init(void);
+#else
+static inline void __init mpc85xx_ds_uli_init(void) {}
+#endif
+
 void __init mpc85xx_ds_pic_init(void);
 void __init mpc85xx_ds_setup_arch(void);
 void __init mpc85xx_rdb_setup_arch(void);
arch/powerpc/platforms/85xx/mpc85xx_ds.c +0 -32
index 011ae86d72f4..f9ac0b6022b1 100644
@@ -52,38 +52,6 @@ void __init mpc85xx_ds_pic_init(void)
 	mpc85xx_8259_init();
 }
 
-static struct device_node *pci_with_uli;
-
-static int mpc85xx_exclude_device(struct pci_controller *hose,
-				   u_char bus, u_char devfn)
-{
-	if (hose->dn == pci_with_uli)
-		return uli_exclude_device(hose, bus, devfn);
-
-	return PCIBIOS_SUCCESSFUL;
-}
-
-static void __init mpc85xx_ds_uli_init(void)
-{
-	struct device_node *node;
-
-	if (!IS_ENABLED(CONFIG_PCI))
-		return;
-
-	/* See if we have a ULI under the primary */
-
-	node = of_find_node_by_name(NULL, "uli1575");
-	while ((pci_with_uli = of_get_parent(node))) {
-		of_node_put(node);
-		node = pci_with_uli;
-
-		if (pci_with_uli == fsl_pci_primary) {
-			ppc_md.pci_exclude_device = mpc85xx_exclude_device;
-			break;
-		}
-	}
-}
-
 /*
  * Setup the architecture
  */
arch/powerpc/platforms/85xx/mpc85xx_uli.c new file +64 -0

64 lines not on this page · raw message

Signature · 1 line
2.39.1
#5 lore raw

PATCH v4 5/17 powerpc/85xx: mpc85xx_{ds/rdb} compact the call to mpic_alloc()

In reply to Christophe Leroy

Reduce number of lines in the call to mpic_alloc().

---
 arch/powerpc/platforms/85xx/mpc85xx_ds.c  | 18 ++++++------------
 arch/powerpc/platforms/85xx/mpc85xx_rdb.c | 16 +++++-----------
 2 files changed, 11 insertions(+), 23 deletions(-)
arch/powerpc/platforms/85xx/mpc85xx_ds.c +6 -12
index f385cd288a76..1e6e89136948 100644
@@ -50,23 +50,17 @@ static void mpc85xx_8259_cascade(struct irq_desc *desc)
 void __init mpc85xx_ds_pic_init(void)
 {
 	struct mpic *mpic;
+	int flags = MPIC_BIG_ENDIAN | MPIC_SINGLE_DEST_CPU;
 #ifdef CONFIG_PPC_I8259
 	struct device_node *np;
 	struct device_node *cascade_node = NULL;
 	int cascade_irq;
 #endif
-	if (of_machine_is_compatible("fsl,MPC8572DS-CAMP")) {
-		mpic = mpic_alloc(NULL, 0,
-			MPIC_NO_RESET |
-			MPIC_BIG_ENDIAN |
-			MPIC_SINGLE_DEST_CPU,
-			0, 256, " OpenPIC  ");
-	} else {
-		mpic = mpic_alloc(NULL, 0,
-			  MPIC_BIG_ENDIAN |
-			  MPIC_SINGLE_DEST_CPU,
-			0, 256, " OpenPIC  ");
-	}
+
+	if (of_machine_is_compatible("fsl,MPC8572DS-CAMP"))
+		flags |= MPIC_NO_RESET;
+
+	mpic = mpic_alloc(NULL, 0, flags, 0, 256, " OpenPIC  ");
 
 	BUG_ON(mpic == NULL);
 	mpic_init(mpic);
arch/powerpc/platforms/85xx/mpc85xx_rdb.c +5 -11
index b5e9a6374edb..110365d7b997 100644
@@ -32,18 +32,12 @@
 void __init mpc85xx_rdb_pic_init(void)
 {
 	struct mpic *mpic;
+	int flags = MPIC_BIG_ENDIAN | MPIC_SINGLE_DEST_CPU;
 
-	if (of_machine_is_compatible("fsl,MPC85XXRDB-CAMP")) {
-		mpic = mpic_alloc(NULL, 0, MPIC_NO_RESET |
-			MPIC_BIG_ENDIAN |
-			MPIC_SINGLE_DEST_CPU,
-			0, 256, " OpenPIC  ");
-	} else {
-		mpic = mpic_alloc(NULL, 0,
-		  MPIC_BIG_ENDIAN |
-		  MPIC_SINGLE_DEST_CPU,
-		  0, 256, " OpenPIC  ");
-	}
+	if (of_machine_is_compatible("fsl,MPC85XXRDB-CAMP"))
+		flags |= MPIC_NO_RESET;
+
+	mpic = mpic_alloc(NULL, 0, flags, 0, 256, " OpenPIC  ");
 
 	BUG_ON(mpic == NULL);
 	mpic_init(mpic);
Signature · 1 line
2.39.1
#12 lore raw

PATCH v4 12/17 powerpc/85xx: p2020: Move i8259 code into own function

In reply to Christophe Leroy

From: Pali Rohár <[email protected]>

Splits mpic and i8259 initialization codes into separate functions. Use 'if (IS_ENABLED(CONFIG_PPC_I8259))' instead of '#ifdef CONFIG_PPC_I8259'.

[chleroy: Put into own C file]
---
 arch/powerpc/platforms/85xx/Makefile       |  3 +-
 arch/powerpc/platforms/85xx/mpc85xx.h      |  6 ++
 arch/powerpc/platforms/85xx/mpc85xx_8259.c | 78 ++++++++++++++++++++++
 arch/powerpc/platforms/85xx/mpc85xx_ds.c   | 46 -------------
 4 files changed, 86 insertions(+), 47 deletions(-)
 create mode 100644 arch/powerpc/platforms/85xx/mpc85xx_8259.c
arch/powerpc/platforms/85xx/Makefile +2 -1
index 93451850ed83..0a0011e8c63c 100644
@@ -16,7 +16,8 @@ obj-$(CONFIG_MPC8540_ADS) += mpc85xx_ads.o
 obj-$(CONFIG_MPC8560_ADS) += mpc85xx_ads.o
 obj-$(CONFIG_MPC85xx_CDS) += mpc85xx_cds.o
 obj-$(CONFIG_MPC8536_DS)  += mpc8536_ds.o
-obj-$(CONFIG_MPC85xx_DS)  += mpc85xx_ds.o p2020.o
+obj8259-$(CONFIG_PPC_I8259)   += mpc85xx_8259.o
+obj-$(CONFIG_MPC85xx_DS)  += mpc85xx_ds.o p2020.o $(obj8259-y)
 obj-$(CONFIG_MPC85xx_MDS) += mpc85xx_mds.o
 obj-$(CONFIG_MPC85xx_RDB) += mpc85xx_rdb.o p2020.o
 obj-$(CONFIG_P1010_RDB)   += p1010rdb.o
arch/powerpc/platforms/85xx/mpc85xx.h +6 -0
index 8f7b37c1de87..e792907ee3d5 100644
@@ -15,6 +15,12 @@ extern void mpc85xx_qe_par_io_init(void);
 static inline void __init mpc85xx_qe_par_io_init(void) {}
 #endif
 
+#ifdef CONFIG_PPC_I8259
+void __init mpc85xx_8259_init(void);
+#else
+static inline void __init mpc85xx_8259_init(void) {}
+#endif
+
 void __init mpc85xx_ds_pic_init(void);
 void __init mpc85xx_ds_setup_arch(void);
 void __init mpc85xx_rdb_setup_arch(void);
arch/powerpc/platforms/85xx/mpc85xx_8259.c new file +78 -0

78 lines not on this page · raw message

arch/powerpc/platforms/85xx/mpc85xx_ds.c +0 -46

52 lines not on this page · raw message

Signature · 1 line
2.39.1
#11 lore raw

PATCH v4 11/17 powerpc/85xx: p2020: Move all P2020 RDB machine descriptions to p2020.c

In reply to Christophe Leroy

From: Pali Rohár <[email protected]>

This moves machine descriptions and all related code for all P2020 boards into new p2020.c source file.
This is preparation for code de-duplication and
providing one unified machine description for all P2020 boards. In follow-up patches would be copied functions refactored and simplified to be specific just for P2020 boards.

[chleroy: Split in two patches: one for DS, one for RDB and keep helpers out]
---
 arch/powerpc/platforms/85xx/Makefile      |  2 +-
 arch/powerpc/platforms/85xx/mpc85xx.h     |  2 +
 arch/powerpc/platforms/85xx/mpc85xx_rdb.c | 46 +-----------------
 arch/powerpc/platforms/85xx/p2020.c       | 57 +++++++++++++++++++++++
 4 files changed, 61 insertions(+), 46 deletions(-)
arch/powerpc/platforms/85xx/Makefile +1 -1
index 1f54623db9b7..93451850ed83 100644
@@ -18,7 +18,7 @@ obj-$(CONFIG_MPC85xx_CDS) += mpc85xx_cds.o
 obj-$(CONFIG_MPC8536_DS)  += mpc8536_ds.o
 obj-$(CONFIG_MPC85xx_DS)  += mpc85xx_ds.o p2020.o
 obj-$(CONFIG_MPC85xx_MDS) += mpc85xx_mds.o
-obj-$(CONFIG_MPC85xx_RDB) += mpc85xx_rdb.o
+obj-$(CONFIG_MPC85xx_RDB) += mpc85xx_rdb.o p2020.o
 obj-$(CONFIG_P1010_RDB)   += p1010rdb.o
 obj-$(CONFIG_P1022_DS)    += p1022_ds.o
 obj-$(CONFIG_P1022_RDK)   += p1022_rdk.o
arch/powerpc/platforms/85xx/mpc85xx.h +2 -0
index ca8b39e6b05a..8f7b37c1de87 100644
@@ -17,5 +17,7 @@ static inline void __init mpc85xx_qe_par_io_init(void) {}
 
 void __init mpc85xx_ds_pic_init(void);
 void __init mpc85xx_ds_setup_arch(void);
+void __init mpc85xx_rdb_setup_arch(void);
+void __init mpc85xx_rdb_pic_init(void);
 
 #endif
arch/powerpc/platforms/85xx/mpc85xx_rdb.c +1 -45

82 lines not on this page · raw message

arch/powerpc/platforms/85xx/p2020.c +57 -0

76 lines not on this page · raw message

Signature · 1 line
2.39.1
#9 lore raw

PATCH v4 9/17 powerpc/85xx: Remove #ifdef CONFIG_QUICC_ENGINE in mpc85xx_rdb

In reply to Christophe Leroy

mpc85xx_qe_par_io_init() is a stub when CONFIG_QUICC_ENGINE is not set.

CONFIG_UCC_GETH and CONFIG_SERIAL_QE depend on CONFIG_QUICC_ENGINE.

Remove #ifdef CONFIG_QUICC_ENGINE

---
 arch/powerpc/platforms/85xx/mpc85xx_rdb.c | 2 --
 1 file changed, 2 deletions(-)
arch/powerpc/platforms/85xx/mpc85xx_rdb.c +0 -2
index 8b0d81f0e1c9..b23f826339b5 100644
@@ -57,7 +57,6 @@ static void __init mpc85xx_rdb_setup_arch(void)
 
 	fsl_pci_assign_primary();
 
-#ifdef CONFIG_QUICC_ENGINE
 	mpc85xx_qe_par_io_init();
 #if defined(CONFIG_UCC_GETH) || defined(CONFIG_SERIAL_QE)
 	if (machine_is(p1025_rdb)) {
@@ -90,7 +89,6 @@ static void __init mpc85xx_rdb_setup_arch(void)
 
 	}
 #endif
-#endif	/* CONFIG_QUICC_ENGINE */
 
 	pr_info("MPC85xx RDB board from Freescale Semiconductor\n");
 }
Signature · 1 line
2.39.1
Reviewed-by on the v4 series
#18 lore raw
In reply to Christophe Leroy
Quoted 7 lines · On Wednesday 22 February 2023 15:42:47 Christophe Leroy wrote:

This patch series unifies all P2020 boards and machine descriptions into one generic unified P2020 machine description. With this generic machine description, kernel can boot on any P2020-based board with correct DTS file.

Tested on CZ.NIC Turris 1.1 board with has Freescale P2020 processor. Kernel during booting correctly detects P2020 and prints:

Quoted 8 lines
[    0.000000] Using Freescale P2020 machine description

Changes in v4:
* Added several preparatory cleanup patchs
* Minimised churn by not duplicating helpers at the first place
* Split main patch in two
* Dropped patchs 1 and 2
* Untested beyond basic build test

Changes looks good. I'm happy with them. You can add my:

Quoted 58 lines

Changes in v3:
* Use 'if (IS_ENABLED(CONFIG_PPC_I8259))' instead of '#ifdef CONFIG_PPC_I8259'
* Simplify p2020_probe()
* Patches generated by -M and -C git options

Link to v2: https://lore.kernel.org/linuxppc-dev/[email protected]/

Changes in v2:
* Added patch "p2020: Move i8259 code into own function" (separated from the next one)
* Renamed CONFIG_P2020 to CONFIG_PPC_P2020
* Fixed descriptions

Link to v1: https://lore.kernel.org/linuxppc-dev/[email protected]/

Christophe Leroy (9):
powerpc/fsl_uli1575: Misc cleanup
powerpc/85xx: Rename setup_arch and pic_init on p1023 powerpc/85xx: Remove DBG() macro
powerpc/85xx: Remove #ifdefs CONFIG_PCI in mpc85xx_ds powerpc/85xx: mpc85xx_{ds/rdb} compact the call to mpic_alloc() powerpc/85xx: mpc85xx_{ds/rdb} replace BUG_ON() by WARN_ON() powerpc/85xx: mpc85xx_{ds/rdb} replace prink by pr_xxx macro powerpc/85xx: Remove #ifdefs CONFIG_PPC_I8259 in mpc85xx_ds powerpc/85xx: Remove #ifdef CONFIG_QUICC_ENGINE in mpc85xx_rdb

Pali Rohár (8):
powerpc/85xx: p2020: Move all P2020 DS machine descriptions to p2020.c powerpc/85xx: p2020: Move all P2020 RDB machine descriptions to

    p2020.c
  powerpc/85xx: p2020: Move i8259 code into own function
  powerpc/85xx: mpc85xx_ds: Move PCI code into own file
  powerpc/85xx: p2020: Unify .setup_arch and .init_IRQ callbacks
  powerpc/85xx: p2020: Define just one machine description
  powerpc/85xx: p2020: Enable boards by new config option
    CONFIG_PPC_P2020

powerpc: dts: turris1x.dts: Remove "fsl,P2020RDB-PC" compatible string

 arch/powerpc/boot/dts/turris1x.dts         |   2 +-
 arch/powerpc/include/asm/ppc-pci.h         |   2 +
 arch/powerpc/platforms/85xx/Kconfig        |  22 +++-
 arch/powerpc/platforms/85xx/Makefile       |   5 +-
 arch/powerpc/platforms/85xx/mpc85xx.h      |  12 ++
 arch/powerpc/platforms/85xx/mpc85xx_8259.c |  78 ++++++++++++
 arch/powerpc/platforms/85xx/mpc85xx_ds.c   | 133 ++-------------------
 arch/powerpc/platforms/85xx/mpc85xx_mds.c  |   7 --
 arch/powerpc/platforms/85xx/mpc85xx_rdb.c  |  79 ++----------
 arch/powerpc/platforms/85xx/mpc85xx_uli.c  |  64 ++++++++++
 arch/powerpc/platforms/85xx/p1023_rdb.c    |   8 +-
 arch/powerpc/platforms/85xx/p2020.c        |  95 +++++++++++++++
 arch/powerpc/platforms/fsl_uli1575.c       |   6 +-
 13 files changed, 301 insertions(+), 212 deletions(-)
 create mode 100644 arch/powerpc/platforms/85xx/mpc85xx_8259.c
 create mode 100644 arch/powerpc/platforms/85xx/mpc85xx_uli.c
 create mode 100644 arch/powerpc/platforms/85xx/p2020.c
Signature · 1 line
2.39.1
#19 lore raw

Le 22/02/2023 à 19:22, Pali Rohár a écrit :

Quoted 17 lines · On Wednesday 22 February 2023 15:42:47 Christophe Leroy wrote:
Quoted 7 lines

This patch series unifies all P2020 boards and machine descriptions into one generic unified P2020 machine description. With this generic machine description, kernel can boot on any P2020-based board with correct DTS file.

Tested on CZ.NIC Turris 1.1 board with has Freescale P2020 processor. Kernel during booting correctly detects P2020 and prints:

Quoted 8 lines
[    0.000000] Using Freescale P2020 machine description

Changes in v4:
* Added several preparatory cleanup patchs
* Minimised churn by not duplicating helpers at the first place
* Split main patch in two
* Dropped patchs 1 and 2
* Untested beyond basic build test

Quoted 3 lines

Changes looks good. I'm happy with them. You can add my:

Thanks.

However this series doesn't have the shape for getting merged yet, I've been very quick with the additional patches descriptions and I have not revisited the descriptions of pre-existing patches.

I was expecting you to take over. By the way there's no hurry I guess, we are already in the middle of the merge window, Michael usually doesn't take any more non-fixes patches once the merge window is open, so that series will go in 6.4

Christophe

Quoted 59 lines
Quoted 59 lines

Changes in v3:
* Use 'if (IS_ENABLED(CONFIG_PPC_I8259))' instead of '#ifdef CONFIG_PPC_I8259'
* Simplify p2020_probe()
* Patches generated by -M and -C git options

Link to v2: https://lore.kernel.org/linuxppc-dev/[email protected]/

Changes in v2:
* Added patch "p2020: Move i8259 code into own function" (separated from the next one)
* Renamed CONFIG_P2020 to CONFIG_PPC_P2020
* Fixed descriptions

Link to v1: https://lore.kernel.org/linuxppc-dev/[email protected]/

Christophe Leroy (9):
powerpc/fsl_uli1575: Misc cleanup
powerpc/85xx: Rename setup_arch and pic_init on p1023 powerpc/85xx: Remove DBG() macro
powerpc/85xx: Remove #ifdefs CONFIG_PCI in mpc85xx_ds powerpc/85xx: mpc85xx_{ds/rdb} compact the call to mpic_alloc() powerpc/85xx: mpc85xx_{ds/rdb} replace BUG_ON() by WARN_ON() powerpc/85xx: mpc85xx_{ds/rdb} replace prink by pr_xxx macro powerpc/85xx: Remove #ifdefs CONFIG_PPC_I8259 in mpc85xx_ds powerpc/85xx: Remove #ifdef CONFIG_QUICC_ENGINE in mpc85xx_rdb

Pali Rohár (8):
powerpc/85xx: p2020: Move all P2020 DS machine descriptions to p2020.c powerpc/85xx: p2020: Move all P2020 RDB machine descriptions to

     p2020.c
   powerpc/85xx: p2020: Move i8259 code into own function
   powerpc/85xx: mpc85xx_ds: Move PCI code into own file
   powerpc/85xx: p2020: Unify .setup_arch and .init_IRQ callbacks
   powerpc/85xx: p2020: Define just one machine description
   powerpc/85xx: p2020: Enable boards by new config option
     CONFIG_PPC_P2020

powerpc: dts: turris1x.dts: Remove "fsl,P2020RDB-PC" compatible string

  arch/powerpc/boot/dts/turris1x.dts         |   2 +-
  arch/powerpc/include/asm/ppc-pci.h         |   2 +
  arch/powerpc/platforms/85xx/Kconfig        |  22 +++-
  arch/powerpc/platforms/85xx/Makefile       |   5 +-
  arch/powerpc/platforms/85xx/mpc85xx.h      |  12 ++
  arch/powerpc/platforms/85xx/mpc85xx_8259.c |  78 ++++++++++++
  arch/powerpc/platforms/85xx/mpc85xx_ds.c   | 133 ++-------------------
  arch/powerpc/platforms/85xx/mpc85xx_mds.c  |   7 --
  arch/powerpc/platforms/85xx/mpc85xx_rdb.c  |  79 ++----------
  arch/powerpc/platforms/85xx/mpc85xx_uli.c  |  64 ++++++++++
  arch/powerpc/platforms/85xx/p1023_rdb.c    |   8 +-
  arch/powerpc/platforms/85xx/p2020.c        |  95 +++++++++++++++
  arch/powerpc/platforms/fsl_uli1575.c       |   6 +-
  13 files changed, 301 insertions(+), 212 deletions(-)

create mode 100644 arch/powerpc/platforms/85xx/mpc85xx_8259.c create mode 100644 arch/powerpc/platforms/85xx/mpc85xx_uli.c create mode 100644 arch/powerpc/platforms/85xx/p2020.c

Signature · 1 line
2.39.1
#20 lore raw
Quoted 24 lines · Christophe Leroy

Le 22/02/2023 à 19:22, Pali Rohár a écrit :

Quoted 17 lines · On Wednesday 22 February 2023 15:42:47 Christophe Leroy wrote:
Quoted 7 lines

This patch series unifies all P2020 boards and machine descriptions into one generic unified P2020 machine description. With this generic machine description, kernel can boot on any P2020-based board with correct DTS file.

Tested on CZ.NIC Turris 1.1 board with has Freescale P2020 processor. Kernel during booting correctly detects P2020 and prints:

Quoted 8 lines
[    0.000000] Using Freescale P2020 machine description

Changes in v4:
* Added several preparatory cleanup patchs
* Minimised churn by not duplicating helpers at the first place
* Split main patch in two
* Dropped patchs 1 and 2
* Untested beyond basic build test

Quoted 3 lines

Changes looks good. I'm happy with them. You can add my:

Thanks.

Quoted 8 lines

However this series doesn't have the shape for getting merged yet, I've been very quick with the additional patches descriptions and I have not revisited the descriptions of pre-existing patches.

I was expecting you to take over. By the way there's no hurry I guess, we are already in the middle of the merge window, Michael usually doesn't take any more non-fixes patches once the merge window is open, so that series will go in 6.4

Correct.

I'll open next for new patches around 6.3-rc2, so in ~2.5 weeks from now.

cheers