From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: "Pali Rohár" <pali@kernel.org>,
"Michael Ellerman" <mpe@ellerman.id.au>,
"Nicholas Piggin" <npiggin@gmail.com>
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: [PATCH v4 11/17] powerpc/85xx: p2020: Move all P2020 RDB machine descriptions to p2020.c
Date: Wed, 22 Feb 2023 15:42:58 +0100 [thread overview]
Message-ID: <c5ca41a6a96ec60d38243cc77d01e77eaaba25cd.1677076552.git.christophe.leroy@csgroup.eu> (raw)
In-Reply-To: <cover.1677076552.git.christophe.leroy@csgroup.eu>
From: Pali Rohár <pali@kernel.org>
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.
Signed-off-by: Pali Rohár <pali@kernel.org>
[chleroy: Split in two patches: one for DS, one for RDB and keep helpers out]
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
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(-)
diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile
index 1f54623db9b7..93451850ed83 100644
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -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
diff --git a/arch/powerpc/platforms/85xx/mpc85xx.h b/arch/powerpc/platforms/85xx/mpc85xx.h
index ca8b39e6b05a..8f7b37c1de87 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx.h
+++ b/arch/powerpc/platforms/85xx/mpc85xx.h
@@ -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
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
index b23f826339b5..d1f497e086ed 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
@@ -48,7 +48,7 @@ void __init mpc85xx_rdb_pic_init(void)
/*
* Setup the architecture
*/
-static void __init mpc85xx_rdb_setup_arch(void)
+void __init mpc85xx_rdb_setup_arch(void)
{
if (ppc_md.progress)
ppc_md.progress("mpc85xx_rdb_setup_arch()", 0);
@@ -93,8 +93,6 @@ static void __init mpc85xx_rdb_setup_arch(void)
pr_info("MPC85xx RDB board from Freescale Semiconductor\n");
}
-machine_arch_initcall(p2020_rdb, mpc85xx_common_publish_devices);
-machine_arch_initcall(p2020_rdb_pc, mpc85xx_common_publish_devices);
machine_arch_initcall(p1020_mbg_pc, mpc85xx_common_publish_devices);
machine_arch_initcall(p1020_rdb, mpc85xx_common_publish_devices);
machine_arch_initcall(p1020_rdb_pc, mpc85xx_common_publish_devices);
@@ -107,13 +105,6 @@ machine_arch_initcall(p1024_rdb, mpc85xx_common_publish_devices);
/*
* Called very early, device-tree isn't unflattened
*/
-static int __init p2020_rdb_probe(void)
-{
- if (of_machine_is_compatible("fsl,P2020RDB"))
- return 1;
- return 0;
-}
-
static int __init p1020_rdb_probe(void)
{
if (of_machine_is_compatible("fsl,P1020RDB"))
@@ -138,13 +129,6 @@ static int __init p1021_rdb_pc_probe(void)
return 0;
}
-static int __init p2020_rdb_pc_probe(void)
-{
- if (of_machine_is_compatible("fsl,P2020RDB-PC"))
- return 1;
- return 0;
-}
-
static int __init p1025_rdb_probe(void)
{
return of_machine_is_compatible("fsl,P1025RDB");
@@ -165,20 +149,6 @@ static int __init p1024_rdb_probe(void)
return of_machine_is_compatible("fsl,P1024RDB");
}
-define_machine(p2020_rdb) {
- .name = "P2020 RDB",
- .probe = p2020_rdb_probe,
- .setup_arch = mpc85xx_rdb_setup_arch,
- .init_IRQ = mpc85xx_rdb_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(p1020_rdb) {
.name = "P1020 RDB",
.probe = p1020_rdb_probe,
@@ -207,20 +177,6 @@ define_machine(p1021_rdb_pc) {
.progress = udbg_progress,
};
-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,
-#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(p1025_rdb) {
.name = "P1025 RDB",
.probe = p1025_rdb_probe,
diff --git a/arch/powerpc/platforms/85xx/p2020.c b/arch/powerpc/platforms/85xx/p2020.c
index 2dfd150c6375..1b0def607749 100644
--- a/arch/powerpc/platforms/85xx/p2020.c
+++ b/arch/powerpc/platforms/85xx/p2020.c
@@ -34,16 +34,42 @@
#include "mpc85xx.h"
+#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 */
/*
* Called very early, device-tree isn't unflattened
*/
+#ifdef CONFIG_MPC85xx_DS
static int __init p2020_ds_probe(void)
{
return !!of_machine_is_compatible("fsl,P2020DS");
}
+#endif /* CONFIG_MPC85xx_DS */
+
+#ifdef CONFIG_MPC85xx_RDB
+static int __init p2020_rdb_probe(void)
+{
+ if (of_machine_is_compatible("fsl,P2020RDB"))
+ return 1;
+ return 0;
+}
+
+static int __init p2020_rdb_pc_probe(void)
+{
+ if (of_machine_is_compatible("fsl,P2020RDB-PC"))
+ return 1;
+ return 0;
+}
+#endif /* CONFIG_MPC85xx_RDB */
+#ifdef CONFIG_MPC85xx_DS
define_machine(p2020_ds) {
.name = "P2020 DS",
.probe = p2020_ds_probe,
@@ -57,3 +83,34 @@ define_machine(p2020_ds) {
.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 = mpc85xx_rdb_setup_arch,
+ .init_IRQ = mpc85xx_rdb_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,
+ .setup_arch = mpc85xx_rdb_setup_arch,
+ .init_IRQ = mpc85xx_rdb_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_RDB */
--
2.39.1
next prev parent reply other threads:[~2023-02-22 14:52 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-22 14:42 [PATCH v4 00/17] powerpc/85xx: p2020: Create one unified machine description Christophe Leroy
2023-02-22 14:42 ` [PATCH v4 01/17] powerpc/fsl_uli1575: Misc cleanup Christophe Leroy
2023-02-22 14:42 ` [PATCH v4 02/17] powerpc/85xx: Rename setup_arch and pic_init on p1023 Christophe Leroy
2023-02-22 14:42 ` [PATCH v4 03/17] powerpc/85xx: Remove DBG() macro Christophe Leroy
2023-02-22 14:42 ` [PATCH v4 04/17] powerpc/85xx: Remove #ifdefs CONFIG_PCI in mpc85xx_ds Christophe Leroy
2023-02-22 14:42 ` [PATCH v4 05/17] powerpc/85xx: mpc85xx_{ds/rdb} compact the call to mpic_alloc() Christophe Leroy
2023-02-22 14:42 ` [PATCH v4 06/17] powerpc/85xx: mpc85xx_{ds/rdb} replace BUG_ON() by WARN_ON() Christophe Leroy
2023-02-22 14:42 ` [PATCH v4 07/17] powerpc/85xx: mpc85xx_{ds/rdb} replace prink by pr_xxx macro Christophe Leroy
2023-02-22 14:42 ` [PATCH v4 08/17] powerpc/85xx: Remove #ifdefs CONFIG_PPC_I8259 in mpc85xx_ds Christophe Leroy
2023-02-22 14:42 ` [PATCH v4 09/17] powerpc/85xx: Remove #ifdef CONFIG_QUICC_ENGINE in mpc85xx_rdb Christophe Leroy
2023-02-22 14:42 ` [PATCH v4 10/17] powerpc/85xx: p2020: Move all P2020 DS machine descriptions to p2020.c Christophe Leroy
2023-02-22 14:42 ` Christophe Leroy [this message]
2023-02-22 14:42 ` [PATCH v4 12/17] powerpc/85xx: p2020: Move i8259 code into own function Christophe Leroy
2023-02-22 14:43 ` [PATCH v4 13/17] powerpc/85xx: mpc85xx_ds: Move PCI code into own file Christophe Leroy
2023-02-22 14:43 ` [PATCH v4 14/17] powerpc/85xx: p2020: Unify .setup_arch and .init_IRQ callbacks Christophe Leroy
2023-02-22 14:43 ` [PATCH v4 15/17] powerpc/85xx: p2020: Define just one machine description Christophe Leroy
2023-02-22 14:43 ` [PATCH v4 16/17] powerpc/85xx: p2020: Enable boards by new config option CONFIG_PPC_P2020 Christophe Leroy
2023-02-22 14:43 ` [PATCH v4 17/17] powerpc: dts: turris1x.dts: Remove "fsl,P2020RDB-PC" compatible string Christophe Leroy
2023-02-22 18:22 ` [PATCH v4 00/17] powerpc/85xx: p2020: Create one unified machine description Pali Rohár
2023-02-23 8:37 ` Christophe Leroy
2023-02-23 8:58 ` Michael Ellerman
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=c5ca41a6a96ec60d38243cc77d01e77eaaba25cd.1677076552.git.christophe.leroy@csgroup.eu \
--to=christophe.leroy@csgroup.eu \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=pali@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).