0556-BCM270X_DT-Add-overlay-for-enc28j60-on-SPI2.patch 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. From ea006f68522d82b294094fd29585b16290758d29 Mon Sep 17 00:00:00 2001
  2. From: Alan Yiding Wang <y2366wan@uwaterloo.ca>
  3. Date: Sat, 3 Dec 2016 23:22:02 -0500
  4. Subject: [PATCH] BCM270X_DT: Add overlay for enc28j60 on SPI2
  5. Works on SPI2 for compute module
  6. ---
  7. arch/arm/boot/dts/overlays/Makefile | 1 +
  8. arch/arm/boot/dts/overlays/README | 10 ++++-
  9. .../boot/dts/overlays/enc28j60-spi2-overlay.dts | 47 ++++++++++++++++++++++
  10. 3 files changed, 57 insertions(+), 1 deletion(-)
  11. create mode 100644 arch/arm/boot/dts/overlays/enc28j60-spi2-overlay.dts
  12. --- a/arch/arm/boot/dts/overlays/Makefile
  13. +++ b/arch/arm/boot/dts/overlays/Makefile
  14. @@ -28,6 +28,7 @@ dtbo-$(RPI_DT_OVERLAYS) += dpi24.dtbo
  15. dtbo-$(RPI_DT_OVERLAYS) += dwc-otg.dtbo
  16. dtbo-$(RPI_DT_OVERLAYS) += dwc2.dtbo
  17. dtbo-$(RPI_DT_OVERLAYS) += enc28j60.dtbo
  18. +dtbo-$(RPI_DT_OVERLAYS) += enc28j60-spi2.dtbo
  19. dtbo-$(RPI_DT_OVERLAYS) += gpio-ir.dtbo
  20. dtbo-$(RPI_DT_OVERLAYS) += gpio-poweroff.dtbo
  21. dtbo-$(RPI_DT_OVERLAYS) += hifiberry-amp.dtbo
  22. --- a/arch/arm/boot/dts/overlays/README
  23. +++ b/arch/arm/boot/dts/overlays/README
  24. @@ -344,12 +344,20 @@ Params: dr_mode Dual rol
  25. Name: enc28j60
  26. -Info: Overlay for the Microchip ENC28J60 Ethernet Controller (SPI)
  27. +Info: Overlay for the Microchip ENC28J60 Ethernet Controller on SPI0
  28. Load: dtoverlay=enc28j60,<param>=<val>
  29. Params: int_pin GPIO used for INT (default 25)
  30. speed SPI bus speed (default 12000000)
  31. +
  32. +Name: enc28j60-spi2
  33. +Info: Overlay for the Microchip ENC28J60 Ethernet Controller on SPI2
  34. +Load: dtoverlay=enc28j60-spi2,<param>=<val>
  35. +Params: int_pin GPIO used for INT (default 39)
  36. +
  37. + speed SPI bus speed (default 12000000)
  38. +
  39. Name: gpio-ir
  40. Info: Use GPIO pin as rc-core style infrared receiver input. The rc-core-
  41. --- /dev/null
  42. +++ b/arch/arm/boot/dts/overlays/enc28j60-spi2-overlay.dts
  43. @@ -0,0 +1,47 @@
  44. +// Overlay for the Microchip ENC28J60 Ethernet Controller - SPI2 Compute Module
  45. +// Interrupt pin: 39
  46. +/dts-v1/;
  47. +/plugin/;
  48. +
  49. +/ {
  50. + compatible = "brcm,bcm2708";
  51. +
  52. + fragment@0 {
  53. + target = <&spi2>;
  54. + __overlay__ {
  55. + /* needed to avoid dtc warning */
  56. + #address-cells = <1>;
  57. + #size-cells = <0>;
  58. +
  59. + status = "okay";
  60. +
  61. + eth1: enc28j60@0{
  62. + compatible = "microchip,enc28j60";
  63. + reg = <0>; /* CE0 */
  64. + pinctrl-names = "default";
  65. + pinctrl-0 = <&eth1_pins>;
  66. + interrupt-parent = <&gpio>;
  67. + interrupts = <39 0x2>; /* falling edge */
  68. + spi-max-frequency = <12000000>;
  69. + status = "okay";
  70. + };
  71. + };
  72. + };
  73. +
  74. + fragment@1 {
  75. + target = <&gpio>;
  76. + __overlay__ {
  77. + eth1_pins: eth1_pins {
  78. + brcm,pins = <39>;
  79. + brcm,function = <0>; /* in */
  80. + brcm,pull = <0>; /* none */
  81. + };
  82. + };
  83. + };
  84. +
  85. + __overrides__ {
  86. + int_pin = <&eth1>, "interrupts:0",
  87. + <&eth1_pins>, "brcm,pins:0";
  88. + speed = <&eth1>, "spi-max-frequency:0";
  89. + };
  90. +};