From patchwork Mon Nov 23 13:16:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ovidiu Panait X-Patchwork-Id: 1404791 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=windriver.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=windriversystems.onmicrosoft.com header.i=@windriversystems.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-windriversystems-onmicrosoft-com header.b=Lp7E+MA8; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Cfnws1rTlzB3yp for ; Tue, 24 Nov 2020 00:26:20 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9AEBD82642; Mon, 23 Nov 2020 14:20:25 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=windriver.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=windriversystems.onmicrosoft.com header.i=@windriversystems.onmicrosoft.com header.b="Lp7E+MA8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1BC23825D6; Mon, 23 Nov 2020 14:18:49 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MSGID_FROM_MTA_HEADER,T_SPF_HELO_TEMPERROR autolearn=ham autolearn_force=no version=3.4.2 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0614.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe45::614]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 290CF825D6 for ; Mon, 23 Nov 2020 14:18:14 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=windriver.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=Ovidiu.Panait@windriver.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FUOKID2sIBqKCD+vbDNQx8gRPP/2jy3VijUzK0HBJ4uTKWlykfb1dvyOXdOTIPhlcnlFLC4DsP/n44J5iG3+9IUe/bmWCRi0txkxjV/mrnl6vFI+1Kgv+tQ6G79zz51r8ytanMa8d2M3iQ7WsssglAWzIRxGgdLpqUv0P1c35k8s1aTjnfdMoj0qoJTghbcbpCzE7PHh3NpAehcBrPTDgu439DvygsnTuoqiXiOQXjQQrtX5M4sCVVbSI3qLZvFpqi3wDOqk/MYbWEprbJt9t23u4Tw2Sv7Hyh4SS5t+y3D+f10JXqUmNcDk1QN/QQT8lO7HLhQBpGzhwl58B+lxCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qIO2pz8SSFB/DqOGIEluWFpeZwUChfykH1VCWRmQdK4=; b=Z9i3ghHPK+dOyl8PC87NfEcSEY/LvUOggekwWmbAD2VmZzLzmDOKpm62IbCcxwSyKzoEENFHPmeketzYlBWVh2b8zVzIIxYEUy5TTWfycLreSzC2wHpxQNsafnXigp6sRGKJapx90rpea/Xy35+GEry2pQRS4K5tnd24OyWiWiYo6fD9crHeh2938eVzYo0QcnhiGqiC7/p4ywk0bbEYDF7Vapo/6vaD87XIuoTZsUTVmtsyd3JJPudCpjcIls9iZzEPqfjYek/mVyPIbSmTmwvF7g+6WZtHtT2wnk866som6dEGF/9mj0ur1330ZdJs2gji60JKnp1ZWoReH0ffag== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriversystems.onmicrosoft.com; s=selector2-windriversystems-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qIO2pz8SSFB/DqOGIEluWFpeZwUChfykH1VCWRmQdK4=; b=Lp7E+MA8Usx4/zQpdzDrrg/5IhTDootwzuefuTjhxFUk9c0fOj5EsM0e0JoAdEEovfGXxnNII+8ld7ommv30tUhmhTd22R3lyCswFnhXHk7smOhVmFfdxENBL0dbgoH0R+g/MbErIAKOG91scBtRdfm6Kdg2sqlrgqWGmJpvZek= Authentication-Results: lists.denx.de; dkim=none (message not signed) header.d=none;lists.denx.de; dmarc=none action=none header.from=windriver.com; Received: from BL0PR11MB3201.namprd11.prod.outlook.com (2603:10b6:208:6b::21) by MN2PR11MB4336.namprd11.prod.outlook.com (2603:10b6:208:18c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3589.20; Mon, 23 Nov 2020 13:17:56 +0000 Received: from BL0PR11MB3201.namprd11.prod.outlook.com ([fe80::650a:e5b9:d7:6cc0]) by BL0PR11MB3201.namprd11.prod.outlook.com ([fe80::650a:e5b9:d7:6cc0%5]) with mapi id 15.20.3589.025; Mon, 23 Nov 2020 13:17:56 +0000 From: Ovidiu Panait To: u-boot@lists.denx.de Cc: sjg@chromium.org Subject: [PATCH v3 10/18] common: board_r: Drop initr_pci wrapper Date: Mon, 23 Nov 2020 15:16:43 +0200 Message-Id: <20201123131651.33032-11-ovidiu.panait@windriver.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201123131651.33032-1-ovidiu.panait@windriver.com> References: <20201123131651.33032-1-ovidiu.panait@windriver.com> X-Originating-IP: [46.97.150.20] X-ClientProxiedBy: VI1PR09CA0089.eurprd09.prod.outlook.com (2603:10a6:802:29::33) To BL0PR11MB3201.namprd11.prod.outlook.com (2603:10b6:208:6b::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from otp-linux01.wrs.com (46.97.150.20) by VI1PR09CA0089.eurprd09.prod.outlook.com (2603:10a6:802:29::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3589.20 via Frontend Transport; Mon, 23 Nov 2020 13:17:55 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 83c7f84a-c877-4801-f6dc-08d88fb230f6 X-MS-TrafficTypeDiagnostic: MN2PR11MB4336: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3826; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: To5UWU4JLzP2T1N3SPq7g0/ECAjkMNWi54th2gLFInK71FboWnb+O6HvzxH4TBoQC9+TRbBDw2Y3opOi3EebEZ1IOzhEzuorPcVEyVgZlleio9GiGQrr0BvyNzUjntMJQIVOIe2fYwmb+HMPDzAV3gt+yfUl43NkRMOnSCCSGUV3X65mp23yVJNr3NetGFu2Z+9nY6D8zJdVPR4HgukMt05DAJGEoZeeVAmCT0AYJJUSn52QaQU4Z55P4RptGnlw6qNRrYYIVvSL9GXDY0JIFtkdinApbwqQ1+0JHhv02AvMEnaQUiP0xhIYQjvIxK2cBMG/cKIeNC2JBJ5yycRgkg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BL0PR11MB3201.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(136003)(366004)(396003)(39840400004)(376002)(6512007)(4326008)(16526019)(478600001)(52116002)(186003)(5660300002)(316002)(8676002)(6486002)(6666004)(83380400001)(6916009)(36756003)(66946007)(86362001)(44832011)(2906002)(26005)(2616005)(8936002)(66476007)(66556008)(1076003)(956004)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: fpTCRAttasB7e4hRinlba7a0rOOKqMWnNXwUc5CDtkYJlK0BIUNXO3J73DVVhNLjtOe+tI/QZCr5DVajnM1ISUyrSOsZtb9PfAwaLwbcGSgMw++EDLTcLF9C7cga2azSmja5rR3RjXEX5kO8CZ4EtQ/tyVLmglfWTdl+AzfTq+3BQcSE0w4LtP1E/BlgIOK4M0U9yeKungDgxdsWzcsxoszICf6Ko+NS5tu+QOrZG7wE3VilrA/3++/2vyR1ob61o1urBiPj0kLrlbg/TdmHVhM3L9EyzQxqfgvnOHWY2jHOohiafVAZt2J6Sz7n/3Ie2T02PXjiOJhIlfWwK3d/qRJgndZKWy4ZlEZ2UF6u99Ujz22PqbmLp+kgdaNz8Vz2fVroX2ZLqnn9gItcWGKq4FRcP4jwed5pjOJikqOU+MR7DKXMt2xr2n8syaCCq+JhUeOpxrDfKhMZCXDuoye23E6eCCaKBA+kiDQbettfj5iSsSMDLRL68olHDxCBqkqmf5/JhlcwbhBtxFJaUE5izVdvsWYEBAwR8VmiSdkIdyvpm25nTDgkubu3BHrxtFz5mRLxnLKzuKoBwnZaR9tkOanea9XuKDoCh+BWYeghBPYwHMnfOSKYG0L/cNMueNLpwt9ivWJyvEO6wR4OMEI+AvxekARC0Bo366/AH3bPaYleLY3UvBdM1kty1JHkyc7ZJ66WwSRqf0F2Qxzuejyhkzp+I0gdTZe9pUVVtBioKj7zaR87R5dffC0yyJDNWpVoLB9DSdOgMVEGYt/DPDn9kP8q48NXYI+4NjJVi6DKyftOSjBsIP0xwiYGSXZIZU55a+Epzyix1eUUI7R4Ffmchisdmo03aMrJAYe+10T2ibe5PI9Js7tut2196PiSutDBeQ6Kfy3P79tnpPyRa57d1Q== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 83c7f84a-c877-4801-f6dc-08d88fb230f6 X-MS-Exchange-CrossTenant-AuthSource: BL0PR11MB3201.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Nov 2020 13:17:56.3206 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: qM0VP1fmKXe8fyVlwtzCiVllEXBYMKO/jOe7o5C4Hiy9HCXYsWY4XmlD+Tj7CtVU+ubrmozIYuNMdxv5lsKojKmmaALcOxKGH/iO7O9y4ew= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4336 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Add a return value to pci_init and use it directly in the post-relocation init sequence, rather than using a wrapper stub. Signed-off-by: Ovidiu Panait Reviewed-by: Simon Glass --- v3 updates: - add reviewed-by tag v2 updates: - add function comment common/board_r.c | 18 ++++-------------- drivers/pci/pci-uclass.c | 4 +++- drivers/pci/pci.c | 6 ++++-- include/init.h | 13 ++++++++++++- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/common/board_r.c b/common/board_r.c index d86ff0cb5e..414b6272c5 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -214,16 +214,6 @@ static int initr_unlock_ram_in_cache(void) } #endif -#ifdef CONFIG_PCI -static int initr_pci(void) -{ - if (IS_ENABLED(CONFIG_PCI_INIT_R)) - pci_init(); - - return 0; -} -#endif - static int initr_barrier(void) { #ifdef CONFIG_PPC @@ -732,12 +722,12 @@ static init_fnc_t init_sequence_r[] = { post_output_backlog, #endif INIT_FUNC_WATCHDOG_RESET -#if defined(CONFIG_PCI) && defined(CONFIG_SYS_EARLY_PCI_INIT) +#if defined(CONFIG_PCI_INIT_R) && defined(CONFIG_SYS_EARLY_PCI_INIT) /* * Do early PCI configuration _before_ the flash gets initialised, * because PCU resources are crucial for flash access on some boards. */ - initr_pci, + pci_init, #endif #ifdef CONFIG_ARCH_EARLY_INIT_R arch_early_init_r, @@ -776,11 +766,11 @@ static init_fnc_t init_sequence_r[] = { mac_read_from_eeprom, #endif INIT_FUNC_WATCHDOG_RESET -#if defined(CONFIG_PCI) && !defined(CONFIG_SYS_EARLY_PCI_INIT) +#if defined(CONFIG_PCI_INIT_R) && !defined(CONFIG_SYS_EARLY_PCI_INIT) /* * Do pci configuration */ - initr_pci, + pci_init, #endif stdio_add_devices, initr_jumptable, diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c index eb07d25301..7e9b5cf0fa 100644 --- a/drivers/pci/pci-uclass.c +++ b/drivers/pci/pci-uclass.c @@ -1834,7 +1834,7 @@ U_BOOT_DRIVER(pci_generic_drv) = { .of_match = pci_generic_ids, }; -void pci_init(void) +int pci_init(void) { struct udevice *bus; @@ -1847,4 +1847,6 @@ void pci_init(void) uclass_next_device_check(&bus)) { ; } + + return 0; } diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 664e8379eb..a7453e5755 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -454,16 +454,18 @@ int pci_hose_scan(struct pci_controller *hose) return pci_hose_scan_bus(hose, hose->current_busno); } -void pci_init(void) +int pci_init(void) { hose_head = NULL; /* allow env to disable pci init/enum */ if (env_get("pcidisable") != NULL) - return; + return 0; /* now call board specific pci_init()... */ pci_init_board(); + + return 0; } /* Returns the address of the requested capability structure within the diff --git a/include/init.h b/include/init.h index c6c5f34b55..dded1cb871 100644 --- a/include/init.h +++ b/include/init.h @@ -186,6 +186,18 @@ int cpu_secondary_init_r(void); */ int pci_ep_init(void); +/** + * pci_init() - Enumerate pci devices + * + * It is called during the generic post-relocation init sequence to enumerate + * pci buses. This is needed, for instance, in the case of DM PCI-based + * Ethernet devices, which will not be detected without having the enumeration + * performed earlier. + * + * Return: 0 if OK + */ +int pci_init(void); + /** * init_cache_f_r() - Turn on the cache in preparation for relocation * @@ -257,7 +269,6 @@ int mac_read_from_eeprom(void); int set_cpu_clk_info(void); int update_flash_size(int flash_size); int arch_early_init_r(void); -void pci_init(void); int misc_init_r(void); #if defined(CONFIG_VID) int init_func_vid(void);