From: Esben Haabendal <eha@doredevelopment.dk>
To: Scott Wood <scottwood@freescale.com>,
LinuxPPC-dev <linuxppc-dev@ozlabs.org>
Subject: [PATCH] cpm: rounding of brg clockdivider
Date: Tue, 2 Oct 2007 09:24:03 +0200 [thread overview]
Message-ID: <9edac4e26b9461b125012c7e025c847f@127.0.0.1> (raw)
Do rounding of brg clockdivider instead of truncate to get more precise baudrates
Something similar might be needed for cpm_fastbrg...
---
commit 52d631eb8f64cef794d6aa66494e253cf268894e
tree 956149a0eb5beb9afb280f4593615929eab7b779
parent 300070dd6b5e71af0c6fbecd32388905dbdd3ea5
author Esben Haabendal <eha@doredevelopment.dk> Wed, 19 Sep 2007 13:18:59 +0200
committer Esben Haabendal <esben@esben.doredevelopment.dk> Wed, 19 Sep 2007 13:18:59 +0200
arch/powerpc/sysdev/cpm2_common.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/arch/powerpc/sysdev/cpm2_common.c b/arch/powerpc/sysdev/cpm2_common.c
index 9058da2..a2c8157 100644
--- a/arch/powerpc/sysdev/cpm2_common.c
+++ b/arch/powerpc/sysdev/cpm2_common.c
@@ -102,7 +102,9 @@ cpm_setbrg(uint brg, uint rate)
brg -= 4;
}
bp += brg;
- out_be32(bp, (((BRG_UART_CLK / rate) - 1) << 1) | CPM_BRG_EN);
+ /* Set the BRG clock divider to get the best match to the requested
+ * baudrate (rounding required) */
+ out_be32(bp, ((((((BRG_UART_CLK*2)/rate)+1)/2)-1) << 1) | CPM_BRG_EN);
cpm2_unmap(bp);
}
!-------------------------------------------------------------flip-
--
Esben Haabendal
Embedded Software Consultant
Doré Development ApS
next reply other threads:[~2007-10-02 7:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-02 7:24 Esben Haabendal [this message]
2007-10-02 15:46 ` [PATCH] cpm: rounding of brg clockdivider Scott Wood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9edac4e26b9461b125012c7e025c847f@127.0.0.1 \
--to=eha@doredevelopment.dk \
--cc=linuxppc-dev@ozlabs.org \
--cc=scottwood@freescale.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).