projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Cleanup: fix "MHz" spelling
[oweals/u-boot.git]
/
cpu
/
mpc8xx
/
spi.c
diff --git
a/cpu/mpc8xx/spi.c
b/cpu/mpc8xx/spi.c
index 16b3f3a957fec0d2a4b53711a6d14a4ff88e0135..b2ac23e5ea4b9bc140ee49c45381fc042108f56f 100644
(file)
--- a/
cpu/mpc8xx/spi.c
+++ b/
cpu/mpc8xx/spi.c
@@
-39,9
+39,9
@@
#include <linux/ctype.h>
#include <malloc.h>
#include <post.h>
#include <linux/ctype.h>
#include <malloc.h>
#include <post.h>
-#include <
net
.h>
+#include <
serial
.h>
-#if (defined(CONFIG_SPI)) || (CONFIG_POST & C
FG
_POST_SPI)
+#if (defined(CONFIG_SPI)) || (CONFIG_POST & C
ONFIG_SYS
_POST_SPI)
/* Warning:
* You cannot enable DEBUG for early system initalization, i. e. when
/* Warning:
* You cannot enable DEBUG for early system initalization, i. e. when
@@
-64,8
+64,8
@@
* The value 0xb00 makes it far enough from the start of the data
* area (as well as from the stack pointer).
* --------------------------------------------------------------- */
* The value 0xb00 makes it far enough from the start of the data
* area (as well as from the stack pointer).
* --------------------------------------------------------------- */
-#ifndef C
FG
_SPI_INIT_OFFSET
-#define C
FG_SPI_INIT_OFFSET
0xB00
+#ifndef C
ONFIG_SYS
_SPI_INIT_OFFSET
+#define C
ONFIG_SYS_SPI_INIT_OFFSET
0xB00
#endif
#ifdef DEBUG
#endif
#ifdef DEBUG
@@
-118,11
+118,11
@@
ssize_t spi_xfer (size_t);
* Initially we place the RX and TX buffers at a fixed location in DPRAM!
* ---------------------------------------------------------------------- */
static uchar *rxbuf =
* Initially we place the RX and TX buffers at a fixed location in DPRAM!
* ---------------------------------------------------------------------- */
static uchar *rxbuf =
- (uchar *)&((cpm8xx_t *)&((immap_t *)C
FG
_IMMR)->im_cpm)->cp_dpmem
- [C
FG
_SPI_INIT_OFFSET];
+ (uchar *)&((cpm8xx_t *)&((immap_t *)C
ONFIG_SYS
_IMMR)->im_cpm)->cp_dpmem
+ [C
ONFIG_SYS
_SPI_INIT_OFFSET];
static uchar *txbuf =
static uchar *txbuf =
- (uchar *)&((cpm8xx_t *)&((immap_t *)C
FG
_IMMR)->im_cpm)->cp_dpmem
- [C
FG
_SPI_INIT_OFFSET+MAX_BUFFER];
+ (uchar *)&((cpm8xx_t *)&((immap_t *)C
ONFIG_SYS
_IMMR)->im_cpm)->cp_dpmem
+ [C
ONFIG_SYS
_SPI_INIT_OFFSET+MAX_BUFFER];
/* **************************************************************************
*
/* **************************************************************************
*
@@
-144,12
+144,12
@@
void spi_init_f (void)
volatile iop8xx_t *iop;
volatile cbd_t *tbdf, *rbdf;
volatile iop8xx_t *iop;
volatile cbd_t *tbdf, *rbdf;
- immr = (immap_t *) C
FG
_IMMR;
+ immr = (immap_t *) C
ONFIG_SYS
_IMMR;
cpi = (cpic8xx_t *)&immr->im_cpic;
iop = (iop8xx_t *) &immr->im_ioport;
cp = (cpm8xx_t *) &immr->im_cpm;
cpi = (cpic8xx_t *)&immr->im_cpic;
iop = (iop8xx_t *) &immr->im_ioport;
cp = (cpm8xx_t *) &immr->im_cpm;
-#ifdef C
FG
_SPI_UCODE_PATCH
+#ifdef C
ONFIG_SYS
_SPI_UCODE_PATCH
spi = (spi_t *)&cp->cp_dpmem[spi->spi_rpbase];
#else
spi = (spi_t *)&cp->cp_dparam[PROFF_SPI];
spi = (spi_t *)&cp->cp_dpmem[spi->spi_rpbase];
#else
spi = (spi_t *)&cp->cp_dparam[PROFF_SPI];
@@
-210,7
+210,7
@@
void spi_init_f (void)
/* Allocate space for one transmit and one receive buffer
* descriptor in the DP ram
*/
/* Allocate space for one transmit and one receive buffer
* descriptor in the DP ram
*/
-#ifdef C
FG
_ALLOC_DPRAM
+#ifdef C
ONFIG_SYS
_ALLOC_DPRAM
dpaddr = dpram_alloc_align (sizeof(cbd_t)*2, 8);
#else
dpaddr = CPM_SPI_BASE;
dpaddr = dpram_alloc_align (sizeof(cbd_t)*2, 8);
#else
dpaddr = CPM_SPI_BASE;
@@
-234,7
+234,7
@@
void spi_init_f (void)
spi->spi_tbptr = spi->spi_tbase;
/* 4 */
spi->spi_tbptr = spi->spi_tbase;
/* 4 */
-#ifdef C
FG
_SPI_UCODE_PATCH
+#ifdef C
ONFIG_SYS
_SPI_UCODE_PATCH
/*
* Initialize required parameters if using microcode patch.
*/
/*
* Initialize required parameters if using microcode patch.
*/
@@
-247,7
+247,7
@@
void spi_init_f (void)
cp->cp_cpcr = mk_cr_cmd(CPM_CR_CH_SPI, CPM_CR_INIT_TRX) | CPM_CR_FLG;
while (cp->cp_cpcr & CPM_CR_FLG)
;
cp->cp_cpcr = mk_cr_cmd(CPM_CR_CH_SPI, CPM_CR_INIT_TRX) | CPM_CR_FLG;
while (cp->cp_cpcr & CPM_CR_FLG)
;
-#endif /* C
FG
_SPI_UCODE_PATCH */
+#endif /* C
ONFIG_SYS
_SPI_UCODE_PATCH */
/* 5 */
/* Set SDMA configuration register */
/* 5 */
/* Set SDMA configuration register */
@@
-299,10
+299,10
@@
void spi_init_r (void)
volatile immap_t *immr;
volatile cbd_t *tbdf, *rbdf;
volatile immap_t *immr;
volatile cbd_t *tbdf, *rbdf;
- immr = (immap_t *) C
FG
_IMMR;
+ immr = (immap_t *) C
ONFIG_SYS
_IMMR;
cp = (cpm8xx_t *) &immr->im_cpm;
cp = (cpm8xx_t *) &immr->im_cpm;
-#ifdef C
FG
_SPI_UCODE_PATCH
+#ifdef C
ONFIG_SYS
_SPI_UCODE_PATCH
spi = (spi_t *)&cp->cp_dpmem[spi->spi_rpbase];
#else
spi = (spi_t *)&cp->cp_dparam[PROFF_SPI];
spi = (spi_t *)&cp->cp_dpmem[spi->spi_rpbase];
#else
spi = (spi_t *)&cp->cp_dparam[PROFF_SPI];
@@
-392,10
+392,10
@@
ssize_t spi_xfer (size_t count)
DPRINT (("*** spi_xfer entered ***\n"));
DPRINT (("*** spi_xfer entered ***\n"));
- immr = (immap_t *) C
FG
_IMMR;
+ immr = (immap_t *) C
ONFIG_SYS
_IMMR;
cp = (cpm8xx_t *) &immr->im_cpm;
cp = (cpm8xx_t *) &immr->im_cpm;
-#ifdef C
FG
_SPI_UCODE_PATCH
+#ifdef C
ONFIG_SYS
_SPI_UCODE_PATCH
spi = (spi_t *)&cp->cp_dpmem[spi->spi_rpbase];
#else
spi = (spi_t *)&cp->cp_dparam[PROFF_SPI];
spi = (spi_t *)&cp->cp_dpmem[spi->spi_rpbase];
#else
spi = (spi_t *)&cp->cp_dparam[PROFF_SPI];
@@
-468,7
+468,7
@@
ssize_t spi_xfer (size_t count)
return count;
}
return count;
}
-#endif /* CONFIG_SPI || (CONFIG_POST & C
FG
_POST_SPI) */
+#endif /* CONFIG_SPI || (CONFIG_POST & C
ONFIG_SYS
_POST_SPI) */
/*
* SPI test
/*
* SPI test
@@
-481,7
+481,7
@@
ssize_t spi_xfer (size_t count)
* TEST_NUM - number of tests
*/
* TEST_NUM - number of tests
*/
-#if CONFIG_POST & C
FG
_POST_SPI
+#if CONFIG_POST & C
ONFIG_SYS
_POST_SPI
#define TEST_MIN_LENGTH 1
#define TEST_MAX_LENGTH MAX_BUFFER
#define TEST_MIN_LENGTH 1
#define TEST_MAX_LENGTH MAX_BUFFER
@@
-503,8
+503,7
@@
static int packet_check (char * packet, int length)
char c = (char) length;
int i;
char c = (char) length;
int i;
- for (i = 0; i < length; i++)
- {
+ for (i = 0; i < length; i++) {
if (packet[i] != c++) return -1;
}
if (packet[i] != c++) return -1;
}
@@
-513,59
+512,49
@@
static int packet_check (char * packet, int length)
int spi_post_test (int flags)
{
int spi_post_test (int flags)
{
- DECLARE_GLOBAL_DATA_PTR;
-
int res = -1;
int res = -1;
- volatile immap_t *immr = (immap_t *) C
FG
_IMMR;
- volatile cpm8xx_t *cp = (cpm8xx_t *) &immr->im_cpm;
+ volatile immap_t *immr = (immap_t *) C
ONFIG_SYS
_IMMR;
+ volatile cpm8xx_t *cp = (cpm8xx_t *) &
immr->im_cpm;
int i;
int l;
int i;
int l;
- spi_init_f();
- spi_init_r();
+ spi_init_f
();
+ spi_init_r
();
cp->cp_spmode |= SPMODE_LOOP;
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 ((char *)txbuf, l);
-
spi_xfer
(l);
+
spi_xfer
(l);
- if (packet_check(rxbuf, l) < 0)
- {
- goto Done;
+ if (packet_check ((char *)rxbuf, l) < 0) {
+ goto Done;
+ }
}
}
- }
}
res = 0;
}
res = 0;
-
Done:
+ Done:
cp->cp_spmode &= ~SPMODE_LOOP;
/*
cp->cp_spmode &= ~SPMODE_LOOP;
/*
- * SCC2
Ethernet
parameter RAM space overlaps
+ * SCC2 parameter RAM space overlaps
* the SPI parameter RAM space. So we need to restore
* the SPI parameter RAM space. So we need to restore
- * the SCC2 configuration if it is used by UART
or Ethernet
.
+ * the SCC2 configuration if it is used by UART.
*/
*/
-#if
defined(CONFIG_8xx_CONS_SCC2
)
- serial_
init
();
+#if
!defined(CONFIG_8xx_CONS_NONE
)
+ serial_
reinit_all
();
#endif
#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;
}
}
return res;
}
-#endif /* CONFIG_POST & C
FG
_POST_SPI */
+#endif /* CONFIG_POST & C
ONFIG_SYS
_POST_SPI */