aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Brown <davidb@codeaurora.org>2011-08-04 04:55:24 -0400
committerDavid Brown <davidb@codeaurora.org>2011-08-29 15:47:36 -0400
commitcfdad2aba7398021f6eec415b9271b9cb40065f9 (patch)
treea38cd210577bdba2affd72322fa36b41404adcd1
parent886a451bd2491de3551c2aea2a2f155f159716c8 (diff)
msm_serial: Add devicetree support
Add devicetree support to the msm_serial driver. Clocks are still queried by direct name from the driver until device tree clock support is implemented. Change-Id: Ia6b2ddfcf1e5dc3bd25dd502662f971202e6d56f Signed-off-by: David Brown <davidb@codeaurora.org> Acked-by: Arnd Bergmann <arnd@arndb.de>
-rw-r--r--Documentation/devicetree/bindings/tty/serial/msm_serial.txt27
-rw-r--r--drivers/tty/serial/msm_serial.c14
2 files changed, 41 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/tty/serial/msm_serial.txt b/Documentation/devicetree/bindings/tty/serial/msm_serial.txt
new file mode 100644
index 000000000000..aef383eb8876
--- /dev/null
+++ b/Documentation/devicetree/bindings/tty/serial/msm_serial.txt
@@ -0,0 +1,27 @@
1* Qualcomm MSM UART
2
3Required properties:
4- compatible :
5 - "qcom,msm-uart", and one of "qcom,msm-hsuart" or
6 "qcom,msm-lsuart".
7- reg : offset and length of the register set for the device
8 for the hsuart operating in compatible mode, there should be a
9 second pair describing the gsbi registers.
10- interrupts : should contain the uart interrupt.
11
12There are two different UART blocks used in MSM devices,
13"qcom,msm-hsuart" and "qcom,msm-lsuart". The msm-serial driver is
14able to handle both of these, and matches against the "qcom,msm-uart"
15as the compatibility.
16
17The registers for the "qcom,msm-hsuart" device need to specify both
18register blocks, even for the common driver.
19
20Example:
21
22 uart@19c400000 {
23 compatible = "qcom,msm-hsuart", "qcom,msm-uart";
24 reg = <0x19c40000 0x1000>,
25 <0x19c00000 0x1000>;
26 interrupts = <195>;
27 };
diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
index d9863b2c2bc8..776790272454 100644
--- a/drivers/tty/serial/msm_serial.c
+++ b/drivers/tty/serial/msm_serial.c
@@ -19,6 +19,7 @@
19# define SUPPORT_SYSRQ 19# define SUPPORT_SYSRQ
20#endif 20#endif
21 21
22#include <linux/atomic.h>
22#include <linux/hrtimer.h> 23#include <linux/hrtimer.h>
23#include <linux/module.h> 24#include <linux/module.h>
24#include <linux/io.h> 25#include <linux/io.h>
@@ -33,6 +34,8 @@
33#include <linux/clk.h> 34#include <linux/clk.h>
34#include <linux/platform_device.h> 35#include <linux/platform_device.h>
35#include <linux/delay.h> 36#include <linux/delay.h>
37#include <linux/of.h>
38#include <linux/of_device.h>
36 39
37#include "msm_serial.h" 40#include "msm_serial.h"
38 41
@@ -856,6 +859,8 @@ static struct uart_driver msm_uart_driver = {
856 .cons = MSM_CONSOLE, 859 .cons = MSM_CONSOLE,
857}; 860};
858 861
862static atomic_t msm_uart_next_id = ATOMIC_INIT(0);
863
859static int __init msm_serial_probe(struct platform_device *pdev) 864static int __init msm_serial_probe(struct platform_device *pdev)
860{ 865{
861 struct msm_port *msm_port; 866 struct msm_port *msm_port;
@@ -863,6 +868,9 @@ static int __init msm_serial_probe(struct platform_device *pdev)
863 struct uart_port *port; 868 struct uart_port *port;
864 int irq; 869 int irq;
865 870
871 if (pdev->id == -1)
872 pdev->id = atomic_inc_return(&msm_uart_next_id) - 1;
873
866 if (unlikely(pdev->id < 0 || pdev->id >= UART_NR)) 874 if (unlikely(pdev->id < 0 || pdev->id >= UART_NR))
867 return -ENXIO; 875 return -ENXIO;
868 876
@@ -920,11 +928,17 @@ static int __devexit msm_serial_remove(struct platform_device *pdev)
920 return 0; 928 return 0;
921} 929}
922 930
931static struct of_device_id msm_match_table[] = {
932 { .compatible = "qcom,msm-uart" },
933 {}
934};
935
923static struct platform_driver msm_platform_driver = { 936static struct platform_driver msm_platform_driver = {
924 .remove = msm_serial_remove, 937 .remove = msm_serial_remove,
925 .driver = { 938 .driver = {
926 .name = "msm_serial", 939 .name = "msm_serial",
927 .owner = THIS_MODULE, 940 .owner = THIS_MODULE,
941 .of_match_table = msm_match_table,
928 }, 942 },
929}; 943};
930 944