msm8953之串口dts配置

https://blog.csdn.net/xuecz1230/article/details/78672662

msm8953支持4路串口,编号uart2、uart4、uart5、uart6

基地址:

中断号:

dts配置如下;

xxx .dtsi

 

 
  1. &blsp1_uart0 {//uart2

  2. status = "ok";

  3. pinctrl-names = "default";

  4. pinctrl-0 = <&uart_console_active>;

  5. };

  6. &blsp1_uart4 {//uart4

  7. status = "ok";

  8. pinctrl-names = "default";

  9. pinctrl-0 = <&uart4_console_active>;

  10. };

  11.  
  12. &blsp2_uart5 {//uart5

  13. status = "ok";

  14. pinctrl-names = "default";

  15. pinctrl-0 = <&uart5_console_active>;

  16. };

  17.  
  18. &blsp2_uart6 {//uart6

  19. status = "ok";

  20. pinctrl-names = "default";

  21. pinctrl-0 = <&uart6_console_active>;

  22. };


xxx-msm8953.dtsi

 

 
  1. blsp1_uart0: serial@78af000 {//uart2

  2. compatible = "qcom,msm-lsuart-v14";

  3. reg = <0x78af000 0x200>;

  4. interrupts = <0 107 0>;

  5. status = "disabled";

  6. clocks = <&clock_gcc clk_gcc_blsp1_uart1_apps_clk>,

  7. <&clock_gcc clk_gcc_blsp1_ahb_clk>;

  8. clock-names = "core_clk", "iface_clk";

  9. };

  10.  
  11. blsp1_uart4:serial@78b0000 {//uart4

  12. compatible = "qcom,msm-lsuart-v14";

  13. reg = <0x78b0000 0x200>;

  14. interrupts = <0 108 0>;

  15. status = "disabled";

  16. clocks = <&clock_gcc clk_gcc_blsp1_uart2_apps_clk>,

  17. <&clock_gcc clk_gcc_blsp1_ahb_clk>;

  18. clock-names = "core_clk", "iface_clk";

  19. };

  20.  
  21. blsp2_uart5:serial@7aef000 {//uart5

  22. compatible = "qcom,msm-lsuart-v14";

  23. reg = <0x7aef000 0x200>;

  24. interrupts = <0 306 0>;

  25. status = "disabled";

  26. clocks = <&clock_gcc clk_gcc_blsp2_uart1_apps_clk>,

  27. <&clock_gcc clk_gcc_blsp2_ahb_clk>;

  28. clock-names = "core_clk","iface_clk";

  29. };

  30.  
  31. blsp2_uart6:serial@7af0000 {//uart6

  32. compatible = "qcom,msm-lsuart-v14";

  33. reg = <0x7af0000 0x200>;

  34. interrupts = <0 307 0>;

  35. status = "disabled";

  36. clocks = <&clock_gcc clk_gcc_blsp2_uart2_apps_clk>,

  37. <&clock_gcc clk_gcc_blsp2_ahb_clk>;

  38. clock-names = "core_clk","iface_clk";

  39. };

 

 

xxx-msm8953-pinctrl.dtsi

 

 
  1. pmx-uartconsole {//uart2

  2. uart_console_active: uart_console_active {

  3. mux {

  4. pins = "gpio4", "gpio5";

  5. function = "blsp_uart2";

  6. };

  7.  
  8. config {

  9. pins = "gpio4", "gpio5";

  10. drive-strength = <2>;

  11. bias-disable;

  12. };

  13. };

  14. uart_console_sleep: uart_console_sleep {

  15. mux {

  16. pins = "gpio4", "gpio5";

  17. function = "blsp_uart2";

  18. };

  19.  
  20. config {

  21. pins = "gpio4", "gpio5";

  22. drive-strength = <2>;

  23. bias-pull-down;

  24. };

  25. };

  26.  
  27. };

  28.  
  29. pmx-uart4console {//uart4

  30. uart4_console_active: uart4_console_active {

  31. mux {

  32. pins = "gpio12","gpio13";

  33. function = "blsp_uart4";

  34. };

  35. config {

  36. pins = "gpio12","gpio13";

  37. drive-strength = <2>;

  38. bias-disable;

  39. };

  40. };

  41. uart4_console_sleep: uart4_console_sleep {

  42. mux {

  43. pins = "gpio12","gpio13";

  44. function = "blsp_uart4";

  45. };

  46. config {

  47. pins = "gpio12","gpio13";

  48. drive-strength = <2>;

  49. bias-pull-down;

  50. };

  51. };

  52. };

  53.  
  54. pmx-uart5console {//uart5

  55. uart5_console_active: uart_console_active {

  56. mux {

  57. pins = "gpio16","gpio17";

  58. function = "blsp_uart5";

  59. };

  60.  
  61. config {

  62. pins = "gpio16","gpio17";

  63. drive-strength = <2>;

  64. bias-disable;

  65. };

  66. };

  67. uart5_console_sleep: uart5_console_sleep {

  68. mux {

  69. pins = "gpio16","gpio17";

  70. function = "blsp_uart5";

  71. };

  72.  
  73. config {

  74. pins = "gpio16","gpio17";

  75. drive-strength = <2>;

  76. bias-disable;

  77. };

  78. };

  79.  
  80. };

  81.  
  82. pmx-uart6console {//uart6

  83. uart6_console_active: uart_console_active {

  84. mux {

  85. pins = "gpio20","gpio21";

  86. function = "blsp_uart6";

  87. };

  88.  
  89. config {

  90. pins = "gpio20","gpio21";

  91. drive-strength = <2>;

  92. bias-disable;

  93. };

  94. };

  95. uart6_console_sleep: uart6_console_sleep {

  96. mux {

  97. pins = "gpio20","gpio21";

  98. function = "blsp_uart6";

  99. };

  100.  
  101. config {

  102. pins = "gpio20","gpio21";

  103. drive-strength = <2>;

  104. bias-disable;

  105. };

  106. };

  107. };

 

 

 

 

msm8953芯片上运行的Android 9.0系统中,设备树文件(Device Tree Blob,简称DTB)位于/boot/dtb目录下。设备树文件是一种描述硬件信息的数据结构,可以在系统运行时动态加载,用于配置设备的硬件资源。 要在设备树文件中配置GPIO,可以按照以下步骤进行操作: 1. 找到设备树文件中相应的节点,例如UART节点: ``` serial@78b0000 { compatible = "qcom,msm-uartdm-v1.1.1"; reg = <0x0 0x78b0000 0x0 0x1000>; clocks = <&gcc GCC_UART1_AHB_CLK>, <&gcc GCC_UART1_CLK>, <&gcc GCC_BLSP1_AHB_CLK>, <&gcc GCC_BLSP1_QUP1_SPI_APPS_CLK>, <&gcc GCC_BLSP1_QUP2_SPI_APPS_CLK>, <&gcc GCC_BLSP1_QUP3_SPI_APPS_CLK>; clock-names = "iface", "core", "iface_axi", "qup1_apps", "qup2_apps", "qup3_apps"; interrupts = <GIC_SPI 191 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 194 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 195 IRQ_TYPE_LEVEL_HIGH>; interrupt-parent = <&intc>; dmas = <&sdhc1 2 0>, <&sdhc1 2 0>; dma-names = "rx", "tx"; status = "disabled"; }; ``` 2. 添加pinctrl节点,例如: ``` pinctrl { uart1_default: uart1_default { pins = "gpio41", "gpio42"; function = "blsp_uart1"; bias-disable; drive-strength = <12>; }; }; ``` 此命令将GPIO41和GPIO42配置UART1的引脚控制器,并设置其参数。 3. 在UART节点中添加pinctrl配置,例如: ``` serial@78b0000 { pinctrl-names = "default"; pinctrl-0 = <&uart1_default>; ... }; ``` 此命令将UART1的引脚控制器配置uart1_default。 完成上述步骤后,系统启动时会自动加载设备树文件,并根据所定义的GPIO配置进行硬件初始化。如果您想在应用程序中调用GPIO,可以使用sysfs文件系统中的GPIO接口进行操作。例如,使用以下命令将GPIO4设置为输出模式,并输出高电平: ``` echo 4 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio4/direction echo 1 > /sys/class/gpio/gpio4/value ``` 需要注意的是,GPIO的编号在不同的平台和设备上可能会有所不同,请根据实际情况进行调整。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值