Coldfire: Applied baudrate formula of serial_init to serial_setbrg
PATCH 6/7 Coldfire: Applied baudrate formula of serial_init to serial_setbrg
Applied the patch for baudrate divider value truncation for serial_init to serial_setbrg as well.
--- drivers/serial/mcfuart.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/serial/mcfuart.c +3 -2
@@ -115,8 +115,9 @@ void serial_setbrg(void)volatile uart_t *uart = (volatile uart_t *)(CONFIG_SYS_UART_BASE );u32 counter; - counter = ((gd->bus_clk / gd->baudrate)) >>5 ; - counter++; +/* Setting up BaudRate */ + counter = (u32) ((gd->bus_clk /32 ) + (gd->baudrate /2 )); + counter = counter / gd->baudrate;/* write to CTUR: divide counter upper byte */ uart->ubg1 = ((counter &0xff00 ) >>8 );
Signature · 1 line
1.5.6.5
PATCH 6/7 Coldfire: Applied baudrate formula of serial_init to serial_setbrg
M5271 dynamic clock multiplier. It is currently fixed at 100MHz.
Allow the board header file to set their own multiplier and divider. Added the #define for the multiplier and divider to the cpu header file.
---
Rebased on:
commit 9d8811c5bd2b7dd6307742cf22fbdb7953b6f816
Merge: 716ebf4... bd99ec1...
Author: Wolfgang Denk <[email protected]>
Date: Tue Feb 3 23:16:15 2009 +0100
cpu/mcf52x2/cpu_init.c | 7 +++++- include/asm-m68k/m5271.h | 53 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 57 insertions(+), 3 deletions(-)
cpu/mcf52x2/cpu_init.c +6 -1
@@ -181,9 +181,14 @@ void cpu_init_f(void)/* FlexBus Chipselect */ init_fbcs (); +#ifdef CONFIG_SYS_MCF_SYNCR +/* Set clockspeed according to board header file */ +mbar_writeLong (MCF_FMPLL_SYNCR ,CONFIG_SYS_MCF_SYNCR ); +#else /* Set clockspeed to 100MHz */ -mbar_writeShort (MCF_FMPLL_SYNCR , +mbar_writeLong (MCF_FMPLL_SYNCR ,MCF_FMPLL_SYNCR_MFD (0 ) |MCF_FMPLL_SYNCR_RFD (0 )); +#endif while (!mbar_readByte (MCF_FMPLL_SYNSR ) &MCF_FMPLL_SYNSR_LOCK ) ; }
include/asm-m68k/m5271.h +51 -2
76 lines not on this page · raw message
Signature · 1 line
1.5.6.5
PATCH v2 6/7 Coldfire: Applied baudrate formula of serial_init to serial_setbrg
Applied the patch for baudrate divider value truncation for serial_init to serial_setbrg as well.
---
PLEASE disregard previous rebase, that was a copy-paste error of another patch
Rebased on:
commit 9d8811c5bd2b7dd6307742cf22fbdb7953b6f816
Merge: 716ebf4... bd99ec1...
Author: Wolfgang Denk <[email protected]>
Date: Tue Feb 3 23:16:15 2009 +0100
drivers/serial/mcfuart.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/serial/mcfuart.c +3 -2
@@ -115,8 +115,9 @@ void serial_setbrg(void)volatile uart_t *uart = (volatile uart_t *)(CONFIG_SYS_UART_BASE );u32 counter; - counter = ((gd->bus_clk / gd->baudrate)) >>5 ; - counter++; +/* Setting up BaudRate */ + counter = (u32) ((gd->bus_clk /32 ) + (gd->baudrate /2 )); + counter = counter / gd->baudrate;/* write to CTUR: divide counter upper byte */ uart->ubg1 = ((counter &0xff00 ) >>8 );
Signature · 1 line
1.5.6.5