From: Michael Walle <michael@walle.cc>
To: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
netdev@vger.kernel.org
Cc: Michael Walle <michael@walle.cc>
Subject: [PATCH 1/3] dt-bindings: net: phy: Add reg-init property
Date: Tue, 29 Oct 2019 18:48:17 +0100 [thread overview]
Message-ID: <20191029174819.3502-2-michael@walle.cc> (raw)
In-Reply-To: <20191029174819.3502-1-michael@walle.cc>
Describe the reg-init property to configure PHY registers.
Signed-off-by: Michael Walle <michael@walle.cc>
---
.../devicetree/bindings/net/ethernet-phy.yaml | 31 +++++++++++++++++++
MAINTAINERS | 1 +
include/dt-bindings/net/phy.h | 18 +++++++++++
3 files changed, 50 insertions(+)
create mode 100644 include/dt-bindings/net/phy.h
diff --git a/Documentation/devicetree/bindings/net/ethernet-phy.yaml b/Documentation/devicetree/bindings/net/ethernet-phy.yaml
index f70f18ff821f..d2dda1f33119 100644
--- a/Documentation/devicetree/bindings/net/ethernet-phy.yaml
+++ b/Documentation/devicetree/bindings/net/ethernet-phy.yaml
@@ -153,6 +153,28 @@ properties:
Delay after the reset was deasserted in microseconds. If
this property is missing the delay will be skipped.
+ reg-init:
+ allOf:
+ - $ref: /schemas/types.yaml#/definitions/uint32-matrix
+ items:
+ items:
+ - description:
+ Set this to zero to write clause-22 register.
+ Set the page ORed with PHY_REG_PAGE to write to
+ a paged register. Set to devad ORed with
+ PHY_REG_C45 to write a clause-45 register.
+ - description:
+ The PHY register.
+ - description:
+ Mask, if non-zero, ANDed with existing register
+ value.
+ - description:
+ Value, ORed with the masked value and written to
+ the register.
+ description:
+ A list of <page_or_devad reg mask value> tuples to configure
+ the PHY registers at startup.
+
required:
- reg
@@ -173,5 +195,14 @@ examples:
reset-gpios = <&gpio1 4 1>;
reset-assert-us = <1000>;
reset-deassert-us = <2000>;
+
+ reg-init =
+ /* Fix RX and TX clock transition timing */
+ <(PHY_REG_PAGE | 2) 0x15 0xffcf 0>, /* Reg 2,21 Clear bits 4, 5 */
+ /* Adjust LED drive. */
+ <(PHY_REG_PAGE | 3) 0x11 0 0x442a>, /* Reg 3,17 <- 0442a */
+ /* irq, blink-activity, blink-link */
+ <(PHY_REG_PAGE | 3) 0x10 0 0x0242>; /* Reg 3,16 <- 0x0242 */
+
};
};
diff --git a/MAINTAINERS b/MAINTAINERS
index a69e6db80c79..493ea5e13c2c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6147,6 +6147,7 @@ F: Documentation/networking/phy.rst
F: drivers/net/phy/
F: drivers/of/of_mdio.c
F: drivers/of/of_net.c
+F: include/dt-bindings/net/phy.h
F: include/linux/*mdio*.h
F: include/linux/of_net.h
F: include/linux/phy.h
diff --git a/include/dt-bindings/net/phy.h b/include/dt-bindings/net/phy.h
new file mode 100644
index 000000000000..b37853144719
--- /dev/null
+++ b/include/dt-bindings/net/phy.h
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Device Tree constants for a generic network PHY
+ *
+ * Author: Michael Walle <michael@walle.cc>
+ *
+ */
+
+#ifndef _DT_BINDINGS_NET_PHY_H
+#define _DT_BINDINGS_NET_PHY_H
+
+/* PHY write selection bits */
+
+#define PHY_REG_C22 (0)
+#define PHY_REG_PAGE (1 << 31)
+#define PHY_REG_C45 (1 << 30)
+
+#endif /* _DT_BINDINGS_NET_PHY_H */
--
2.20.1
next prev parent reply other threads:[~2019-10-29 17:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-29 17:48 [PATCH 0/3] net: phy: initialize PHYs via device tree properties Michael Walle
2019-10-29 17:48 ` Michael Walle [this message]
2019-10-29 17:48 ` [PATCH 2/3] net: phy: export __phy_{read|write}_page Michael Walle
2019-10-29 17:48 ` [PATCH 3/3] net: phy: Use device tree properties to initialize any PHYs Michael Walle
2019-10-29 17:59 ` [PATCH 0/3] net: phy: initialize PHYs via device tree properties Florian Fainelli
2019-10-29 18:25 ` Andrew Lunn
2019-10-29 20:54 ` Michael Walle
2019-10-29 20:59 ` Florian Fainelli
2019-10-30 13:19 ` Michael Walle
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=20191029174819.3502-2-michael@walle.cc \
--to=michael@walle.cc \
--cc=devicetree@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).