summaryrefslogtreecommitdiff
path: root/cpu/nios2/epcs.c
diff options
context:
space:
mode:
authorHeiko Schocher <hs@pollux.denx.de>2006-04-20 12:38:41 +0200
committerHeiko Schocher <hs@pollux.denx.de>2006-04-20 12:38:41 +0200
commit60e270a4903b3379d6859418d99aeef1d0d0cdff (patch)
tree48a033782d7f641ffd75f2be076da5b8d513254e /cpu/nios2/epcs.c
parent9acb626fc145e7327f94fd77f927dce08dd978a8 (diff)
downloadu-boot-imx-60e270a4903b3379d6859418d99aeef1d0d0cdff.zip
u-boot-imx-60e270a4903b3379d6859418d99aeef1d0d0cdff.tar.gz
u-boot-imx-60e270a4903b3379d6859418d99aeef1d0d0cdff.tar.bz2
Fix I/O Macros and mini-app stubs for Nios-II
Patch by Scott McNutt 11, Aug 2005 -Fix asm/io.h macros -Eliminate use of CACHE_BYPASS in cpu code -Eliminate assembler warnings -Fix mini-app stubs and force no small data
Diffstat (limited to 'cpu/nios2/epcs.c')
-rw-r--r--cpu/nios2/epcs.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/cpu/nios2/epcs.c b/cpu/nios2/epcs.c
index a8851e9..fd9fd84 100644
--- a/cpu/nios2/epcs.c
+++ b/cpu/nios2/epcs.c
@@ -25,7 +25,7 @@
#if defined(CFG_NIOS_EPCSBASE)
#include <command.h>
-#include <nios2.h>
+#include <asm/io.h>
#include <nios2-io.h>
#include <nios2-epcs.h>
@@ -72,8 +72,7 @@
*/
#define EPCS_TIMEOUT 100 /* 100 msec timeout */
-static nios_spi_t *epcs =
- (nios_spi_t *)CACHE_BYPASS(CFG_NIOS_EPCSBASE);
+static nios_spi_t *epcs = (nios_spi_t *)CFG_NIOS_EPCSBASE;
/***********************************************************************
* Device access
@@ -81,16 +80,20 @@ static nios_spi_t *epcs =
static int epcs_cs (int assert)
{
ulong start;
+ unsigned tmp;
+
if (assert) {
- epcs->control |= NIOS_SPI_SSO;
+ tmp = readl (&epcs->control);
+ writel (&epcs->control, tmp | NIOS_SPI_SSO);
} else {
/* Let all bits shift out */
start = get_timer (0);
- while ((epcs->status & NIOS_SPI_TMT) == 0)
+ while ((readl (&epcs->status) & NIOS_SPI_TMT) == 0)
if (get_timer (start) > EPCS_TIMEOUT)
return (-1);
- epcs->control &= ~NIOS_SPI_SSO;
+ tmp = readl (&epcs->control);
+ writel (&epcs->control, tmp & ~NIOS_SPI_SSO);
}
return (0);
}
@@ -100,10 +103,10 @@ static int epcs_tx (unsigned char c)
ulong start;
start = get_timer (0);
- while ((epcs->status & NIOS_SPI_TRDY) == 0)
+ while ((readl (&epcs->status) & NIOS_SPI_TRDY) == 0)
if (get_timer (start) > EPCS_TIMEOUT)
return (-1);
- epcs->txdata = c;
+ writel (&epcs->txdata, c);
return (0);
}
@@ -112,10 +115,10 @@ static int epcs_rx (void)
ulong start;
start = get_timer (0);
- while ((epcs->status & NIOS_SPI_RRDY) == 0)
+ while ((readl (&epcs->status) & NIOS_SPI_RRDY) == 0)
if (get_timer (start) > EPCS_TIMEOUT)
return (-1);
- return (epcs->rxdata);
+ return (readl (&epcs->rxdata));
}
static unsigned char bitrev[] = {