From patchwork Thu Dec 10 14:14:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58209 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp517707lbb; Thu, 10 Dec 2015 06:14:25 -0800 (PST) X-Received: by 10.66.234.133 with SMTP id ue5mr16934501pac.56.1449756865738; Thu, 10 Dec 2015 06:14:25 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id wy9si20605431pab.27.2015.12.10.06.14.25; Thu, 10 Dec 2015 06:14:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dkim=neutral (body hash did not verify) header.i=@linaro-org.20150623.gappssmtp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752208AbbLJOOY (ORCPT + 6 others); Thu, 10 Dec 2015 09:14:24 -0500 Received: from mail-lb0-f174.google.com ([209.85.217.174]:32820 "EHLO mail-lb0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752043AbbLJOOY (ORCPT ); Thu, 10 Dec 2015 09:14:24 -0500 Received: by lbbkw15 with SMTP id kw15so51766034lbb.0 for ; Thu, 10 Dec 2015 06:14:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=yqsVRLzRW5oHbRJDlPBcTRBzCClxNCS+CguhVQoIvAg=; b=lIG0+urf2jMcKJzinQG36AcRGA+w/0cV9aTa6JLsgSfeFrHnEvTszhKpt7bE6XtL7t 0vn6TOgp7PHBSgUfnUNp8QWV2Yy1H2CBpOGUirIxf84BeohL1JH3XB+GvJUl0CIyY/2+ s0ODqSs+Pc3vqR+TlepcGPmNqYt/AamwRPkEvtv0SoOLwoRjipGTU0U9aKm6k4k70EUr fidPvUG+YNJsUycSyxd7/8lcijuzVTg/ElQKgNWdEd2NCqozVDnfCRTkipZLo0CeU801 dSm+4hiJP7QUr8kSEo8JfhGVA/upqebFB7ABbUYSpeV9MTDl+0SPrL+5bjO/Rj381vrc AiEA== 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=yqsVRLzRW5oHbRJDlPBcTRBzCClxNCS+CguhVQoIvAg=; b=G+6lFLYwxvNy81ofgsu7NRZIAIsIszuBei0CzAcjXJAmb3IBoQkuSGnzVwWqvLZFqD u83W5puhA+S8W9Vne6f4RygNuisLEyOjsqKtrBCCKw6oGYacAD28e5azKv9A9Cy1AdEN Awdb2xG7HVIoQNRvov9M3QpoXnilnvzUlJ6vE0QUcVszsCk2XKPTr+z7my5mXDu3bgB6 FBSwJtDX3SDIPxWCbZPLhyMP4G12i0Yopzt83kP/KqI81pWx8tAHgjtf3zYMits/9hU8 YOrH10td/UJ+KKC4cOYrBtPNGhbnC7jHBXHIBVDgiNzi2ML0zJXNGGpvDxB5TYR5wbRY ZmNg== X-Gm-Message-State: ALoCoQmFlFaolXBs8Mjrd2IRswerq/jHQseRKwU4JNVxpVwPvPlMMZNoZuXhtyYU8xpmpCqXnoP/IE/MjTVI2bx96cwpphByOA== X-Received: by 10.112.169.34 with SMTP id ab2mr5533685lbc.140.1449756862012; Thu, 10 Dec 2015 06:14:22 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id um1sm2322727lbb.23.2015.12.10.06.14.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Dec 2015 06:14:21 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org Cc: Linus Walleij , Russell King , Arnd Bergmann , devicetree@vger.kernel.org Subject: [PATCH 1/2] ARM: l2x0: make it possible to disable outer sync from DT Date: Thu, 10 Dec 2015 15:14:15 +0100 Message-Id: <1449756855-19473-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.4.3 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Some RealView platforms have broken outer_sync, see: http://marc.info/?l=linux-kernel&m=144846940516899&w=2 We got rid of the custom barriers from the machine by disabling outer sync, but that was just for the boardfile case. We have to be able to do the same in the device tree case. Since __l2c_init() is cloning and copying the L2C vtable, we pass an argument to this function to optionally numb the outer sync operation if desired, before initializing the cache. After this we can set up the cache correctly on the RealView PB11MPCore, and it boots rock solid with the cache enabled. Before this, spurious crashes would occur if we try to set up the cache properly. Cc: Russell King Cc: Arnd Bergmann Cc: devicetree@vger.kernel.org Signed-off-by: Linus Walleij --- Documentation/devicetree/bindings/arm/l2cc.txt | 1 + arch/arm/mm/cache-l2x0.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/Documentation/devicetree/bindings/arm/l2cc.txt b/Documentation/devicetree/bindings/arm/l2cc.txt index d181b7c4c522..aae7387acbdb 100644 --- a/Documentation/devicetree/bindings/arm/l2cc.txt +++ b/Documentation/devicetree/bindings/arm/l2cc.txt @@ -75,6 +75,7 @@ Optional properties: specified to indicate that such transforms are precluded. - arm,parity-enable : enable parity checking on the L2 cache (L220 or PL310). - arm,parity-disable : disable parity checking on the L2 cache (L220 or PL310). +- arm,outer-sync-disable : disable the outer sync operation on the L2 cache. - prefetch-data : Data prefetch. Value: <0> (forcibly disable), <1> (forcibly enable), property absent (retain settings set by firmware) - prefetch-instr : Instruction prefetch. Value: <0> (forcibly disable), diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c index 3f3008e5c662..9f9d54271aad 100644 --- a/arch/arm/mm/cache-l2x0.c +++ b/arch/arm/mm/cache-l2x0.c @@ -790,7 +790,7 @@ static const struct l2c_init_data l2c310_init_fns __initconst = { }; static int __init __l2c_init(const struct l2c_init_data *data, - u32 aux_val, u32 aux_mask, u32 cache_id) + u32 aux_val, u32 aux_mask, u32 cache_id, bool nosync) { struct outer_cache_fns fns; unsigned way_size_bits, ways; @@ -866,6 +866,10 @@ static int __init __l2c_init(const struct l2c_init_data *data, fns.configure = outer_cache.configure; if (data->fixup) data->fixup(l2x0_base, cache_id, &fns); + if (nosync) { + pr_info("L2C: disabling outer sync\n"); + fns.sync = NULL; + } /* * Check if l2x0 controller is already enabled. If we are booting @@ -925,7 +929,7 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask) if (data->save) data->save(l2x0_base); - __l2c_init(data, aux_val, aux_mask, cache_id); + __l2c_init(data, aux_val, aux_mask, cache_id, false); } #ifdef CONFIG_OF @@ -1724,6 +1728,7 @@ int __init l2x0_of_init(u32 aux_val, u32 aux_mask) struct resource res; u32 cache_id, old_aux; u32 cache_level = 2; + bool nosync = false; np = of_find_matching_node(NULL, l2x0_ids); if (!np) @@ -1762,6 +1767,8 @@ int __init l2x0_of_init(u32 aux_val, u32 aux_mask) if (cache_level != 2) pr_err("L2C: device tree specifies invalid cache level\n"); + nosync = of_property_read_bool(np, "arm,outer-sync-disable"); + /* Read back current (default) hardware configuration */ if (data->save) data->save(l2x0_base); @@ -1776,6 +1783,6 @@ int __init l2x0_of_init(u32 aux_val, u32 aux_mask) else cache_id = readl_relaxed(l2x0_base + L2X0_CACHE_ID); - return __l2c_init(data, aux_val, aux_mask, cache_id); + return __l2c_init(data, aux_val, aux_mask, cache_id, nosync); } #endif