From patchwork Tue Jun 7 15:29:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 9161685 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 4505860571 for ; Tue, 7 Jun 2016 15:31:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 366D52521F for ; Tue, 7 Jun 2016 15:31:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A46427248; Tue, 7 Jun 2016 15:31:43 +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 D034D2521F for ; Tue, 7 Jun 2016 15:31:42 +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 1bAIxH-000491-Dl; Tue, 07 Jun 2016 15:30:11 +0000 Received: from mail-pa0-x241.google.com ([2607:f8b0:400e:c03::241]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1bAIxF-0002tw-1z for linux-arm-kernel@lists.infradead.org; Tue, 07 Jun 2016 15:30:09 +0000 Received: by mail-pa0-x241.google.com with SMTP id ug1so4426904pab.1 for ; Tue, 07 Jun 2016 08:29: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; bh=FGxJ4PSxhT9zWt6lFegj7msH0HJ0xRzGpCt7Y+rFs1I=; b=jO6W6nVmKOcXdko4PALt9c9jNRmvDA2zoLI3Ay0zpDZAydE4SBdT2AToNgNR9r11Td kRXmbH/jy3+tIZpRXj7aAjLiEeNYqy3B0LRoNwbfDKe4ZwjSnHppODn0g9aXNGF3VEEN nwN7dRt6uq/FT8+gL0ud9e+EkrYjS6OW8cL7z6RfCN+n0I5XFpkooImuiPPt3wA6Cis1 ztWfZhluRNY8m1l0xazdQQ1fxKbiipIsdx5Hx4fNP3lHRL1NKrohrdYbfSflUrJHK0zq hiRmXDfrnniKpyLAKCWq7kfo95ngp2bEBM2FKYbBb0gTDHFBhsrjtrogxlB1KtaLIKvI 0kLA== 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; bh=FGxJ4PSxhT9zWt6lFegj7msH0HJ0xRzGpCt7Y+rFs1I=; b=Jom5Wbz382Hf5O1qbhPLsMcH/Rifg9Fh3ZEqNF7ncsRyVplQIUef664MHZpVj7+Iwb AOyz9cO8FTXIZbI4OU0nLv37UpO28j+ie/k3LXyZwFhW3Ur7unTQPx6zGdgGnICkbZBU f2MjbAkwL3VDstXEsjskbGnfPNuX4bfgvxTTEgKnLNU/u+9Oj1dcC8sRVIylW6Bsi+Wj pCG7w9Cz/u1kw+GdTR5pPtYO0MTdac88z0+Svs4hTHWqlRAbQys2mS8RrH/B7ifh3rpS HV9/qWcboZlNXYQXIr4a2qPK3mvWzoVtOQP4gmlR8Gj+nAfKur5Lb3q7dWMf33XfFMnv QOYg== X-Gm-Message-State: ALyK8tIFQarKUJwwBTjxXAnQn4OrTGA5gH/1B6nKtCy1o8RaoQ4g8zYETMQaoIKDzmyEUQ== X-Received: by 10.66.220.33 with SMTP id pt1mr23339pac.120.1465313387996; Tue, 07 Jun 2016 08:29:47 -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 dr4sm33973707pac.11.2016.06.07.08.29.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Jun 2016 08:29:47 -0700 (PDT) From: Andrey Smirnov To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/3] i.MX: system.c: Convert goto to if statement Date: Tue, 7 Jun 2016 08:29:24 -0700 Message-Id: <1465313366-5182-1-git-send-email-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.5.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160607_083009_143177_82485F29 X-CRM114-Status: GOOD ( 13.25 ) 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: Andrey Smirnov , Shawn Guo , linux-kernel@vger.kernel.org, Sascha Hauer 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. 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);