aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2009-11-25 02:23:35 -0500
committerPaul Mundt <lethal@linux-sh.org>2009-11-25 02:23:35 -0500
commitedad1f208e6edabb917e4f8a33c7e45bf78bb79d (patch)
treebeada10e4fdcb4984c8ed3481cf805012cd32861 /drivers/serial
parent6ba653830c85a37d0a054f1e43d9b51e59d1150b (diff)
serial: sh-sci: Depend on HAVE_CLK unconditionally.
The sh-sci code conditionalized the clock framework support in order to give the other platforms a chance to catch up. sh64 supported this some time ago and the forthcoming ARM changes handle this as well, this leaves h8300 as the odd one out. H8300 has had since 2.5 to merge it's sh-sci support upstream, and has yet to do so. At this point I will no longer be holding back the driver to support an unreponsive architecture, 7 years is quite enough of a grace period. Support is easily implemented on the architecture if and when it ever decides to merge its changes upstream. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/Kconfig2
-rw-r--r--drivers/serial/sh-sci.c53
-rw-r--r--drivers/serial/sh-sci.h2
3 files changed, 3 insertions, 54 deletions
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index e52257257279..30b58eeb439f 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -996,7 +996,7 @@ config SERIAL_IP22_ZILOG_CONSOLE
996 996
997config SERIAL_SH_SCI 997config SERIAL_SH_SCI
998 tristate "SuperH SCI(F) serial port support" 998 tristate "SuperH SCI(F) serial port support"
999 depends on SUPERH || H8300 999 depends on HAVE_CLK && (SUPERH || H8300)
1000 select SERIAL_CORE 1000 select SERIAL_CORE
1001 1001
1002config SERIAL_SH_SCI_NR_UARTS 1002config SERIAL_SH_SCI_NR_UARTS
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 89421fa0d250..972fca0a3ef1 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -50,7 +50,6 @@
50#include <linux/list.h> 50#include <linux/list.h>
51 51
52#ifdef CONFIG_SUPERH 52#ifdef CONFIG_SUPERH
53#include <asm/clock.h>
54#include <asm/sh_bios.h> 53#include <asm/sh_bios.h>
55#endif 54#endif
56 55
@@ -79,22 +78,18 @@ struct sci_port {
79 struct timer_list break_timer; 78 struct timer_list break_timer;
80 int break_flag; 79 int break_flag;
81 80
82#ifdef CONFIG_HAVE_CLK
83 /* Interface clock */ 81 /* Interface clock */
84 struct clk *iclk; 82 struct clk *iclk;
85 /* Data clock */ 83 /* Data clock */
86 struct clk *dclk; 84 struct clk *dclk;
87#endif 85
88 struct list_head node; 86 struct list_head node;
89}; 87};
90 88
91struct sh_sci_priv { 89struct sh_sci_priv {
92 spinlock_t lock; 90 spinlock_t lock;
93 struct list_head ports; 91 struct list_head ports;
94
95#ifdef CONFIG_HAVE_CLK
96 struct notifier_block clk_nb; 92 struct notifier_block clk_nb;
97#endif
98}; 93};
99 94
100/* Function prototypes */ 95/* Function prototypes */
@@ -156,32 +151,6 @@ static void sci_poll_put_char(struct uart_port *port, unsigned char c)
156} 151}
157#endif /* CONFIG_CONSOLE_POLL || CONFIG_SERIAL_SH_SCI_CONSOLE */ 152#endif /* CONFIG_CONSOLE_POLL || CONFIG_SERIAL_SH_SCI_CONSOLE */
158 153
159#if defined(__H8300S__)
160enum { sci_disable, sci_enable };
161
162static void h8300_sci_config(struct uart_port *port, unsigned int ctrl)
163{
164 volatile unsigned char *mstpcrl = (volatile unsigned char *)MSTPCRL;
165 int ch = (port->mapbase - SMR0) >> 3;
166 unsigned char mask = 1 << (ch+1);
167
168 if (ctrl == sci_disable)
169 *mstpcrl |= mask;
170 else
171 *mstpcrl &= ~mask;
172}
173
174static void h8300_sci_enable(struct uart_port *port)
175{
176 h8300_sci_config(port, sci_enable);
177}
178
179static void h8300_sci_disable(struct uart_port *port)
180{
181 h8300_sci_config(port, sci_disable);
182}
183#endif
184
185#if defined(__H8300H__) || defined(__H8300S__) 154#if defined(__H8300H__) || defined(__H8300S__)
186static void sci_init_pins(struct uart_port *port, unsigned int cflag) 155static void sci_init_pins(struct uart_port *port, unsigned int cflag)
187{ 156{
@@ -733,7 +702,6 @@ static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr)
733 return ret; 702 return ret;
734} 703}
735 704
736#ifdef CONFIG_HAVE_CLK
737/* 705/*
738 * Here we define a transistion notifier so that we can update all of our 706 * Here we define a transistion notifier so that we can update all of our
739 * ports' baud rate when the peripheral clock changes. 707 * ports' baud rate when the peripheral clock changes.
@@ -751,7 +719,6 @@ static int sci_notifier(struct notifier_block *self,
751 spin_lock_irqsave(&priv->lock, flags); 719 spin_lock_irqsave(&priv->lock, flags);
752 list_for_each_entry(sci_port, &priv->ports, node) 720 list_for_each_entry(sci_port, &priv->ports, node)
753 sci_port->port.uartclk = clk_get_rate(sci_port->dclk); 721 sci_port->port.uartclk = clk_get_rate(sci_port->dclk);
754
755 spin_unlock_irqrestore(&priv->lock, flags); 722 spin_unlock_irqrestore(&priv->lock, flags);
756 } 723 }
757 724
@@ -778,7 +745,6 @@ static void sci_clk_disable(struct uart_port *port)
778 745
779 clk_disable(sci_port->dclk); 746 clk_disable(sci_port->dclk);
780} 747}
781#endif
782 748
783static int sci_request_irq(struct sci_port *port) 749static int sci_request_irq(struct sci_port *port)
784{ 750{
@@ -1077,21 +1043,10 @@ static void __devinit sci_init_single(struct platform_device *dev,
1077 sci_port->port.iotype = UPIO_MEM; 1043 sci_port->port.iotype = UPIO_MEM;
1078 sci_port->port.line = index; 1044 sci_port->port.line = index;
1079 sci_port->port.fifosize = 1; 1045 sci_port->port.fifosize = 1;
1080
1081#if defined(__H8300H__) || defined(__H8300S__)
1082#ifdef __H8300S__
1083 sci_port->enable = h8300_sci_enable;
1084 sci_port->disable = h8300_sci_disable;
1085#endif
1086 sci_port->port.uartclk = CONFIG_CPU_CLOCK;
1087#elif defined(CONFIG_HAVE_CLK)
1088 sci_port->iclk = p->clk ? clk_get(&dev->dev, p->clk) : NULL; 1046 sci_port->iclk = p->clk ? clk_get(&dev->dev, p->clk) : NULL;
1089 sci_port->dclk = clk_get(&dev->dev, "peripheral_clk"); 1047 sci_port->dclk = clk_get(&dev->dev, "peripheral_clk");
1090 sci_port->enable = sci_clk_enable; 1048 sci_port->enable = sci_clk_enable;
1091 sci_port->disable = sci_clk_disable; 1049 sci_port->disable = sci_clk_disable;
1092#else
1093#error "Need a valid uartclk"
1094#endif
1095 1050
1096 sci_port->break_timer.data = (unsigned long)sci_port; 1051 sci_port->break_timer.data = (unsigned long)sci_port;
1097 sci_port->break_timer.function = sci_break_timer; 1052 sci_port->break_timer.function = sci_break_timer;
@@ -1106,7 +1061,6 @@ static void __devinit sci_init_single(struct platform_device *dev,
1106 sci_port->type = sci_port->port.type = p->type; 1061 sci_port->type = sci_port->port.type = p->type;
1107 1062
1108 memcpy(&sci_port->irqs, &p->irqs, sizeof(p->irqs)); 1063 memcpy(&sci_port->irqs, &p->irqs, sizeof(p->irqs));
1109
1110} 1064}
1111 1065
1112#ifdef CONFIG_SERIAL_SH_SCI_CONSOLE 1066#ifdef CONFIG_SERIAL_SH_SCI_CONSOLE
@@ -1239,14 +1193,11 @@ static int sci_remove(struct platform_device *dev)
1239 struct sci_port *p; 1193 struct sci_port *p;
1240 unsigned long flags; 1194 unsigned long flags;
1241 1195
1242#ifdef CONFIG_HAVE_CLK
1243 cpufreq_unregister_notifier(&priv->clk_nb, CPUFREQ_TRANSITION_NOTIFIER); 1196 cpufreq_unregister_notifier(&priv->clk_nb, CPUFREQ_TRANSITION_NOTIFIER);
1244#endif
1245 1197
1246 spin_lock_irqsave(&priv->lock, flags); 1198 spin_lock_irqsave(&priv->lock, flags);
1247 list_for_each_entry(p, &priv->ports, node) 1199 list_for_each_entry(p, &priv->ports, node)
1248 uart_remove_one_port(&sci_uart_driver, &p->port); 1200 uart_remove_one_port(&sci_uart_driver, &p->port);
1249
1250 spin_unlock_irqrestore(&priv->lock, flags); 1201 spin_unlock_irqrestore(&priv->lock, flags);
1251 1202
1252 kfree(priv); 1203 kfree(priv);
@@ -1307,10 +1258,8 @@ static int __devinit sci_probe(struct platform_device *dev)
1307 spin_lock_init(&priv->lock); 1258 spin_lock_init(&priv->lock);
1308 platform_set_drvdata(dev, priv); 1259 platform_set_drvdata(dev, priv);
1309 1260
1310#ifdef CONFIG_HAVE_CLK
1311 priv->clk_nb.notifier_call = sci_notifier; 1261 priv->clk_nb.notifier_call = sci_notifier;
1312 cpufreq_register_notifier(&priv->clk_nb, CPUFREQ_TRANSITION_NOTIFIER); 1262 cpufreq_register_notifier(&priv->clk_nb, CPUFREQ_TRANSITION_NOTIFIER);
1313#endif
1314 1263
1315 if (dev->id != -1) { 1264 if (dev->id != -1) {
1316 ret = sci_probe_single(dev, dev->id, p, &sci_ports[dev->id]); 1265 ret = sci_probe_single(dev, dev->id, p, &sci_ports[dev->id]);
diff --git a/drivers/serial/sh-sci.h b/drivers/serial/sh-sci.h
index 3e2fcf93b42e..a32094eeb42b 100644
--- a/drivers/serial/sh-sci.h
+++ b/drivers/serial/sh-sci.h
@@ -1,5 +1,5 @@
1#include <linux/serial_core.h> 1#include <linux/serial_core.h>
2#include <asm/io.h> 2#include <linux/io.h>
3#include <linux/gpio.h> 3#include <linux/gpio.h>
4 4
5#if defined(CONFIG_H83007) || defined(CONFIG_H83068) 5#if defined(CONFIG_H83007) || defined(CONFIG_H83068)