summaryrefslogtreecommitdiff
path: root/post
diff options
context:
space:
mode:
authorwdenk <wdenk>2004-08-01 22:48:16 +0000
committerwdenk <wdenk>2004-08-01 22:48:16 +0000
commit281e00a3be453a169d854f824a460359d10f92bb (patch)
tree43dab398f1d6f601bb44df108427f7e0c611d68d /post
parentcfca5e604d5692f081cc1a9185ca5dc6dc77599d (diff)
* Code cleanup
* Patch by Sascha Hauer, 28 Jun: - add generic support for Motorola i.MX architecture - add support for mx1ads, mx1fs2 and scb9328 boards * Patches by Marc Leeman, 23 Jul 2004: - Add define for the PCI/Memory Buffer Configuration Register - corrected comments in cpu/mpc824x/cpu_init.c * Add support for multiple serial interfaces (for example to allow modem dial-in / dial-out)
Diffstat (limited to 'post')
-rw-r--r--post/ether.c27
-rw-r--r--post/uart.c53
2 files changed, 30 insertions, 50 deletions
diff --git a/post/ether.c b/post/ether.c
index 47aa3526b8f..660620e8f62 100644
--- a/post/ether.c
+++ b/post/ether.c
@@ -49,6 +49,7 @@
#include <command.h>
#include <net.h>
+#include <serial.h>
#define MIN_PACKET_LENGTH 64
#define MAX_PACKET_LENGTH 256
@@ -77,8 +78,6 @@ static struct {
static char *ctlr_name[1] = { "SCC" };
-static int used_by_uart[1] = { -1 };
-
/* Ethernet Transmit and Receive Buffers */
#define DBUF_LENGTH 1520
@@ -458,6 +457,7 @@ static void scc_halt (int scc_index)
immr->im_cpm.cp_scc[scc_index].scc_gsmrl &=
~(SCC_GSMRL_ENR | SCC_GSMRL_ENT);
+ immr->im_ioport.iop_pcso &= ~(PC_ENET_CLSN | PC_ENET_RENA);
}
static int scc_send (int index, volatile void *packet, int length)
@@ -513,7 +513,7 @@ static int scc_recv (int index, void *packet, int max_length)
rxIdx++;
}
- Done:
+Done:
return length;
}
@@ -579,16 +579,10 @@ static int test_ctlr (int ctlr, int index)
res = 0;
- Done:
+Done:
ctlr_proc[ctlr].halt (index);
-#if !defined(CONFIG_8xx_CONS_NONE)
- if (used_by_uart[ctlr] == index) {
- serial_init ();
- }
-#endif
-
/*
* SCC2 Ethernet parameter RAM space overlaps
* the SPI parameter RAM space. So we need to restore
@@ -614,16 +608,6 @@ int ether_post_test (int flags)
int res = 0;
int i;
-#if defined(CONFIG_8xx_CONS_SCC1)
- used_by_uart[CTLR_SCC] = 0;
-#elif defined(CONFIG_8xx_CONS_SCC2)
- used_by_uart[CTLR_SCC] = 1;
-#elif defined(CONFIG_8xx_CONS_SCC3)
- used_by_uart[CTLR_SCC] = 2;
-#elif defined(CONFIG_8xx_CONS_SCC4)
- used_by_uart[CTLR_SCC] = 3;
-#endif
-
ctlr_proc[CTLR_SCC].init = scc_init;
ctlr_proc[CTLR_SCC].halt = scc_halt;
ctlr_proc[CTLR_SCC].send = scc_send;
@@ -635,6 +619,9 @@ int ether_post_test (int flags)
}
}
+#if !defined(CONFIG_8xx_CONS_NONE)
+ serial_reinit_all ();
+#endif
return res;
}
diff --git a/post/uart.c b/post/uart.c
index f6936ca7fcd..23bf036ba48 100644
--- a/post/uart.c
+++ b/post/uart.c
@@ -48,7 +48,7 @@
#error "Apparently a bad configuration, please fix."
#endif
#include <command.h>
-#include <net.h>
+#include <serial.h>
#define CTLR_SMC 0
#define CTLR_SCC 1
@@ -65,14 +65,13 @@ static int ctlr_list[][2] = { };
static struct {
void (*init) (int index);
+ void (*halt) (int index);
void (*putc) (int index, const char c);
int (*getc) (int index);
} ctlr_proc[2];
static char *ctlr_name[2] = { "SMC", "SCC" };
-static int used_by_uart[2] = { -1, -1 };
-
static int proff_smc[] = { PROFF_SMC1, PROFF_SMC2 };
static int proff_scc[] =
{ PROFF_SCC1, PROFF_SCC2, PROFF_SCC3, PROFF_SCC4 };
@@ -212,6 +211,10 @@ static void smc_init (int smc_index)
sp->smc_smcmr |= SMCMR_REN | SMCMR_TEN;
}
+static void smc_halt(int smc_index)
+{
+}
+
static void smc_putc (int smc_index, const char c)
{
volatile cbd_t *tbdf;
@@ -419,6 +422,15 @@ static void scc_init (int scc_index)
sp->scc_gsmrl |= (SCC_GSMRL_ENR | SCC_GSMRL_ENT);
}
+static void scc_halt(int scc_index)
+{
+ volatile immap_t *im = (immap_t *) CFG_IMMR;
+ volatile cpm8xx_t *cp = &(im->im_cpm);
+ volatile scc_t *sp = (scc_t *) & (cp->cp_scc[scc_index]);
+
+ sp->scc_gsmrl &= ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT | SCC_GSMRL_DIAG_LE);
+}
+
static void scc_putc (int scc_index, const char c)
{
volatile cbd_t *tbdf;
@@ -496,12 +508,6 @@ static int test_ctlr (int ctlr, int index)
char test_str[] = "*** UART Test String ***\r\n";
int i;
-#if !defined(CONFIG_8xx_CONS_NONE)
- if (used_by_uart[ctlr] == index) {
- while (ctlr_proc[ctlr].getc (index) != -1);
- }
-#endif
-
ctlr_proc[ctlr].init (index);
for (i = 0; i < sizeof (test_str) - 1; i++) {
@@ -512,13 +518,8 @@ static int test_ctlr (int ctlr, int index)
res = 0;
- Done:
-
-#if !defined(CONFIG_8xx_CONS_NONE)
- if (used_by_uart[ctlr] == index) {
- serial_init ();
- }
-#endif
+Done:
+ ctlr_proc[ctlr].halt (index);
if (res != 0) {
post_log ("uart %s%d test failed\n",
@@ -533,25 +534,13 @@ int uart_post_test (int flags)
int res = 0;
int i;
-#if defined(CONFIG_8xx_CONS_SMC1)
- used_by_uart[CTLR_SMC] = 0;
-#elif defined(CONFIG_8xx_CONS_SMC2)
- used_by_uart[CTLR_SMC] = 1;
-#elif defined(CONFIG_8xx_CONS_SCC1)
- used_by_uart[CTLR_SCC] = 0;
-#elif defined(CONFIG_8xx_CONS_SCC2)
- used_by_uart[CTLR_SCC] = 1;
-#elif defined(CONFIG_8xx_CONS_SCC3)
- used_by_uart[CTLR_SCC] = 2;
-#elif defined(CONFIG_8xx_CONS_SCC4)
- used_by_uart[CTLR_SCC] = 3;
-#endif
-
ctlr_proc[CTLR_SMC].init = smc_init;
+ ctlr_proc[CTLR_SMC].halt = smc_halt;
ctlr_proc[CTLR_SMC].putc = smc_putc;
ctlr_proc[CTLR_SMC].getc = smc_getc;
ctlr_proc[CTLR_SCC].init = scc_init;
+ ctlr_proc[CTLR_SCC].halt = scc_halt;
ctlr_proc[CTLR_SCC].putc = scc_putc;
ctlr_proc[CTLR_SCC].getc = scc_getc;
@@ -561,6 +550,10 @@ int uart_post_test (int flags)
}
}
+#if !defined(CONFIG_8xx_CONS_NONE)
+ serial_reinit_all ();
+#endif
+
return res;
}