* [PATCH] sh-sci: fix SCBRR value calculation
@ 2009-04-14 4:34 Kuninori Morimoto
2009-04-14 5:37 ` yoshii.takashi
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Kuninori Morimoto @ 2009-04-14 4:34 UTC (permalink / raw)
To: linux-sh
Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
---
>> Iwamatsu-san
Please check this patch to make sure it doesn't break any boards.
I checked this patch by AP325 (for SCIFA)
and Diamond Head (for SCIF)
It works well
But I don't know about some strange Hitachi ULSI board with magical clock settings.
drivers/serial/sh-sci.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/serial/sh-sci.h b/drivers/serial/sh-sci.h
index d0aa82d..f8c0b87 100644
--- a/drivers/serial/sh-sci.h
+++ b/drivers/serial/sh-sci.h
@@ -761,9 +761,9 @@ static inline int sci_rxd_in(struct uart_port *port)
static inline int scbrr_calc(struct uart_port *port, int bps, int clk)
{
if (port->type = PORT_SCIF)
- return (clk+16*bps)/(32*bps)-1;
+ return (clk/(32*bps)) - 1;
else
- return ((clk*2)+16*bps)/(16*bps)-1;
+ return ((clk*2)/(16*bps)) - 1;
}
#define SCBRR_VALUE(bps, clk) scbrr_calc(port, bps, clk)
#elif defined(__H8300H__) || defined(__H8300S__)
--
1.5.6.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] sh-sci: fix SCBRR value calculation
2009-04-14 4:34 [PATCH] sh-sci: fix SCBRR value calculation Kuninori Morimoto
@ 2009-04-14 5:37 ` yoshii.takashi
2009-04-14 5:53 ` morimoto.kuninori
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: yoshii.takashi @ 2009-04-14 5:37 UTC (permalink / raw)
To: linux-sh
Please don't omit that term, that is for "round to near" operation.
round_to_near(clk/(32*bps)) -1
--> round_to_zero(clk/(32*bps) + 0.5) -1
--> (int)((clk+16*bps)/(32*bps)) -1
> - return (clk+16*bps)/(32*bps)-1;
> + return (clk/(32*bps)) - 1;
Former one is correct.
> - return ((clk*2)+16*bps)/(16*bps)-1;
> + return ((clk*2)/(16*bps)) - 1;
Both incorrect? Perhaps,
return ((clk*2)+8*bps)/(16*bps) - 1;
I don't have read 7723 HW manual, though.
/yoshii
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] sh-sci: fix SCBRR value calculation
2009-04-14 4:34 [PATCH] sh-sci: fix SCBRR value calculation Kuninori Morimoto
2009-04-14 5:37 ` yoshii.takashi
@ 2009-04-14 5:53 ` morimoto.kuninori
2009-04-22 0:36 ` Paul Mundt
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: morimoto.kuninori @ 2009-04-14 5:53 UTC (permalink / raw)
To: linux-sh
Dear yoshii
> Please don't omit that term, that is for "round to near" operation.
Ahhhhhh....
Now I could understand !!!
Sorry I didn't know that this calculation is "round to near" operation.
Best regards
--
Kuninori Morimoto
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] sh-sci: fix SCBRR value calculation
2009-04-14 4:34 [PATCH] sh-sci: fix SCBRR value calculation Kuninori Morimoto
2009-04-14 5:37 ` yoshii.takashi
2009-04-14 5:53 ` morimoto.kuninori
@ 2009-04-22 0:36 ` Paul Mundt
2009-04-22 2:50 ` Kuninori Morimoto
2009-04-22 2:55 ` Paul Mundt
4 siblings, 0 replies; 6+ messages in thread
From: Paul Mundt @ 2009-04-22 0:36 UTC (permalink / raw)
To: linux-sh
On Tue, Apr 14, 2009 at 02:53:13PM +0900, morimoto.kuninori@renesas.com wrote:
>
> Dear yoshii
>
> > Please don't omit that term, that is for "round to near" operation.
>
> Ahhhhhh....
> Now I could understand !!!
> Sorry I didn't know that this calculation is "round to near" operation.
>
Is there an updated patch forthcoming for this, or do we just leave SCBRR
as it is?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] sh-sci: fix SCBRR value calculation
2009-04-14 4:34 [PATCH] sh-sci: fix SCBRR value calculation Kuninori Morimoto
` (2 preceding siblings ...)
2009-04-22 0:36 ` Paul Mundt
@ 2009-04-22 2:50 ` Kuninori Morimoto
2009-04-22 2:55 ` Paul Mundt
4 siblings, 0 replies; 6+ messages in thread
From: Kuninori Morimoto @ 2009-04-22 2:50 UTC (permalink / raw)
To: linux-sh
Dear Paul
> > > Please don't omit that term, that is for "round to near" operation.
> >
> > Ahhhhhh....
> > Now I could understand !!!
> > Sorry I didn't know that this calculation is "round to near" operation.
> >
> Is there an updated patch forthcoming for this, or do we just leave SCBRR
> as it is?
There is no problem at present for me.
Sorry for my stupid question/patch.
Best regards
--
Kuninori Morimoto
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] sh-sci: fix SCBRR value calculation
2009-04-14 4:34 [PATCH] sh-sci: fix SCBRR value calculation Kuninori Morimoto
` (3 preceding siblings ...)
2009-04-22 2:50 ` Kuninori Morimoto
@ 2009-04-22 2:55 ` Paul Mundt
4 siblings, 0 replies; 6+ messages in thread
From: Paul Mundt @ 2009-04-22 2:55 UTC (permalink / raw)
To: linux-sh
On Wed, Apr 22, 2009 at 11:50:11AM +0900, Kuninori Morimoto wrote:
>
> Dear Paul
>
> > > > Please don't omit that term, that is for "round to near" operation.
> > >
> > > Ahhhhhh....
> > > Now I could understand !!!
> > > Sorry I didn't know that this calculation is "round to near" operation.
> > >
> > Is there an updated patch forthcoming for this, or do we just leave SCBRR
> > as it is?
>
> There is no problem at present for me.
> Sorry for my stupid question/patch.
>
No problem, there are so many variations that it is pretty easy for there
to be an incorrect setting that still "works" for the general cases. It
is always better to be certain if you spot something that looks
questionable, especially as a lot of this code has not changed
fundamentally in years, while the CPUs have.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-04-22 2:55 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-14 4:34 [PATCH] sh-sci: fix SCBRR value calculation Kuninori Morimoto
2009-04-14 5:37 ` yoshii.takashi
2009-04-14 5:53 ` morimoto.kuninori
2009-04-22 0:36 ` Paul Mundt
2009-04-22 2:50 ` Kuninori Morimoto
2009-04-22 2:55 ` Paul Mundt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox