summaryrefslogtreecommitdiff
path: root/cpu/mpc8xx/spi.c
diff options
context:
space:
mode:
authorwdenk <wdenk>2004-01-20 23:12:12 +0000
committerwdenk <wdenk>2004-01-20 23:12:12 +0000
commitc837dcb1a316745092567bfe4fb266d0941884ff (patch)
tree8b275e8c982d1b0a411ff33c08c86cd3d343eed6 /cpu/mpc8xx/spi.c
parentb0aef11c9f1f98d018adaa484f1e048fa626801e (diff)
downloadu-boot-imx-c837dcb1a316745092567bfe4fb266d0941884ff.zip
u-boot-imx-c837dcb1a316745092567bfe4fb266d0941884ff.tar.gz
u-boot-imx-c837dcb1a316745092567bfe4fb266d0941884ff.tar.bz2
* The PS/2 mux on the BMS2003 board needs 450 ms after power on
before we can access it; add delay in case we are faster (with no CF card inserted) * Cleanup of some init functions * Make sure SCC Ethernet is always stopped by the time we boot Linux to avoid Linux crashes by early packets coming in. * Accelerate flash accesses on LWMON board by using buffered writes
Diffstat (limited to 'cpu/mpc8xx/spi.c')
-rw-r--r--cpu/mpc8xx/spi.c41
1 files changed, 15 insertions, 26 deletions
diff --git a/cpu/mpc8xx/spi.c b/cpu/mpc8xx/spi.c
index 16b3f3a..5d75207 100644
--- a/cpu/mpc8xx/spi.c
+++ b/cpu/mpc8xx/spi.c
@@ -503,8 +503,7 @@ static int packet_check (char * packet, int length)
char c = (char) length;
int i;
- for (i = 0; i < length; i++)
- {
+ for (i = 0; i < length; i++) {
if (packet[i] != c++) return -1;
}
@@ -513,37 +512,32 @@ static int packet_check (char * packet, int length)
int spi_post_test (int flags)
{
- DECLARE_GLOBAL_DATA_PTR;
-
int res = -1;
volatile immap_t *immr = (immap_t *) CFG_IMMR;
- volatile cpm8xx_t *cp = (cpm8xx_t *) &immr->im_cpm;
+ volatile cpm8xx_t *cp = (cpm8xx_t *) & immr->im_cpm;
int i;
int l;
- spi_init_f();
- spi_init_r();
+ spi_init_f ();
+ spi_init_r ();
cp->cp_spmode |= SPMODE_LOOP;
- for (i = 0; i < TEST_NUM; i++)
- {
- for (l = TEST_MIN_LENGTH; l <= TEST_MAX_LENGTH; l += 8)
- {
- packet_fill(txbuf, l);
+ for (i = 0; i < TEST_NUM; i++) {
+ for (l = TEST_MIN_LENGTH; l <= TEST_MAX_LENGTH; l += 8) {
+ packet_fill (txbuf, l);
- spi_xfer(l);
+ spi_xfer (l);
- if (packet_check(rxbuf, l) < 0)
- {
- goto Done;
+ if (packet_check (rxbuf, l) < 0) {
+ goto Done;
+ }
}
- }
}
res = 0;
- Done:
+ Done:
cp->cp_spmode &= ~SPMODE_LOOP;
@@ -554,16 +548,11 @@ int spi_post_test (int flags)
*/
#if defined(CONFIG_8xx_CONS_SCC2)
- serial_init();
+ serial_init ();
#endif
-#if defined(SCC_ENET) && (SCC_ENET == 1)
- eth_init(gd->bd);
-#endif
-
- if (res != 0)
- {
- post_log("SPI test failed\n");
+ if (res != 0) {
+ post_log ("SPI test failed\n");
}
return res;