diff options
author | Matthias Fuchs <matthias.fuchs@esd-electronics.com> | 2009-02-20 10:19:18 +0100 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2009-03-20 22:39:14 +0100 |
commit | 049216f045fd8e0f45bcef121c2bb1c7d3de6988 (patch) | |
tree | eb0cb37228f27f5fc9737c0e8e960afa8e2993c9 /board/esd/ar405 | |
parent | a59205d1519375d027f97a545ad642ab20fce6f8 (diff) | |
download | u-boot-imx-049216f045fd8e0f45bcef121c2bb1c7d3de6988.zip u-boot-imx-049216f045fd8e0f45bcef121c2bb1c7d3de6988.tar.gz u-boot-imx-049216f045fd8e0f45bcef121c2bb1c7d3de6988.tar.bz2 |
ppc4xx: Use correct io accessors for esd 405 boards
This patch replaces in/out8/16/32 macros by in/out_8/_be16/_be32
macros. Also volatile pointer references are replaced by the
new accessors.
Signed-off-by: Matthias Fuchs <matthias.fuchs@esd.eu>
Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'board/esd/ar405')
-rw-r--r-- | board/esd/ar405/ar405.c | 83 |
1 files changed, 41 insertions, 42 deletions
diff --git a/board/esd/ar405/ar405.c b/board/esd/ar405/ar405.c index c4b4b67..14520e1 100644 --- a/board/esd/ar405/ar405.c +++ b/board/esd/ar405/ar405.c @@ -24,6 +24,7 @@ #include <common.h> #include "ar405.h" #include <asm/processor.h> +#include <asm/io.h> #include <command.h> DECLARE_GLOBAL_DATA_PTR; @@ -137,18 +138,14 @@ int board_early_init_f (void) mtdcr (uicvcr, 0x00000001); /* set vect base=0,INT0 highest priority */ mtdcr (uicsr, 0xFFFFFFFF); /* clear all ints */ - *(ushort *) 0xf03000ec = 0x0fff; /* enable all interrupts in fpga */ + out_be16((void *)0xf03000ec, 0x0fff); /* enable interrupts in fpga */ return 0; } - -/* ------------------------------------------------------------------------- */ - /* * Check Board Identity: */ - int checkboard (void) { int index; @@ -192,14 +189,15 @@ int checkboard (void) #if 1 /* test-only: some internal test routines... */ +#define DIGEN ((void *)0xf03000b4) /* u8 */ +#define DIGOUT ((void *)0xf03000b0) /* u16 */ +#define DIGIN ((void *)0xf03000a0) /* u16 */ + /* * Some test routines */ int do_digtest(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { - volatile uchar *digen = (volatile uchar *)0xf03000b4; - volatile ushort *digout = (volatile ushort *)0xf03000b0; - volatile ushort *digin = (volatile ushort *)0xf03000a0; int i; int k; int start; @@ -216,7 +214,7 @@ int do_digtest(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) /* * Enable digital outputs */ - *digen = 0x08; + out_8(DIGEN, 0x08); printf("\nStarting digital In-/Out Test from I/O %d to %d (Cntrl-C to abort)...\n", start, end); @@ -226,12 +224,13 @@ int do_digtest(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) */ for (;;) { for (i=start; i<=end; i++) { - *digout = 0x0001 << i; + out_be16(DIGOUT, 0x0001 << i); for (k=0; k<200; k++) udelay(1000); - if (*digin != (0x0001 << i)) { - printf("ERROR: OUT=0x%04X, IN=0x%04X\n", 0x0001 << i, *digin); + if (in_be16(DIGIN) != (0x0001 << i)) { + printf("ERROR: OUT=0x%04X, IN=0x%04X\n", + 0x0001 << i, in_be16(DIGIN)); return 0; } @@ -255,13 +254,13 @@ U_BOOT_CMD( #define ERROR_DELTA 256 struct io { - volatile short val; + short val; short dummy; }; int do_anatest(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { - volatile short val; + short val; int i; int volt; struct io *out; @@ -274,9 +273,9 @@ int do_anatest(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) volt = 0; printf("Setting Channel %d to %dV...\n", i, volt); - out[i].val = (volt * 0x7fff) / 10; + out_be16((void *)&(out[i].val), (volt * 0x7fff) / 10); udelay(10000); - val = in[i*2].val; + val = in_be16((void *)&(in[i*2].val)); printf("-> InChannel %d: 0x%04x=%dV\n", i*2, val, (val * 4000) / 0x7fff); if ((val < ((volt * 0x7fff) / 40) - ERROR_DELTA) || (val > ((volt * 0x7fff) / 40) + ERROR_DELTA)) { @@ -284,7 +283,7 @@ int do_anatest(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) ((volt * 0x7fff) / 40) + ERROR_DELTA); return -1; } - val = in[i*2+1].val; + val = in_be16((void *)&(in[i*2+1].val)); printf("-> InChannel %d: 0x%04x=%dV\n", i*2+1, val, (val * 4000) / 0x7fff); if ((val < ((volt * 0x7fff) / 40) - ERROR_DELTA) || (val > ((volt * 0x7fff) / 40) + ERROR_DELTA)) { @@ -295,9 +294,9 @@ int do_anatest(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) volt = 5; printf("Setting Channel %d to %dV...\n", i, volt); - out[i].val = (volt * 0x7fff) / 10; + out_be16((void *)&(out[i].val), (volt * 0x7fff) / 10); udelay(10000); - val = in[i*2].val; + val = in_be16((void *)&(in[i*2].val)); printf("-> InChannel %d: 0x%04x=%dV\n", i*2, val, (val * 4000) / 0x7fff); if ((val < ((volt * 0x7fff) / 40) - ERROR_DELTA) || (val > ((volt * 0x7fff) / 40) + ERROR_DELTA)) { @@ -305,7 +304,7 @@ int do_anatest(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) ((volt * 0x7fff) / 40) + ERROR_DELTA); return -1; } - val = in[i*2+1].val; + val = in_be16((void *)&(in[i*2+1].val)); printf("-> InChannel %d: 0x%04x=%dV\n", i*2+1, val, (val * 4000) / 0x7fff); if ((val < ((volt * 0x7fff) / 40) - ERROR_DELTA) || (val > ((volt * 0x7fff) / 40) + ERROR_DELTA)) { @@ -316,9 +315,9 @@ int do_anatest(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) volt = 10; printf("Setting Channel %d to %dV...\n", i, volt); - out[i].val = (volt * 0x7fff) / 10; + out_be16((void *)&(out[i].val), (volt * 0x7fff) / 10); udelay(10000); - val = in[i*2].val; + val = in_be16((void *)&(in[i*2].val)); printf("-> InChannel %d: 0x%04x=%dV\n", i*2, val, (val * 4000) / 0x7fff); if ((val < ((volt * 0x7fff) / 40) - ERROR_DELTA) || (val > ((volt * 0x7fff) / 40) + ERROR_DELTA)) { @@ -326,7 +325,7 @@ int do_anatest(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) ((volt * 0x7fff) / 40) + ERROR_DELTA); return -1; } - val = in[i*2+1].val; + val = in_be16((void *)&(in[i*2+1].val)); printf("-> InChannel %d: 0x%04x=%dV\n", i*2+1, val, (val * 4000) / 0x7fff); if ((val < ((volt * 0x7fff) / 40) - ERROR_DELTA) || (val > ((volt * 0x7fff) / 40) + ERROR_DELTA)) { @@ -350,28 +349,27 @@ int counter = 0; void cyclicInt(void *ptr) { - *(ushort *)0xf03000e8 = 0x0800; /* ack int */ + out_be16((void *)0xf03000e8, 0x0800); /* ack int */ counter++; } int do_inctest(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { - volatile uchar *digout = (volatile uchar *)0xf03000b4; - volatile ulong *incin; + ulong *incin; int i; - incin = (volatile ulong *)0xf0300040; + incin = (ulong *)0xf0300040; /* * Clear inc counter */ - incin[0] = 0; - incin[1] = 0; - incin[2] = 0; - incin[3] = 0; + out_be32((void *)&incin[0], 0); + out_be32((void *)&incin[1], 0); + out_be32((void *)&incin[2], 0); + out_be32((void *)&incin[3], 0); - incin = (volatile ulong *)0xf0300050; + incin = (ulong *)0xf0300050; /* * Inc a little @@ -379,28 +377,29 @@ int do_inctest(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) for (i=0; i<10000; i++) { switch (i & 0x03) { case 0: - *digout = 0x02; + out_8(DIGEN, 0x02); break; case 1: - *digout = 0x03; + out_8(DIGEN, 0x03); break; case 2: - *digout = 0x01; + out_8(DIGEN, 0x01); break; case 3: - *digout = 0x00; + out_8(DIGEN, 0x00); break; } udelay(10); } - printf("Inc 0 = %ld\n", incin[0]); - printf("Inc 1 = %ld\n", incin[1]); - printf("Inc 2 = %ld\n", incin[2]); - printf("Inc 3 = %ld\n", incin[3]); + printf("Inc 0 = %d\n", in_be32((void *)&incin[0])); + printf("Inc 1 = %d\n", in_be32((void *)&incin[1])); + printf("Inc 2 = %d\n", in_be32((void *)&incin[2])); + printf("Inc 3 = %d\n", in_be32((void *)&incin[3])); - *(ushort *)0xf03000e0 = 0x0c80-1; /* set counter */ - *(ushort *)0xf03000ec |= 0x0800; /* enable int */ + out_be16((void *)0xf03000e0, 0x0c80-1); /* set counter */ + out_be16((void *)0xf03000ec, + in_be16((void *)0xf03000ec) | 0x0800); /* enable int */ irq_install_handler (30, (interrupt_handler_t *) cyclicInt, NULL); printf("counter=%d\n", counter); |