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 DC221C433EF for ; Fri, 1 Jul 2022 12:37:56 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 74D7C844BC; Fri, 1 Jul 2022 14:36:47 +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="14TJ53qT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BBA2F84480; Fri, 1 Jul 2022 14:30:21 +0200 (CEST) Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) (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 B1D1084488 for ; Fri, 1 Jul 2022 14:30:17 +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-wm1-x333.google.com with SMTP id u12-20020a05600c210c00b003a02b16d2b8so1496138wml.2 for ; Fri, 01 Jul 2022 05:30:17 -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=14TJ53qTKhM8WJcbgK6c3TLPDdbRdiZnlt1VqLzHhmhRBGH2pGcKHGCKnY5or/KnQk a1HLAwoZFWLrmz2/XsVu4TMcOpXFk4biLUWphxAXo3LLTf8uIiMUkPTG/T3JmtgchbLQ tT9J8EJGgPO5EooV/WAI0LkBtAnaZRYaFYuNGQZO/VBI3U/Re2bW33MN3FASQaV5vWiw t2+W4q/vIV0G7Qaf3Jmo+mgwKL43GE6ArX4PBg+Zg9ewlcNCOZ+qaTfbCyadbacz076t bRoXx5zy/7lm8Qi0IhvYh5ezcRekEAlKBuKQmNMJNfHjAxc0WzZqpalmj9uT9ZwxDAIy YP+Q== 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=Ma2Mp6hTawmYy2XKq9MqyZGKP6AnOrHiyOtWUKNaQg+v2LUefDVVz4YE+YUpEDUc11 Tg8CVYBmZBW0AiLvjaSAJcGuhSJJClLiBPqfA1PwWT1c9X8/0ToK194xld034fDPCBgk WL+qXfqamecagWLQNIHI6nUwxwLyMowEKg6lwrLowvwI/y/VGMIh+Ite1vNvnFo1cc9D 3HGLWB9LaGBhOt24sKoxkT/j9ELP/k4Ji+NLMsCcGOXjnscUSu0izE0aLAgoHfice20J TCmauOygZamHMJpmNBNsBURiI4zLBjWASrJxHqyYuO5Qx+ljxPjdLwhjtxsjSiz0XfLf rXdA== X-Gm-Message-State: AJIora8OmbxoU8yXwLftCsgdEVB1qJpGftdbgRVjZcwZpy6QXa4cxyjl 1rzKi4XffXjMFmiIyg34JU+1uw== X-Google-Smtp-Source: AGRyM1sQJemGlJTofS1uwY4mjuJzA76xPAwmqEDZ5zb1Yw2NPSvqmoDtVkC4kqaPwm/Ih9dJ+Nry2Q== X-Received: by 2002:a05:600c:4e51:b0:3a0:4e8d:1e44 with SMTP id e17-20020a05600c4e5100b003a04e8d1e44mr16452824wmq.105.1656678617226; Fri, 01 Jul 2022 05:30:17 -0700 (PDT) Received: from localhost.localdomain (120.205.87.79.rev.sfr.net. [79.87.205.120]) by smtp.gmail.com with ESMTPSA id y12-20020a5d4acc000000b0021b9416fa13sm25440947wrs.90.2022.07.01.05.30.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 05:30:16 -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: [PATCH v1 2/3] arm64: mach-k3: am625_init: Probe ESM nodes Date: Fri, 1 Jul 2022 14:30:11 +0200 Message-Id: <20220701123012.224960-3-jpanis@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220701123012.224960-1-jpanis@baylibre.com> References: <20220701123012.224960-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