From patchwork Sun Jun 19 01:09:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 9185997 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0310D6075F for ; Sun, 19 Jun 2016 01:11:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E638F269A3 for ; Sun, 19 Jun 2016 01:11:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D9A1A2793B; Sun, 19 Jun 2016 01:11:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9BB25269A3 for ; Sun, 19 Jun 2016 01:11:34 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1bERFl-0004GI-FM; Sun, 19 Jun 2016 01:10:21 +0000 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1bERFY-0002sa-2n for linux-arm-kernel@lists.infradead.org; Sun, 19 Jun 2016 01:10:08 +0000 Received: by mail-pf0-x242.google.com with SMTP id i123so5815583pfg.3 for ; Sat, 18 Jun 2016 18:09:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bDf0VsaJYaiHp2Sc7qDN99OxRJAPvJFRrkNNgasSoGU=; b=BYYWKMRgpDp/tRXEdyXylAg0RxCpZVNUYTJWXxv18LY67BcZHvAS4D9ebyWT3PObBC 8fdI0+EkrLXJNzjG1emigEnKue9nGFnYBKM4HT4yFycMItQeOgH61aZobviqmm5hSvzX dOI01ECPWRNizag/sfJwmYzUkffuHBVCZzKM5vKiK95z+WJZXklzZLLuVi2aBBcJHcVv BE4vEuSMXY1prxzN5TWtyT0Ecm110vYIQnTtZH/ixFuPBWUfwxp6oBzWFTcY9C8EeI+v xHxYYiv9oWEF5A4poLykn4yOci7X20U3AbfYOXJRMHIY7rDEtGnmiOjk+qPIT3rwnjaj imKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bDf0VsaJYaiHp2Sc7qDN99OxRJAPvJFRrkNNgasSoGU=; b=UVlNBRxKmBZA/5NzlpzleEYtnWEeu5gjkIn3cldyjn/Cx4NWcGAPJun6y4ttDg223n UipBiljTNruvibju80IAFDJwmFLsWAnoAVMXR7Cjn9AhQn3h+U74dxES3MUVS6agzKME 0BhzP2aVlEpxMSZJxzuCl0mp+7CB4NCzY/YmfnFo93Fjo6L3q4l0azSpb+xmwfvUSt6D zcTWlNBmqZsG/AY4raxteeGfyPnHVmWuI5x4zJ77aLENgXUe0KWT8kCI9DBYCvx7rWeG J9qKTeoObJJD7uy6rx5NRQKoIkpF3bfdONDpjrnDDd/NkcJwhObTqkI65RNvR7kglbpc wfiA== X-Gm-Message-State: ALyK8tL0847Av78W79dfMyAn6FcwjivEQ68GH+zEVDWoDM2bT7h2GlLVCC5IdTALY/fsdQ== X-Received: by 10.98.56.86 with SMTP id f83mr12230923pfa.83.1466298588225; Sat, 18 Jun 2016 18:09:48 -0700 (PDT) Received: from squirtle.localdomain.localdomain (c-73-225-163-254.hsd1.wa.comcast.net. [73.225.163.254]) by smtp.gmail.com with ESMTPSA id ln4sm15258402pab.38.2016.06.18.18.09.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Jun 2016 18:09:47 -0700 (PDT) From: Andrey Smirnov To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 1/5] i.MX: system.c: Convert goto to if statement Date: Sat, 18 Jun 2016 18:09:27 -0700 Message-Id: <1466298571-7888-2-git-send-email-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1466298571-7888-1-git-send-email-andrew.smirnov@gmail.com> References: <1466298571-7888-1-git-send-email-andrew.smirnov@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160618_181008_264866_17215E3B X-CRM114-Status: GOOD ( 13.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Russell King , Arnd Bergmann , Andrey Smirnov , linux-kernel@vger.kernel.org, Sascha Hauer , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Shawn Guo MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Using goto here doesn't bring any advantages and only makes the code flow less clear. No functional changes. Acked-by: Arnd Bergmann Signed-off-by: Andrey Smirnov --- arch/arm/mach-imx/system.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/arch/arm/mach-imx/system.c b/arch/arm/mach-imx/system.c index 105d1ce..d9f8b0e 100644 --- a/arch/arm/mach-imx/system.c +++ b/arch/arm/mach-imx/system.c @@ -106,26 +106,24 @@ void __init imx_init_l2cache(void) goto out; } - if (readl_relaxed(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN) - goto skip_if_enabled; - - /* Configure the L2 PREFETCH and POWER registers */ - val = readl_relaxed(l2x0_base + L310_PREFETCH_CTRL); - val |= 0x70800000; - /* - * The L2 cache controller(PL310) version on the i.MX6D/Q is r3p1-50rel0 - * The L2 cache controller(PL310) version on the i.MX6DL/SOLO/SL is r3p2 - * But according to ARM PL310 errata: 752271 - * ID: 752271: Double linefill feature can cause data corruption - * Fault Status: Present in: r3p0, r3p1, r3p1-50rel0. Fixed in r3p2 - * Workaround: The only workaround to this erratum is to disable the - * double linefill feature. This is the default behavior. - */ - if (cpu_is_imx6q()) - val &= ~(1 << 30 | 1 << 23); - writel_relaxed(val, l2x0_base + L310_PREFETCH_CTRL); + if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN)) { + /* Configure the L2 PREFETCH and POWER registers */ + val = readl_relaxed(l2x0_base + L310_PREFETCH_CTRL); + val |= 0x70800000; + /* + * The L2 cache controller(PL310) version on the i.MX6D/Q is r3p1-50rel0 + * The L2 cache controller(PL310) version on the i.MX6DL/SOLO/SL is r3p2 + * But according to ARM PL310 errata: 752271 + * ID: 752271: Double linefill feature can cause data corruption + * Fault Status: Present in: r3p0, r3p1, r3p1-50rel0. Fixed in r3p2 + * Workaround: The only workaround to this erratum is to disable the + * double linefill feature. This is the default behavior. + */ + if (cpu_is_imx6q()) + val &= ~(1 << 30 | 1 << 23); + writel_relaxed(val, l2x0_base + L310_PREFETCH_CTRL); + } -skip_if_enabled: iounmap(l2x0_base); of_node_put(np);