projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of git://git.denx.de/u-boot-at91
[oweals/u-boot.git]
/
cpu
/
mpc8xx
/
serial.c
diff --git
a/cpu/mpc8xx/serial.c
b/cpu/mpc8xx/serial.c
index c8caa793d218a690135572104de43e45ea6ce8e4..bd90dcd3b0f46abe510f04ba9378502b338bfa28 100644
(file)
--- a/
cpu/mpc8xx/serial.c
+++ b/
cpu/mpc8xx/serial.c
@@
-70,12
+70,12
@@
static void serial_setdivisor(volatile cpm8xx_t *cp)
int divisor=(gd->cpu_clk + 8*gd->baudrate)/16/gd->baudrate;
if(divisor/16>0x1000) {
int divisor=(gd->cpu_clk + 8*gd->baudrate)/16/gd->baudrate;
if(divisor/16>0x1000) {
- /* bad divisor, assume 50M
h
z clock and 9600 baud */
+ /* bad divisor, assume 50M
H
z clock and 9600 baud */
divisor=(50*1000*1000 + 8*9600)/16/9600;
}
divisor=(50*1000*1000 + 8*9600)/16/9600;
}
-#ifdef C
FG
_BRGCLK_PRESCALE
- divisor /= C
FG
_BRGCLK_PRESCALE;
+#ifdef C
ONFIG_SYS
_BRGCLK_PRESCALE
+ divisor /= C
ONFIG_SYS
_BRGCLK_PRESCALE;
#endif
if(divisor<=0x1000) {
#endif
if(divisor<=0x1000) {
@@
-94,7
+94,7
@@
static void serial_setdivisor(volatile cpm8xx_t *cp)
static void smc_setbrg (void)
{
static void smc_setbrg (void)
{
- volatile immap_t *im = (immap_t *)C
FG
_IMMR;
+ volatile immap_t *im = (immap_t *)C
ONFIG_SYS
_IMMR;
volatile cpm8xx_t *cp = &(im->im_cpm);
/* Set up the baud rate generator.
volatile cpm8xx_t *cp = &(im->im_cpm);
/* Set up the baud rate generator.
@@
-110,7
+110,7
@@
static void smc_setbrg (void)
static int smc_init (void)
{
static int smc_init (void)
{
- volatile immap_t *im = (immap_t *)C
FG
_IMMR;
+ volatile immap_t *im = (immap_t *)C
ONFIG_SYS
_IMMR;
volatile smc_t *sp;
volatile smc_uart_t *up;
volatile cbd_t *tbdf, *rbdf;
volatile smc_t *sp;
volatile smc_uart_t *up;
volatile cbd_t *tbdf, *rbdf;
@@
-124,6
+124,12
@@
static int smc_init (void)
sp = (smc_t *) &(cp->cp_smc[SMC_INDEX]);
up = (smc_uart_t *) &cp->cp_dparam[PROFF_SMC];
sp = (smc_t *) &(cp->cp_smc[SMC_INDEX]);
up = (smc_uart_t *) &cp->cp_dparam[PROFF_SMC];
+#ifdef CONFIG_SYS_SMC_UCODE_PATCH
+ up = (smc_uart_t *) &cp->cp_dpmem[up->smc_rpbase];
+#else
+ /* Disable relocation */
+ up->smc_rpbase = 0;
+#endif
/* Disable transmitter/receiver.
*/
/* Disable transmitter/receiver.
*/
@@
-134,15
+140,15
@@
static int smc_init (void)
im->im_siu_conf.sc_sdcr = 1;
/* clear error conditions */
im->im_siu_conf.sc_sdcr = 1;
/* clear error conditions */
-#ifdef C
FG
_SDSR
- im->im_sdma.sdma_sdsr = C
FG
_SDSR;
+#ifdef C
ONFIG_SYS
_SDSR
+ im->im_sdma.sdma_sdsr = C
ONFIG_SYS
_SDSR;
#else
im->im_sdma.sdma_sdsr = 0x83;
#endif
/* clear SDMA interrupt mask */
#else
im->im_sdma.sdma_sdsr = 0x83;
#endif
/* clear SDMA interrupt mask */
-#ifdef C
FG
_SDMR
- im->im_sdma.sdma_sdmr = C
FG
_SDMR;
+#ifdef C
ONFIG_SYS
_SDMR
+ im->im_sdma.sdma_sdmr = C
ONFIG_SYS
_SDMR;
#else
im->im_sdma.sdma_sdmr = 0x00;
#endif
#else
im->im_sdma.sdma_sdmr = 0x00;
#endif
@@
-187,7
+193,7
@@
static int smc_init (void)
* the buffer descriptors.
*/
* the buffer descriptors.
*/
-#ifdef C
FG
_ALLOC_DPRAM
+#ifdef C
ONFIG_SYS
_ALLOC_DPRAM
dpaddr = dpram_alloc_align (sizeof(cbd_t)*2 + 2, 8) ;
#else
dpaddr = CPM_SERIAL_BASE ;
dpaddr = dpram_alloc_align (sizeof(cbd_t)*2 + 2, 8) ;
#else
dpaddr = CPM_SERIAL_BASE ;
@@
-212,6
+218,12
@@
static int smc_init (void)
up->smc_tbase = dpaddr+sizeof(cbd_t);
up->smc_rfcr = SMC_EB;
up->smc_tfcr = SMC_EB;
up->smc_tbase = dpaddr+sizeof(cbd_t);
up->smc_rfcr = SMC_EB;
up->smc_tfcr = SMC_EB;
+#if defined (CONFIG_SYS_SMC_UCODE_PATCH)
+ up->smc_rbptr = up->smc_rbase;
+ up->smc_tbptr = up->smc_tbase;
+ up->smc_rstate = 0;
+ up->smc_tstate = 0;
+#endif
#if defined(CONFIG_MBX)
board_serial_init();
#if defined(CONFIG_MBX)
board_serial_init();
@@
-227,17
+239,16
@@
static int smc_init (void)
sp->smc_smcm = 0;
sp->smc_smce = 0xff;
sp->smc_smcm = 0;
sp->smc_smce = 0xff;
-#ifdef C
FG
_SPC1920_SMC1_CLK4
+#ifdef C
ONFIG_SYS
_SPC1920_SMC1_CLK4
/* clock source is PLD */
/* clock source is PLD */
-
+
/* set freq to 19200 Baud */
/* set freq to 19200 Baud */
- *((volatile uchar *) C
FG
_SPC1920_PLD_BASE+6) = 0x3;
+ *((volatile uchar *) C
ONFIG_SYS
_SPC1920_PLD_BASE+6) = 0x3;
/* configure clk4 as input */
im->im_ioport.iop_pdpar |= 0x800;
im->im_ioport.iop_pddir &= ~0x800;
/* configure clk4 as input */
im->im_ioport.iop_pdpar |= 0x800;
im->im_ioport.iop_pddir &= ~0x800;
-
- cp->cp_simode = 0x0000;
- cp->cp_simode |= 0x7000;
+
+ cp->cp_simode = ((cp->cp_simode & ~0xf000) | 0x7000);
#else
/* Set up the baud rate generator */
smc_setbrg ();
#else
/* Set up the baud rate generator */
smc_setbrg ();
@@
-277,7
+288,7
@@
smc_putc(const char c)
volatile cbd_t *tbdf;
volatile char *buf;
volatile smc_uart_t *up;
volatile cbd_t *tbdf;
volatile char *buf;
volatile smc_uart_t *up;
- volatile immap_t *im = (immap_t *)C
FG
_IMMR;
+ volatile immap_t *im = (immap_t *)C
ONFIG_SYS
_IMMR;
volatile cpm8xx_t *cpmp = &(im->im_cpm);
#ifdef CONFIG_MODEM_SUPPORT
volatile cpm8xx_t *cpmp = &(im->im_cpm);
#ifdef CONFIG_MODEM_SUPPORT
@@
-289,6
+300,9
@@
smc_putc(const char c)
smc_putc ('\r');
up = (smc_uart_t *)&cpmp->cp_dparam[PROFF_SMC];
smc_putc ('\r');
up = (smc_uart_t *)&cpmp->cp_dparam[PROFF_SMC];
+#ifdef CONFIG_SYS_SMC_UCODE_PATCH
+ up = (smc_uart_t *) &cpmp->cp_dpmem[up->smc_rpbase];
+#endif
tbdf = (cbd_t *)&cpmp->cp_dpmem[up->smc_tbase];
tbdf = (cbd_t *)&cpmp->cp_dpmem[up->smc_tbase];
@@
-322,11
+336,14
@@
smc_getc(void)
volatile cbd_t *rbdf;
volatile unsigned char *buf;
volatile smc_uart_t *up;
volatile cbd_t *rbdf;
volatile unsigned char *buf;
volatile smc_uart_t *up;
- volatile immap_t *im = (immap_t *)C
FG
_IMMR;
+ volatile immap_t *im = (immap_t *)C
ONFIG_SYS
_IMMR;
volatile cpm8xx_t *cpmp = &(im->im_cpm);
unsigned char c;
up = (smc_uart_t *)&cpmp->cp_dparam[PROFF_SMC];
volatile cpm8xx_t *cpmp = &(im->im_cpm);
unsigned char c;
up = (smc_uart_t *)&cpmp->cp_dparam[PROFF_SMC];
+#ifdef CONFIG_SYS_SMC_UCODE_PATCH
+ up = (smc_uart_t *) &cpmp->cp_dpmem[up->smc_rpbase];
+#endif
rbdf = (cbd_t *)&cpmp->cp_dpmem[up->smc_rbase];
rbdf = (cbd_t *)&cpmp->cp_dpmem[up->smc_rbase];
@@
-348,10
+365,13
@@
smc_tstc(void)
{
volatile cbd_t *rbdf;
volatile smc_uart_t *up;
{
volatile cbd_t *rbdf;
volatile smc_uart_t *up;
- volatile immap_t *im = (immap_t *)C
FG
_IMMR;
+ volatile immap_t *im = (immap_t *)C
ONFIG_SYS
_IMMR;
volatile cpm8xx_t *cpmp = &(im->im_cpm);
up = (smc_uart_t *)&cpmp->cp_dparam[PROFF_SMC];
volatile cpm8xx_t *cpmp = &(im->im_cpm);
up = (smc_uart_t *)&cpmp->cp_dparam[PROFF_SMC];
+#ifdef CONFIG_SYS_SMC_UCODE_PATCH
+ up = (smc_uart_t *) &cpmp->cp_dpmem[up->smc_rpbase];
+#endif
rbdf = (cbd_t *)&cpmp->cp_dpmem[up->smc_rbase];
rbdf = (cbd_t *)&cpmp->cp_dpmem[up->smc_rbase];
@@
-378,7
+398,7
@@
struct serial_device serial_smc_device =
static void
scc_setbrg (void)
{
static void
scc_setbrg (void)
{
- volatile immap_t *im = (immap_t *)C
FG
_IMMR;
+ volatile immap_t *im = (immap_t *)C
ONFIG_SYS
_IMMR;
volatile cpm8xx_t *cp = &(im->im_cpm);
/* Set up the baud rate generator.
volatile cpm8xx_t *cp = &(im->im_cpm);
/* Set up the baud rate generator.
@@
-394,7
+414,7
@@
scc_setbrg (void)
static int scc_init (void)
{
static int scc_init (void)
{
- volatile immap_t *im = (immap_t *)C
FG
_IMMR;
+ volatile immap_t *im = (immap_t *)C
ONFIG_SYS
_IMMR;
volatile scc_t *sp;
volatile scc_uart_t *up;
volatile cbd_t *tbdf, *rbdf;
volatile scc_t *sp;
volatile scc_uart_t *up;
volatile cbd_t *tbdf, *rbdf;
@@
-454,7
+474,7
@@
static int scc_init (void)
/* Allocate space for two buffer descriptors in the DP ram.
*/
/* Allocate space for two buffer descriptors in the DP ram.
*/
-#ifdef C
FG
_ALLOC_DPRAM
+#ifdef C
ONFIG_SYS
_ALLOC_DPRAM
dpaddr = dpram_alloc_align (sizeof(cbd_t)*2 + 2, 8) ;
#else
dpaddr = CPM_SERIAL2_BASE ;
dpaddr = dpram_alloc_align (sizeof(cbd_t)*2 + 2, 8) ;
#else
dpaddr = CPM_SERIAL2_BASE ;
@@
-560,7
+580,7
@@
scc_putc(const char c)
volatile cbd_t *tbdf;
volatile char *buf;
volatile scc_uart_t *up;
volatile cbd_t *tbdf;
volatile char *buf;
volatile scc_uart_t *up;
- volatile immap_t *im = (immap_t *)C
FG
_IMMR;
+ volatile immap_t *im = (immap_t *)C
ONFIG_SYS
_IMMR;
volatile cpm8xx_t *cpmp = &(im->im_cpm);
#ifdef CONFIG_MODEM_SUPPORT
volatile cpm8xx_t *cpmp = &(im->im_cpm);
#ifdef CONFIG_MODEM_SUPPORT
@@
-605,7
+625,7
@@
scc_getc(void)
volatile cbd_t *rbdf;
volatile unsigned char *buf;
volatile scc_uart_t *up;
volatile cbd_t *rbdf;
volatile unsigned char *buf;
volatile scc_uart_t *up;
- volatile immap_t *im = (immap_t *)C
FG
_IMMR;
+ volatile immap_t *im = (immap_t *)C
ONFIG_SYS
_IMMR;
volatile cpm8xx_t *cpmp = &(im->im_cpm);
unsigned char c;
volatile cpm8xx_t *cpmp = &(im->im_cpm);
unsigned char c;
@@
-631,7
+651,7
@@
scc_tstc(void)
{
volatile cbd_t *rbdf;
volatile scc_uart_t *up;
{
volatile cbd_t *rbdf;
volatile scc_uart_t *up;
- volatile immap_t *im = (immap_t *)C
FG
_IMMR;
+ volatile immap_t *im = (immap_t *)C
ONFIG_SYS
_IMMR;
volatile cpm8xx_t *cpmp = &(im->im_cpm);
up = (scc_uart_t *)&cpmp->cp_dparam[PROFF_SCC];
volatile cpm8xx_t *cpmp = &(im->im_cpm);
up = (scc_uart_t *)&cpmp->cp_dparam[PROFF_SCC];
@@
-667,7
+687,7
@@
void enable_putc(void)
}
#endif
}
#endif
-#if
(CONFIG_COMMANDS & CF
G_CMD_KGDB)
+#if
defined(CONFI
G_CMD_KGDB)
void
kgdb_serial_init(void)
void
kgdb_serial_init(void)
@@
-724,6
+744,6
@@
kgdb_interruptible (int yes)
{
return;
}
{
return;
}
-#endif
/* CFG_CMD_KGDB */
+#endif
#endif /* CONFIG_8xx_CONS_NONE */
#endif /* CONFIG_8xx_CONS_NONE */