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 CE15AC6FA8E for ; Tue, 27 Sep 2022 11:21:47 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2D42484BB4; Tue, 27 Sep 2022 13:21:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=codasip.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=codasip.com header.i=@codasip.com header.b="JvcfIk94"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 36BC684C9B; Tue, 27 Sep 2022 13:21:43 +0200 (CEST) Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) (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 EFE1D80548 for ; Tue, 27 Sep 2022 13:21:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=codasip.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=samuel.obuch@codasip.com Received: by mail-ed1-x52d.google.com with SMTP id a41so12743933edf.4 for ; Tue, 27 Sep 2022 04:21:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codasip.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=ptM1X7q1LLApXrYhJae92cCy69CLqvcjN+ENxQegju4=; b=JvcfIk947HTLqS8j7R31A7XVnlLewGofsCWavB6Q6DxiJLvRgNtD9bnKJRcoUMWllg yR4xhj0HfoKSgGEqOdGMulDtCezbEBq1WOprtSIaX0kzfniG2c+bJj0XlqLdMKP+T5ZT C0tsjt7bgkqbOzGAiJXhlTy16ZYPCNJnJV8R2Ovdhl08cPav0+XYnD0JgbMCxHFdiWkA 2DFDNhMTH/tTcMaRLLBW+GqmfPOSQv6g40xA2dn8b1q6J0RX1t/lpJYcRcOODtFKQwpX 4phWnUh1EQx3KL5i70d6WfkCL58asu9rPn4l4nAu2l0cr/eT+dtWB/Ovs+HpoQhmxsAU k2Jw== 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; bh=ptM1X7q1LLApXrYhJae92cCy69CLqvcjN+ENxQegju4=; b=KspaxuTjCSLwp7zH8kaSK8dgbC3sJvl3QYjqao8S6TQXG0xdkym3p7BQg2JnpZo0CR i0TGVEV18TB7eRA9bY57lnbj92MzcyBT/4IviPuu5Xd2Sq6TjsHxYYa6BVKt+OB7Ak9D n2dzm9dburT+AGZMoff64iyRBDksfq+KjuEK1aBuEo5sVHBVMoUBvUwNtA9B+gwNuc/j 5FzYHEV0dLpyQ0LDuSbJ2YNQO0okxhpaQY/9ymY8SthFWSzo0Cpkm/BzVun04fVT5Suo E8AkNrwnNYa4MGxIS55Zrr8qadcAhGR2UiTGql2ZQDzO1KaiFX+HU6fasy3KdZGr95jR kp5A== X-Gm-Message-State: ACrzQf1Q4VP59o+Jv+ftGJr1b+UmNjjohyOOx5/4zPF0CK+HJWE3IKjb O2vvydxSipN/9iclgqW+1RyJ4gE98cCbingQ X-Google-Smtp-Source: AMsMyM67h3+OJrj6JUiu4JihalFG+dt4F1AxjsWb7toFU1j6r0Nee1aOXXpROW3mYaFBfyFRP+ccfw== X-Received: by 2002:a05:6402:2693:b0:450:a807:6c91 with SMTP id w19-20020a056402269300b00450a8076c91mr27504415edd.33.1664277700331; Tue, 27 Sep 2022 04:21:40 -0700 (PDT) Received: from nb76.codasip.com (fw1.dino.sk. [84.245.95.252]) by smtp.gmail.com with ESMTPSA id i1-20020a170906a28100b0078238c1c182sm622523ejz.222.2022.09.27.04.21.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Sep 2022 04:21:39 -0700 (PDT) From: samuel.obuch@codasip.com To: u-boot@lists.denx.de Cc: rfried.dev@gmail.com, michal.simek@amd.com, Samuel Obuch Subject: [PATCH v3 2/3] net: emaclite: fix xemaclite_alignedread/write functions Date: Tue, 27 Sep 2022 13:21:02 +0200 Message-Id: <20220927112103.155689-2-samuel.obuch@codasip.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220927112103.155689-1-samuel.obuch@codasip.com> References: <20220927112103.155689-1-samuel.obuch@codasip.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 From: Samuel Obuch Use __raw_read* and __raw_write* functions to ensure read/write is passed to the memory-mapped regions, as non-volatile accesses may get optimised out. Signed-off-by: Samuel Obuch --- drivers/net/xilinx_emaclite.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c index 29e8271c63..a4851ad36f 100644 --- a/drivers/net/xilinx_emaclite.c +++ b/drivers/net/xilinx_emaclite.c @@ -112,12 +112,12 @@ static void xemaclite_alignedread(u32 *srcptr, void *destptr, u32 bytecount) /* Word aligned buffer, no correction needed. */ to32ptr = (u32 *) destptr; while (bytecount > 3) { - *to32ptr++ = *from32ptr++; + *to32ptr++ = __raw_readl(from32ptr++); bytecount -= 4; } to8ptr = (u8 *) to32ptr; - alignbuffer = *from32ptr++; + alignbuffer = __raw_readl(from32ptr++); from8ptr = (u8 *) &alignbuffer; for (i = 0; i < bytecount; i++) @@ -135,8 +135,7 @@ static void xemaclite_alignedwrite(void *srcptr, u32 *destptr, u32 bytecount) from32ptr = (u32 *) srcptr; while (bytecount > 3) { - - *to32ptr++ = *from32ptr++; + __raw_writel(*from32ptr++, to32ptr++); bytecount -= 4; } @@ -147,7 +146,7 @@ static void xemaclite_alignedwrite(void *srcptr, u32 *destptr, u32 bytecount) for (i = 0; i < bytecount; i++) *to8ptr++ = *from8ptr++; - *to32ptr++ = alignbuffer; + __raw_writel(alignbuffer, to32ptr++); } static int wait_for_bit(const char *func, u32 *reg, const u32 mask, -- 2.31.1