* [RFC] SCI(F) clock source select
@ 2008-08-12 23:23 Yoshinori Sato
2008-08-13 1:20 ` Paul Mundt
0 siblings, 1 reply; 2+ messages in thread
From: Yoshinori Sato @ 2008-08-12 23:23 UTC (permalink / raw)
To: linux-sh
SCI(F) clock source (Internal/External) selection is hard coding now.
And depend on CPU type.
But I think it's setting depend on target.
I hope add clock selection in platform_data.
Any comments?
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 3df2aae..6c0ceff 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -82,6 +82,8 @@ struct sci_port {
/* Port clock */
struct clk *clk;
#endif
+ /* clock source */
+ int clock_source;
};
#ifdef CONFIG_SH_KGDB
@@ -1040,7 +1042,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
struct ktermios *old)
{
struct sci_port *s = &sci_ports[port->line];
- unsigned int status, baud, smr_val;
+ unsigned int status, baud, smr_val, scscr_val;
int t;
baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
@@ -1099,7 +1101,16 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
if (likely(s->init_pins))
s->init_pins(port, termios->c_cflag);
- sci_out(port, SCSCR, SCSCR_INIT(port));
+ scscr_val = SCSCR_INIT(port);
+ switch (s->clock_source) {
+ case SCIx_CLOCK_INT:
+ scscr_val &= ~0x02;
+ break;
+ case SCIx_CLOCK_EXT:
+ scscr_val |= 0x02;
+ break;
+ }
+ sci_out(port, SCSCR, scscr_val);
if ((termios->c_cflag & CREAD) != 0)
sci_start_rx(port,0);
@@ -1468,6 +1479,8 @@ static int __devinit sci_probe(struct platform_device *dev)
sciport->type = sciport->port.type = p->type;
+ sciport->clock_source = p->clock;
+
memcpy(&sciport->irqs, &p->irqs, sizeof(p->irqs));
uart_add_one_port(&sci_uart_driver, &sciport->port);
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index 893cc53..8f08db1 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -16,6 +16,12 @@ enum {
SCIx_NR_IRQS,
};
+/* clock source type */
+enum {
+ SCIx_CLOCK_INT,
+ SCIx_CLOCK_EXT,
+};
+
/*
* Platform device specific platform_data struct
*/
@@ -25,6 +31,7 @@ struct plat_sci_port {
unsigned int irqs[SCIx_NR_IRQS]; /* ERI, RXI, TXI, BRI */
unsigned int type; /* SCI / SCIF / IRDA */
upf_t flags; /* UPF_* flags */
+ int clock; /* clock source */
};
int early_sci_setup(struct uart_port *port);
--
Yoshinori Sato
<ysato@users.sourceforge.jp>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [RFC] SCI(F) clock source select
2008-08-12 23:23 [RFC] SCI(F) clock source select Yoshinori Sato
@ 2008-08-13 1:20 ` Paul Mundt
0 siblings, 0 replies; 2+ messages in thread
From: Paul Mundt @ 2008-08-13 1:20 UTC (permalink / raw)
To: linux-sh
On Tue, Aug 12, 2008 at 07:23:57PM -0400, Yoshinori Sato wrote:
> SCI(F) clock source (Internal/External) selection is hard coding now.
> And depend on CPU type.
>
> But I think it's setting depend on target.
>
> I hope add clock selection in platform_data.
>
> Any comments?
>
> diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
> index 3df2aae..6c0ceff 100644
> --- a/drivers/serial/sh-sci.c
> +++ b/drivers/serial/sh-sci.c
> @@ -82,6 +82,8 @@ struct sci_port {
> /* Port clock */
> struct clk *clk;
> #endif
> + /* clock source */
> + int clock_source;
> };
>
We should probably just add an additional flags field to the port type
and platform data and allow internal/external selection based off of
that. Then we can default to the current behaviour, and allow the
platforms that want different behaviour to specifically set a bit.
It's certainly heading in the right direction, though.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-08-13 1:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-12 23:23 [RFC] SCI(F) clock source select Yoshinori Sato
2008-08-13 1:20 ` Paul Mundt
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.