Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2057044rwl; Sat, 8 Apr 2023 07:04:41 -0700 (PDT) X-Google-Smtp-Source: AKy350bHDRaCKikRt0og/fxGNGCAeHKdq1L60Z1xMipQUDcIkqBkX+L2DIALH+rIOKTT3Rtx8/A4 X-Received: by 2002:a17:902:db12:b0:1a2:afdd:8476 with SMTP id m18-20020a170902db1200b001a2afdd8476mr7173520plx.2.1680962680877; Sat, 08 Apr 2023 07:04:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680962680; cv=none; d=google.com; s=arc-20160816; b=fsQATIAb2qn98P3y7fvs+39+Yh58hARboSgRfVYVU+xxdIEDrLvgOmerZ+36oalHHT wA7egww/FLWYC5re6OYKvVEcwZYb4pjLa2V5J0QsFTBe37lxv3F9r0wJTh9KXGoBmVbU /NA/YKsYw4H4rl8xUq+Chx+jDHEpmP0e3Ob0IgWNHLEcthhIssHTwaiJTDwPODhaWTlV KzlO6cQKImjvnaP2iWbZDVgnU0ptDX/1ZwnV8qvWgZbjcwHlraY0rwSImsDyu1vum0/X p+G0vXwS7ifSVpclm73ZTNpTLAO4ePGSIbAaCB54phNXAZIbTbd3PNwjqfh2YQC9qt1g wOwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ohM4+pfY7dKgPbOYtbAcbcDtKyfZTZDB4VqbM15/2AE=; b=ustGg+r8P90sYnUjvlhAy8uv0Cn+ZRsW6z61sKMg1bK+ub/J7W/JBxfDAzSKxftEol xh9/b2bybS95OBl2sUEfWxBv/02e/2+oDQbAw85dWvU7YhnMqbXVVWLG1F746n45MHFO wOxSyM/DRo+oIbYWu2JdpksnkywIFM6JqP4jPux3z8KPwtd8xFSbJzkjqMERe9YG3+ul hWU2U1e/0bwx8Ak/0Uqs4kLoqZXpdg6HUM3PJrpYTMKjtEdj/t1VBzX5TbzzCsC5RJip LvCXUj2pjssPZ7iQfAj6EGmF7M4xjYiLYEEoBTOBjjgpV1Tt9D1rOCeuW0VgWxIx2c+p r76w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fBBkYvEp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r17-20020a170902e3d100b0019cf7f260adsi6262195ple.173.2023.04.08.07.04.28; Sat, 08 Apr 2023 07:04:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fBBkYvEp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230115AbjDHODK (ORCPT + 99 others); Sat, 8 Apr 2023 10:03:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229914AbjDHOCj (ORCPT ); Sat, 8 Apr 2023 10:02:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70A93EFBD for ; Sat, 8 Apr 2023 07:02:35 -0700 (PDT) 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 6DA94615A8 for ; Sat, 8 Apr 2023 14:02:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 878B9C433EF; Sat, 8 Apr 2023 14:02:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680962550; bh=a38Nb5+8BNBu5WNBdOxVHDnSVobRmoKRlk/8DEiKyc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fBBkYvEpUI8SwbbzlPd2D0k2OvEpwpC+5BqBS8Z0u8CDD+F9eZEnh0euO/f+HwRx/ s3qd2JdMkWkkSs9zm9vAZDXJhfRra6u+5K/0iltAoeQ69TINxpP3a/TIp7/wUvL2XH DvtP+wWyJ3siCNd72JqNhIPpptnDIgIhojgRWu338t/F+4tyHUEpxUoSxURjh2WuHz 5KwGNW8ZCTWlhEdKExquwDBqR50QSCzqiN3ExmObLpRY9M7RJqrUZCmCRbYN/rqyUF 0n1IwbBM/gnnczWxqw6TEGFDERNPVEMgctBqZMlqmFEcCV9ADx2iSllhgccbUOBo7g PMgylgktVCeWA== Received: by pali.im (Postfix) id 3B0E924CB; Sat, 8 Apr 2023 16:02:27 +0200 (CEST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Michael Ellerman , Christophe Leroy , Nicholas Piggin Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 10/13] powerpc/85xx: p2020: Unify .setup_arch and .init_IRQ callbacks Date: Sat, 8 Apr 2023 16:01:19 +0200 Message-Id: <20230408140122.25293-11-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230408140122.25293-1-pali@kernel.org> References: <20230408140122.25293-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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ár Signed-off-by: Christophe Leroy --- 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(-) diff --git a/arch/powerpc/platforms/85xx/mpc85xx.h b/arch/powerpc/platforms/85xx/mpc85xx.h index e792907ee3d5..c764d7551ef1 100644 --- a/arch/powerpc/platforms/85xx/mpc85xx.h +++ b/arch/powerpc/platforms/85xx/mpc85xx.h @@ -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 diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c index db4cf76c0fd1..4347d629b567 100644 --- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c +++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c @@ -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); diff --git a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c index dbedffc57ce8..c42a68da6dfd 100644 --- a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c +++ b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c @@ -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); diff --git a/arch/powerpc/platforms/85xx/p2020.c b/arch/powerpc/platforms/85xx/p2020.c index 41bba8c0e335..0e7be454b2de 100644 --- a/arch/powerpc/platforms/85xx/p2020.c +++ b/arch/powerpc/platforms/85xx/p2020.c @@ -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_DS machine_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, -- 2.20.1