0570-BCM270X_DT-Add-spi0-cs-overlay.patch 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. From 1a2339385e478e3ae3ee4f79edbfefd7fd22e96c Mon Sep 17 00:00:00 2001
  2. From: Phil Elwell <phil@raspberrypi.org>
  3. Date: Mon, 16 Jan 2017 14:53:12 +0000
  4. Subject: [PATCH] BCM270X_DT: Add spi0-cs overlay
  5. The spi0-cs overlay allows the software chip selectts to be modified
  6. using the cs0_pin and cs1_pin parameters.
  7. ---
  8. arch/arm/boot/dts/overlays/Makefile | 1 +
  9. arch/arm/boot/dts/overlays/README | 9 +++++++-
  10. arch/arm/boot/dts/overlays/spi0-cs-overlay.dts | 29 ++++++++++++++++++++++++++
  11. 3 files changed, 38 insertions(+), 1 deletion(-)
  12. create mode 100644 arch/arm/boot/dts/overlays/spi0-cs-overlay.dts
  13. --- a/arch/arm/boot/dts/overlays/Makefile
  14. +++ b/arch/arm/boot/dts/overlays/Makefile
  15. @@ -93,6 +93,7 @@ dtbo-$(RPI_DT_OVERLAYS) += smi-dev.dtbo
  16. dtbo-$(RPI_DT_OVERLAYS) += smi-nand.dtbo
  17. dtbo-$(RPI_DT_OVERLAYS) += spi-gpio35-39.dtbo
  18. dtbo-$(RPI_DT_OVERLAYS) += spi-rtc.dtbo
  19. +dtbo-$(RPI_DT_OVERLAYS) += spi0-cs.dtbo
  20. dtbo-$(RPI_DT_OVERLAYS) += spi0-hw-cs.dtbo
  21. dtbo-$(RPI_DT_OVERLAYS) += spi1-1cs.dtbo
  22. dtbo-$(RPI_DT_OVERLAYS) += spi1-2cs.dtbo
  23. --- a/arch/arm/boot/dts/overlays/README
  24. +++ b/arch/arm/boot/dts/overlays/README
  25. @@ -1131,7 +1131,7 @@ Params: <None>
  26. Name: spi-gpio35-39
  27. -Info: move SPI function block to GPIO 35 to 39
  28. +Info: Move SPI function block to GPIO 35 to 39
  29. Load: dtoverlay=spi-gpio35-39
  30. Params: <None>
  31. @@ -1142,6 +1142,13 @@ Load: dtoverlay=spi-rtc,<param>=<val>
  32. Params: pcf2123 Select the PCF2123 device
  33. +Name: spi0-cs
  34. +Info: Allows the (software) CS pins for SPI0 to be changed
  35. +Load: dtoverlay=spi0-cs,<param>=<val>
  36. +Params: cs0_pin GPIO pin for CS0 (default 8)
  37. + cs1_pin GPIO pin for CS1 (default 7)
  38. +
  39. +
  40. Name: spi0-hw-cs
  41. Info: Re-enables hardware CS/CE (chip selects) for SPI0
  42. Load: dtoverlay=spi0-hw-cs
  43. --- /dev/null
  44. +++ b/arch/arm/boot/dts/overlays/spi0-cs-overlay.dts
  45. @@ -0,0 +1,29 @@
  46. +/dts-v1/;
  47. +/plugin/;
  48. +
  49. +
  50. +/ {
  51. + compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";
  52. +
  53. + fragment@0 {
  54. + target = <&spi0_cs_pins>;
  55. + frag0: __overlay__ {
  56. + brcm,pins = <8 7>;
  57. + };
  58. + };
  59. +
  60. + fragment@1 {
  61. + target = <&spi0>;
  62. + frag1: __overlay__ {
  63. + cs-gpios = <&gpio 8 1>, <&gpio 7 1>;
  64. + status = "okay";
  65. + };
  66. + };
  67. +
  68. + __overrides__ {
  69. + cs0_pin = <&frag0>,"brcm,pins:0",
  70. + <&frag1>,"cs-gpios:4";
  71. + cs1_pin = <&frag0>,"brcm,pins:4",
  72. + <&frag1>,"cs-gpios:16";
  73. + };
  74. +};