powerpc/85xx: p2020: Create one unified machine description
Subsystems (3)
v5 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 which has Freescale P2020 processor. Kernel during booting correctly detects P2020 and prints:
[ 0.000000] Hardware name: Turris 1.1 e500v2 0x80211051 Freescale P2020
This patch series depends on another patch series "powerpc/fsl_uli1575: Cleanups":
https://lore.kernel.org/linuxppc-dev/[email protected]/t/#u
(it was split from this one in v5)
Changes in v5:
* Split fsl_uli1575 patches to separate patch series as this one started to be too big.
* Fix commit messages
* Reduce includes
* Rebase on top of powerpc/next (b0bbe5a2915201e3231e788d716d39dc54493b03)
* Test all patches again on CZ.NIC Turris 1.1 board with P2020 processor
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 (6):
powerpc/85xx: Remove DBG() macro
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 (7):
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: mpc85xx_ds: Move i8259 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/platforms/85xx/Kconfig | 22 +++++- arch/powerpc/platforms/85xx/Makefile | 4 +- arch/powerpc/platforms/85xx/mpc85xx.h | 6 ++ arch/powerpc/platforms/85xx/mpc85xx_8259.c | 63 ++++++++++++++++ arch/powerpc/platforms/85xx/mpc85xx_ds.c | 87 +++------------------- arch/powerpc/platforms/85xx/mpc85xx_mds.c | 7 -- arch/powerpc/platforms/85xx/mpc85xx_rdb.c | 63 +++------------- arch/powerpc/platforms/85xx/p2020.c | 81 ++++++++++++++++++++ 9 files changed, 191 insertions(+), 144 deletions(-) create mode 100644 arch/powerpc/platforms/85xx/mpc85xx_8259.c create mode 100644 arch/powerpc/platforms/85xx/p2020.c
Signature · 1 line
2.20.1
PATCH v5 1/13 powerpc/85xx: Remove DBG() macro
From: Christophe Leroy <[email protected]>
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
@@ -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
@@ -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
@@ -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.20.1
PATCH v5 3/13 powerpc/85xx: mpc85xx_{ds/rdb} replace BUG_ON() by WARN_ON()
In reply to Pali RohárFrom: Christophe Leroy <[email protected]>
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
@@ -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
@@ -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.20.1
PATCH v5 2/13 powerpc/85xx: mpc85xx_{ds/rdb} compact the call to mpic_alloc()
In reply to Pali RohárFrom: Christophe Leroy <[email protected]>
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
@@ -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
@@ -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.20.1
PATCH v5 4/13 powerpc/85xx: mpc85xx_{ds/rdb} replace prink by pr_xxx macro
In reply to Pali RohárFrom: Christophe Leroy <[email protected]>
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
@@ -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 ; }
@@ -108,7 +108,7 @@ static void __init mpc85xx_ds_setup_arch(void)uli_init ();mpc85xx_smp_init (); -printk ("MPC85xx DS board from Freescale Semiconductor\n" ); +pr_info ("MPC85xx DS board from Freescale Semiconductor\n" ); }machine_arch_initcall (mpc8544_ds, mpc85xx_common_publish_devices);
arch/powerpc/platforms/85xx/mpc85xx_rdb.c +1 -1
@@ -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.20.1
PATCH v5 5/13 powerpc/85xx: Remove #ifdefs CONFIG_PPC_I8259 in mpc85xx_ds
In reply to Pali RohárFrom: Christophe Leroy <[email protected]>
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
@@ -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 (); }/*
Signature · 1 line
2.20.1
PATCH v5 8/13 powerpc/85xx: p2020: Move all P2020 RDB machine descriptions to p2020.c
In reply to Pali RohárThis moves P2020 RDB machine descriptions into new p2020.c source file. This is preparation for code de-duplication and providing one unified machine description for all P2020 boards.
---
Changes in v5:
* Fix commit message
* Reduce includes
--- arch/powerpc/platforms/85xx/Makefile | 2 +- arch/powerpc/platforms/85xx/mpc85xx.h | 2 ++ arch/powerpc/platforms/85xx/mpc85xx_rdb.c | 30 +-------------------- arch/powerpc/platforms/85xx/p2020.c | 33 +++++++++++++++++++++++ 4 files changed, 37 insertions(+), 30 deletions(-)
arch/powerpc/platforms/85xx/Makefile +1 -1
@@ -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
@@ -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 -29
@@ -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);
@@ -104,19 +102,6 @@ machine_arch_initcall(p1021_rdb_pc, mpc85xx_common_publish_devices);machine_arch_initcall (p1025_rdb, mpc85xx_common_publish_devices);machine_arch_initcall (p1024_rdb, mpc85xx_common_publish_devices); -define_machine (p2020_rdb) { - .name = "P2020 RDB", - .compatible = "fsl,P2020RDB", - .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, - .progress = udbg_progress, -}; -define_machine (p1020_rdb) { .name = "P1020 RDB", .compatible = "fsl,P1020RDB",
@@ -143,19 +128,6 @@ define_machine(p1021_rdb_pc) { .progress = udbg_progress, }; -define_machine (p2020_rdb_pc) { - .name = "P2020RDB-PC", - .compatible = "fsl,P2020RDB-PC", - .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, - .progress = udbg_progress, -}; -define_machine (p1025_rdb) { .name = "P1025 RDB", .compatible = "fsl,P1025RDB",
arch/powerpc/platforms/85xx/p2020.c +33 -0
@@ -25,6 +25,11 @@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 */ +#ifdef CONFIG_MPC85xx_DSdefine_machine (p2020_ds) { .name = "P2020 DS",
@@ -39,3 +44,31 @@ define_machine(p2020_ds) { .progress = udbg_progress, };#endif /* CONFIG_MPC85xx_DS */ + +#ifdef CONFIG_MPC85xx_RDB +define_machine(p2020_rdb) { + .name = "P2020 RDB", + .compatible = "fsl,P2020RDB", + .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, + .progress = udbg_progress, +}; + +define_machine(p2020_rdb_pc) { + .name = "P2020RDB-PC", + .compatible = "fsl,P2020RDB-PC", + .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, + .progress = udbg_progress, +}; +#endif /* CONFIG_MPC85xx_RDB */
Signature · 1 line
2.20.1
PATCH v5 6/13 powerpc/85xx: Remove #ifdef CONFIG_QUICC_ENGINE in mpc85xx_rdb
In reply to Pali RohárFrom: Christophe Leroy <[email protected]>
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
@@ -57,7 +57,6 @@ static void __init mpc85xx_rdb_setup_arch(void)fsl_pci_assign_primary (); -#ifdef CONFIG_QUICC_ENGINEmpc85xx_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.20.1
PATCH v5 11/13 powerpc/85xx: p2020: Define just one machine description
In reply to Pali RohárCombine 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 | 57 ++++++++++------------------- 1 file changed, 19 insertions(+), 38 deletions(-)
arch/powerpc/platforms/85xx/p2020.c +19 -38
@@ -47,47 +47,29 @@ 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 */ +/* +* Called very early, device-tree isn't unflattened +*/ +static int __init p2020_probe (void ) +{ +struct device_node *p2020_cpu; -#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 */ +/* +* 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); -#ifdef CONFIG_MPC85xx_DS -define_machine(p2020_ds) { - .name = "P2020 DS", - .compatible = "fsl,P2020DS", - .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, - .progress = udbg_progress, -}; -#endif /* CONFIG_MPC85xx_DS */ +return !!p2020_cpu; +} -#ifdef CONFIG_MPC85xx_RDB -define_machine(p2020_rdb) { - .name = "P2020 RDB", - .compatible = "fsl,P2020RDB", - .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, - .progress = udbg_progress, -}; +machine_arch_initcall (p2020, mpc85xx_common_publish_devices); -define_machine(p2020_rdb_pc) { - .name = "P2020RDB-PC", - .compatible = "fsl,P2020RDB-PC", +define_machine (p2020) { + .name = "Freescale P2020", + .probe = p2020_probe, .setup_arch = p2020_setup_arch, .init_IRQ = p2020_pic_init,#ifdef CONFIG_PCI
@@ -97,4 +79,3 @@ define_machine(p2020_rdb_pc) { .get_irq = mpic_get_irq, .progress = udbg_progress, }; -#endif /* CONFIG_MPC85xx_RDB */
Signature · 1 line
2.20.1
PATCH v5 7/13 powerpc/85xx: p2020: Move all P2020 DS machine descriptions to p2020.c
In reply to Pali RohárThis moves P2020 DS machine descriptions into new p2020.c source file. This is preparation for code de-duplication and providing one unified machine description for all P2020 boards.
---
Changes in v5:
* Fix commit message
* Reduce includes
--- arch/powerpc/platforms/85xx/Makefile | 2 +- arch/powerpc/platforms/85xx/mpc85xx.h | 3 ++ arch/powerpc/platforms/85xx/mpc85xx_ds.c | 16 +-------- arch/powerpc/platforms/85xx/p2020.c | 41 ++++++++++++++++++++++++ 4 files changed, 46 insertions(+), 16 deletions(-) create mode 100644 arch/powerpc/platforms/85xx/p2020.c
arch/powerpc/platforms/85xx/Makefile +1 -1
@@ -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
@@ -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 -15
@@ -101,7 +101,7 @@ void __init mpc85xx_ds_pic_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 );
@@ -116,7 +116,6 @@ static void __init mpc85xx_ds_setup_arch(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);define_machine (mpc8544_ds) { .name = "MPC8544 DS",
@@ -143,16 +142,3 @@ define_machine(mpc8572_ds) { .get_irq = mpic_get_irq, .progress = udbg_progress, }; - -define_machine (p2020_ds) { - .name = "P2020 DS", - .compatible = "fsl,P2020DS", - .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, - .progress = udbg_progress, -};
arch/powerpc/platforms/85xx/p2020.c new file +41 -0
41 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v5 13/13 powerpc: dts: turris1x.dts: Remove "fsl,P2020RDB-PC" compatible string
In reply to Pali Rohár"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
@@ -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.20.1
PATCH v5 12/13 powerpc/85xx: p2020: Enable boards by new config option CONFIG_PPC_P2020
In reply to Pali RohárGeneric 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
@@ -78,23 +78,37 @@ 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 SWIOTLB 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
@@ -17,13 +17,14 @@ 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) +obj-$(CONFIG_MPC85xx_DS) += mpc85xx_ds.o $(obj8259-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) 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.20.1
PATCH v5 9/13 powerpc/85xx: mpc85xx_ds: Move i8259 code into own file
In reply to Pali RohárIn order to share mpc85xx i8259 code between DS and P2020. Prefix i8259 debug and error messages by i8259 word.
---
Changes in v5:
* Add prefix for err/dbg messages
* Fix commit message
* Reduce includes
--- arch/powerpc/platforms/85xx/Makefile | 3 +- arch/powerpc/platforms/85xx/mpc85xx.h | 6 +++ arch/powerpc/platforms/85xx/mpc85xx_8259.c | 63 ++++++++++++++++++++++ arch/powerpc/platforms/85xx/mpc85xx_ds.c | 46 ---------------- 4 files changed, 71 insertions(+), 47 deletions(-) create mode 100644 arch/powerpc/platforms/85xx/mpc85xx_8259.c
arch/powerpc/platforms/85xx/Makefile +2 -1
@@ -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
@@ -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 +63 -0
63 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.20.1
PATCH v5 10/13 powerpc/85xx: p2020: Unify .setup_arch and .init_IRQ callbacks
In reply to Pali RohárMake just one .setup_arch and one .init_IRQ callback implementation for all P2020 board code. This deduplicate repeated and same code.
---
Changes in v5:
* Make mpc85xx_ds_pic_init() and mpc85xx_ds_setup_arch() static too.
--- arch/powerpc/platforms/85xx/mpc85xx.h | 5 --- arch/powerpc/platforms/85xx/mpc85xx_ds.c | 4 +-- arch/powerpc/platforms/85xx/mpc85xx_rdb.c | 4 +-- arch/powerpc/platforms/85xx/p2020.c | 38 +++++++++++++++++++---- 4 files changed, 36 insertions(+), 15 deletions(-)
arch/powerpc/platforms/85xx/mpc85xx.h +0 -5
@@ -21,9 +21,4 @@ void __init mpc85xx_8259_init(void);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 ); -void __init mpc85xx_rdb_pic_init (void ); -#endif
arch/powerpc/platforms/85xx/mpc85xx_ds.c +2 -2
@@ -34,7 +34,7 @@#include "mpc85xx.h" -void __init mpc85xx_ds_pic_init (void ) +static void __init mpc85xx_ds_pic_init (void ) {struct mpic *mpic;int flags =MPIC_BIG_ENDIAN |MPIC_SINGLE_DEST_CPU ;
@@ -55,7 +55,7 @@ void __init mpc85xx_ds_pic_init(void)/* * Setup the architecture */ -void __init mpc85xx_ds_setup_arch (void ) +static void __init mpc85xx_ds_setup_arch (void ) {if (ppc_md.progress) ppc_md.progress ("mpc85xx_ds_setup_arch()" ,0 );
arch/powerpc/platforms/85xx/mpc85xx_rdb.c +2 -2
@@ -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
@@ -21,6 +21,32 @@#include "smp.h" #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 (); +uli_init (); +mpc85xx_smp_init (); +mpc85xx_qe_par_io_init (); +} +#ifdef CONFIG_MPC85xx_DSmachine_arch_initcall (p2020_ds, mpc85xx_common_publish_devices);#endif /* CONFIG_MPC85xx_DS */
@@ -34,8 +60,8 @@ machine_arch_initcall(p2020_rdb_pc, mpc85xx_common_publish_devices);define_machine (p2020_ds) { .name = "P2020 DS", .compatible = "fsl,P2020DS", - .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,
@@ -49,8 +75,8 @@ define_machine(p2020_ds) {define_machine (p2020_rdb) { .name = "P2020 RDB", .compatible = "fsl,P2020RDB", - .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,
@@ -62,8 +88,8 @@ define_machine(p2020_rdb) {define_machine (p2020_rdb_pc) { .name = "P2020RDB-PC", .compatible = "fsl,P2020RDB-PC", - .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.20.1
Michael Ellerman
AppliedQuoted 10 lines · Pali Rohár
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 which has Freescale P2020 processor. Kernel during booting correctly detects P2020 and prints:
[ 0.000000] Hardware name: Turris 1.1 e500v2 0x80211051 Freescale P2020[...]
Applied to powerpc/next.
[01/13] powerpc/85xx: Remove DBG() macro
https://git.kernel.org/powerpc/c/6faab5d7ac49d40bedf348a879042681755c14b0 [02/13] powerpc/85xx: mpc85xx_{ds/rdb} compact the call to mpic_alloc() https://git.kernel.org/powerpc/c/0abc1eadd605d461b9a953e6a27d810ed169ed7b [03/13] powerpc/85xx: mpc85xx_{ds/rdb} replace BUG_ON() by WARN_ON() https://git.kernel.org/powerpc/c/1bca2f8219da51a1119d1f4054b44880cbf0494e [04/13] powerpc/85xx: mpc85xx_{ds/rdb} replace prink by pr_xxx macro https://git.kernel.org/powerpc/c/15c6ba7992993fecdac52a424ce35b6e4a272c75 [05/13] powerpc/85xx: Remove #ifdefs CONFIG_PPC_I8259 in mpc85xx_ds https://git.kernel.org/powerpc/c/f435f67024cbee223083aa843f9b69888c8de8a8 [06/13] powerpc/85xx: Remove #ifdef CONFIG_QUICC_ENGINE in mpc85xx_rdb https://git.kernel.org/powerpc/c/b1a54cb693724b6212efa64d877126769ece4d4c [07/13] powerpc/85xx: p2020: Move all P2020 DS machine descriptions to p2020.c https://git.kernel.org/powerpc/c/ba5a7ca277afc0e9083a7a2021725425a493cfb2 [08/13] powerpc/85xx: p2020: Move all P2020 RDB machine descriptions to p2020.c https://git.kernel.org/powerpc/c/c30aa8fd6cabd12917277facbd2bd81dc3a226d6 [09/13] powerpc/85xx: mpc85xx_ds: Move i8259 code into own file https://git.kernel.org/powerpc/c/92189c902c2e2f8c0d4238310686e93da99156b5 [10/13] powerpc/85xx: p2020: Unify .setup_arch and .init_IRQ callbacks https://git.kernel.org/powerpc/c/7d8ae6e081428699999c9d128c4e9d3927c1da03 [11/13] powerpc/85xx: p2020: Define just one machine description https://git.kernel.org/powerpc/c/1a170efec56ba4707cd33e711dbafb60b7f94626 [12/13] powerpc/85xx: p2020: Enable boards by new config option CONFIG_PPC_P2020 https://git.kernel.org/powerpc/c/b5340a094b5c753ee3490716bcd86546dfd3e078 [13/13] powerpc: dts: turris1x.dts: Remove "fsl,P2020RDB-PC" compatible string https://git.kernel.org/powerpc/c/40f7b523e31fd68163d9dfe639f2f34b6a726ecd
cheers