From mboxrd@z Thu Jan 1 00:00:00 1970 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 598C4C4332F for ; Wed, 12 Oct 2022 05:37:26 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7A5BB84DEB; Wed, 12 Oct 2022 07:37:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="hlBmq/JU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7343D84C86; Wed, 12 Oct 2022 07:37:10 +0200 (CEST) Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) (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 350DF84D88 for ; Wed, 12 Oct 2022 07:37:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ovpanait@gmail.com Received: by mail-ed1-x52a.google.com with SMTP id a67so13624611edf.12 for ; Tue, 11 Oct 2022 22:37:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7/R1QKtinAhJHFzZm+9LYVyETwQPVbT+eQYZxWXpdgI=; b=hlBmq/JUrUzct+AU9vOSKM7JoemRJY+kAO6uVkAbnsJ60dYz8tgy5Z+emCmmXCkhND e7b8W+4hyyUE3XVKbYEGC04KYCE9FenlC7UomJvfzlu8RPRcavhsV/B536Rufrzv6mut 3TPLlN+5DFMODyHasMKbi42TgUvePXs5HnA2XNIxz1kaKBdkFBD1/aAgR4tFA7s1FnyL 29AwyE/dPHMNI9fhHnI7Ro6KDlxOiSagavr7I8PJA/TQIk+fy2oyvQtvenZZJlC9GL+T 3v9CPCuYO5vyGu9Bc6DDn/hqEE+9iC2cGY23ntGMv/y0I2mzGiaSrq/DX36sF/nTx7l6 5D1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7/R1QKtinAhJHFzZm+9LYVyETwQPVbT+eQYZxWXpdgI=; b=hd8pFPasbV4vUrgXm8eUHcAMkrHDvjLZTSu6IzlfwiEHTz1pma4QzOo1+ea8dW9L/N 3lRweQcYdj8dZHY6cFxdw97r/tSaJ4StGyTKJRgl/boiflFR2JOYxvJCJWy/5IxL9ko8 WhHYOhHJOYUM0UHK8RIoxSWGWlmpwD+msZ0JBUv1vXkBsTVp58J7WYI8hQ/t+I8co5ec IK5BzBAstq70g6IqcgbK+1sohZK5kykXMYbKuIGZrvD0xuYnNbM7Lpv4ppO4LSHzvEo3 /ZT406mZ8rE9xqZm3DILmtMduWL0ByI4YQ5VbLBXtfQppkvxwSwF690L5RXF/lLAHth7 K/jA== X-Gm-Message-State: ACrzQf1oU5Q/bBI+6QQx1t7zr1ZLoHX77uTJVo17slHlO+iD3XSHuYUZ zlEBcPfJTv1XUMUNcYJ3PlUSXJSpppff0Q== X-Google-Smtp-Source: AMsMyM6aAKKcXsg2Zd41FvgCT6pdIklEKixpIv3LMuQ+ZFCTCbOMJ+nur3LrjxeXLDWC97Q1WZs+6Q== X-Received: by 2002:a05:6402:3215:b0:45c:97de:b438 with SMTP id g21-20020a056402321500b0045c97deb438mr3638828eda.7.1665553027766; Tue, 11 Oct 2022 22:37:07 -0700 (PDT) Received: from localhost.localdomain ([2a02:2f0e:ca15:2800:c696:dfd3:f393:fcf7]) by smtp.gmail.com with ESMTPSA id i26-20020a170906265a00b00787f91a6b16sm644372ejc.26.2022.10.11.22.37.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Oct 2022 22:37:07 -0700 (PDT) From: Ovidiu Panait To: u-boot@lists.denx.de Cc: Ovidiu Panait , Andy Shevchenko , Patrice Chotard , Simon Glass Subject: [PATCH 2/3] timer-uclass: relocate ops pointers for CONFIG_NEEDS_MANUAL_RELOC Date: Wed, 12 Oct 2022 08:36:55 +0300 Message-Id: <20221012053656.1492457-2-ovpanait@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221012053656.1492457-1-ovpanait@gmail.com> References: <20221012053656.1492457-1-ovpanait@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Relocate timer_ops pointers when CONFIG_NEEDS_MANUAL_RELOC is enabled. The (gd->flags & GD_FLG_RELOC) check was added to make sure the reloc_done logic works for drivers that use DM_FLAG_PRE_RELOC. Signed-off-by: Ovidiu Panait --- drivers/timer/timer-uclass.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c index bdc77b3822..bb71979213 100644 --- a/drivers/timer/timer-uclass.c +++ b/drivers/timer/timer-uclass.c @@ -18,6 +18,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -50,6 +51,19 @@ unsigned long notrace timer_get_rate(struct udevice *dev) static int timer_pre_probe(struct udevice *dev) { + if (IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC) && + (gd->flags & GD_FLG_RELOC)) { + struct timer_ops *ops = timer_get_ops(dev); + static int reloc_done; + + if (!reloc_done) { + if (ops->get_count) + MANUAL_RELOC(ops->get_count); + + reloc_done++; + } + } + if (CONFIG_IS_ENABLED(OF_REAL)) { struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev); struct clk timer_clk; -- 2.25.1