From patchwork Sat Oct 9 17:33:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 1538834 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=g8abm1I7; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HRXJf5LV1z9sPf for ; Sun, 10 Oct 2021 04:35:30 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 35C708367F; Sat, 9 Oct 2021 19:34:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="g8abm1I7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 53AA083681; Sat, 9 Oct 2021 19:34:17 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (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 1A1C983692 for ; Sat, 9 Oct 2021 19:33:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: by mail.kernel.org (Postfix) with ESMTPSA id F01C16109E; Sat, 9 Oct 2021 17:33:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1633800837; bh=dEr/5szhjxoQNQRV7oR40pYrRKt21PFtazoLCbau2/E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g8abm1I7ktHI6ekRPKrlniYxu/q9amivpSaaXwlwEts682UkH2LoUwkVzeqs4xfxz d7OrI5Mv/2xTaBzdeqtDCdjT2P5zVyYm4nH0Ht4nL1jOo5zqTV1644pF7mNRfLAOAY rlwX9qYfWlz28SINjFGnoyW4fAAVhCLIHLsQH9ma2FUc0T1LSyoEpfS2V8X6WwtsLK PnSQO0Xish6sIK85Gb73Kqbowoogwk9AeL63Cjzm/1OTp6amuB/BcGhhy4CHByIwjM TWpj4wOxPTEd5Ufz1IhxYpE5MsISqcsxerem6pK5WN5AIJPRt6/p7nDWooRixn42g1 sqazdNFZeCRVg== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Stefan Roese Cc: u-boot@lists.denx.de, pali@kernel.org, =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH u-boot-marvell 06/12] arm: mvebu: turris_mox: Use show_board_info() Date: Sat, 9 Oct 2021 19:33:40 +0200 Message-Id: <20211009173346.7859-7-kabel@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211009173346.7859-1-kabel@kernel.org> References: <20211009173346.7859-1-kabel@kernel.org> MIME-Version: 1.0 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.103.2 at phobos.denx.de X-Virus-Status: Clean From: Marek BehĂșn We are printing board information in last_stage_init(), but U-Boot has dedicated function, show_board_info(), for this. Move code which prints board information (board version, serial number, module topology, ...) to show_board_info(). Signed-off-by: Marek BehĂșn Reviewed-by: Stefan Roese --- board/CZ.NIC/turris_mox/turris_mox.c | 67 ++++++++++++++-------------- 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/board/CZ.NIC/turris_mox/turris_mox.c b/board/CZ.NIC/turris_mox/turris_mox.c index 428cd23a19..ff0ed28045 100644 --- a/board/CZ.NIC/turris_mox/turris_mox.c +++ b/board/CZ.NIC/turris_mox/turris_mox.c @@ -485,44 +485,34 @@ static void handle_reset_button(void) } } -static void mox_print_info(void) +int show_board_info(void) { - int ret, board_version, ram_size; - u64 serial_number; + int i, ret, board_version, ram_size, is_sd; const char *pub_key; + const u8 *topology; + u64 serial_number; + + printf("Model: CZ.NIC Turris Mox Board\n"); ret = mbox_sp_get_board_info(&serial_number, NULL, NULL, &board_version, &ram_size); - if (ret < 0) - return; - - printf("Turris Mox:\n"); - printf(" Board version: %i\n", board_version); - printf(" RAM size: %i MiB\n", ram_size); - printf(" Serial Number: %016llX\n", serial_number); + if (ret < 0) { + printf(" Cannot read board info: %i\n", ret); + } else { + printf(" Board version: %i\n", board_version); + printf(" RAM size: %i MiB\n", ram_size); + printf(" Serial Number: %016llX\n", serial_number); + } pub_key = mox_sp_get_ecdsa_public_key(); if (pub_key) printf(" ECDSA Public Key: %s\n", pub_key); else - printf("Cannot read ECDSA Public Key\n"); -} - -int last_stage_init(void) -{ - int ret, i; - const u8 *topology; - int is_sd; - struct mii_dev *bus; - struct gpio_desc reset_gpio = {}; - - mox_print_info(); + printf(" Cannot read ECDSA Public Key\n"); ret = mox_get_topology(&topology, &module_count, &is_sd); - if (ret) { + if (ret) printf("Cannot read module topology!\n"); - return 0; - } printf(" SD/eMMC version: %s\n", is_sd ? "SD" : "eMMC"); @@ -554,8 +544,7 @@ int last_stage_init(void) } } - /* now check if modules are connected in supported mode */ - + /* check if modules are connected in supported mode */ for (i = 0; i < module_count; ++i) { switch (topology[i]) { case MOX_MODULE_SFP: @@ -616,8 +605,17 @@ int last_stage_init(void) } } - /* now configure modules */ + if (module_count) + printf("\n"); + + return 0; +} + +int last_stage_init(void) +{ + struct gpio_desc reset_gpio = {}; + /* configure modules */ if (get_reset_gpio(&reset_gpio) < 0) return 0; @@ -633,16 +631,19 @@ int last_stage_init(void) mdelay(50); } + /* + * check if the addresses are set by reading Scratch & Misc register + * 0x70 of Peridot (and potentially Topaz) modules + */ if (peridot || topaz) { - /* - * now check if the addresses are set by reading Scratch & Misc - * register 0x70 of Peridot (and potentially Topaz) modules - */ + struct mii_dev *bus; bus = miiphy_get_dev_by_name("neta@30000"); if (!bus) { printf("Cannot get MDIO bus device!\n"); } else { + int i; + for (i = 0; i < peridot; ++i) check_switch_address(bus, 0x10 + i); @@ -653,8 +654,6 @@ int last_stage_init(void) } } - printf("\n"); - handle_reset_button(); return 0;