linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <Vineet.Gupta1@synopsys.com>
To: <linux-arch@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <tglx@linutronix.de>, <arnd@arndb.de>,
	Vineet Gupta <Vineet.Gupta1@synopsys.com>
Subject: [RFC Patch v1 48/55] ARC: [plat-arfpga] BVCI Latency Unit setup
Date: Mon, 12 Nov 2012 17:19:06 +0530	[thread overview]
Message-ID: <1352720953-24321-18-git-send-email-vgupta@synopsys.com> (raw)
In-Reply-To: <1352720953-24321-1-git-send-email-vgupta@synopsys.com>

From: Vineet Gupta <vgupta@synopsys.com>

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
---
 arch/arc/plat-arcfpga/Kconfig    |   32 +++++++++++++++++++++
 arch/arc/plat-arcfpga/platform.c |   56 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 88 insertions(+), 0 deletions(-)

diff --git a/arch/arc/plat-arcfpga/Kconfig b/arch/arc/plat-arcfpga/Kconfig
index 1b65644..6bc1149 100644
--- a/arch/arc/plat-arcfpga/Kconfig
+++ b/arch/arc/plat-arcfpga/Kconfig
@@ -55,4 +55,36 @@ config ARC_SERIAL_LV2
 	depends on ARC_COMPACT_IRQ_LEVELS
 	select ARC_IRQ5_LV2
 
+menuconfig ARC_HAS_BVCI_LAT_UNIT
+	bool "BVCI Bus Latency Unit"
+	depends on ARC_BOARD_ML509 || ARC_BOARD_ANGEL4
+	help
+	  IP to add artifical latency to BVCI Bus Based FPGA builds.
+	  The default latency (even worst case) for FPGA is non-realistic
+	  (~10 SDRAM, ~5 SSRAM).
+
+config BVCI_LAT_UNITS
+	hex "Latency Unit(s) Bitmap"
+	default "0x0"
+	depends on ARC_HAS_BVCI_LAT_UNIT
+	help
+	  There are multiple Latency Units corresponding to the many
+	  interfaces of the system bus arbiter (both CPU side as well as
+	  the peripheral side).
+	  To add latency to ALL memory transaction, choose Unit 0, otherwise
+	  for finer grainer - interface wise latency, specify a bitmap (1 bit
+	  per unit) of all units. e.g. 1,2,12 will be 0x1003
+
+	  Unit  0 - System Arb and Mem Controller
+	  Unit  1 - I$ and System Bus
+	  Unit  2 - D$ and System Bus
+	  ..
+	  Unit 12 - IDE Disk controller and System Bus
+
+config BVCI_LAT_CYCLES
+	int "Latency Value in cycles"
+	range 0 63
+	default "30"
+	depends on ARC_HAS_BVCI_LAT_UNIT
+
 endif
diff --git a/arch/arc/plat-arcfpga/platform.c b/arch/arc/plat-arcfpga/platform.c
index 3243091..d5d4a10 100644
--- a/arch/arc/plat-arcfpga/platform.c
+++ b/arch/arc/plat-arcfpga/platform.c
@@ -17,6 +17,60 @@
 #include <asm/irq.h>
 #include <plat/memmap.h>
 
+/*-----------------------BVCI Latency Unit -----------------------------*/
+
+#ifdef CONFIG_ARC_HAS_BVCI_LAT_UNIT
+
+int lat_cycles = CONFIG_BVCI_LAT_CYCLES;
+
+/* BVCI Bus Profiler: Latency Unit */
+static void __init setup_bvci_lat_unit(void)
+{
+#define MAX_BVCI_UNITS 12
+
+	/* TBD: rewrite this using I/O macros */
+	volatile unsigned int *base = (unsigned int *)BVCI_LAT_UNIT_BASE;
+	volatile unsigned int *lat_unit = (unsigned int *)base + 21;
+	volatile unsigned int *lat_val = (unsigned int *)base + 22;
+	unsigned int unit;
+	const unsigned long units_req = CONFIG_BVCI_LAT_UNITS;
+
+	/*
+	 * There are multiple Latency Units corresponding to the many
+	 * interfaces of the system bus arbiter (both CPU side as well as
+	 * the peripheral side).
+	 *
+	 * Unit  0 - System Arb and Mem Controller - adds latency to all
+	 *	    memory trasactions
+	 * Unit  1 - I$ and System Bus
+	 * Unit  2 - D$ and System Bus
+	 * ..
+	 * Unit 12 - IDE Disk controller and System Bus
+	 *
+	 * The programmers model requires writing to lat_unit reg first
+	 * and then the latency value (cycles) to lat_value reg
+	 */
+
+	if (CONFIG_BVCI_LAT_UNITS == 0) {
+		*lat_unit = 0;
+		*lat_val = lat_cycles;
+		pr_info("BVCI Latency for all Memory Transactions %d cycles\n",
+			lat_cycles);
+	} else {
+		for_each_set_bit(unit, &units_req, MAX_BVCI_UNITS) {
+			*lat_unit = unit + 1;  /* above returns 0 based */
+			*lat_val = lat_cycles;
+			pr_info("BVCI Latency for Unit[%d] = %d cycles\n",
+				(unit + 1), lat_cycles);
+		}
+	}
+}
+#else
+static void __init setup_bvci_lat_unit(void)
+{
+}
+#endif
+
 /*----------------------- Platform Devices -----------------------------*/
 
 #if defined(CONFIG_SERIAL_ARC) || defined(CONFIG_SERIAL_ARC_MODULE)
@@ -111,6 +165,8 @@ void __init arc_platform_early_init(void)
 {
 	pr_info("[plat-arcfpga]: registering early dev resources\n");
 
+	setup_bvci_lat_unit();
+
 	arc_fpga_serial_init();
 }
 
-- 
1.7.4.1


  parent reply	other threads:[~2012-11-12 11:52 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-12 11:48 [RFC Patch v1 00/55] Addons to Synopsys ARC Linux kernel Port Vineet.Gupta1
2012-11-12 11:48 ` [RFC Patch v1 32/55] ARC: [optim] Cache "current" in Register r25 Vineet.Gupta1
2012-11-12 13:50   ` Arnd Bergmann
2012-11-15 10:22     ` Vineet Gupta
2012-11-12 11:48 ` [RFC Patch v1 33/55] ARC: ptrace support Vineet.Gupta1
2012-11-12 13:51   ` Arnd Bergmann
2012-11-15 10:24     ` Vineet Gupta
2012-11-15 11:56       ` Arnd Bergmann
2012-11-12 11:48 ` [RFC Patch v1 34/55] ARC: futex Vineet.Gupta1
2012-11-12 11:48 ` [RFC Patch v1 35/55] ARC: oprofile support Vineet.Gupta1
2012-11-12 11:48 ` [RFC Patch v1 36/55] ARC: ARCompact 2 levels IRQ (high/low priority) Handling Vineet.Gupta1
2012-11-12 11:48 ` [RFC Patch v1 37/55] ARC: dynamic loadable module support Vineet.Gupta1
2012-11-12 13:53   ` Arnd Bergmann
2012-11-15 10:28     ` Vineet Gupta
2012-11-12 11:48 ` [RFC Patch v1 38/55] ARC: Low level event capture/logging Vineet.Gupta1
2012-11-12 13:55   ` Arnd Bergmann
2012-11-15 10:40     ` Vineet Gupta
2012-11-15 12:04       ` Arnd Bergmann
2012-12-20  6:22         ` Vineet Gupta
2012-11-12 11:48 ` [RFC Patch v1 39/55] ARC: kernel diagnostics: show_regs() etc Vineet.Gupta1
2012-11-12 11:48 ` [RFC Patch v1 40/55] ARC: SMP support Vineet.Gupta1
2012-11-12 11:48 ` [RFC Patch v1 41/55] ARC: dwarf2 stack unwinder Vineet.Gupta1
2012-11-12 11:49 ` [RFC Patch v1 42/55] ARC: stacktracing APIs based on dw2 unwinder Vineet.Gupta1
2012-11-12 11:49 ` [RFC Patch v1 43/55] ARC: disassembly (needed by kprobes/kgdb/unaligned-access-emul) Vineet.Gupta1
2012-11-12 11:49 ` [RFC Patch v1 44/55] ARC: kprobes support Vineet.Gupta1
2012-11-12 11:49 ` [RFC Patch v1 45/55] ARC: unaligned access emulation Vineet.Gupta1
2012-11-12 14:00   ` Arnd Bergmann
2012-12-20  6:59     ` Vineet Gupta
2012-12-20 10:30       ` Vineet Gupta
2012-12-20 10:34         ` Geert Uytterhoeven
     [not found]       ` <1356001898-2960-1-git-send-email-vgupta@synopsys.com>
2012-12-20 11:11         ` [PATCH] sysctl: convert arch specific unaligned access regulators to generic ones Vineet.Gupta1
2013-01-03  6:47       ` [RESEND PATCH] Convert IA64 sysctl to generic Vineet Gupta
2013-01-03  6:47         ` [RESEND PATCH] sysctl: Enable IA64 "ignore-unaligned-usertrap" to be used cross-arch Vineet Gupta
2013-01-08 23:43           ` Tony Luck
2013-01-09 14:14             ` Vineet Gupta
2013-01-09 14:36               ` [PATCH v2] " Vineet Gupta
2013-01-09 18:55                 ` Tony Luck
2013-01-09 21:03                   ` Eric W. Biederman
2013-01-10  4:13                   ` Vineet Gupta
2013-01-03  6:59       ` [RESEND PATCH] Convert PARISC sysctl to be generic Vineet Gupta
2013-01-03  6:59         ` [RESEND PATCH] sysctl: Enable PARISC "unaligned-trap" to be used cross-arch Vineet Gupta
2013-01-15 22:03           ` Helge Deller
2012-12-20  8:08     ` [RFC Patch v1 45/55] ARC: unaligned access emulation Vineet Gupta
2012-12-20  8:51       ` Arnd Bergmann
2012-11-12 11:49 ` [RFC Patch v1 46/55] ARC: kgdb support Vineet.Gupta1
2012-11-12 11:49 ` [RFC Patch v1 47/55] ARC: startup #2: Verbose Boot reporting / feature verification Vineet.Gupta1
2012-11-12 11:49 ` Vineet.Gupta1 [this message]
2012-11-12 14:02   ` [RFC Patch v1 48/55] ARC: [plat-arfpga] BVCI Latency Unit setup Arnd Bergmann
2013-01-17  5:08     ` Vineet Gupta
2012-11-12 11:49 ` [RFC Patch v1 49/55] perf, ARC: Enable building perf tools for ARC Vineet.Gupta1
2012-11-12 11:49 ` [RFC Patch v1 50/55] ARC: perf support (software counters only) Vineet.Gupta1
2012-11-12 11:49 ` [RFC Patch v1 51/55] modpost: Ignore ARC specific non-alloc section Vineet.Gupta1
2012-12-27 10:47   ` [RESEND PATCH] modpost: For ARC Port submission Vineet Gupta
2012-12-27 10:47     ` [PATCH] modpost: Ignore ARC specific non-alloc sections Vineet Gupta
2012-12-27 20:48       ` Sam Ravnborg
2012-12-28  4:42         ` Vineet Gupta
2013-01-02  0:49         ` Rusty Russell
2013-01-02  5:16           ` Vineet Gupta
2012-11-12 11:49 ` [RFC Patch v1 52/55] ARC: Support for single cycle Close Coupled Mem (CCM) Vineet.Gupta1
2012-11-12 14:10   ` Arnd Bergmann
2013-01-17  5:09     ` Vineet Gupta
2013-01-17 10:53       ` Arnd Bergmann
2012-11-12 11:49 ` [RFC Patch v1 53/55] ARC: Hostlink Pseudo-Driver for Metaware Debugger Vineet.Gupta1
2012-11-12 11:49 ` [RFC Patch v1 54/55] ARC: [plat-arcfpga] defconfig Vineet.Gupta1
2012-11-12 11:49 ` [RFC Patch v1 55/55] ARC: Add self to MAINTAINERS Vineet.Gupta1

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1352720953-24321-18-git-send-email-vgupta@synopsys.com \
    --to=vineet.gupta1@synopsys.com \
    --cc=arnd@arndb.de \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).