summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2008-04-20 03:11:53 -0400
committerMike Frysinger <vapier@gentoo.org>2008-10-23 05:03:51 -0400
commit25cd33d82ea521b7bd90ca858f8919fae1e9732b (patch)
treeb0143468ab8081f8a1c5ca8bfb4cdc077f20f395
parent0ba1da116e5edcb0c5ae4a7585d73f6548400a06 (diff)
downloadu-boot-imx-25cd33d82ea521b7bd90ca858f8919fae1e9732b.zip
u-boot-imx-25cd33d82ea521b7bd90ca858f8919fae1e9732b.tar.gz
u-boot-imx-25cd33d82ea521b7bd90ca858f8919fae1e9732b.tar.bz2
Blackfin: make baud calculation more accurate
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>
-rw-r--r--cpu/blackfin/serial.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/cpu/blackfin/serial.h b/cpu/blackfin/serial.h
index 1f0f4b4..ec40c26 100644
--- a/cpu/blackfin/serial.h
+++ b/cpu/blackfin/serial.h
@@ -175,11 +175,11 @@ static inline uint32_t serial_early_get_baud(void)
__attribute__((always_inline))
static inline void serial_early_set_baud(uint32_t baud)
{
- /* Translate from baud into divisor in terms of SCLK.
- * The +1 is to make sure we over sample just a little
- * rather than under sample the incoming signals.
+ /* Translate from baud into divisor in terms of SCLK. The
+ * weird multiplication 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) - ANOMALY_05000230;
/* Set DLAB in LCR to Access DLL and DLH */
ACCESS_LATCH();