From patchwork Tue Dec 5 10:19:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Brodkin X-Patchwork-Id: 844668 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Cri0rWkk"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yrd5l4PJJz9t9m for ; Tue, 5 Dec 2017 21:19:39 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=YXZ5a/L5RaylQQSdy3BYWpDMs4h5OJqDSnC9LxnNREw=; b=Cri 0rWkkLSRXCA8rPHCBxv3zU5mD0x3Yq3qwW+p2Bnf8c0PuDiuXVqA1GwTl4O4fhPhUMSCAKiC7Au7j moik9UTIkucN5rOLHR9NyG3hqmlKZ2v7xSx8WJyzgeIW1fDAN3Zl7oFhTFjPwI7H7R6yVykTSKYFk MawBzQQ4PLho+JHOxaQVRYd2YybzzJov+Ec2v8L0aaWMagZYM/wM9mrd5+IkMpOEtmOKLCiRq7LMf LRxeHTeYwQFwNZbI7LcKJqDXJyw12SQrUEN3+OwimqXffKGGhkG5nbjyBc1DVIH+zkr3th01Ko6wH lrug+E1Q72HpWiJouPA9F6DRKXHxyZg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eMAKA-0007Oc-5i; Tue, 05 Dec 2017 10:19:38 +0000 Received: from smtprelay4.synopsys.com ([198.182.47.9] helo=smtprelay.synopsys.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eMAK7-0007Ee-3L for linux-snps-arc@lists.infradead.org; Tue, 05 Dec 2017 10:19:36 +0000 Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id B434924E03BC; Tue, 5 Dec 2017 02:19:12 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 946AE247; Tue, 5 Dec 2017 02:19:12 -0800 (PST) Received: from abrodkin-7440l.internal.synopsys.com (unknown [10.225.15.245]) by mailhost.synopsys.com (Postfix) with ESMTP id 0CDE523B; Tue, 5 Dec 2017 02:19:10 -0800 (PST) From: Alexey Brodkin To: linux-snps-arc@lists.infradead.org Subject: [PATCH] ARC: Force disable IOC if ioc_enable=0 Date: Tue, 5 Dec 2017 13:19:02 +0300 Message-Id: <1512469142-5916-1-git-send-email-abrodkin@synopsys.com> X-Mailer: git-send-email 2.7.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171205_021935_220815_B26BA7F3 X-CRM114-Status: GOOD ( 10.67 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [198.182.47.9 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [198.182.47.9 listed in wl.mailspike.net] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vineet Gupta , Alexey Brodkin , linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org U-Boot enables and uses IOC so if we don't want to use it in the kernel we need to _disable_ it for real. This is in comparison to what we do today based on "ioc_enable" flag - if it is set to 0 we just _dont_enable_ IOC which effectively keeps IOC alive and kicking. Signed-off-by: Alexey Brodkin --- arch/arc/mm/cache.c | 47 +++++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/arch/arc/mm/cache.c b/arch/arc/mm/cache.c index eee924dfffa6..b763c34aa6bc 100644 --- a/arch/arc/mm/cache.c +++ b/arch/arc/mm/cache.c @@ -1149,6 +1149,10 @@ noinline void __init arc_ioc_setup(void) { unsigned int ioc_base, mem_sz; + /* Force disable IOC if it exists but we don't want to use it */ + if (ioc_exists && !ioc_enable) + write_aux_reg(ARC_REG_IO_COH_ENABLE, 0); + /* Flush + invalidate + disable L1 dcache */ __dc_disable(); @@ -1156,31 +1160,34 @@ noinline void __init arc_ioc_setup(void) if (read_aux_reg(ARC_REG_SLC_BCR)) slc_entire_op(OP_FLUSH_N_INV); - /* - * currently IOC Aperture covers entire DDR - * TBD: fix for PGU + 1GB of low mem - * TBD: fix for PAE - */ - mem_sz = arc_get_mem_sz(); + /* Only setup IOC if we really want to use it */ + if (ioc_exists && ioc_enable) { + /* + * currently IOC Aperture covers entire DDR + * TBD: fix for PGU + 1GB of low mem + * TBD: fix for PAE + */ + mem_sz = arc_get_mem_sz(); - if (!is_power_of_2(mem_sz) || mem_sz < 4096) - panic("IOC Aperture size must be power of 2 larger than 4KB"); + if (!is_power_of_2(mem_sz) || mem_sz < 4096) + panic("IOC Aperture size must be power of 2 larger than 4KB"); - /* - * IOC Aperture size decoded as 2 ^ (SIZE + 2) KB, - * so setting 0x11 implies 512MB, 0x12 implies 1GB... - */ - write_aux_reg(ARC_REG_IO_COH_AP0_SIZE, order_base_2(mem_sz >> 10) - 2); + /* + * IOC Aperture size decoded as 2 ^ (SIZE + 2) KB, + * so setting 0x11 implies 512MB, 0x12 implies 1GB... + */ + write_aux_reg(ARC_REG_IO_COH_AP0_SIZE, order_base_2(mem_sz >> 10) - 2); - /* for now assume kernel base is start of IOC aperture */ - ioc_base = CONFIG_LINUX_RAM_BASE; + /* for now assume kernel base is start of IOC aperture */ + ioc_base = CONFIG_LINUX_RAM_BASE; - if (ioc_base % mem_sz != 0) - panic("IOC Aperture start must be aligned to the size of the aperture"); + if (ioc_base % mem_sz != 0) + panic("IOC Aperture start must be aligned to the size of the aperture"); - write_aux_reg(ARC_REG_IO_COH_AP0_BASE, ioc_base >> 12); - write_aux_reg(ARC_REG_IO_COH_PARTIAL, 1); - write_aux_reg(ARC_REG_IO_COH_ENABLE, 1); + write_aux_reg(ARC_REG_IO_COH_AP0_BASE, ioc_base >> 12); + write_aux_reg(ARC_REG_IO_COH_PARTIAL, 1); + write_aux_reg(ARC_REG_IO_COH_ENABLE, 1); + } /* Re-enable L1 dcache */ __dc_enable();