[PATCH net-next 1/2] dt-bindings: dp83867: add ti,led-function and ti,led-ctrl properties

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



With the TQ-Systems MBa7x (imx7-mba7.dtsi), a user of these properties
already sneaked in before they were properly specified. Add them to the
binding docs.

On top of the existing use (requiring to specify the raw register value
in the DTS), we propose a few convenience macros and defines.

Signed-off-by: Matthias Schiffer <matthias.schiffer@xxxxxxxxxxxxxxx>
---
 .../devicetree/bindings/net/ti,dp83867.yaml   | 18 ++++++
 include/dt-bindings/net/ti-dp83867.h          | 60 +++++++++++++++++++
 2 files changed, 78 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/ti,dp83867.yaml b/Documentation/devicetree/bindings/net/ti,dp83867.yaml
index c6716ac6cbcc..f91d40edab39 100644
--- a/Documentation/devicetree/bindings/net/ti,dp83867.yaml
+++ b/Documentation/devicetree/bindings/net/ti,dp83867.yaml
@@ -106,6 +106,18 @@ properties:
       Transmitt FIFO depth- see dt-bindings/net/ti-dp83867.h for applicable
       values.
 
+  ti,led-function:
+    $ref: /schemas/types.yaml#definitions/uint32
+    description: |
+      Value of LED configuration register 1, controlling the triggers for the
+      PHY LED outputs. See dt-bindings/net/ti-dp83867.h.
+
+  ti,led-ctrl:
+    $ref: /schemas/types.yaml#definitions/uint32
+    description: |
+      Value of LED configuration register 2, controlling polarity and related
+      settings for the PHY LED outputs. See dt-bindings/net/ti-dp83867.h.
+
 required:
   - reg
 
@@ -123,5 +135,11 @@ examples:
         ti,clk-output-sel = <DP83867_CLK_O_SEL_CHN_A_RCLK>;
         ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_25_NS>;
         ti,tx-internal-delay = <DP83867_RGMIIDCTL_2_75_NS>;
+        ti,led-function = <(DP83867_LED0(FUNC_LINK_ACT) |
+                            DP83867_LED1(FUNC_LINK_1000))>;
+        ti,led-ctrl = <(DP83867_LED0(CTRL_ACTIVE_HIGH) |
+                        DP83867_LED1(CTRL_ACTIVE_HIGH) |
+                        DP83867_LED2(CTRL_FORCE_LOW) |
+                        DP83867_LED3(CTRL_FORCE_LOW))>;
       };
     };
diff --git a/include/dt-bindings/net/ti-dp83867.h b/include/dt-bindings/net/ti-dp83867.h
index 6fc4b445d3a1..f3e3866d26ee 100644
--- a/include/dt-bindings/net/ti-dp83867.h
+++ b/include/dt-bindings/net/ti-dp83867.h
@@ -50,4 +50,64 @@
 #define DP83867_CLK_O_SEL_REF_CLK		0xC
 /* Special flag to indicate clock should be off */
 #define DP83867_CLK_O_SEL_OFF			0xFFFFFFFF
+
+/*
+ * Register values and helper macros for ti,led-function and ti,led-ctrl
+ *
+ * Example:
+ *
+ * ti,led-function = <(DP83867_LED0(FUNC_LINK_ACT) |
+ *                     DP83867_LED1(FUNC_LINK_1000))>;
+ * ti,led-ctrl = <(DP83867_LED0(CTRL_ACTIVE_HIGH) |
+ *                 DP83867_LED1(CTRL_ACTIVE_HIGH) |
+ *                 DP83867_LED2(CTRL_FORCE_LOW) |
+ *                 DP83867_LED3(CTRL_FORCE_LOW))>;
+ *
+ * It is recommended to force all unused LED pins to high or low level via
+ * led-ctrl (led-function is ignored in this case). LEDs that are missing from
+ * the configured value will be set to value 0x0 (FUNC_LINK and
+ * CTRL_ACTIVE_LOW).
+ */
+
+/* Link established */
+#define DP83867_LED_FUNC_LINK		0x0
+/* Receive or transmit activity */
+#define DP83867_LED_FUNC_ACT		0x1
+/* Transmit activity */
+#define DP83867_LED_FUNC_ACT_TX		0x2
+/* Receive activity */
+#define DP83867_LED_FUNC_ACT_RX		0x3
+/* Collision detected */
+#define DP83867_LED_FUNC_COLLISION	0x4
+/* 1000BT link established */
+#define DP83867_LED_FUNC_LINK_1000	0x5
+/* 100BTX link established */
+#define DP83867_LED_FUNC_LINK_100	0x6
+/* 10BT link established */
+#define DP83867_LED_FUNC_LINK_10	0x7
+/* 10/100BT link established */
+#define DP83867_LED_FUNC_LINK_10_100	0x8
+/* 100/1000BT link established */
+#define DP83867_LED_FUNC_LINK_100_1000	0x9
+/* Full duplex */
+#define DP83867_LED_FUNC_FULL_DUPLEX	0xa
+/* Link established, blink for transmit or receive activity */
+#define DP83867_LED_FUNC_LINK_ACT	0xb
+/* Receive Error or Transmit Error */
+#define DP83867_LED_FUNC_ERR		0xd
+/* Receive Error */
+#define DP83867_LED_FUNC_ERR_RX		0xe
+
+#define DP83867_LED_CTRL_ACTIVE_HIGH	0x4
+#define DP83867_LED_CTRL_ACTIVE_LOW	0x0
+#define DP83867_LED_CTRL_FORCE_HIGH	0x3
+#define DP83867_LED_CTRL_FORCE_LOW	0x1
+
+#define DP83867_LED_SHIFT(v, s)		((DP83867_LED_##v) << (s))
+
+#define DP83867_LED0(v)			DP83867_LED_SHIFT(v, 0)
+#define DP83867_LED1(v)			DP83867_LED_SHIFT(v, 4)
+#define DP83867_LED2(v)			DP83867_LED_SHIFT(v, 8)
+#define DP83867_LED3(v)			DP83867_LED_SHIFT(v, 12)
+
 #endif
-- 
2.17.1




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux