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 2F168C43334 for ; Fri, 1 Jul 2022 12:37:10 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 961FF84498; Fri, 1 Jul 2022 14:36:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com 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=baylibre-com.20210112.gappssmtp.com header.i=@baylibre-com.20210112.gappssmtp.com header.b="xGeWve2h"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C5A6E844A6; Fri, 1 Jul 2022 14:05:19 +0200 (CEST) Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 485A384492 for ; Fri, 1 Jul 2022 14:05:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jpanis@baylibre.com Received: by mail-wr1-x42a.google.com with SMTP id v9so2910030wrp.7 for ; Fri, 01 Jul 2022 05:05:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8K1gJn1gOoTmaPYRgRKJwHTxhSrHh+MvkKVJT3Ks4rU=; b=xGeWve2huJ74jSRfl530rydNs0i+BE5ytppHCJZj80U3X9f4wPoz1ytBHvoVUIgjw5 BcgNNmP5RMByDUjSS+Qol0gS+7DhBNoRbjjqXtxHA4b78TSHXT/Hf3fcuKFXSUoNQABu pn/hAw4IoYk1XYseghng6V9fl8LNBjgk7rPFeBycM/4F01q3/SmyMSOrD2tC4T/00hoA 30UrnNaRLZsrOmX/bJshp1Wng4IWBjWgR+bWphqJVH7i27aJd3VyVz/rnaWuxrhFgGOV H9NUbzBA8oAVhcpIJGMZYYR816x/+uREbXJt5sLfzkOid/uNTbEbzRaizxhGQtklANU1 3zgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8K1gJn1gOoTmaPYRgRKJwHTxhSrHh+MvkKVJT3Ks4rU=; b=H06bJeznuO8EDLW+SDS4XKFDvJR65PTTm01L/SNKBiM8LPQINWx8OLp6KOKyTB9pj6 sb/blnzH7DfQp/ao9+E/d1XlDhPylV7hvIcKgA26awclz3ikNcESrIE+gRZ7UY+xJ9UT SRKYJe8+GkZzoNggjtXNdx0P+6/k/uiK2lsKYoCnvahVXLOms1NejLUnOx4hD/3U3kgv 3DI0h/vUrs5IZ2obwSIT7PfcmNEKKao8r/3u2bVFLGVhgfC9nf8BxMuZdC9HJxHWusYh S6x8TXQ2CTIUkPOvd2BXpOlSqkfTUKQYNzowgkXz0rWODJduumh2yWsH5RkO5fQooyv6 4rQw== X-Gm-Message-State: AJIora/NP3V/5z6OQzoBhA3XxklKy50DwrZJ19OzoqOpwvCVt4abBWO8 LpgZ9McZOQnoxpm/KatVhOiUcw== X-Google-Smtp-Source: AGRyM1t9pm5T/uJv/9BJv0bYH8LsOfrBJ0GscjIqEiL+MfdAOu0a86jZXPktj1SJ/Bia0qX7flrO3A== X-Received: by 2002:a5d:588b:0:b0:21b:b8e6:f9e with SMTP id n11-20020a5d588b000000b0021bb8e60f9emr13183624wrf.643.1656677115651; Fri, 01 Jul 2022 05:05:15 -0700 (PDT) Received: from localhost.localdomain (120.205.87.79.rev.sfr.net. [79.87.205.120]) by smtp.gmail.com with ESMTPSA id l10-20020a5d560a000000b0021b9270de3csm23399545wrv.10.2022.07.01.05.05.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 05:05:15 -0700 (PDT) From: Julien Panis To: d-gerlach@ti.com, nm@ti.com, a-govindraju@ti.com, vigneshr@ti.com, g-tammana@ti.com, s-anna@ti.com Cc: u-boot@lists.denx.de, Julien Panis Subject: [tiU21.01 PATCH 2/3] arm64: mach-k3: am625_init: Probe ESM nodes Date: Fri, 1 Jul 2022 14:05:08 +0200 Message-Id: <20220701120509.217612-3-jpanis@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220701120509.217612-1-jpanis@baylibre.com> References: <20220701120509.217612-1-jpanis@baylibre.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Fri, 01 Jul 2022 14:36:34 +0200 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 On AM62x devices, main ESM error event outputs can be routed to MCU ESM as inputs. So, two ESM device nodes are expected in the device tree : one for main ESM and another one for MCU ESM. MCU ESM error output can trigger the reset logic to reset the device when CTRLMMR_MCU_RST_CTRL:MCU_ESM_ERROR_RESET_EN_Z is set to '0'. Signed-off-by: Julien Panis --- arch/arm/mach-k3/am625_init.c | 23 +++++++++++++++++++ arch/arm/mach-k3/include/mach/am62_hardware.h | 3 +++ 2 files changed, 26 insertions(+) diff --git a/arch/arm/mach-k3/am625_init.c b/arch/arm/mach-k3/am625_init.c index 0d9525992bb0..dfd95b8053b5 100644 --- a/arch/arm/mach-k3/am625_init.c +++ b/arch/arm/mach-k3/am625_init.c @@ -64,6 +64,15 @@ static void ctrl_mmr_unlock(void) mmr_unlock(PADCFG_MMR1_BASE, 1); } +static __maybe_unused void enable_mcu_esm_reset(void) +{ + /* Set CTRLMMR_MCU_RST_CTRL:MCU_ESM_ERROR_RST_EN_Z to '0' (low active) */ + u32 stat = readl(CTRLMMR_MCU_RST_CTRL); + + stat &= RST_CTRL_ESM_ERROR_RST_EN_Z_MASK; + writel(stat, CTRLMMR_MCU_RST_CTRL); +} + void board_init_f(ulong dummy) { struct udevice *dev; @@ -142,6 +151,20 @@ void board_init_f(ulong dummy) /* Output System Firmware version info */ k3_sysfw_print_ver(); + if (IS_ENABLED(CONFIG_ESM_K3)) { + /* Probe/configure ESM0 */ + ret = uclass_get_device_by_name(UCLASS_MISC, "esm@420000", &dev); + if (ret) + printf("esm main init failed: %d\n", ret); + + /* Probe/configure MCUESM */ + ret = uclass_get_device_by_name(UCLASS_MISC, "esm@4100000", &dev); + if (ret) + printf("esm mcu init failed: %d\n", ret); + + enable_mcu_esm_reset(); + } + #if defined(CONFIG_K3_AM64_DDRSS) ret = uclass_get_device(UCLASS_RAM, 0, &dev); if (ret) diff --git a/arch/arm/mach-k3/include/mach/am62_hardware.h b/arch/arm/mach-k3/include/mach/am62_hardware.h index cfabd20cbd79..9118d052042a 100644 --- a/arch/arm/mach-k3/include/mach/am62_hardware.h +++ b/arch/arm/mach-k3/include/mach/am62_hardware.h @@ -29,6 +29,7 @@ #define MAIN_DEVSTAT_BACKUP_BOOTMODE_SHIFT 10 #define MAIN_DEVSTAT_BACKUP_BOOTMODE_CFG_MASK BIT(13) #define MAIN_DEVSTAT_BACKUP_BOOTMODE_CFG_SHIFT 13 +#define RST_CTRL_ESM_ERROR_RST_EN_Z_MASK (~BIT(17)) /* Primary Bootmode MMC Config macros */ #define MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK 0x4 @@ -67,6 +68,8 @@ #define MCU_CTRL_DEVICE_CLKOUT_32K_CTRL (MCU_CTRL_MMR0_BASE + 0x8058) #define MCU_CTRL_DEVICE_CLKOUT_LFOSC_SELECT_VAL (0x3) +#define CTRLMMR_MCU_RST_CTRL (MCU_CTRL_MMR0_BASE + 0x18170) + #define ROM_ENTENDED_BOOT_DATA_INFO 0x43c3f1e0 /* Use Last 2K as Scratch pad */ -- 2.25.1