aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/serial/cpm_uart/cpm_uart.h1
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_core.c26
2 files changed, 20 insertions, 7 deletions
diff --git a/drivers/serial/cpm_uart/cpm_uart.h b/drivers/serial/cpm_uart/cpm_uart.h
index 5999ef5ac78e..7274b527a3c1 100644
--- a/drivers/serial/cpm_uart/cpm_uart.h
+++ b/drivers/serial/cpm_uart/cpm_uart.h
@@ -77,6 +77,7 @@ struct uart_cpm_port {
77 unsigned char *rx_buf; 77 unsigned char *rx_buf;
78 u32 flags; 78 u32 flags;
79 void (*set_lineif)(struct uart_cpm_port *); 79 void (*set_lineif)(struct uart_cpm_port *);
80 struct clk *clk;
80 u8 brg; 81 u8 brg;
81 uint dp_addr; 82 uint dp_addr;
82 void *mem_addr; 83 void *mem_addr;
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c
index 5e0c17f71653..25efca5a7a1f 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -45,6 +45,7 @@
45#include <linux/of_platform.h> 45#include <linux/of_platform.h>
46#include <linux/gpio.h> 46#include <linux/gpio.h>
47#include <linux/of_gpio.h> 47#include <linux/of_gpio.h>
48#include <linux/clk.h>
48 49
49#include <asm/io.h> 50#include <asm/io.h>
50#include <asm/irq.h> 51#include <asm/irq.h>
@@ -596,7 +597,10 @@ static void cpm_uart_set_termios(struct uart_port *port,
596 out_be16(&sccp->scc_psmr, (sbits << 12) | scval); 597 out_be16(&sccp->scc_psmr, (sbits << 12) | scval);
597 } 598 }
598 599
599 cpm_set_brg(pinfo->brg - 1, baud); 600 if (pinfo->clk)
601 clk_set_rate(pinfo->clk, baud);
602 else
603 cpm_set_brg(pinfo->brg - 1, baud);
600 spin_unlock_irqrestore(&port->lock, flags); 604 spin_unlock_irqrestore(&port->lock, flags);
601} 605}
602 606
@@ -1023,13 +1027,21 @@ static int cpm_uart_init_port(struct device_node *np,
1023 int ret; 1027 int ret;
1024 int i; 1028 int i;
1025 1029
1026 data = of_get_property(np, "fsl,cpm-brg", &len); 1030 data = of_get_property(np, "clock", NULL);
1027 if (!data || len != 4) { 1031 if (data) {
1028 printk(KERN_ERR "CPM UART %s has no/invalid " 1032 struct clk *clk = clk_get(NULL, (const char*)data);
1029 "fsl,cpm-brg property.\n", np->name); 1033 if (!IS_ERR(clk))
1030 return -EINVAL; 1034 pinfo->clk = clk;
1035 }
1036 if (!pinfo->clk) {
1037 data = of_get_property(np, "fsl,cpm-brg", &len);
1038 if (!data || len != 4) {
1039 printk(KERN_ERR "CPM UART %s has no/invalid "
1040 "fsl,cpm-brg property.\n", np->name);
1041 return -EINVAL;
1042 }
1043 pinfo->brg = *data;
1031 } 1044 }
1032 pinfo->brg = *data;
1033 1045
1034 data = of_get_property(np, "fsl,cpm-command", &len); 1046 data = of_get_property(np, "fsl,cpm-command", &len);
1035 if (!data || len != 4) { 1047 if (!data || len != 4) {