aboutsummaryrefslogtreecommitdiff
path: root/cpu/mpc8xx/spi.c
diff options
context:
space:
mode:
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 16b3f3a957f..5d752077339 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;