All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH/review] Blackfin: make baud calculation more accurate
@ 2008-04-09  6:06 Mike Frysinger
  2008-04-09  6:06 ` [U-Boot-Users] [PATCH/review] Blackfin: fix up UART status bit handling Mike Frysinger
  2008-04-20  6:36 ` [U-Boot-Users] [PATCH/review] Blackfin: make baud calculation more accurate Wolfgang Denk
  0 siblings, 2 replies; 5+ messages in thread
From: Mike Frysinger @ 2008-04-09  6:06 UTC (permalink / raw)
  To: u-boot

We should use the algorithm in the Linux kernel so that the UART divisor
calculation is more accurate.  It also fixes problems on some picky UARTs
that have sampling anomalies.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 cpu/blackfin/serial.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/cpu/blackfin/serial.h b/cpu/blackfin/serial.h
index 1f0f4b4..d268da5 100644
--- a/cpu/blackfin/serial.h
+++ b/cpu/blackfin/serial.h
@@ -179,7 +179,7 @@ static inline void serial_early_set_baud(uint32_t baud)
 	 * The +1 is to make sure we over sample just a little
 	 * rather than under sample the incoming signals.
 	 */
-	uint16_t divisor = (get_sclk() / (baud * 16)) + 1;
+	uint16_t divisor = (get_sclk() + (baud * 8)) / (baud * 16);
 
 	/* Set DLAB in LCR to Access DLL and DLH */
 	ACCESS_LATCH();
-- 
1.5.4.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-04-20  7:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-09  6:06 [U-Boot-Users] [PATCH/review] Blackfin: make baud calculation more accurate Mike Frysinger
2008-04-09  6:06 ` [U-Boot-Users] [PATCH/review] Blackfin: fix up UART status bit handling Mike Frysinger
2008-04-20  6:36   ` Wolfgang Denk
2008-04-20  7:08     ` Mike Frysinger
2008-04-20  6:36 ` [U-Boot-Users] [PATCH/review] Blackfin: make baud calculation more accurate Wolfgang Denk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.