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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4C590C19F2C for ; Mon, 1 Aug 2022 10:33:36 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3D27B8450F; Mon, 1 Aug 2022 12:31:36 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=fris.de 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=fris.de header.i=@fris.de header.b="aEhT/19x"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 83D1E8459A; Mon, 1 Aug 2022 12:31:19 +0200 (CEST) Received: from mail.fris.de (mail.fris.de [116.203.77.234]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 113ED8450F for ; Mon, 1 Aug 2022 12:31:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=fris.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=frieder@fris.de Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 6DE5EBFB1D; Mon, 1 Aug 2022 12:31:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fris.de; s=dkim; t=1659349863; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=+iy3DJId1RECd1XQMofwgRtIb0Hv3F2HrGulY2vv71Q=; b=aEhT/19xGtOB5/8g4XdbUWU2a3nXjb2LDsRNOCFzkp/mT/NYx7meSnQQU7jcthUXlmFTu9 I3FNbx23u5vza8PFEi+OeApPa6r6v1KTHT7BkOXcnyrU2Wu8keh35YWacxqS5UrjIq5NKb 3//DT2firZ1+at5cUebtmWhBpaIDgmk3O8ErkK5ltpGXosebVj9lmQJmt690KO0xtMyKRZ ST0exCMiUTiGpCwzxjEdPrYfHOQgz+9ZsvPLCK/3THLPMXVJbZiRQyilZ4l1ltRk1rP6nz CvsJGyLnT6varK4JqLS0Jy2AdyatzNuF7987qTGNG7tkWaYZ5I+t9INQpOmu9A== From: Frieder Schrempf To: Frieder Schrempf , u-boot@lists.denx.de Cc: Fabio Estevam , Peng Fan , Stefano Babic Subject: [PATCH v2 17/19] imx: kontron-sl-mx8mm: Simplify code in spl.c Date: Mon, 1 Aug 2022 12:30:19 +0200 Message-Id: <20220801103027.96820-18-frieder@fris.de> In-Reply-To: <20220801103027.96820-1-frieder@fris.de> References: <20220801103027.96820-1-frieder@fris.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Last-TLS-Session-Version: TLSv1.3 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.6 at phobos.denx.de X-Virus-Status: Clean From: Frieder Schrempf Refactor the code a bit without any functional changes. Signed-off-by: Frieder Schrempf --- Changes in v2: * fix printf warning * remove unused pinmux definitions --- board/kontron/sl-mx8mm/spl.c | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/board/kontron/sl-mx8mm/spl.c b/board/kontron/sl-mx8mm/spl.c index affdc136e10..f856b3c74dd 100644 --- a/board/kontron/sl-mx8mm/spl.c +++ b/board/kontron/sl-mx8mm/spl.c @@ -39,11 +39,6 @@ static iomux_v3_cfg_t const i2c1_pads[] = { IMX8MM_PAD_I2C1_SDA_I2C1_SDA | MUX_PAD_CTRL(I2C_PAD_CTRL) | MUX_MODE_SION }; -static iomux_v3_cfg_t const i2c2_pads[] = { - IMX8MM_PAD_I2C2_SCL_I2C2_SCL | MUX_PAD_CTRL(I2C_PAD_CTRL) | MUX_MODE_SION, - IMX8MM_PAD_I2C2_SDA_I2C2_SDA | MUX_PAD_CTRL(I2C_PAD_CTRL) | MUX_MODE_SION -}; - int spl_board_boot_device(enum boot_device boot_dev_spl) { switch (boot_dev_spl) { @@ -109,41 +104,26 @@ static void spl_dram_init(void) size = 1; } - printf("Kontron SL i.MX8MM (N801X) module, %u GB RAM detected\n", size); + gd->ram_size = size; writel(size, M4_BOOTROM_BASE_ADDR); } -static int i2c_detect(u8 bus, u16 addr) -{ - struct udevice *udev; - int ret; - - /* - * Try to probe the touch controller to check if an LVDS panel is - * connected. - */ - ret = i2c_get_chip_for_busnum(bus, addr, 0, &udev); - if (ret == 0) - return 0; - - return 1; -} - int do_board_detect(void) { + gd->board_type = BOARD_TYPE_KTN_N801X; + printf("Kontron SL i.MX8MM (N801X) module, %llu GB RAM detected\n", gd->ram_size); + /* * Check the I2C PMIC to detect the deprecated SoM with DA9063. */ imx_iomux_v3_setup_multiple_pads(i2c1_pads, ARRAY_SIZE(i2c1_pads)); - if (i2c_detect(0, 0x58) == 0) { + if (i2c_get_chip_for_busnum(0, 0x58, 0, &udev) == 0) { printf("### ATTENTION: DEPRECATED SOM REVISION (N8010 Rev0) DETECTED! ###\n"); printf("### THIS HW IS NOT SUPPORTED AND BOOTING WILL PROBABLY FAIL ###\n"); printf("### PLEASE UPGRADE TO LATEST MODULE ###\n"); } - gd->board_type = BOARD_TYPE_KTN_N801X; - return 0; } -- 2.37.1