Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+41
+27
Documentation/devicetree/bindings/tty/serial/msm_serial.txt
··· 1 + * Qualcomm MSM UART 2 + 3 + Required 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 + 12 + There are two different UART blocks used in MSM devices, 13 + "qcom,msm-hsuart" and "qcom,msm-lsuart". The msm-serial driver is 14 + able to handle both of these, and matches against the "qcom,msm-uart" 15 + as the compatibility. 16 + 17 + The registers for the "qcom,msm-hsuart" device need to specify both 18 + register blocks, even for the common driver. 19 + 20 + Example: 21 + 22 + uart@19c400000 { 23 + compatible = "qcom,msm-hsuart", "qcom,msm-uart"; 24 + reg = <0x19c40000 0x1000>, 25 + <0x19c00000 0x1000>; 26 + interrupts = <195>; 27 + };
+14
drivers/tty/serial/msm_serial.c
··· 19 19 # define SUPPORT_SYSRQ 20 20 #endif 21 21 22 + #include <linux/atomic.h> 22 23 #include <linux/hrtimer.h> 23 24 #include <linux/module.h> 24 25 #include <linux/io.h> ··· 34 33 #include <linux/clk.h> 35 34 #include <linux/platform_device.h> 36 35 #include <linux/delay.h> 36 + #include <linux/of.h> 37 + #include <linux/of_device.h> 37 38 38 39 #include "msm_serial.h" 39 40 ··· 859 856 .cons = MSM_CONSOLE, 860 857 }; 861 858 859 + static atomic_t msm_uart_next_id = ATOMIC_INIT(0); 860 + 862 861 static int __init msm_serial_probe(struct platform_device *pdev) 863 862 { 864 863 struct msm_port *msm_port; 865 864 struct resource *resource; 866 865 struct uart_port *port; 867 866 int irq; 867 + 868 + if (pdev->id == -1) 869 + pdev->id = atomic_inc_return(&msm_uart_next_id) - 1; 868 870 869 871 if (unlikely(pdev->id < 0 || pdev->id >= UART_NR)) 870 872 return -ENXIO; ··· 928 920 return 0; 929 921 } 930 922 923 + static struct of_device_id msm_match_table[] = { 924 + { .compatible = "qcom,msm-uart" }, 925 + {} 926 + }; 927 + 931 928 static struct platform_driver msm_platform_driver = { 932 929 .remove = msm_serial_remove, 933 930 .driver = { 934 931 .name = "msm_serial", 935 932 .owner = THIS_MODULE, 933 + .of_match_table = msm_match_table, 936 934 }, 937 935 }; 938 936