From patchwork Mon Oct 27 11:05:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 39599 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8E9242118A for ; Mon, 27 Oct 2014 11:06:58 +0000 (UTC) Received: by mail-wi0-f197.google.com with SMTP id ex7sf2774333wid.8 for ; Mon, 27 Oct 2014 04:06:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=6v0GClB4kx3kahvMl6m9CV3LTsOyDtIIdGYBEB2znZ0=; b=jzDpezn+7U7QzPAR1q3ODgnYUVAoMqh2Cbb+RX46LqcV4EiJJ7PtqCRYGmtJc+9hZ0 SuE1QcDj8SETQ/lklaMIUXp1u17tbLITBYFHvOdeBYV0+floNVPMGBm8nm7CuF4gCQTI aXAXHYFlvvifHeTq2jGC9n7pcqaLp7NMtwgyYVTlDBneJvBAcpq0uN72oZFepVF2gNx4 5DCFxdJkjPsJN+Jg2aCPNlDjM6D8UqQQejWS3ZcRrC4/hU0N+llPBA2qJOTepAP2ExW+ kDArrCRb5t0nkFAXPdqPu8CZvt7Q3wvga7lZPkPrCjofk2IvkS0GURoKlae7hfToUGop 6oTw== X-Gm-Message-State: ALoCoQlMK3wKbMwDgWoccBdunST07trF573Eqngs9pyE+98iWsHor44PVw6Z6PqDqJ1U6+qfohJY X-Received: by 10.112.154.194 with SMTP id vq2mr342361lbb.10.1414408017554; Mon, 27 Oct 2014 04:06:57 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.10 with SMTP id m10ls690510laj.72.gmail; Mon, 27 Oct 2014 04:06:57 -0700 (PDT) X-Received: by 10.112.148.199 with SMTP id tu7mr23063890lbb.7.1414408017374; Mon, 27 Oct 2014 04:06:57 -0700 (PDT) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id k17si19345221lab.102.2014.10.27.04.06.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 27 Oct 2014 04:06:57 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by mail-lb0-f173.google.com with SMTP id l4so429590lbv.18 for ; Mon, 27 Oct 2014 04:06:57 -0700 (PDT) X-Received: by 10.112.12.35 with SMTP id v3mr22768973lbb.80.1414408017133; Mon, 27 Oct 2014 04:06:57 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.84.229 with SMTP id c5csp267978lbz; Mon, 27 Oct 2014 04:06:56 -0700 (PDT) X-Received: by 10.68.103.97 with SMTP id fv1mr1643834pbb.141.1414408015877; Mon, 27 Oct 2014 04:06:55 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y4si10343986pdn.6.2014.10.27.04.06.54 for ; Mon, 27 Oct 2014 04:06:55 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752306AbaJ0LGI (ORCPT + 26 others); Mon, 27 Oct 2014 07:06:08 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:14311 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751586AbaJ0LGB (ORCPT ); Mon, 27 Oct 2014 07:06:01 -0400 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NE300A1WOAK8W20@mailout4.w1.samsung.com>; Mon, 27 Oct 2014 11:08:44 +0000 (GMT) X-AuditID: cbfec7f4-b7f6c6d00000120b-6a-544e271609dd Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id D0.4F.04619.6172E445; Mon, 27 Oct 2014 11:05:58 +0000 (GMT) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync2.samsung.com (Oracle Communications Messaging Server 7u4-23.01 (7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0NE300JBOO5RPJ10@eusync2.samsung.com>; Mon, 27 Oct 2014 11:05:58 +0000 (GMT) From: Marek Szyprowski To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Tomasz Figa , Kyungmin Park , Russell King - ARM Linux , Kukjin Kim , lauraa@codeaurora.org, linux-omap@vger.kernel.org, linus.walleij@linaro.org, santosh.shilimkar@ti.com, tony@atomide.com, drake@endlessm.com, loeliger@gmail.com, Mark Rutland Subject: [PATCH v6 4/7] ARM: l2c: Add support for overriding prefetch settings Date: Mon, 27 Oct 2014 12:05:47 +0100 Message-id: <1414407950-3029-5-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1414407950-3029-1-git-send-email-m.szyprowski@samsung.com> References: <1414407950-3029-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrNLMWRmVeSWpSXmKPExsVy+t/xK7pi6n4hBreX8Fs8mv+Y2aJ3wVU2 i7NNb9gttnfOYLeY8mc5k8Wmx9dYLS7vmsNmMXtJP4vFjPP7mCxuX+a1OLd9C4vF2iN32S2W Xr/IZPG6bw2zxapdfxgt9l/xchDwWDNvDaNHS3MPm8e3r5NYPC739TJ5LPqe5bFz1l12jzvX 9rB5bF5S79G3ZRWjx/Eb25k8Pm+SC+CO4rJJSc3JLEst0rdL4MqYcai+4LFCRee3fywNjP+l uhg5OSQETCTu7nvMCmGLSVy4t56ti5GLQ0hgKaPEk01dLCAJIYE+JomLV/xBbDYBQ4mut11s ILaIQLbEj2+TWUAamAVWMUtMObAOaBIHh7CAn8SzO5YgNSwCqhLvpxxhBrF5Bdwltm69yQKx TE7i/8sVTCA2p4CHxOSWmUwQu9wlVn3YyziBkXcBI8MqRtHU0uSC4qT0XEO94sTc4tK8dL3k /NxNjJAA/7KDcfExq0OMAhyMSjy8O6b5hgixJpYVV+YeYpTgYFYS4XX8CRTiTUmsrEotyo8v Ks1JLT7EyMTBKdXA6KMh8ezAnw3dk2ac2NeakfP9wry6n77AoN7OvTDvyuXD7CFvTjzJS274 JswSNuHnBu59Eb8O/5kfcmqZwMHM8l3+8uqWOUdcJJYtsl10zmvat+Ip2/L4Q9PVupRTvBjX /i5mWP750sfeAz8aHq6qbLpybHPv0ZU/trbNqLlwZVdhsvAyMz71aiWW4oxEQy3mouJEANPF qWZOAgAA Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: m.szyprowski@samsung.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Tomasz Figa Firmware on certain boards (e.g. ODROID-U3) can leave incorrect L2C prefetch settings configured in registers leading to crashes if L2C is enabled without overriding them. This patch introduces bindings to enable prefetch settings to be specified from DT and necessary support in the driver. Signed-off-by: Tomasz Figa [mszyprow: rebased onto v3.18-rc1, added error messages when property value is missing] Signed-off-by: Marek Szyprowski --- Documentation/devicetree/bindings/arm/l2cc.txt | 10 +++++ arch/arm/mm/cache-l2x0.c | 55 ++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) diff --git a/Documentation/devicetree/bindings/arm/l2cc.txt b/Documentation/devicetree/bindings/arm/l2cc.txt index 292ef7ca3058..0dbabe9a6b0a 100644 --- a/Documentation/devicetree/bindings/arm/l2cc.txt +++ b/Documentation/devicetree/bindings/arm/l2cc.txt @@ -57,6 +57,16 @@ Optional properties: - cache-id-part: cache id part number to be used if it is not present on hardware - wt-override: If present then L2 is forced to Write through mode +- arm,double-linefill : Override double linefill enable setting. Enable if + non-zero, disable if zero. +- arm,double-linefill-incr : Override double linefill on INCR read. Enable + if non-zero, disable if zero. +- arm,double-linefill-wrap : Override double linefill on WRAP read. Enable + if non-zero, disable if zero. +- arm,prefetch-drop : Override prefetch drop enable setting. Enable if non-zero, + disable if zero. +- arm,prefetch-offset : Override prefetch offset value. Valid values are + 0-7, 15, 23, and 31. Example: diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c index ad981894de73..69cfa8359ed3 100644 --- a/arch/arm/mm/cache-l2x0.c +++ b/arch/arm/mm/cache-l2x0.c @@ -1163,6 +1163,9 @@ static void __init l2c310_of_parse(const struct device_node *np, u32 tag[3] = { 0, 0, 0 }; u32 filter[2] = { 0, 0 }; u32 assoc; + u32 prefetch; + u32 val; + int ret; of_property_read_u32_array(np, "arm,tag-latency", tag, ARRAY_SIZE(tag)); if (tag[0] && tag[1] && tag[2]) @@ -1204,6 +1207,58 @@ static void __init l2c310_of_parse(const struct device_node *np, pr_err("PL310 OF: %d calculated, only 8 and 16 legal\n", assoc); break; } + + prefetch = l2x0_saved_regs.prefetch_ctrl; + + ret = of_property_read_u32(np, "arm,double-linefill", &val); + if (ret == 0) { + if (val) + prefetch |= L310_PREFETCH_CTRL_DBL_LINEFILL; + else + prefetch &= ~L310_PREFETCH_CTRL_DBL_LINEFILL; + } else if (ret != -EINVAL) { + pr_err("PL310 OF: missing value for arm,double-linefill property\n"); + } + + ret = of_property_read_u32(np, "arm,double-linefill-incr", &val); + if (ret == 0) { + if (val) + prefetch |= L310_PREFETCH_CTRL_DBL_LINEFILL_INCR; + else + prefetch &= ~L310_PREFETCH_CTRL_DBL_LINEFILL_INCR; + } else if (ret != -EINVAL) { + pr_err("PL310 OF: missing value for arm,double-linefill-incr property\n"); + } + + ret = of_property_read_u32(np, "arm,double-linefill-wrap", &val); + if (ret == 0) { + if (!val) + prefetch |= L310_PREFETCH_CTRL_DBL_LINEFILL_WRAP; + else + prefetch &= ~L310_PREFETCH_CTRL_DBL_LINEFILL_WRAP; + } else if (ret != -EINVAL) { + pr_err("PL310 OF: missing value for arm,double-linefill-wrap property\n"); + } + + ret = of_property_read_u32(np, "arm,prefetch-drop", &val); + if (ret == 0) { + if (val) + prefetch |= L310_PREFETCH_CTRL_PREFETCH_DROP; + else + prefetch &= ~L310_PREFETCH_CTRL_PREFETCH_DROP; + } else if (ret != -EINVAL) { + pr_err("PL310 OF: missing value for arm,prefetch-drop property\n"); + } + + ret = of_property_read_u32(np, "arm,prefetch-offset", &val); + if (ret == 0) { + prefetch &= ~L310_PREFETCH_CTRL_OFFSET_MASK; + prefetch |= val & L310_PREFETCH_CTRL_OFFSET_MASK; + } else if (ret != -EINVAL) { + pr_err("PL310 OF: missing value for arm,prefetch-offset property\n"); + } + + l2x0_saved_regs.prefetch_ctrl = prefetch; } static const struct l2c_init_data of_l2c310_data __initconst = {