From patchwork Sun Jul 2 16:30:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 9821685 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 06D686035F for ; Sun, 2 Jul 2017 16:32:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC3A827FB1 for ; Sun, 2 Jul 2017 16:32:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF84028173; Sun, 2 Jul 2017 16:32:10 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6983027FB1 for ; Sun, 2 Jul 2017 16:32:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752514AbdGBQbr (ORCPT ); Sun, 2 Jul 2017 12:31:47 -0400 Received: from outils.crapouillou.net ([89.234.176.41]:41940 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752243AbdGBQaj (ORCPT ); Sun, 2 Jul 2017 12:30:39 -0400 From: Paul Cercueil To: Ralf Baechle , Michael Turquette , Stephen Boyd , Rob Herring Cc: Paul Burton , Maarten ter Huurne , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@linux-mips.org, linux-clk@vger.kernel.org Subject: [PATCH v3 15/18] MIPS: JZ4770: Work around config2 misreporting associativity Date: Sun, 2 Jul 2017 18:30:13 +0200 Message-Id: <20170702163016.6714-16-paul@crapouillou.net> In-Reply-To: <20170702163016.6714-1-paul@crapouillou.net> References: <20170607200439.24450-2-paul@crapouillou.net> <20170702163016.6714-1-paul@crapouillou.net> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1499013037; bh=hy9Qdh6ZRVQZrImDd/0PbzNkMGf5D2+terPO5rZ/fqk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=EHPvczjAC6l3DsiaztSb9DdsPFe6TGqFYpqfGPwE0zK3n2cNDFldKsI5MFBf/qDhjG3uqX63E2g1KYsRi65we50Cz5bID4WFyXyQRvJ7cYTFnnhsT7/Tx5m5nDNzUaea/5elWajRgtqp+MiIhMWLpL2YemKC96fV7tUVLaf03Ek= Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Maarten ter Huurne According to config2, the associativity would be 5-ways, but the documentation states 4-ways, which also matches the documented L2 cache size of 256 kB. Signed-off-by: Maarten ter Huurne --- arch/mips/mm/sc-mips.c | 9 +++++++++ 1 file changed, 9 insertions(+) v2: No change v3: No change diff --git a/arch/mips/mm/sc-mips.c b/arch/mips/mm/sc-mips.c index c909c3342729..67a3b4d88580 100644 --- a/arch/mips/mm/sc-mips.c +++ b/arch/mips/mm/sc-mips.c @@ -15,6 +15,7 @@ #include #include #include +#include /* * MIPS32/MIPS64 L2 cache handling @@ -228,6 +229,14 @@ static inline int __init mips_sc_probe(void) else return 0; + /* + * According to config2 it would be 5-ways, but that is contradicted + * by all documentation. + */ + if (current_cpu_type() == CPU_JZRISC && + mips_machtype == MACH_INGENIC_JZ4770) + c->scache.ways = 4; + c->scache.waysize = c->scache.sets * c->scache.linesz; c->scache.waybit = __ffs(c->scache.waysize);