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 47B89ECAAD8 for ; Fri, 23 Sep 2022 12:32:06 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7582983FB2; Fri, 23 Sep 2022 14:31:58 +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="TDNaRajL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7D81283AB9; Fri, 23 Sep 2022 14:31:53 +0200 (CEST) Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) (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 4101683B43 for ; Fri, 23 Sep 2022 14:31:51 +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-ej1-x633.google.com with SMTP id lh5so308165ejb.10 for ; Fri, 23 Sep 2022 05:31:51 -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=xHjga+f7TiQHwP562AYQNqVz4i27KRCkqHj8QBStPOQ=; b=TDNaRajLOyEuMrOiIzejbE5uX/LD9USmKLrZ1Xp13B2wcm23u8RPob4cnpFYDddj/Y bNbgPOV38UYGvnzW2vO0VqfeeTMg7Dmh/2RO2yUqe+aIgfRHkgLlvG/ncek8yGWaOWuq RveU0SXHMicFqlcSZKBaVkpglnB+boehYgN0jX0G3x4PbgGv0onfJKPK0GIYGX7BuDz4 kE6OQu7QFOqh9EaaeC+wQYJPtZrm6g6pDkp8Poye/3hb8AwA/JHy+VPsf3jHN1JtGPUc tNWK4uqlEi6LAqE4tG6lCTLmU8pfdlpgbBLVwyAXz+QDDMRKwcMcamjAx+O/ePbl8UZD zpHw== 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=xHjga+f7TiQHwP562AYQNqVz4i27KRCkqHj8QBStPOQ=; b=f17SMJYmY+7zO02bNXxrEPh7IjHN2TUVPNa3Ecn2URjT0w4m97WFtmeDaXXUef0Yqz OW0TTAnIwUa5lxWNQfXsqfm5EJq8BpbVf9eJ+l5FSQXF8SL97A5wLR4oNcieRbHNQG9k Q3wFBrZ8ofeDd20i2QGI/0ToW09JvNDkAV7jiDrYY9sEAUxYNsF5hCUTiIlcDSgsMHis PFouIp2fpjNnFDThOmN5Z0hDwyHdMtwGWQYC6TFTCCTIrdTwolO+ALQfi2FAHAc0QSLN DGCKHIkb3wydPL1W+N5gzWx2xmpgIBMHhatVBIq61+mfbJaeA108bTVULGuWSs7KiLkL oeew== X-Gm-Message-State: ACrzQf1eVViUEqdJOph1GNxH4VzpDMiyz6Mr4iIXsyGEWz78PHHWFHAJ ssy6lxkups/JaRG8Lq8LWYJya5kOsHT6QOlimuM= X-Google-Smtp-Source: AMsMyM7xU5e8B4LPXN1gd2GzNY3rI9WwJD1ky/i8x2AQR6PhUtcu7VLDClueAJ8FUFZuJW3queydMQ== X-Received: by 2002:a17:907:2da8:b0:782:60bc:c864 with SMTP id gt40-20020a1709072da800b0078260bcc864mr5662197ejc.687.1663936310568; Fri, 23 Sep 2022 05:31:50 -0700 (PDT) Received: from nb76.codasip.com ([193.85.186.210]) by smtp.gmail.com with ESMTPSA id f15-20020a50d54f000000b004527eb874ebsm5538207edj.40.2022.09.23.05.31.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Sep 2022 05:31:50 -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 v2 2/3] net: emaclite: fix xemaclite_alignedread/write functions Date: Fri, 23 Sep 2022 14:31:20 +0200 Message-Id: <20220923123121.49411-2-samuel.obuch@codasip.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220923123121.49411-1-samuel.obuch@codasip.com> References: <20220923123121.49411-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 2e152bf873..c12736d0ee 100644 --- a/drivers/net/xilinx_emaclite.c +++ b/drivers/net/xilinx_emaclite.c @@ -113,12 +113,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++) @@ -136,8 +136,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; } @@ -148,7 +147,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