aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2008-12-16 04:36:16 -0500
committerPaul Mundt <lethal@linux-sh.org>2008-12-22 04:44:43 -0500
commit027e68724935599417faa7dd4123c117d18e2483 (patch)
tree79bde723d9e2ef6117660814c6b066f6e9957591 /drivers/serial
parentd9341b51f28a5eb4ce231f4a3bbfa02aaecae626 (diff)
serial: sh-sci: Fix up the cpufreq notifier to use the proper port clock.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/sh-sci.c38
1 files changed, 10 insertions, 28 deletions
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 231f77b16492..2cbefd2ca522 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -748,7 +748,7 @@ static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr)
748 return ret; 748 return ret;
749} 749}
750 750
751#if defined(CONFIG_CPU_FREQ) && defined(CONFIG_HAVE_CLK) 751#ifdef CONFIG_HAVE_CLK
752/* 752/*
753 * Here we define a transistion notifier so that we can update all of our 753 * Here we define a transistion notifier so that we can update all of our
754 * ports' baud rate when the peripheral clock changes. 754 * ports' baud rate when the peripheral clock changes.
@@ -756,41 +756,20 @@ static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr)
756static int sci_notifier(struct notifier_block *self, 756static int sci_notifier(struct notifier_block *self,
757 unsigned long phase, void *p) 757 unsigned long phase, void *p)
758{ 758{
759 struct cpufreq_freqs *freqs = p;
760 int i; 759 int i;
761 760
762 if ((phase == CPUFREQ_POSTCHANGE) || 761 if ((phase == CPUFREQ_POSTCHANGE) ||
763 (phase == CPUFREQ_RESUMECHANGE)) { 762 (phase == CPUFREQ_RESUMECHANGE))
764 for (i = 0; i < SCI_NPORTS; i++) { 763 for (i = 0; i < SCI_NPORTS; i++) {
765 struct uart_port *port = &sci_ports[i].port; 764 struct sci_port *s = &sci_ports[i];
766 struct clk *clk; 765 s->port.uartclk = clk_get_rate(s->clk);
767
768 /*
769 * Update the uartclk per-port if frequency has
770 * changed, since it will no longer necessarily be
771 * consistent with the old frequency.
772 *
773 * Really we want to be able to do something like
774 * uart_change_speed() or something along those lines
775 * here to implicitly reset the per-port baud rate..
776 *
777 * Clean this up later..
778 */
779 clk = clk_get(NULL, "module_clk");
780 port->uartclk = clk_get_rate(clk);
781 clk_put(clk);
782 } 766 }
783 767
784 printk(KERN_INFO "%s: got a postchange notification "
785 "for cpu %d (old %d, new %d)\n",
786 __func__, freqs->cpu, freqs->old, freqs->new);
787 }
788
789 return NOTIFY_OK; 768 return NOTIFY_OK;
790} 769}
791 770
792static struct notifier_block sci_nb = { &sci_notifier, NULL, 0 }; 771static struct notifier_block sci_nb = { &sci_notifier, NULL, 0 };
793#endif /* CONFIG_CPU_FREQ && CONFIG_HAVE_CLK */ 772#endif
794 773
795static int sci_request_irq(struct sci_port *port) 774static int sci_request_irq(struct sci_port *port)
796{ 775{
@@ -1326,9 +1305,8 @@ static int __devinit sci_probe(struct platform_device *dev)
1326 uart_add_one_port(&sci_uart_driver, &sciport->port); 1305 uart_add_one_port(&sci_uart_driver, &sciport->port);
1327 } 1306 }
1328 1307
1329#if defined(CONFIG_CPU_FREQ) && defined(CONFIG_HAVE_CLK) 1308#ifdef CONFIG_HAVE_CLK
1330 cpufreq_register_notifier(&sci_nb, CPUFREQ_TRANSITION_NOTIFIER); 1309 cpufreq_register_notifier(&sci_nb, CPUFREQ_TRANSITION_NOTIFIER);
1331 dev_info(&dev->dev, "CPU frequency notifier registered\n");
1332#endif 1310#endif
1333 1311
1334#ifdef CONFIG_SH_STANDARD_BIOS 1312#ifdef CONFIG_SH_STANDARD_BIOS
@@ -1348,6 +1326,10 @@ static int __devexit sci_remove(struct platform_device *dev)
1348{ 1326{
1349 int i; 1327 int i;
1350 1328
1329#ifdef CONFIG_HAVE_CLK
1330 cpufreq_unregister_notifier(&sci_nb, CPUFREQ_TRANSITION_NOTIFIER);
1331#endif
1332
1351 for (i = 0; i < SCI_NPORTS; i++) 1333 for (i = 0; i < SCI_NPORTS; i++)
1352 uart_remove_one_port(&sci_uart_driver, &sci_ports[i].port); 1334 uart_remove_one_port(&sci_uart_driver, &sci_ports[i].port);
1353 1335