All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hauke Mehrtens <hauke-5/S+JYg5SzeELgA04lAiVw@public.gmane.org>
To: f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Cc: alexander.stein-93q1YBGzJSMe9JSWTWOYM3xStJ4P+DSV@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	andrew-g2DYL2Zd6BY@public.gmane.org,
	john-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org,
	openwrt-zg6vgJgm1sizQB+pC5nmwQ@public.gmane.org,
	hauke.mehrtens-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	daniel.schwierzeck-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	eckert.florian-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	thomas.langer-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	Hauke Mehrtens <hauke-5/S+JYg5SzeELgA04lAiVw@public.gmane.org>
Subject: [PATCH 1/2] NET: PHY: Add PHY LED control binding.
Date: Sun,  5 Jun 2016 23:45:49 +0200	[thread overview]
Message-ID: <1465163150-21429-2-git-send-email-hauke@hauke-m.de> (raw)
In-Reply-To: <1465163150-21429-1-git-send-email-hauke-5/S+JYg5SzeELgA04lAiVw@public.gmane.org>

This binding makes it possible to control the LEDs of an Ethernet PHY.
These settings allow it to abstract the hardware configuration which
tells the hardware when to switch the LED constant on or blink for
example. This will be used by the Intel XWAY PHY driver.  I also
checked datasheets for some other Ethernet PHYs and it should be
possible to also control their LED behavior with these settings, but
they all did not allow a so fine control over the LED behavior.

Signed-off-by: Hauke Mehrtens <hauke-5/S+JYg5SzeELgA04lAiVw@public.gmane.org>
---
 Documentation/devicetree/bindings/phy/phy-leds.txt | 52 ++++++++++++++++++++++
 include/dt-bindings/phy/phy-leds.h                 | 27 +++++++++++
 2 files changed, 79 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/phy-leds.txt
 create mode 100644 include/dt-bindings/phy/phy-leds.h

diff --git a/Documentation/devicetree/bindings/phy/phy-leds.txt b/Documentation/devicetree/bindings/phy/phy-leds.txt
new file mode 100644
index 0000000..1a35e3d
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/phy-leds.txt
@@ -0,0 +1,52 @@
+LED configuration for Ethernet phys
+
+All these properties are optional, not all properties are supported by
+all PHYs. When more then one property name is define for one LED the
+order they get applied is device depended.
+Property names:
+	led-const-on: conditions the LED should be constant on
+	led-pulse: condition the LED should be pulsed on
+	led-blink-slow: condition the LED should slowly blink
+	led-blink-fast: condition the LED should fast blink
+
+These property values define the states a LED is triggered by the
+hardware. Not all PHYs support all states. It is possible to connect
+these property values with OR to trigger the LED in multiple stats like
+10MBit/s and 100MBit/s. The possible combinations are device specific.
+property values:
+	PHY_LED_OFF:		LED is off
+	PHY_LED_LINK10:		link is 10MBit/s
+	PHY_LED_LINK100:	link is 100MBit/s
+	PHY_LED_LINK1000:	link is 1000MBit/s
+	PHY_LED_PDOWN:		link is powered down
+	PHY_LED_EEE:		link is in EEE mode
+	PHY_LED_ANEG:		auto negotiation is running
+	PHY_LED_ABIST:		analog self testing is running
+	PHY_LED_CDIAG:		cable diagnostics is running
+	PHY_LED_COPPER:		copper interface detected
+	PHY_LED_FIBER:		fiber interface detected
+	PHY_LED_TXACT:		Transmit activity
+	PHY_LED_RXACT:		Receive activity
+	PHY_LED_COL:		Collision
+
+Example:
+
+#include <dt-bindings/phy/phy-leds.h>
+phy@0 {
+	compatible = "ethernet-phy-ieee802.3-c22";
+	reg = <0x0>;
+	#address-cells = <1>;
+	#size-cells = <0>;
+	led@0 {
+		compatible = "phy,led";
+		reg = <0>;
+		led-const-on = <(PHY_LED_LINK10 | PHY_LED_LINK100 | PHY_LED_LINK1000)>;
+		led-pulse = <(PHY_LED_TXACT | PHY_LED_RXACT)>;
+	};
+	led@2 {
+		compatible = "phy,led";
+		reg = <2>;
+		led-blink-slow = <PHY_LED_EEE>;
+		led-blink-fast = <PHY_LED_PDOWN>;
+	};
+};
diff --git a/include/dt-bindings/phy/phy-leds.h b/include/dt-bindings/phy/phy-leds.h
new file mode 100644
index 0000000..801fdaf
--- /dev/null
+++ b/include/dt-bindings/phy/phy-leds.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2016 Hauke Mehrtens <hauke-5/S+JYg5SzeELgA04lAiVw@public.gmane.org>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ */
+
+#ifndef _DT_BINDINGS_PHY_LEDS
+#define _DT_BINDINGS_PHY_LEDS
+
+#define PHY_LED_OFF		(1 << 0)  /* is off */
+#define PHY_LED_LINK10		(1 << 1)  /* link is 10MBit/s */
+#define PHY_LED_LINK100		(1 << 2)  /* link is 100MBit/s */
+#define PHY_LED_LINK1000	(1 << 3)  /* link is 1000MBit/s */
+#define PHY_LED_PDOWN		(1 << 4)  /* link is powered down */
+#define PHY_LED_EEE		(1 << 5)  /* link is in EEE mode */
+#define PHY_LED_ANEG		(1 << 6)  /* auto negotiation is running */
+#define PHY_LED_ABIST		(1 << 7)  /* analog self testing is running */
+#define PHY_LED_CDIAG		(1 << 8)  /* cable diagnostics is running */
+#define PHY_LED_COPPER		(1 << 9)  /* copper interface detected */
+#define PHY_LED_FIBER		(1 << 10) /* fiber interface detected */
+#define PHY_LED_TXACT		(1 << 11) /* Transmit activity */
+#define PHY_LED_RXACT		(1 << 12) /* Receive activity */
+#define PHY_LED_COL		(1 << 13) /* Collision */
+
+#endif /* _DT_BINDINGS_PHY_LEDS */
-- 
2.8.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2016-06-05 21:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-05 21:45 [PATCH 0/2] NET: PHY: Add PHY LED control binding Hauke Mehrtens
     [not found] ` <1465163150-21429-1-git-send-email-hauke-5/S+JYg5SzeELgA04lAiVw@public.gmane.org>
2016-06-05 21:45   ` Hauke Mehrtens [this message]
2016-06-08 19:30     ` [PATCH 1/2] " Rob Herring
2016-06-09  6:06       ` Alexander Stein
2016-06-09  6:12         ` John Crispin
     [not found]           ` <f1e22176-d30a-be66-a4ea-dd0666775597-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org>
2016-06-09 20:13             ` Hauke Mehrtens
     [not found]               ` <cf8ba323-5d15-b5b6-fe7c-9f9a7da2c18a-5/S+JYg5SzeELgA04lAiVw@public.gmane.org>
2016-06-20 22:17                 ` Hauke Mehrtens
2016-06-05 21:45 ` [PATCH 2/2] NET: PHY: Intel XWAY: add LED configuration support Hauke Mehrtens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1465163150-21429-2-git-send-email-hauke@hauke-m.de \
    --to=hauke-5/s+jyg5szeelga04laivw@public.gmane.org \
    --cc=alexander.stein-93q1YBGzJSMe9JSWTWOYM3xStJ4P+DSV@public.gmane.org \
    --cc=andrew-g2DYL2Zd6BY@public.gmane.org \
    --cc=daniel.schwierzeck-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=eckert.florian-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org \
    --cc=f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=hauke.mehrtens-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=john-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=openwrt-zg6vgJgm1sizQB+pC5nmwQ@public.gmane.org \
    --cc=thomas.langer-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.