summaryrefslogtreecommitdiffstats
path: root/arch/nios2
diff options
context:
space:
mode:
authorThomas Chou <thomas@wytron.com.tw>2014-08-25 16:50:14 +0800
committerThomas Chou <thomas@wytron.com.tw>2014-08-30 17:48:43 +0800
commit8645071006a0b577ae4660f4a271f42c081ef4ab (patch)
tree2fc4bd555b665626099489dc77dd2dadaaa11001 /arch/nios2
parentef3cc8112c7ac58d621246523e8c84bf6035b53b (diff)
downloadblackbird-obmc-uboot-8645071006a0b577ae4660f4a271f42c081ef4ab.tar.gz
blackbird-obmc-uboot-8645071006a0b577ae4660f4a271f42c081ef4ab.zip
nios2: divide nios2-io.h into each specific drivers and remove it
The nios2-io.h defines hardware registers and bits of several FPGA IP cores. It could be divided in to the specific drivers, including altera timer, altera sysid, altera uart and altera jtag uart. The altera pio and altera spi drivers use their own hardware definitions. The removal of nios2-io.h will help modularity and maintenance. Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Diffstat (limited to 'arch/nios2')
-rw-r--r--arch/nios2/cpu/cpu.c1
-rw-r--r--arch/nios2/cpu/interrupts.c20
-rw-r--r--arch/nios2/cpu/sysid.c8
3 files changed, 25 insertions, 4 deletions
diff --git a/arch/nios2/cpu/cpu.c b/arch/nios2/cpu/cpu.c
index 86f94b76fa..36ea90bc8c 100644
--- a/arch/nios2/cpu/cpu.c
+++ b/arch/nios2/cpu/cpu.c
@@ -7,7 +7,6 @@
#include <common.h>
#include <nios2.h>
-#include <nios2-io.h>
#include <asm/cache.h>
DECLARE_GLOBAL_DATA_PTR;
diff --git a/arch/nios2/cpu/interrupts.c b/arch/nios2/cpu/interrupts.c
index c4bed2253d..b363a1feb0 100644
--- a/arch/nios2/cpu/interrupts.c
+++ b/arch/nios2/cpu/interrupts.c
@@ -10,7 +10,6 @@
#include <nios2.h>
-#include <nios2-io.h>
#include <asm/types.h>
#include <asm/io.h>
#include <asm/ptrace.h>
@@ -21,6 +20,25 @@
#include <status_led.h>
#endif
+typedef volatile struct {
+ unsigned status; /* Timer status reg */
+ unsigned control; /* Timer control reg */
+ unsigned periodl; /* Timeout period low */
+ unsigned periodh; /* Timeout period high */
+ unsigned snapl; /* Snapshot low */
+ unsigned snaph; /* Snapshot high */
+} nios_timer_t;
+
+/* status register */
+#define NIOS_TIMER_TO (1 << 0) /* Timeout */
+#define NIOS_TIMER_RUN (1 << 1) /* Timer running */
+
+/* control register */
+#define NIOS_TIMER_ITO (1 << 0) /* Timeout int ena */
+#define NIOS_TIMER_CONT (1 << 1) /* Continuous mode */
+#define NIOS_TIMER_START (1 << 2) /* Start timer */
+#define NIOS_TIMER_STOP (1 << 3) /* Stop timer */
+
#if defined(CONFIG_SYS_NIOS_TMRBASE) && !defined(CONFIG_SYS_NIOS_TMRIRQ)
#error CONFIG_SYS_NIOS_TMRIRQ not defined (see documentation)
#endif
diff --git a/arch/nios2/cpu/sysid.c b/arch/nios2/cpu/sysid.c
index 943bff8d29..50819b2424 100644
--- a/arch/nios2/cpu/sysid.c
+++ b/arch/nios2/cpu/sysid.c
@@ -11,12 +11,16 @@
#include <command.h>
#include <asm/io.h>
-#include <nios2-io.h>
#include <linux/time.h>
+typedef volatile struct {
+ unsigned id; /* The system build id */
+ unsigned timestamp; /* Timestamp */
+} nios_sysid_t;
+
void display_sysid (void)
{
- struct nios_sysid_t *sysid = (struct nios_sysid_t *)CONFIG_SYS_NIOS_SYSID_BASE;
+ nios_sysid_t *sysid = (nios_sysid_t *)CONFIG_SYS_NIOS_SYSID_BASE;
struct tm t;
char asc[32];
time_t stamp;
OpenPOWER on IntegriCloud