From nobody Wed Sep 17 01:14:04 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F227C3DA7A for ; Sat, 24 Dec 2022 21:16:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230155AbiLXVQi (ORCPT ); Sat, 24 Dec 2022 16:16:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229445AbiLXVQg (ORCPT ); Sat, 24 Dec 2022 16:16:36 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74319A445 for ; Sat, 24 Dec 2022 13:16:35 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0A5C060B0C for ; Sat, 24 Dec 2022 21:16:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 429B5C433EF; Sat, 24 Dec 2022 21:16:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671916594; bh=UD5jorQCVmKiXH0v3VkIP3iO7pPTI+aaxJhMgfUmopA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oc6cSSGgtRTQmJ86c8kAsul6M3Ygniaj0MO56wwfXbVITrjxApARWDw2K7umElNgo ATWv7q/bPgLcHXJLE6hNFIKdZaz1cI60NU6/8CFqqwYsOi3ruyJbSvPtRJPBlnMAdM Gw6jPpnWCgVVnXOm3NvCMpAN49KWZOYzZ9NOBHtUEwk2+jzSKWa6skt+5UsJeK6BLx n3+XPsXrDqdlui1E7FzFvDXr3IBGH50+dkFqV092+FLhQKL7I2pB5fSC9vcQtgyUW2 1XHn5s5PgkSFWjF1na6LGTvnGeDlEx/FkP+UlgcQDBwBeVDWkBIgIUzq//sbcOsoSy qIwle/yYr65VA== Received: by pali.im (Postfix) id C5B48720; Sat, 24 Dec 2022 22:16:31 +0100 (CET) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Michael Ellerman , Nicholas Piggin , Christophe Leroy , Scott Wood , Sinan Akman , Martin Kennedy Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/8] powerpc/85xx: Mark mpc85xx_rdb_pic_init() as static Date: Sat, 24 Dec 2022 22:14:18 +0100 Message-Id: <20221224211425.14983-2-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20221224211425.14983-1-pali@kernel.org> References: <20221224211425.14983-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Function mpc85xx_rdb_pic_init() is not used out of the mpc85xx_rdb.c file. Signed-off-by: Pali Roh=C3=A1r --- arch/powerpc/platforms/85xx/mpc85xx_rdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c b/arch/powerpc/platf= orms/85xx/mpc85xx_rdb.c index d99aba158235..b6129c148fea 100644 --- a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c +++ b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c @@ -38,7 +38,7 @@ #endif =20 =20 -void __init mpc85xx_rdb_pic_init(void) +static void __init mpc85xx_rdb_pic_init(void) { struct mpic *mpic; =20 --=20 2.20.1 From nobody Wed Sep 17 01:14:04 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E80ABC4332F for ; Sat, 24 Dec 2022 21:16:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230222AbiLXVQl (ORCPT ); Sat, 24 Dec 2022 16:16:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229445AbiLXVQj (ORCPT ); Sat, 24 Dec 2022 16:16:39 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D7D8A446 for ; Sat, 24 Dec 2022 13:16:38 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E7998B80139 for ; Sat, 24 Dec 2022 21:16:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A20EC433D2; Sat, 24 Dec 2022 21:16:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671916595; bh=RoXrwfU/s5vurCwlxvo8Vd+Lw1JXCW4diLyk4VZ6JDI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cR6u70y95h2R+t1gaD2QDSB2DCABAVBiIAvdmhHnHOXLA5fddVSelnAd4kZykVEg8 h7TMpEtoktLZzwbmGMs2zY1albKs0iPtHZXmVSodhety7X0wFKGs6rYvEPrdiDJhdD lKR4zeg1DGvqF4Z0lW6o03pBsmCOh3Y4BUcD5egPGfpQVUAD68yM7bdTzKdmX1L0an lIs8V7x41KBM0lxjpe3+P/Mq+OUW0+5Zx47HsQyFC7H+oHt7oI0vCft9qyAWfTXldL WklfcVxPRxfcVsHjtyppKlGSOt+khxqXLSkU6fqQJw15cSrXVGZv/ncesqqkj4od/B juRWKj41jIDRQ== Received: by pali.im (Postfix) id D4C5E9D7; Sat, 24 Dec 2022 22:16:32 +0100 (CET) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Michael Ellerman , Nicholas Piggin , Christophe Leroy , Scott Wood , Sinan Akman , Martin Kennedy Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/8] powerpc/85xx: Mark mpc85xx_ds_pic_init() as static Date: Sat, 24 Dec 2022 22:14:19 +0100 Message-Id: <20221224211425.14983-3-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20221224211425.14983-1-pali@kernel.org> References: <20221224211425.14983-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Function mpc85xx_ds_pic_init() is not used out of the mpc85xx_ds.c file. Signed-off-by: Pali Roh=C3=A1r --- arch/powerpc/platforms/85xx/mpc85xx_ds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platfo= rms/85xx/mpc85xx_ds.c index f8d2c97f39bd..9a6d637ef54a 100644 --- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c +++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c @@ -54,7 +54,7 @@ static void mpc85xx_8259_cascade(struct irq_desc *desc) } #endif /* CONFIG_PPC_I8259 */ =20 -void __init mpc85xx_ds_pic_init(void) +static void __init mpc85xx_ds_pic_init(void) { struct mpic *mpic; #ifdef CONFIG_PPC_I8259 --=20 2.20.1 From nobody Wed Sep 17 01:14:04 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A61C9C4332F for ; Sat, 24 Dec 2022 21:16:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229693AbiLXVQs (ORCPT ); Sat, 24 Dec 2022 16:16:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230186AbiLXVQj (ORCPT ); Sat, 24 Dec 2022 16:16:39 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F5DCA445 for ; Sat, 24 Dec 2022 13:16:37 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3B9C960B0C for ; Sat, 24 Dec 2022 21:16:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B931C433F1; Sat, 24 Dec 2022 21:16:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671916596; bh=UU48dkbPMWSfqv33kA8+TfkcfoCpjLsskO/H+O/CHJg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J+JXBqKJ/DgB9Gjt43K/ArKCpmBGKk/BpjpNZNExk7VWSMTxM2RtkMX46XrQqpOFd mjP+FkvbgSxSUflrxpBL+MN3Hk0STZbF1ykBaS4JJWiTTwYhT37Neeo6QKafvjAi9V RBRW6Q6CWOusTVJ9y/i3Fq6pM64CCzNpmGyzQESiJPU9MsS5N4XZIfudIQoMFnojhX DK0T2Rs5KB1Jpii27beRc4U3AtLuAEb8IF8CNBxuxTrKgoR//M8m+E79Vc4J//7hRP 90gFTVNrPWHUtrOKXi4Gdyg/m5i58sQxH//IJ70ZrLvMtH3Z9LJKVQRT7AVml1VyNe fxS0qdIqpzX0w== Received: by pali.im (Postfix) id 01E679E4; Sat, 24 Dec 2022 22:16:33 +0100 (CET) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Michael Ellerman , Nicholas Piggin , Christophe Leroy , Scott Wood , Sinan Akman , Martin Kennedy Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/8] powerpc/85xx: p2020: Move all P2020 machine descriptions to p2020.c Date: Sat, 24 Dec 2022 22:14:20 +0100 Message-Id: <20221224211425.14983-4-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20221224211425.14983-1-pali@kernel.org> References: <20221224211425.14983-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This moves machine descriptions and all related code for all P2020 boards into new p2020.c source file. This change also copies helper static functions from other mpc85xx*.c files into p2020.c, which are required for machine descriptions. 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=C3=A1r --- arch/powerpc/platforms/85xx/Makefile | 2 + arch/powerpc/platforms/85xx/mpc85xx_ds.c | 23 -- arch/powerpc/platforms/85xx/mpc85xx_rdb.c | 44 ---- arch/powerpc/platforms/85xx/p2020.c | 273 ++++++++++++++++++++++ 4 files changed, 275 insertions(+), 67 deletions(-) create mode 100644 arch/powerpc/platforms/85xx/p2020.c diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/= 85xx/Makefile index 260fbad7967b..1ad261b4eeb6 100644 --- a/arch/powerpc/platforms/85xx/Makefile +++ b/arch/powerpc/platforms/85xx/Makefile @@ -23,6 +23,8 @@ obj-$(CONFIG_P1010_RDB) +=3D p1010rdb.o obj-$(CONFIG_P1022_DS) +=3D p1022_ds.o obj-$(CONFIG_P1022_RDK) +=3D p1022_rdk.o obj-$(CONFIG_P1023_RDB) +=3D p1023_rdb.o +obj-$(CONFIG_MPC85xx_DS) +=3D p2020.o +obj-$(CONFIG_MPC85xx_RDB) +=3D p2020.o obj-$(CONFIG_TWR_P102x) +=3D twr_p102x.o obj-$(CONFIG_CORENET_GENERIC) +=3D corenet_generic.o obj-$(CONFIG_FB_FSL_DIU) +=3D t1042rdb_diu.o diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platfo= rms/85xx/mpc85xx_ds.c index 9a6d637ef54a..05aac997b5ed 100644 --- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c +++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c @@ -168,7 +168,6 @@ static int __init mpc8544_ds_probe(void) =20 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); =20 /* * Called very early, device-tree isn't unflattened @@ -178,14 +177,6 @@ static int __init mpc8572_ds_probe(void) return !!of_machine_is_compatible("fsl,MPC8572DS"); } =20 -/* - * 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 =3D "MPC8544 DS", .probe =3D mpc8544_ds_probe, @@ -213,17 +204,3 @@ define_machine(mpc8572_ds) { .calibrate_decr =3D generic_calibrate_decr, .progress =3D udbg_progress, }; - -define_machine(p2020_ds) { - .name =3D "P2020 DS", - .probe =3D p2020_ds_probe, - .setup_arch =3D mpc85xx_ds_setup_arch, - .init_IRQ =3D mpc85xx_ds_pic_init, -#ifdef CONFIG_PCI - .pcibios_fixup_bus =3D fsl_pcibios_fixup_bus, - .pcibios_fixup_phb =3D fsl_pcibios_fixup_phb, -#endif - .get_irq =3D mpic_get_irq, - .calibrate_decr =3D generic_calibrate_decr, - .progress =3D udbg_progress, -}; diff --git a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c b/arch/powerpc/platf= orms/85xx/mpc85xx_rdb.c index b6129c148fea..05f1ed635735 100644 --- a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c +++ b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c @@ -108,8 +108,6 @@ static void __init mpc85xx_rdb_setup_arch(void) printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n"); } =20 -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); @@ -122,13 +120,6 @@ machine_arch_initcall(p1024_rdb, mpc85xx_common_publis= h_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")) @@ -153,13 +144,6 @@ static int __init p1021_rdb_pc_probe(void) return 0; } =20 -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"); @@ -180,20 +164,6 @@ static int __init p1024_rdb_probe(void) return of_machine_is_compatible("fsl,P1024RDB"); } =20 -define_machine(p2020_rdb) { - .name =3D "P2020 RDB", - .probe =3D p2020_rdb_probe, - .setup_arch =3D mpc85xx_rdb_setup_arch, - .init_IRQ =3D mpc85xx_rdb_pic_init, -#ifdef CONFIG_PCI - .pcibios_fixup_bus =3D fsl_pcibios_fixup_bus, - .pcibios_fixup_phb =3D fsl_pcibios_fixup_phb, -#endif - .get_irq =3D mpic_get_irq, - .calibrate_decr =3D generic_calibrate_decr, - .progress =3D udbg_progress, -}; - define_machine(p1020_rdb) { .name =3D "P1020 RDB", .probe =3D p1020_rdb_probe, @@ -222,20 +192,6 @@ define_machine(p1021_rdb_pc) { .progress =3D udbg_progress, }; =20 -define_machine(p2020_rdb_pc) { - .name =3D "P2020RDB-PC", - .probe =3D p2020_rdb_pc_probe, - .setup_arch =3D mpc85xx_rdb_setup_arch, - .init_IRQ =3D mpc85xx_rdb_pic_init, -#ifdef CONFIG_PCI - .pcibios_fixup_bus =3D fsl_pcibios_fixup_bus, - .pcibios_fixup_phb =3D fsl_pcibios_fixup_phb, -#endif - .get_irq =3D mpic_get_irq, - .calibrate_decr =3D generic_calibrate_decr, - .progress =3D udbg_progress, -}; - define_machine(p1025_rdb) { .name =3D "P1025 RDB", .probe =3D p1025_rdb_probe, diff --git a/arch/powerpc/platforms/85xx/p2020.c b/arch/powerpc/platforms/8= 5xx/p2020.c new file mode 100644 index 000000000000..d65d4c88ac47 --- /dev/null +++ b/arch/powerpc/platforms/85xx/p2020.c @@ -0,0 +1,273 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Freescale P2020 board Setup + * + * Copyright 2007,2009,2012-2013 Freescale Semiconductor Inc. + * Copyright 2022 Pali Roh=C3=A1r + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include "smp.h" + +#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_MPC85xx_DS + +#ifdef CONFIG_PPC_I8259 +static void mpc85xx_8259_cascade(struct irq_desc *desc) +{ + struct irq_chip *chip =3D irq_desc_get_chip(desc); + unsigned int cascade_irq =3D i8259_irq(); + + if (cascade_irq) { + generic_handle_irq(cascade_irq); + } + chip->irq_eoi(&desc->irq_data); +} +#endif /* CONFIG_PPC_I8259 */ + +static void __init mpc85xx_ds_pic_init(void) +{ + struct mpic *mpic; +#ifdef CONFIG_PPC_I8259 + struct device_node *np; + struct device_node *cascade_node =3D NULL; + int cascade_irq; +#endif + + mpic =3D mpic_alloc(NULL, 0, + MPIC_BIG_ENDIAN | + MPIC_SINGLE_DEST_CPU, + 0, 256, " OpenPIC "); + + BUG_ON(mpic =3D=3D NULL); + 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")) { + cascade_node =3D np; + break; + } + + if (cascade_node =3D=3D NULL) { + printk(KERN_DEBUG "Could not find i8259 PIC\n"); + return; + } + + cascade_irq =3D irq_of_parse_and_map(cascade_node, 0); + if (!cascade_irq) { + printk(KERN_ERR "Failed to map cascade interrupt\n"); + return; + } + + DBG("mpc85xxds: cascade mapped to irq %d\n", cascade_irq); + + i8259_init(cascade_node, 0); + of_node_put(cascade_node); + + irq_set_chained_handler(cascade_irq, mpc85xx_8259_cascade); +#endif /* CONFIG_PPC_I8259 */ +} + +#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, + u_char bus, u_char devfn) +{ + if (hose->dn =3D=3D pci_with_uli) + return uli_exclude_device(hose, bus, devfn); + + return PCIBIOS_SUCCESSFUL; +} +#endif /* CONFIG_PCI */ + +static void __init mpc85xx_ds_uli_init(void) +{ +#ifdef CONFIG_PCI + struct device_node *node; + + /* See if we have a ULI under the primary */ + + node =3D of_find_node_by_name(NULL, "uli1575"); + while ((pci_with_uli =3D of_get_parent(node))) { + of_node_put(node); + node =3D pci_with_uli; + + if (pci_with_uli =3D=3D fsl_pci_primary) { + ppc_md.pci_exclude_device =3D mpc85xx_exclude_device; + break; + } + } +#endif +} + +#endif /* CONFIG_MPC85xx_DS */ + +#ifdef CONFIG_MPC85xx_RDB +static void __init mpc85xx_rdb_pic_init(void) +{ + struct mpic *mpic; + + mpic =3D mpic_alloc(NULL, 0, + MPIC_BIG_ENDIAN | + MPIC_SINGLE_DEST_CPU, + 0, 256, " OpenPIC "); + + BUG_ON(mpic =3D=3D NULL); + mpic_init(mpic); +} +#endif /* CONFIG_MPC85xx_RDB */ + +/* + * Setup the architecture + */ +#ifdef CONFIG_MPC85xx_DS +static void __init mpc85xx_ds_setup_arch(void) +{ + if (ppc_md.progress) + ppc_md.progress("mpc85xx_ds_setup_arch()", 0); + + swiotlb_detect_4g(); + fsl_pci_assign_primary(); + mpc85xx_ds_uli_init(); + mpc85xx_smp_init(); + + printk("MPC85xx DS board from Freescale Semiconductor\n"); +} +#endif /* CONFIG_MPC85xx_DS */ + +#ifdef CONFIG_MPC85xx_RDB +static void __init mpc85xx_rdb_setup_arch(void) +{ + if (ppc_md.progress) + ppc_md.progress("mpc85xx_rdb_setup_arch()", 0); + + mpc85xx_smp_init(); + + fsl_pci_assign_primary(); + +#ifdef CONFIG_QUICC_ENGINE + mpc85xx_qe_par_io_init(); +#endif /* CONFIG_QUICC_ENGINE */ + + printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n"); +} +#endif /* CONFIG_MPC85xx_RDB */ + +#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 =3D "P2020 DS", + .probe =3D p2020_ds_probe, + .setup_arch =3D mpc85xx_ds_setup_arch, + .init_IRQ =3D mpc85xx_ds_pic_init, +#ifdef CONFIG_PCI + .pcibios_fixup_bus =3D fsl_pcibios_fixup_bus, + .pcibios_fixup_phb =3D fsl_pcibios_fixup_phb, +#endif + .get_irq =3D mpic_get_irq, + .calibrate_decr =3D generic_calibrate_decr, + .progress =3D udbg_progress, +}; +#endif /* CONFIG_MPC85xx_DS */ + +#ifdef CONFIG_MPC85xx_RDB +define_machine(p2020_rdb) { + .name =3D "P2020 RDB", + .probe =3D p2020_rdb_probe, + .setup_arch =3D mpc85xx_rdb_setup_arch, + .init_IRQ =3D mpc85xx_rdb_pic_init, +#ifdef CONFIG_PCI + .pcibios_fixup_bus =3D fsl_pcibios_fixup_bus, + .pcibios_fixup_phb =3D fsl_pcibios_fixup_phb, +#endif + .get_irq =3D mpic_get_irq, + .calibrate_decr =3D generic_calibrate_decr, + .progress =3D udbg_progress, +}; + +define_machine(p2020_rdb_pc) { + .name =3D "P2020RDB-PC", + .probe =3D p2020_rdb_pc_probe, + .setup_arch =3D mpc85xx_rdb_setup_arch, + .init_IRQ =3D mpc85xx_rdb_pic_init, +#ifdef CONFIG_PCI + .pcibios_fixup_bus =3D fsl_pcibios_fixup_bus, + .pcibios_fixup_phb =3D fsl_pcibios_fixup_phb, +#endif + .get_irq =3D mpic_get_irq, + .calibrate_decr =3D generic_calibrate_decr, + .progress =3D udbg_progress, +}; +#endif /* CONFIG_MPC85xx_RDB */ --=20 2.20.1 From nobody Wed Sep 17 01:14:04 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE003C10F1B for ; Sat, 24 Dec 2022 21:16:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230247AbiLXVQp (ORCPT ); Sat, 24 Dec 2022 16:16:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230185AbiLXVQj (ORCPT ); Sat, 24 Dec 2022 16:16:39 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 683DCA447 for ; Sat, 24 Dec 2022 13:16:38 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 18A77B8016A for ; Sat, 24 Dec 2022 21:16:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E5E7C433F0; Sat, 24 Dec 2022 21:16:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671916595; bh=ySpGEUFcvdEqE4LGPb4c2lY8Vn2te6xLgnS8OF0nmEM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IHEA5/atfot9gZy3MSrVLjUZNV1u4eLIfyMJ4VTqUwwR6L0CCX58gPQKK01m7lMKG McfzfAATsX64wt37mCLGjeJrFzNnPC74XU+cTM1VYvLdcvbYy5huyzgo+KHYfwMyE+ 1w8/DYuDLYZLeGWulVkzqV/hAey/Ru0ICKka7uQ5dsqeo+eN1VNpgSWHo7LHO63x+6 aT5HwidY+o6KZ/75N+q+uf2ZgVJaeOKx5lbLev9JODTwK1VKmP6W4S87ob9r4urd0a vT86eYmdykyDQIz2v/K2QC3MrZxsbFnDED0+JMLd+n4aTBfKW30P4MPgBO5hK0ZjLP WoTunWbWsXDmQ== Received: by pali.im (Postfix) id 26112720; Sat, 24 Dec 2022 22:16:35 +0100 (CET) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Michael Ellerman , Nicholas Piggin , Christophe Leroy , Scott Wood , Sinan Akman , Martin Kennedy Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/8] powerpc/85xx: p2020: Move i8259 code into own function Date: Sat, 24 Dec 2022 22:14:21 +0100 Message-Id: <20221224211425.14983-5-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20221224211425.14983-1-pali@kernel.org> References: <20221224211425.14983-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Splits mpic and i8259 initialization codes into separate functions. Signed-off-by: Pali Roh=C3=A1r --- arch/powerpc/platforms/85xx/p2020.c | 37 ++++++++++++++++------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/arch/powerpc/platforms/85xx/p2020.c b/arch/powerpc/platforms/8= 5xx/p2020.c index d65d4c88ac47..b8584bf307b0 100644 --- a/arch/powerpc/platforms/85xx/p2020.c +++ b/arch/powerpc/platforms/85xx/p2020.c @@ -45,6 +45,7 @@ #ifdef CONFIG_MPC85xx_DS =20 #ifdef CONFIG_PPC_I8259 + static void mpc85xx_8259_cascade(struct irq_desc *desc) { struct irq_chip *chip =3D irq_desc_get_chip(desc); @@ -55,27 +56,13 @@ static void mpc85xx_8259_cascade(struct irq_desc *desc) } chip->irq_eoi(&desc->irq_data); } -#endif /* CONFIG_PPC_I8259 */ =20 -static void __init mpc85xx_ds_pic_init(void) +static void __init mpc85xx_8259_init(void) { - struct mpic *mpic; -#ifdef CONFIG_PPC_I8259 struct device_node *np; struct device_node *cascade_node =3D NULL; int cascade_irq; -#endif - - mpic =3D mpic_alloc(NULL, 0, - MPIC_BIG_ENDIAN | - MPIC_SINGLE_DEST_CPU, - 0, 256, " OpenPIC "); - - BUG_ON(mpic =3D=3D NULL); - mpic_init(mpic); =20 -#ifdef CONFIG_PPC_I8259 - /* Initialize the i8259 controller */ for_each_node_by_type(np, "interrupt-controller") if (of_device_is_compatible(np, "chrp,iic")) { cascade_node =3D np; @@ -93,13 +80,31 @@ static void __init mpc85xx_ds_pic_init(void) return; } =20 - DBG("mpc85xxds: cascade mapped to irq %d\n", cascade_irq); + DBG("i8259: cascade mapped to irq %d\n", cascade_irq); =20 i8259_init(cascade_node, 0); of_node_put(cascade_node); =20 irq_set_chained_handler(cascade_irq, mpc85xx_8259_cascade); +} + #endif /* CONFIG_PPC_I8259 */ + +static void __init mpc85xx_ds_pic_init(void) +{ + struct mpic *mpic; + + mpic =3D mpic_alloc(NULL, 0, + MPIC_BIG_ENDIAN | + MPIC_SINGLE_DEST_CPU, + 0, 256, " OpenPIC "); + + BUG_ON(mpic =3D=3D NULL); + mpic_init(mpic); + +#ifdef CONFIG_PPC_I8259 + mpc85xx_8259_init(); +#endif } =20 #ifdef CONFIG_PCI --=20 2.20.1 From nobody Wed Sep 17 01:14:04 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 368C6C4332F for ; Sat, 24 Dec 2022 21:16:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230315AbiLXVQw (ORCPT ); Sat, 24 Dec 2022 16:16:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230203AbiLXVQk (ORCPT ); Sat, 24 Dec 2022 16:16:40 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83207A457 for ; Sat, 24 Dec 2022 13:16:39 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1B4FCB802C6 for ; Sat, 24 Dec 2022 21:16:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 833C9C433EF; Sat, 24 Dec 2022 21:16:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671916596; bh=xNSdUI6pz4D6dE9/Og/zOzJThSiw3fw4+p8TGNZp1R0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DsDHwiA1Ml1/V9aFtJjyvnguPlFykX7SqWAxLPn1/2OmrJiOtMFJu4fiHxeS/51MK Py+b9wD4O1fIaKofMSAk5BsCmejZSGQvCpumBQW8uCG+/+lfjy+Grcirb4Ylj28tg+ rAvSS0SGB0nYtqB+OWSEVZZIx+kVYF/j2qUfhNI7wZcPCQDrhalzqL3i9rKrMLs4dK 7EctiQ30THPYXQhdWffKwWrkKqvfSjA+DKBdqguvkJNhmriQNHcGmUjccIU5c+Xfn/ st4O39arY0XTQSTA4BbwaAtrRsavYjyMyZHmES05IGpln7mgG2bIClTgqfszYSLO81 yFaOQARpg4mBQ== Received: by pali.im (Postfix) id 3E87D720; Sat, 24 Dec 2022 22:16:36 +0100 (CET) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Michael Ellerman , Nicholas Piggin , Christophe Leroy , Scott Wood , Sinan Akman , Martin Kennedy Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 5/8] powerpc/85xx: p2020: Unify .setup_arch and .init_IRQ callbacks Date: Sat, 24 Dec 2022 22:14:22 +0100 Message-Id: <20221224211425.14983-6-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20221224211425.14983-1-pali@kernel.org> References: <20221224211425.14983-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make just one .setup_arch and one .init_IRQ callback implementation for all P2020 board code. This deduplicate repeated and same code. Signed-off-by: Pali Roh=C3=A1r --- arch/powerpc/platforms/85xx/p2020.c | 58 +++++------------------------ 1 file changed, 9 insertions(+), 49 deletions(-) diff --git a/arch/powerpc/platforms/85xx/p2020.c b/arch/powerpc/platforms/8= 5xx/p2020.c index b8584bf307b0..adf3750abef9 100644 --- a/arch/powerpc/platforms/85xx/p2020.c +++ b/arch/powerpc/platforms/85xx/p2020.c @@ -42,8 +42,6 @@ #define DBG(fmt, args...) #endif =20 -#ifdef CONFIG_MPC85xx_DS - #ifdef CONFIG_PPC_I8259 =20 static void mpc85xx_8259_cascade(struct irq_desc *desc) @@ -90,7 +88,7 @@ static void __init mpc85xx_8259_init(void) =20 #endif /* CONFIG_PPC_I8259 */ =20 -static void __init mpc85xx_ds_pic_init(void) +static void __init p2020_pic_init(void) { struct mpic *mpic; =20 @@ -143,58 +141,20 @@ static void __init mpc85xx_ds_uli_init(void) #endif } =20 -#endif /* CONFIG_MPC85xx_DS */ - -#ifdef CONFIG_MPC85xx_RDB -static void __init mpc85xx_rdb_pic_init(void) -{ - struct mpic *mpic; - - mpic =3D mpic_alloc(NULL, 0, - MPIC_BIG_ENDIAN | - MPIC_SINGLE_DEST_CPU, - 0, 256, " OpenPIC "); - - BUG_ON(mpic =3D=3D NULL); - mpic_init(mpic); -} -#endif /* CONFIG_MPC85xx_RDB */ - /* * Setup the architecture */ -#ifdef CONFIG_MPC85xx_DS -static void __init mpc85xx_ds_setup_arch(void) +static void __init p2020_setup_arch(void) { - if (ppc_md.progress) - ppc_md.progress("mpc85xx_ds_setup_arch()", 0); - swiotlb_detect_4g(); fsl_pci_assign_primary(); mpc85xx_ds_uli_init(); mpc85xx_smp_init(); =20 - printk("MPC85xx DS board from Freescale Semiconductor\n"); -} -#endif /* CONFIG_MPC85xx_DS */ - -#ifdef CONFIG_MPC85xx_RDB -static void __init mpc85xx_rdb_setup_arch(void) -{ - if (ppc_md.progress) - ppc_md.progress("mpc85xx_rdb_setup_arch()", 0); - - mpc85xx_smp_init(); - - fsl_pci_assign_primary(); - #ifdef CONFIG_QUICC_ENGINE mpc85xx_qe_par_io_init(); -#endif /* CONFIG_QUICC_ENGINE */ - - printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n"); +#endif } -#endif /* CONFIG_MPC85xx_RDB */ =20 #ifdef CONFIG_MPC85xx_DS machine_arch_initcall(p2020_ds, mpc85xx_common_publish_devices); @@ -235,8 +195,8 @@ static int __init p2020_rdb_pc_probe(void) define_machine(p2020_ds) { .name =3D "P2020 DS", .probe =3D p2020_ds_probe, - .setup_arch =3D mpc85xx_ds_setup_arch, - .init_IRQ =3D mpc85xx_ds_pic_init, + .setup_arch =3D p2020_setup_arch, + .init_IRQ =3D p2020_pic_init, #ifdef CONFIG_PCI .pcibios_fixup_bus =3D fsl_pcibios_fixup_bus, .pcibios_fixup_phb =3D fsl_pcibios_fixup_phb, @@ -251,8 +211,8 @@ define_machine(p2020_ds) { define_machine(p2020_rdb) { .name =3D "P2020 RDB", .probe =3D p2020_rdb_probe, - .setup_arch =3D mpc85xx_rdb_setup_arch, - .init_IRQ =3D mpc85xx_rdb_pic_init, + .setup_arch =3D p2020_setup_arch, + .init_IRQ =3D p2020_pic_init, #ifdef CONFIG_PCI .pcibios_fixup_bus =3D fsl_pcibios_fixup_bus, .pcibios_fixup_phb =3D fsl_pcibios_fixup_phb, @@ -265,8 +225,8 @@ define_machine(p2020_rdb) { define_machine(p2020_rdb_pc) { .name =3D "P2020RDB-PC", .probe =3D p2020_rdb_pc_probe, - .setup_arch =3D mpc85xx_rdb_setup_arch, - .init_IRQ =3D mpc85xx_rdb_pic_init, + .setup_arch =3D p2020_setup_arch, + .init_IRQ =3D p2020_pic_init, #ifdef CONFIG_PCI .pcibios_fixup_bus =3D fsl_pcibios_fixup_bus, .pcibios_fixup_phb =3D fsl_pcibios_fixup_phb, --=20 2.20.1 From nobody Wed Sep 17 01:14:04 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3997C4332F for ; Sat, 24 Dec 2022 21:18:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230393AbiLXVSA (ORCPT ); Sat, 24 Dec 2022 16:18:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230250AbiLXVRu (ORCPT ); Sat, 24 Dec 2022 16:17:50 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD841A445 for ; Sat, 24 Dec 2022 13:17:49 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 37248B802C6 for ; Sat, 24 Dec 2022 21:17:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DF47C433D2; Sat, 24 Dec 2022 21:17:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671916666; bh=GmtMxhGoXO8mzjcBa/1xqcbgZxWhZejdfxvLHGTF0Vo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=drl8Y8PLpCkemip4M3K5tuRiOA8LlyJDgh1VykS/oxwNX42iAY+ljwHIunIvcrvlL gvFf+OKBa6GagtAf+21dsQUMgIiUYne73KTouQe4XrDwiK25zCzvXIFVK5+Xf12uFr Vyf6YgTBugtUWKgG2RVT1ZocrT4h3xztj4sgeouE+Pf3fWZM/gLpvqy0dQUA1iXRa4 Fv32OA9mKRU+HD1kG4zg52JJrVoaLA5R3/bQVdSYmPCkZg/dcoGXhx/gMztmRioXD8 q4phiHHP7pg0h43b9qBz1kj5z0C7tAzgAxgMkJDmD+XdrsLoBh6lKm3ubJvnyZ29tL l9CAECGu7XhcA== Received: by pali.im (Postfix) id F31E4720; Sat, 24 Dec 2022 22:17:43 +0100 (CET) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Michael Ellerman , Nicholas Piggin , Christophe Leroy , Scott Wood , Sinan Akman , Martin Kennedy Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 6/8] powerpc/85xx: p2020: Define just one machine description Date: Sat, 24 Dec 2022 22:14:23 +0100 Message-Id: <20221224211425.14983-7-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20221224211425.14983-1-pali@kernel.org> References: <20221224211425.14983-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Pali Roh=C3=A1r --- arch/powerpc/platforms/85xx/p2020.c | 83 +++++++---------------------- 1 file changed, 19 insertions(+), 64 deletions(-) diff --git a/arch/powerpc/platforms/85xx/p2020.c b/arch/powerpc/platforms/8= 5xx/p2020.c index adf3750abef9..b3fb600e1d83 100644 --- a/arch/powerpc/platforms/85xx/p2020.c +++ b/arch/powerpc/platforms/85xx/p2020.c @@ -156,83 +156,38 @@ static void __init p2020_setup_arch(void) #endif } =20 -#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); =20 /* * 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) +static int __init p2020_probe(void) { - if (of_machine_is_compatible("fsl,P2020RDB-PC")) - return 1; - return 0; + struct device_node *p2020_cpu; + + /* + * 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 =3D of_find_node_by_path("/cpus/PowerPC,P2020@0"); + if (!p2020_cpu) + return 0; + + of_node_put(p2020_cpu); + return 1; } -#endif /* CONFIG_MPC85xx_RDB */ - -#ifdef CONFIG_MPC85xx_DS -define_machine(p2020_ds) { - .name =3D "P2020 DS", - .probe =3D p2020_ds_probe, - .setup_arch =3D p2020_setup_arch, - .init_IRQ =3D p2020_pic_init, -#ifdef CONFIG_PCI - .pcibios_fixup_bus =3D fsl_pcibios_fixup_bus, - .pcibios_fixup_phb =3D fsl_pcibios_fixup_phb, -#endif - .get_irq =3D mpic_get_irq, - .calibrate_decr =3D generic_calibrate_decr, - .progress =3D udbg_progress, -}; -#endif /* CONFIG_MPC85xx_DS */ - -#ifdef CONFIG_MPC85xx_RDB -define_machine(p2020_rdb) { - .name =3D "P2020 RDB", - .probe =3D p2020_rdb_probe, - .setup_arch =3D p2020_setup_arch, - .init_IRQ =3D p2020_pic_init, -#ifdef CONFIG_PCI - .pcibios_fixup_bus =3D fsl_pcibios_fixup_bus, - .pcibios_fixup_phb =3D fsl_pcibios_fixup_phb, -#endif - .get_irq =3D mpic_get_irq, - .calibrate_decr =3D generic_calibrate_decr, - .progress =3D udbg_progress, -}; =20 -define_machine(p2020_rdb_pc) { - .name =3D "P2020RDB-PC", - .probe =3D p2020_rdb_pc_probe, +define_machine(p2020) { + .name =3D "Freescale P2020", + .probe =3D p2020_probe, .setup_arch =3D p2020_setup_arch, .init_IRQ =3D p2020_pic_init, #ifdef CONFIG_PCI .pcibios_fixup_bus =3D fsl_pcibios_fixup_bus, - .pcibios_fixup_phb =3D fsl_pcibios_fixup_phb, + .pcibios_fixup_phb =3D fsl_pcibios_fixup_phb, #endif .get_irq =3D mpic_get_irq, .calibrate_decr =3D generic_calibrate_decr, .progress =3D udbg_progress, }; -#endif /* CONFIG_MPC85xx_RDB */ --=20 2.20.1 From nobody Wed Sep 17 01:14:04 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2438AC4332F for ; Sat, 24 Dec 2022 21:17:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230322AbiLXVR4 (ORCPT ); Sat, 24 Dec 2022 16:17:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230297AbiLXVRv (ORCPT ); Sat, 24 Dec 2022 16:17:51 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D9D2A447 for ; Sat, 24 Dec 2022 13:17:50 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0436DB803F3 for ; Sat, 24 Dec 2022 21:17:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95FC5C433EF; Sat, 24 Dec 2022 21:17:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671916667; bh=13zOblXSPCKmmAdfWqVJT/RFm4vtSa7vCpTc5iq/PY0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nlH0n42jrmpjHRFZuqdIaqsBKhZ7ZBekaTz2U9h7oHKh0wg7KcoYy9bcnXynZRkeJ Wu9Zr4t7dgqkNQ/3S6jdfRIb7I21fU2ibuKq/FvyyvAzdK5KHi9nE9FpgLrhnT5ihc g5BJN26YS22x+3gXkZySk4v/zAMI/pkU1vDFnT9FncxT4+LdvkgOtRVJXb+J1Ra649 rK92Getqe3un2LZ4SPxR9Iby30rFv0zE3iWC1ssq3/CTBJWuMEkOKnFcig3cZxhP/M u+e6guo4QeMHtpApOcZXsjXlvk0L4hTa18biKXwzYJrWJyJzV0t+UTYDZMikhcD9/3 OKGhxN3qFBrSA== Received: by pali.im (Postfix) id 33D569D7; Sat, 24 Dec 2022 22:17:45 +0100 (CET) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Michael Ellerman , Nicholas Piggin , Christophe Leroy , Scott Wood , Sinan Akman , Martin Kennedy Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 7/8] powerpc/85xx: p2020: Enable boards by new config option CONFIG_PPC_P2020 Date: Sat, 24 Dec 2022 22:14:24 +0100 Message-Id: <20221224211425.14983-8-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20221224211425.14983-1-pali@kernel.org> References: <20221224211425.14983-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Pali Roh=C3=A1r --- arch/powerpc/platforms/85xx/Kconfig | 22 ++++++++++++++++++---- arch/powerpc/platforms/85xx/Makefile | 3 +-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/8= 5xx/Kconfig index b92cb2b4d54d..90665882143b 100644 --- a/arch/powerpc/platforms/85xx/Kconfig +++ b/arch/powerpc/platforms/85xx/Kconfig @@ -78,16 +78,16 @@ config MPC8536_DS This option enables support for the MPC8536 DS board =20 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 =20 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. =20 config P1010_RDB bool "Freescale P1010 RDB" diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/= 85xx/Makefile index 1ad261b4eeb6..76ee691d29b5 100644 --- a/arch/powerpc/platforms/85xx/Makefile +++ b/arch/powerpc/platforms/85xx/Makefile @@ -23,8 +23,7 @@ obj-$(CONFIG_P1010_RDB) +=3D p1010rdb.o obj-$(CONFIG_P1022_DS) +=3D p1022_ds.o obj-$(CONFIG_P1022_RDK) +=3D p1022_rdk.o obj-$(CONFIG_P1023_RDB) +=3D p1023_rdb.o -obj-$(CONFIG_MPC85xx_DS) +=3D p2020.o -obj-$(CONFIG_MPC85xx_RDB) +=3D p2020.o +obj-$(CONFIG_PPC_P2020) +=3D p2020.o obj-$(CONFIG_TWR_P102x) +=3D twr_p102x.o obj-$(CONFIG_CORENET_GENERIC) +=3D corenet_generic.o obj-$(CONFIG_FB_FSL_DIU) +=3D t1042rdb_diu.o --=20 2.20.1 From nobody Wed Sep 17 01:14:04 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29F62C4332F for ; Sat, 24 Dec 2022 21:18:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230404AbiLXVSD (ORCPT ); Sat, 24 Dec 2022 16:18:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230364AbiLXVRv (ORCPT ); Sat, 24 Dec 2022 16:17:51 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A0A1A459 for ; Sat, 24 Dec 2022 13:17:51 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C6B19B80189 for ; Sat, 24 Dec 2022 21:17:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6908BC433F0; Sat, 24 Dec 2022 21:17:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671916668; bh=5jg2jqGPIyL6vN19Ng9QZ/xR8UUjQOy1EGr++zpbTmM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BDOZE3l54x8eupSo5X3S7yWgViyX+eDy0DbSLU2Js6c4GbJHOh9rfHZBiciZUf13/ jRQu5yuEvzN7aMWx/RDVkQiAjTmhbv97dY4e5dIgVovnxSfAgGpzDpSoZJ7FeqdvQi tKQGKRnPFBELka1oWhrfjkWFTy287o7F1+GCW3p01G/Vyg66MDcwZOfJcnD8rMSXWB ++CSDpguhNJQkdv+veJVZOXdK0/i4SR4jPYTITxAfl6tYrBkDkmm9zzCDRFU8tmFbE DuyTbuemxIGbKEZ7Kvc5Bd2JNgo0XPdy3VXTKFxOEF239+3PfzF1KvouW8dVBfczFQ 02IxbqgP73mWg== Received: by pali.im (Postfix) id 48F0D9E4; Sat, 24 Dec 2022 22:17:46 +0100 (CET) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Michael Ellerman , Nicholas Piggin , Christophe Leroy , Scott Wood , Sinan Akman , Martin Kennedy Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 8/8] powerpc: dts: turris1x.dts: Remove "fsl,P2020RDB-PC" compatible string Date: Sat, 24 Dec 2022 22:14:25 +0100 Message-Id: <20221224211425.14983-9-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20221224211425.14983-1-pali@kernel.org> References: <20221224211425.14983-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org "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. Signed-off-by: Pali Roh=C3=A1r --- arch/powerpc/boot/dts/turris1x.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/boot/dts/turris1x.dts b/arch/powerpc/boot/dts/tur= ris1x.dts index e9cda34a140e..a95857de6858 100644 --- a/arch/powerpc/boot/dts/turris1x.dts +++ b/arch/powerpc/boot/dts/turris1x.dts @@ -15,7 +15,7 @@ =20 / { model =3D "Turris 1.x"; - compatible =3D "cznic,turris1x", "fsl,P2020RDB-PC"; /* fsl,P2020RDB-PC is= required for booting Linux */ + compatible =3D "cznic,turris1x"; =20 aliases { ethernet0 =3D &enet0; --=20 2.20.1