summaryrefslogtreecommitdiff
path: root/board/esd/ar405
diff options
context:
space:
mode:
Diffstat (limited to 'board/esd/ar405')
-rw-r--r--board/esd/ar405/ar405.c83
-rw-r--r--board/esd/ar405/u-boot.lds32
2 files changed, 42 insertions, 73 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);
diff --git a/board/esd/ar405/u-boot.lds b/board/esd/ar405/u-boot.lds
index 2c1cf92..0221e30 100644
--- a/board/esd/ar405/u-boot.lds
+++ b/board/esd/ar405/u-boot.lds
@@ -57,35 +57,7 @@ SECTIONS
.plt : { *(.plt) }
.text :
{
- /* WARNING - the following is hand-optimized to fit within */
- /* the sector layout of our flash chips! XXX FIXME XXX */
-
cpu/ppc4xx/start.o (.text)
- cpu/ppc4xx/traps.o (.text)
- cpu/ppc4xx/interrupts.o (.text)
- cpu/ppc4xx/4xx_uart.o (.text)
- cpu/ppc4xx/cpu_init.o (.text)
- cpu/ppc4xx/speed.o (.text)
- drivers/net/4xx_enet.o (.text)
- common/dlmalloc.o (.text)
- lib_generic/crc32.o (.text)
- lib_ppc/extable.o (.text)
- lib_ppc/board.o (.text)
- lib_generic/zlib.o (.text)
-
- common/cmd_boot.o (.text)
- common/cmd_bootm.o (.text)
- common/cmd_flash.o (.text)
- common/cmd_mem.o (.text)
- common/cmd_nvedit.o (.text)
- common/console.o (.text)
- common/main.o (.text)
-
-/*
- . = DEFINED(env_offset) ? env_offset : .;
- common/env_embedded.o (.ppcenv)
-*/
- common/env_embedded.o (.text)
*(.text)
*(.fixup)
@@ -95,10 +67,8 @@ SECTIONS
PROVIDE (etext = .);
.rodata :
{
- *(.rodata)
- *(.rodata1)
- *(.rodata.str1.4)
*(.eh_frame)
+ *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
}
.fini : { *(.fini) } =0
.ctors : { *(.ctors) }