linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] net: phy: at803x device tree binding
@ 2019-11-02  1:13 Michael Walle
  2019-11-02  1:13 ` [PATCH 1/5] net: phy: at803x: fix Kconfig description Michael Walle
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: Michael Walle @ 2019-11-02  1:13 UTC (permalink / raw)
  To: linux-kernel, devicetree, netdev
  Cc: Michael Walle, David S. Miller, Rob Herring, Mark Rutland,
	Andrew Lunn, Florian Fainelli, Heiner Kallweit, Liam Girdwood,
	Mark Brown, Simon Horman

Adds a device tree binding to configure the clock and the RGMII voltage.

Changes since the RFC:
 - renamed the Kconfig entry to "Qualcomm Atheros.." and reordered the
   item
 - renamed the prefix from atheros to qca
 - use the correct name AR803x (instead of AT803x) in new files and
   dt-bindings.
 - listed the PHY maintainers in the new schema. Hopefully, thats ok.
 - fixed a typo in the bindings schema
 - run dtb_checks and dt_binding_check and fixed the schema
 - dropped the rgmii-io-1v8 property; instead provide two regulators vddh
   and vddio, add one consumer vddio-supply
 - fix the clock settings for the AR8030/AR8035
 - only the AR8031 supports chaning the LDO and the PLL mode in software.
   Check if we have the correct PHY.
 - new patch to mention the AR8033 which is the same as the AR8031 just
   without PTP support
 - new patch which corrects any displayed PHY names and comments. Be
   consistent.

Michael Walle (5):
  net: phy: at803x: fix Kconfig description
  dt-bindings: net: phy: Add support for AT803X
  net: phy: at803x: add device tree binding
  net: phy: at803x: mention AR8033 as same as AR8031
  net: phy: at803x: fix the PHY names

 .../devicetree/bindings/net/qca,ar803x.yaml   | 111 +++++++
 MAINTAINERS                                   |   2 +
 drivers/net/phy/Kconfig                       |  10 +-
 drivers/net/phy/at803x.c                      | 301 +++++++++++++++++-
 include/dt-bindings/net/qca-ar803x.h          |  13 +
 5 files changed, 422 insertions(+), 15 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/qca,ar803x.yaml
 create mode 100644 include/dt-bindings/net/qca-ar803x.h

Cc: "David S. Miller" <davem@davemloft.net>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Simon Horman <simon.horman@netronome.com>
-- 
2.20.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/5] net: phy: at803x: fix Kconfig description
  2019-11-02  1:13 [PATCH 0/5] net: phy: at803x device tree binding Michael Walle
@ 2019-11-02  1:13 ` Michael Walle
  2019-11-02  2:57   ` Florian Fainelli
  2019-11-02  1:13 ` [PATCH 2/5] dt-bindings: net: phy: Add support for AT803X Michael Walle
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Michael Walle @ 2019-11-02  1:13 UTC (permalink / raw)
  To: linux-kernel, devicetree, netdev; +Cc: Michael Walle

The name of the PHY is actually AR803x not AT803x. Additionally, add the
name of the vendor and mention the AR8031 support.

Signed-off-by: Michael Walle <michael@walle.cc>
---
 drivers/net/phy/Kconfig | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index fe602648b99f..1b884ebb4e48 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -282,11 +282,6 @@ config AX88796B_PHY
 	  Currently supports the Asix Electronics PHY found in the X-Surf 100
 	  AX88796B package.
 
-config AT803X_PHY
-	tristate "AT803X PHYs"
-	---help---
-	  Currently supports the AT8030 and AT8035 model
-
 config BCM63XX_PHY
 	tristate "Broadcom 63xx SOCs internal PHY"
 	depends on BCM63XX || COMPILE_TEST
@@ -444,6 +439,11 @@ config NXP_TJA11XX_PHY
 	---help---
 	  Currently supports the NXP TJA1100 and TJA1101 PHY.
 
+config AT803X_PHY
+	tristate "Qualcomm Atheros AR803X PHYs"
+	help
+	  Currently supports the AR8030, AR8031 and AR8035 model
+
 config QSEMI_PHY
 	tristate "Quality Semiconductor PHYs"
 	---help---
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/5] dt-bindings: net: phy: Add support for AT803X
  2019-11-02  1:13 [PATCH 0/5] net: phy: at803x device tree binding Michael Walle
  2019-11-02  1:13 ` [PATCH 1/5] net: phy: at803x: fix Kconfig description Michael Walle
@ 2019-11-02  1:13 ` Michael Walle
  2019-11-02  2:59   ` Florian Fainelli
  2019-11-06  4:37   ` Rob Herring
  2019-11-02  1:13 ` [PATCH 3/5] net: phy: at803x: add device tree binding Michael Walle
                   ` (3 subsequent siblings)
  5 siblings, 2 replies; 14+ messages in thread
From: Michael Walle @ 2019-11-02  1:13 UTC (permalink / raw)
  To: linux-kernel, devicetree, netdev; +Cc: Michael Walle

Document the Atheros AR803x PHY bindings.

Signed-off-by: Michael Walle <michael@walle.cc>
---
 .../devicetree/bindings/net/qca,ar803x.yaml   | 111 ++++++++++++++++++
 MAINTAINERS                                   |   2 +
 include/dt-bindings/net/qca-ar803x.h          |  13 ++
 3 files changed, 126 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/qca,ar803x.yaml
 create mode 100644 include/dt-bindings/net/qca-ar803x.h

diff --git a/Documentation/devicetree/bindings/net/qca,ar803x.yaml b/Documentation/devicetree/bindings/net/qca,ar803x.yaml
new file mode 100644
index 000000000000..5a6c9d20c0ba
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/qca,ar803x.yaml
@@ -0,0 +1,111 @@
+# SPDX-License-Identifier: GPL-2.0+
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/qca,ar803x.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm Atheros AR803x PHY
+
+maintainers:
+  - Andrew Lunn <andrew@lunn.ch>
+  - Florian Fainelli <f.fainelli@gmail.com>
+  - Heiner Kallweit <hkallweit1@gmail.com>
+
+description: |
+  Bindings for Qualcomm Atheros AR803x PHYs
+
+allOf:
+  - $ref: ethernet-phy.yaml#
+
+properties:
+  qca,clk-out-frequency:
+    description: Clock output frequency in Hertz.
+    allOf:
+      - $ref: /schemas/types.yaml#/definitions/uint32
+      - enum: [ 25000000, 50000000, 62500000, 125000000 ]
+
+  qca,clk-out-strength:
+    description: Clock output driver strength.
+    allOf:
+      - $ref: /schemas/types.yaml#/definitions/uint32
+      - enum: [ 0, 1, 2 ]
+
+  qca,keep-pll-enabled:
+    description: |
+      If set, keep the PLL enabled even if there is no link. Useful if you
+      want to use the clock output without an ethernet link.
+
+      Only supported on the AR8031.
+    type: boolean
+
+  vddio-supply:
+    description: |
+      RGMII I/O voltage regulator (see regulator/regulator.yaml).
+
+      The PHY supports RGMII I/O voltages of 1.5V, 1.8V and 2.5V. You can
+      either connect this to the vddio-regulator (1.5V / 1.8V) or the
+      vddh-regulator (2.5V).
+
+      Only supported on the AR8031.
+
+  vddio-regulator:
+    type: object
+    description:
+      Initial data for the VDDIO regulator. Set this to 1.5V or 1.8V.
+    allOf:
+      - $ref: /schemas/regulator/regulator.yaml
+
+  vddh-regulator:
+    type: object
+    description:
+      Dummy subnode to model the external connection of the PHY VDDH
+      regulator to VDDIO.
+    allOf:
+      - $ref: /schemas/regulator/regulator.yaml
+
+
+examples:
+  - |
+    #include <dt-bindings/net/qca-ar803x.h>
+
+    ethernet {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        phy-mode = "rgmii-id";
+
+        ethernet-phy@0 {
+            reg = <0>;
+
+            qca,clk-out-frequency = <125000000>;
+            qca,clk-out-strength = <AR803X_STRENGTH_FULL>;
+
+            vddio-supply = <&vddio>;
+
+            vddio: vddio-regulator {
+                regulator-min-microvolt = <1800000>;
+                regulator-max-microvolt = <1800000>;
+            };
+        };
+    };
+  - |
+    #include <dt-bindings/net/qca-ar803x.h>
+
+    ethernet {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        phy-mode = "rgmii-id";
+
+        ethernet-phy@0 {
+            reg = <0>;
+
+            qca,clk-out-frequency = <50000000>;
+            qca,keep-pll-enabled;
+
+            vddio-supply = <&vddh>;
+
+            vddh: vddh-regulator {
+            };
+        };
+    };
diff --git a/MAINTAINERS b/MAINTAINERS
index a69e6db80c79..2a68c255579e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6143,10 +6143,12 @@ S:	Maintained
 F:	Documentation/ABI/testing/sysfs-class-net-phydev
 F:	Documentation/devicetree/bindings/net/ethernet-phy.yaml
 F:	Documentation/devicetree/bindings/net/mdio*
+F:	Documentation/devicetree/bindings/net/qca,ar803x.yaml
 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/qca-ar803x.h
 F:	include/linux/*mdio*.h
 F:	include/linux/of_net.h
 F:	include/linux/phy.h
diff --git a/include/dt-bindings/net/qca-ar803x.h b/include/dt-bindings/net/qca-ar803x.h
new file mode 100644
index 000000000000..9c046c7242ed
--- /dev/null
+++ b/include/dt-bindings/net/qca-ar803x.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Device Tree constants for the Qualcomm Atheros AR803x PHYs
+ */
+
+#ifndef _DT_BINDINGS_QCA_AR803X_H
+#define _DT_BINDINGS_QCA_AR803X_H
+
+#define AR803X_STRENGTH_FULL		0
+#define AR803X_STRENGTH_HALF		1
+#define AR803X_STRENGTH_QUARTER		2
+
+#endif
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/5] net: phy: at803x: add device tree binding
  2019-11-02  1:13 [PATCH 0/5] net: phy: at803x device tree binding Michael Walle
  2019-11-02  1:13 ` [PATCH 1/5] net: phy: at803x: fix Kconfig description Michael Walle
  2019-11-02  1:13 ` [PATCH 2/5] dt-bindings: net: phy: Add support for AT803X Michael Walle
@ 2019-11-02  1:13 ` Michael Walle
  2019-11-02  3:01   ` Florian Fainelli
  2019-11-05 22:28   ` Michael Walle
  2019-11-02  1:13 ` [PATCH 4/5] net: phy: at803x: mention AR8033 as same as AR8031 Michael Walle
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 14+ messages in thread
From: Michael Walle @ 2019-11-02  1:13 UTC (permalink / raw)
  To: linux-kernel, devicetree, netdev; +Cc: Michael Walle

Add support for configuring the CLK_25M pin as well as the RGMII I/O
voltage by the device tree.

Signed-off-by: Michael Walle <michael@walle.cc>
---
 drivers/net/phy/at803x.c | 283 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 281 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
index 1eb5d4fb8925..a30a2ff57068 100644
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
@@ -13,7 +13,12 @@
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/of_gpio.h>
+#include <linux/bitfield.h>
 #include <linux/gpio/consumer.h>
+#include <linux/regulator/of_regulator.h>
+#include <linux/regulator/driver.h>
+#include <linux/regulator/consumer.h>
+#include <dt-bindings/net/qca-ar803x.h>
 
 #define AT803X_SPECIFIC_STATUS			0x11
 #define AT803X_SS_SPEED_MASK			(3 << 14)
@@ -62,6 +67,42 @@
 #define AT803X_DEBUG_REG_5			0x05
 #define AT803X_DEBUG_TX_CLK_DLY_EN		BIT(8)
 
+#define AT803X_DEBUG_REG_1F			0x1F
+#define AT803X_DEBUG_PLL_ON			BIT(2)
+#define AT803X_DEBUG_RGMII_1V8			BIT(3)
+
+/* AT803x supports either the XTAL input pad, an internal PLL or the
+ * DSP as clock reference for the clock output pad. The XTAL reference
+ * is only used for 25 MHz output, all other frequencies need the PLL.
+ * The DSP as a clock reference is used in synchronous ethernet
+ * applications.
+ *
+ * By default the PLL is only enabled if there is a link. Otherwise
+ * the PHY will go into low power state and disabled the PLL. You can
+ * set the PLL_ON bit (see debug register 0x1f) to keep the PLL always
+ * enabled.
+ */
+#define AT803X_MMD7_CLK25M			0x8016
+#define AT803X_CLK_OUT_MASK			GENMASK(4, 2)
+#define AT803X_CLK_OUT_25MHZ_XTAL		0
+#define AT803X_CLK_OUT_25MHZ_DSP		1
+#define AT803X_CLK_OUT_50MHZ_PLL		2
+#define AT803X_CLK_OUT_50MHZ_DSP		3
+#define AT803X_CLK_OUT_62_5MHZ_PLL		4
+#define AT803X_CLK_OUT_62_5MHZ_DSP		5
+#define AT803X_CLK_OUT_125MHZ_PLL		6
+#define AT803X_CLK_OUT_125MHZ_DSP		7
+
+/* Unfortunately, the AR8035 has another mask which is incompatible
+ * with the AR8031 PHY. Also, it only supports 25MHz and 50MHz.
+ */
+#define AT8035_CLK_OUT_MASK			GENMASK(4, 3)
+
+#define AT803X_CLK_OUT_STRENGTH_MASK		GENMASK(8, 7)
+#define AT803X_CLK_OUT_STRENGTH_FULL		0
+#define AT803X_CLK_OUT_STRENGTH_HALF		1
+#define AT803X_CLK_OUT_STRENGTH_QUARTER		2
+
 #define ATH8030_PHY_ID 0x004dd076
 #define ATH8031_PHY_ID 0x004dd074
 #define ATH8035_PHY_ID 0x004dd072
@@ -73,6 +114,13 @@ MODULE_LICENSE("GPL");
 
 struct at803x_priv {
 	bool phy_reset:1;
+	int flags;
+#define AT803X_KEEP_PLL_ENABLED	BIT(0)	/* don't turn off internal PLL */
+	u16 clk_25m_reg;
+	u16 clk_25m_mask;
+	struct regulator_dev *vddio_rdev;
+	struct regulator_dev *vddh_rdev;
+	struct regulator *vddio;
 };
 
 struct at803x_context {
@@ -240,6 +288,192 @@ static int at803x_resume(struct phy_device *phydev)
 	return phy_modify(phydev, MII_BMCR, BMCR_PDOWN | BMCR_ISOLATE, 0);
 }
 
+static int at803x_rgmii_reg_set_voltage_sel(struct regulator_dev *rdev,
+					    unsigned int selector)
+{
+	struct phy_device *phydev = rdev_get_drvdata(rdev);
+
+	if (selector)
+		return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_1F,
+					     0, AT803X_DEBUG_RGMII_1V8);
+	else
+		return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_1F,
+					     AT803X_DEBUG_RGMII_1V8, 0);
+}
+
+static int at803x_rgmii_reg_get_voltage_sel(struct regulator_dev *rdev)
+{
+	struct phy_device *phydev = rdev_get_drvdata(rdev);
+	int val;
+
+	val = at803x_debug_reg_read(phydev, AT803X_DEBUG_REG_1F);
+	if (val < 0)
+		return val;
+
+	return (val & AT803X_DEBUG_RGMII_1V8) ? 1 : 0;
+}
+
+static struct regulator_ops vddio_regulator_ops = {
+	.list_voltage = regulator_list_voltage_table,
+	.set_voltage_sel = at803x_rgmii_reg_set_voltage_sel,
+	.get_voltage_sel = at803x_rgmii_reg_get_voltage_sel,
+};
+
+static const unsigned int vddio_voltage_table[] = {
+	1500000,
+	1800000,
+};
+
+static const struct regulator_desc vddio_desc = {
+	.name = "vddio",
+	.of_match = of_match_ptr("vddio-regulator"),
+	.n_voltages = ARRAY_SIZE(vddio_voltage_table),
+	.volt_table = vddio_voltage_table,
+	.ops = &vddio_regulator_ops,
+	.type = REGULATOR_VOLTAGE,
+	.owner = THIS_MODULE,
+};
+
+static struct regulator_ops vddh_regulator_ops = {
+};
+
+static const struct regulator_desc vddh_desc = {
+	.name = "vddh",
+	.of_match = of_match_ptr("vddh-regulator"),
+	.n_voltages = 1,
+	.fixed_uV = 2500000,
+	.ops = &vddh_regulator_ops,
+	.type = REGULATOR_VOLTAGE,
+	.owner = THIS_MODULE,
+};
+
+static int at8031_register_regulators(struct phy_device *phydev)
+{
+	struct at803x_priv *priv = phydev->priv;
+	struct device *dev = &phydev->mdio.dev;
+	struct regulator_config config = { };
+
+	config.dev = dev;
+	config.driver_data = phydev;
+
+	priv->vddio_rdev = devm_regulator_register(dev, &vddio_desc, &config);
+	if (IS_ERR(priv->vddio_rdev)) {
+		phydev_err(phydev, "failed to register VDDIO regulator\n");
+		return PTR_ERR(priv->vddio_rdev);
+	}
+
+	priv->vddh_rdev = devm_regulator_register(dev, &vddh_desc, &config);
+	if (IS_ERR(priv->vddh_rdev)) {
+		phydev_err(phydev, "failed to register VDDH regulator\n");
+		return PTR_ERR(priv->vddh_rdev);
+	}
+
+	return 0;
+}
+
+static bool at803x_match_phy_id(struct phy_device *phydev, u32 phy_id)
+{
+	return (phydev->phy_id & phydev->drv->phy_id_mask)
+		== (phy_id & phydev->drv->phy_id_mask);
+}
+
+static int at803x_parse_dt(struct phy_device *phydev)
+{
+	struct device_node *node = phydev->mdio.dev.of_node;
+	struct at803x_priv *priv = phydev->priv;
+	unsigned int sel, mask;
+	u32 freq, strength;
+	int ret;
+
+	if (!IS_ENABLED(CONFIG_OF_MDIO))
+		return 0;
+
+	ret = of_property_read_u32(node, "qca,clk-out-frequency", &freq);
+	if (!ret) {
+		mask = AT803X_CLK_OUT_MASK;
+		switch (freq) {
+		case 25000000:
+			sel = AT803X_CLK_OUT_25MHZ_XTAL;
+			break;
+		case 50000000:
+			sel = AT803X_CLK_OUT_50MHZ_PLL;
+			break;
+		case 62500000:
+			sel = AT803X_CLK_OUT_62_5MHZ_PLL;
+			break;
+		case 125000000:
+			sel = AT803X_CLK_OUT_125MHZ_PLL;
+			break;
+		default:
+			phydev_err(phydev, "invalid qca,clk-out-frequency\n");
+			return -EINVAL;
+		}
+
+		/* Fixup for the AR8030/AR8035. This chip has another mask and
+		 * supports only 25MHz and 50MHz output.
+		 *
+		 * Warning:
+		 *   There was no datasheet for the AR8030 available so this is
+		 *   just a guess. But the AR8035 is listed as pin compatible
+		 *   to the AR8030 so there might be a good chance it works on
+		 *   the AR8030 too.
+		 */
+		if (at803x_match_phy_id(phydev, ATH8030_PHY_ID) ||
+		    at803x_match_phy_id(phydev, ATH8035_PHY_ID)) {
+			mask = AT8035_CLK_OUT_MASK;
+			if (freq > 50000000)
+				phydev_err(phydev,
+					   "invalid qca,clk-out-frequency\n");
+				return -EINVAL;
+		}
+
+		priv->clk_25m_reg |= FIELD_PREP(mask, sel);
+		priv->clk_25m_mask |= mask;
+	}
+
+	ret = of_property_read_u32(node, "qca,clk-out-strength", &strength);
+	if (!ret) {
+		priv->clk_25m_mask |= AT803X_CLK_OUT_STRENGTH_MASK;
+		switch (strength) {
+		case AR803X_STRENGTH_FULL:
+			priv->clk_25m_reg |= AT803X_CLK_OUT_STRENGTH_FULL;
+			break;
+		case AR803X_STRENGTH_HALF:
+			priv->clk_25m_reg |= AT803X_CLK_OUT_STRENGTH_HALF;
+			break;
+		case AR803X_STRENGTH_QUARTER:
+			priv->clk_25m_reg |= AT803X_CLK_OUT_STRENGTH_QUARTER;
+			break;
+		default:
+			phydev_err(phydev, "invalid qca,clk-out-strength\n");
+			return -EINVAL;
+		}
+	}
+
+	/* Only supported on AR8031, the AR8030/AR8035 use strapping options */
+	if (at803x_match_phy_id(phydev, ATH8031_PHY_ID)) {
+		if (of_property_read_bool(node, "qca,keep-pll-enabled"))
+			priv->flags |= AT803X_KEEP_PLL_ENABLED;
+
+		ret = at8031_register_regulators(phydev);
+		if (ret < 0)
+			return ret;
+
+		priv->vddio = devm_regulator_get_optional(&phydev->mdio.dev,
+							  "vddio");
+		if (IS_ERR(priv->vddio)) {
+			phydev_err(phydev, "failed to get VDDIO regulator\n");
+			return PTR_ERR(priv->vddio);
+		}
+
+		ret = regulator_enable(priv->vddio);
+		if (ret < 0)
+			return ret;
+	}
+
+	return 0;
+}
+
 static int at803x_probe(struct phy_device *phydev)
 {
 	struct device *dev = &phydev->mdio.dev;
@@ -251,7 +485,40 @@ static int at803x_probe(struct phy_device *phydev)
 
 	phydev->priv = priv;
 
-	return 0;
+	return at803x_parse_dt(phydev);
+}
+
+static int at803x_clk_out_config(struct phy_device *phydev)
+{
+	struct at803x_priv *priv = phydev->priv;
+	int val;
+
+	if (!priv->clk_25m_mask)
+		return 0;
+
+	val = phy_read_mmd(phydev, MDIO_MMD_AN, AT803X_MMD7_CLK25M);
+	if (val < 0)
+		return val;
+
+	val &= ~priv->clk_25m_mask;
+	val |= priv->clk_25m_reg;
+
+	return phy_write_mmd(phydev, MDIO_MMD_AN, AT803X_MMD7_CLK25M, val);
+}
+
+static int at8031_pll_config(struct phy_device *phydev)
+{
+	struct at803x_priv *priv = phydev->priv;
+
+	/* The default after hardware reset is PLL OFF. After a soft reset, the
+	 * values are retained.
+	 */
+	if (priv->flags & AT803X_KEEP_PLL_ENABLED)
+		return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_1F,
+					     0, AT803X_DEBUG_PLL_ON);
+	else
+		return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_1F,
+					     AT803X_DEBUG_PLL_ON, 0);
 }
 
 static int at803x_config_init(struct phy_device *phydev)
@@ -276,8 +543,20 @@ static int at803x_config_init(struct phy_device *phydev)
 		ret = at803x_enable_tx_delay(phydev);
 	else
 		ret = at803x_disable_tx_delay(phydev);
+	if (ret < 0)
+		return ret;
 
-	return ret;
+	ret = at803x_clk_out_config(phydev);
+	if (ret < 0)
+		return ret;
+
+	if (at803x_match_phy_id(phydev, ATH8031_PHY_ID)) {
+		ret = at8031_pll_config(phydev);
+		if (ret < 0)
+			return ret;
+	}
+
+	return 0;
 }
 
 static int at803x_ack_interrupt(struct phy_device *phydev)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/5] net: phy: at803x: mention AR8033 as same as AR8031
  2019-11-02  1:13 [PATCH 0/5] net: phy: at803x device tree binding Michael Walle
                   ` (2 preceding siblings ...)
  2019-11-02  1:13 ` [PATCH 3/5] net: phy: at803x: add device tree binding Michael Walle
@ 2019-11-02  1:13 ` Michael Walle
  2019-11-02  1:13 ` [PATCH 5/5] net: phy: at803x: fix the PHY names Michael Walle
  2019-11-05 22:06 ` [PATCH 0/5] net: phy: at803x device tree binding David Miller
  5 siblings, 0 replies; 14+ messages in thread
From: Michael Walle @ 2019-11-02  1:13 UTC (permalink / raw)
  To: linux-kernel, devicetree, netdev; +Cc: Michael Walle

The AR8033 is the AR8031 without PTP support. All other registers are
the same. Unfortunately, they share the same PHY ID. Therefore, we
cannot distinguish between the one with PTP support and the one without.

Signed-off-by: Michael Walle <michael@walle.cc>
---
 drivers/net/phy/Kconfig  |  2 +-
 drivers/net/phy/at803x.c | 10 ++++++----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 1b884ebb4e48..8bccadf17e60 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -442,7 +442,7 @@ config NXP_TJA11XX_PHY
 config AT803X_PHY
 	tristate "Qualcomm Atheros AR803X PHYs"
 	help
-	  Currently supports the AR8030, AR8031 and AR8035 model
+	  Currently supports the AR8030, AR8031, AR8033 and AR8035 model
 
 config QSEMI_PHY
 	tristate "Quality Semiconductor PHYs"
diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
index a30a2ff57068..49a1eebc7825 100644
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
@@ -94,7 +94,7 @@
 #define AT803X_CLK_OUT_125MHZ_DSP		7
 
 /* Unfortunately, the AR8035 has another mask which is incompatible
- * with the AR8031 PHY. Also, it only supports 25MHz and 50MHz.
+ * with the AR8031/AR8033 PHY. Also, it only supports 25MHz and 50MHz.
  */
 #define AT8035_CLK_OUT_MASK			GENMASK(4, 3)
 
@@ -450,7 +450,9 @@ static int at803x_parse_dt(struct phy_device *phydev)
 		}
 	}
 
-	/* Only supported on AR8031, the AR8030/AR8035 use strapping options */
+	/* Only supported on AR8031/AR8033, the AR8030/AR8035 use strapping
+	 * options.
+	 */
 	if (at803x_match_phy_id(phydev, ATH8031_PHY_ID)) {
 		if (of_property_read_bool(node, "qca,keep-pll-enabled"))
 			priv->flags |= AT803X_KEEP_PLL_ENABLED;
@@ -735,9 +737,9 @@ static struct phy_driver at803x_driver[] = {
 	.ack_interrupt		= at803x_ack_interrupt,
 	.config_intr		= at803x_config_intr,
 }, {
-	/* ATHEROS 8031 */
+	/* ATHEROS 8031/8033 */
 	.phy_id			= ATH8031_PHY_ID,
-	.name			= "Atheros 8031 ethernet",
+	.name			= "Atheros 8031/8033 ethernet",
 	.phy_id_mask		= AT803X_PHY_ID_MASK,
 	.probe			= at803x_probe,
 	.config_init		= at803x_config_init,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 5/5] net: phy: at803x: fix the PHY names
  2019-11-02  1:13 [PATCH 0/5] net: phy: at803x device tree binding Michael Walle
                   ` (3 preceding siblings ...)
  2019-11-02  1:13 ` [PATCH 4/5] net: phy: at803x: mention AR8033 as same as AR8031 Michael Walle
@ 2019-11-02  1:13 ` Michael Walle
  2019-11-02  3:21   ` Florian Fainelli
  2019-11-05 22:06 ` [PATCH 0/5] net: phy: at803x device tree binding David Miller
  5 siblings, 1 reply; 14+ messages in thread
From: Michael Walle @ 2019-11-02  1:13 UTC (permalink / raw)
  To: linux-kernel, devicetree, netdev; +Cc: Michael Walle

Fix at least the displayed strings. The actual name of the chip is
AR803x.

Signed-off-by: Michael Walle <michael@walle.cc>
---
 drivers/net/phy/at803x.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
index 49a1eebc7825..4a0f0bcaac1f 100644
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
@@ -2,7 +2,7 @@
 /*
  * drivers/net/phy/at803x.c
  *
- * Driver for Atheros 803x PHY
+ * Driver for Atheros AR803x PHY
  *
  * Author: Matus Ujhelyi <ujhelyi.m@gmail.com>
  */
@@ -108,7 +108,7 @@
 #define ATH8035_PHY_ID 0x004dd072
 #define AT803X_PHY_ID_MASK			0xffffffef
 
-MODULE_DESCRIPTION("Atheros 803x PHY driver");
+MODULE_DESCRIPTION("Atheros AR803x PHY driver");
 MODULE_AUTHOR("Matus Ujhelyi");
 MODULE_LICENSE("GPL");
 
@@ -707,9 +707,9 @@ static int at803x_read_status(struct phy_device *phydev)
 
 static struct phy_driver at803x_driver[] = {
 {
-	/* ATHEROS 8035 */
+	/* Atheros AR8035 */
 	.phy_id			= ATH8035_PHY_ID,
-	.name			= "Atheros 8035 ethernet",
+	.name			= "Atheros AR8035",
 	.phy_id_mask		= AT803X_PHY_ID_MASK,
 	.probe			= at803x_probe,
 	.config_init		= at803x_config_init,
@@ -722,9 +722,9 @@ static struct phy_driver at803x_driver[] = {
 	.ack_interrupt		= at803x_ack_interrupt,
 	.config_intr		= at803x_config_intr,
 }, {
-	/* ATHEROS 8030 */
+	/* Atheros AR8030 */
 	.phy_id			= ATH8030_PHY_ID,
-	.name			= "Atheros 8030 ethernet",
+	.name			= "Atheros AR8030",
 	.phy_id_mask		= AT803X_PHY_ID_MASK,
 	.probe			= at803x_probe,
 	.config_init		= at803x_config_init,
@@ -737,9 +737,9 @@ static struct phy_driver at803x_driver[] = {
 	.ack_interrupt		= at803x_ack_interrupt,
 	.config_intr		= at803x_config_intr,
 }, {
-	/* ATHEROS 8031/8033 */
+	/* Atheros AR8031/AR8033 */
 	.phy_id			= ATH8031_PHY_ID,
-	.name			= "Atheros 8031/8033 ethernet",
+	.name			= "Atheros AR8031/AR8033",
 	.phy_id_mask		= AT803X_PHY_ID_MASK,
 	.probe			= at803x_probe,
 	.config_init		= at803x_config_init,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/5] net: phy: at803x: fix Kconfig description
  2019-11-02  1:13 ` [PATCH 1/5] net: phy: at803x: fix Kconfig description Michael Walle
@ 2019-11-02  2:57   ` Florian Fainelli
  0 siblings, 0 replies; 14+ messages in thread
From: Florian Fainelli @ 2019-11-02  2:57 UTC (permalink / raw)
  To: Michael Walle, linux-kernel, devicetree, netdev



On 11/1/2019 6:13 PM, Michael Walle wrote:
> The name of the PHY is actually AR803x not AT803x. Additionally, add the
> name of the vendor and mention the AR8031 support.
> 
> Signed-off-by: Michael Walle <michael@walle.cc>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/5] dt-bindings: net: phy: Add support for AT803X
  2019-11-02  1:13 ` [PATCH 2/5] dt-bindings: net: phy: Add support for AT803X Michael Walle
@ 2019-11-02  2:59   ` Florian Fainelli
  2019-11-06  4:37   ` Rob Herring
  1 sibling, 0 replies; 14+ messages in thread
From: Florian Fainelli @ 2019-11-02  2:59 UTC (permalink / raw)
  To: Michael Walle, linux-kernel, devicetree, netdev



On 11/1/2019 6:13 PM, Michael Walle wrote:
> Document the Atheros AR803x PHY bindings.
> 
> Signed-off-by: Michael Walle <michael@walle.cc>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

Nice, especially the way you have solved the regulator, this looks good
to me.
-- 
Florian

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/5] net: phy: at803x: add device tree binding
  2019-11-02  1:13 ` [PATCH 3/5] net: phy: at803x: add device tree binding Michael Walle
@ 2019-11-02  3:01   ` Florian Fainelli
  2019-11-05 22:28   ` Michael Walle
  1 sibling, 0 replies; 14+ messages in thread
From: Florian Fainelli @ 2019-11-02  3:01 UTC (permalink / raw)
  To: Michael Walle, linux-kernel, devicetree, netdev



On 11/1/2019 6:13 PM, Michael Walle wrote:
> Add support for configuring the CLK_25M pin as well as the RGMII I/O
> voltage by the device tree.
> 
> Signed-off-by: Michael Walle <michael@walle.cc>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 5/5] net: phy: at803x: fix the PHY names
  2019-11-02  1:13 ` [PATCH 5/5] net: phy: at803x: fix the PHY names Michael Walle
@ 2019-11-02  3:21   ` Florian Fainelli
  0 siblings, 0 replies; 14+ messages in thread
From: Florian Fainelli @ 2019-11-02  3:21 UTC (permalink / raw)
  To: Michael Walle, linux-kernel, devicetree, netdev



On 11/1/2019 6:13 PM, Michael Walle wrote:
> Fix at least the displayed strings. The actual name of the chip is
> AR803x.

Only if you have to spin a v2, since you fixed the Kconfig entry, you
might as well fix those names to be Qualcomm Atheros.
--
Florian

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/5] net: phy: at803x device tree binding
  2019-11-02  1:13 [PATCH 0/5] net: phy: at803x device tree binding Michael Walle
                   ` (4 preceding siblings ...)
  2019-11-02  1:13 ` [PATCH 5/5] net: phy: at803x: fix the PHY names Michael Walle
@ 2019-11-05 22:06 ` David Miller
  2019-11-05 22:22   ` Michael Walle
  5 siblings, 1 reply; 14+ messages in thread
From: David Miller @ 2019-11-05 22:06 UTC (permalink / raw)
  To: michael
  Cc: linux-kernel, devicetree, netdev, robh+dt, mark.rutland, andrew,
	f.fainelli, hkallweit1, lgirdwood, broonie, simon.horman

From: Michael Walle <michael@walle.cc>
Date: Sat,  2 Nov 2019 02:13:46 +0100

> Adds a device tree binding to configure the clock and the RGMII voltage.

This does not apply cleanly to net-next, please respin.

Thank you.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/5] net: phy: at803x device tree binding
  2019-11-05 22:06 ` [PATCH 0/5] net: phy: at803x device tree binding David Miller
@ 2019-11-05 22:22   ` Michael Walle
  0 siblings, 0 replies; 14+ messages in thread
From: Michael Walle @ 2019-11-05 22:22 UTC (permalink / raw)
  To: David Miller
  Cc: linux-kernel, devicetree, netdev, robh+dt, mark.rutland, andrew,
	f.fainelli, hkallweit1, lgirdwood, broonie, simon.horman

Am 2019-11-05 23:06, schrieb David Miller:
> From: Michael Walle <michael@walle.cc>
> Date: Sat,  2 Nov 2019 02:13:46 +0100
> 
>> Adds a device tree binding to configure the clock and the RGMII 
>> voltage.
> 
> This does not apply cleanly to net-next, please respin.

That is actually just fine, because there is a bug in the AR8035 
handling. I'll fix that and rebase it on your net-next.

Thanks,
-michael

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/5] net: phy: at803x: add device tree binding
  2019-11-02  1:13 ` [PATCH 3/5] net: phy: at803x: add device tree binding Michael Walle
  2019-11-02  3:01   ` Florian Fainelli
@ 2019-11-05 22:28   ` Michael Walle
  1 sibling, 0 replies; 14+ messages in thread
From: Michael Walle @ 2019-11-05 22:28 UTC (permalink / raw)
  To: linux-kernel, devicetree, netdev

Am 2019-11-02 02:13, schrieb Michael Walle:
> Add support for configuring the CLK_25M pin as well as the RGMII I/O
> voltage by the device tree.
> 
> Signed-off-by: Michael Walle <michael@walle.cc>
> ---
>  drivers/net/phy/at803x.c | 283 ++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 281 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
> index 1eb5d4fb8925..a30a2ff57068 100644
> --- a/drivers/net/phy/at803x.c
> +++ b/drivers/net/phy/at803x.c
> @@ -13,7 +13,12 @@
>  #include <linux/netdevice.h>
>  #include <linux/etherdevice.h>
>  #include <linux/of_gpio.h>
> +#include <linux/bitfield.h>
>  #include <linux/gpio/consumer.h>
> +#include <linux/regulator/of_regulator.h>
> +#include <linux/regulator/driver.h>
> +#include <linux/regulator/consumer.h>
> +#include <dt-bindings/net/qca-ar803x.h>
> 
>  #define AT803X_SPECIFIC_STATUS			0x11
>  #define AT803X_SS_SPEED_MASK			(3 << 14)
> @@ -62,6 +67,42 @@
>  #define AT803X_DEBUG_REG_5			0x05
>  #define AT803X_DEBUG_TX_CLK_DLY_EN		BIT(8)
> 
> +#define AT803X_DEBUG_REG_1F			0x1F
> +#define AT803X_DEBUG_PLL_ON			BIT(2)
> +#define AT803X_DEBUG_RGMII_1V8			BIT(3)
> +
> +/* AT803x supports either the XTAL input pad, an internal PLL or the
> + * DSP as clock reference for the clock output pad. The XTAL reference
> + * is only used for 25 MHz output, all other frequencies need the PLL.
> + * The DSP as a clock reference is used in synchronous ethernet
> + * applications.
> + *
> + * By default the PLL is only enabled if there is a link. Otherwise
> + * the PHY will go into low power state and disabled the PLL. You can
> + * set the PLL_ON bit (see debug register 0x1f) to keep the PLL always
> + * enabled.
> + */
> +#define AT803X_MMD7_CLK25M			0x8016
> +#define AT803X_CLK_OUT_MASK			GENMASK(4, 2)
> +#define AT803X_CLK_OUT_25MHZ_XTAL		0
> +#define AT803X_CLK_OUT_25MHZ_DSP		1
> +#define AT803X_CLK_OUT_50MHZ_PLL		2
> +#define AT803X_CLK_OUT_50MHZ_DSP		3
> +#define AT803X_CLK_OUT_62_5MHZ_PLL		4
> +#define AT803X_CLK_OUT_62_5MHZ_DSP		5
> +#define AT803X_CLK_OUT_125MHZ_PLL		6
> +#define AT803X_CLK_OUT_125MHZ_DSP		7
> +
> +/* Unfortunately, the AR8035 has another mask which is incompatible
> + * with the AR8031 PHY. Also, it only supports 25MHz and 50MHz.
> + */
> +#define AT8035_CLK_OUT_MASK			GENMASK(4, 3)
> +
> +#define AT803X_CLK_OUT_STRENGTH_MASK		GENMASK(8, 7)
> +#define AT803X_CLK_OUT_STRENGTH_FULL		0
> +#define AT803X_CLK_OUT_STRENGTH_HALF		1
> +#define AT803X_CLK_OUT_STRENGTH_QUARTER		2
> +
>  #define ATH8030_PHY_ID 0x004dd076
>  #define ATH8031_PHY_ID 0x004dd074
>  #define ATH8035_PHY_ID 0x004dd072
> @@ -73,6 +114,13 @@ MODULE_LICENSE("GPL");
> 
>  struct at803x_priv {
>  	bool phy_reset:1;
> +	int flags;
> +#define AT803X_KEEP_PLL_ENABLED	BIT(0)	/* don't turn off internal PLL 
> */
> +	u16 clk_25m_reg;
> +	u16 clk_25m_mask;
> +	struct regulator_dev *vddio_rdev;
> +	struct regulator_dev *vddh_rdev;
> +	struct regulator *vddio;
>  };
> 
>  struct at803x_context {
> @@ -240,6 +288,192 @@ static int at803x_resume(struct phy_device 
> *phydev)
>  	return phy_modify(phydev, MII_BMCR, BMCR_PDOWN | BMCR_ISOLATE, 0);
>  }
> 
> +static int at803x_rgmii_reg_set_voltage_sel(struct regulator_dev 
> *rdev,
> +					    unsigned int selector)
> +{
> +	struct phy_device *phydev = rdev_get_drvdata(rdev);
> +
> +	if (selector)
> +		return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_1F,
> +					     0, AT803X_DEBUG_RGMII_1V8);
> +	else
> +		return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_1F,
> +					     AT803X_DEBUG_RGMII_1V8, 0);
> +}
> +
> +static int at803x_rgmii_reg_get_voltage_sel(struct regulator_dev 
> *rdev)
> +{
> +	struct phy_device *phydev = rdev_get_drvdata(rdev);
> +	int val;
> +
> +	val = at803x_debug_reg_read(phydev, AT803X_DEBUG_REG_1F);
> +	if (val < 0)
> +		return val;
> +
> +	return (val & AT803X_DEBUG_RGMII_1V8) ? 1 : 0;
> +}
> +
> +static struct regulator_ops vddio_regulator_ops = {
> +	.list_voltage = regulator_list_voltage_table,
> +	.set_voltage_sel = at803x_rgmii_reg_set_voltage_sel,
> +	.get_voltage_sel = at803x_rgmii_reg_get_voltage_sel,
> +};
> +
> +static const unsigned int vddio_voltage_table[] = {
> +	1500000,
> +	1800000,
> +};
> +
> +static const struct regulator_desc vddio_desc = {
> +	.name = "vddio",
> +	.of_match = of_match_ptr("vddio-regulator"),
> +	.n_voltages = ARRAY_SIZE(vddio_voltage_table),
> +	.volt_table = vddio_voltage_table,
> +	.ops = &vddio_regulator_ops,
> +	.type = REGULATOR_VOLTAGE,
> +	.owner = THIS_MODULE,
> +};
> +
> +static struct regulator_ops vddh_regulator_ops = {
> +};
> +
> +static const struct regulator_desc vddh_desc = {
> +	.name = "vddh",
> +	.of_match = of_match_ptr("vddh-regulator"),
> +	.n_voltages = 1,
> +	.fixed_uV = 2500000,
> +	.ops = &vddh_regulator_ops,
> +	.type = REGULATOR_VOLTAGE,
> +	.owner = THIS_MODULE,
> +};
> +
> +static int at8031_register_regulators(struct phy_device *phydev)
> +{
> +	struct at803x_priv *priv = phydev->priv;
> +	struct device *dev = &phydev->mdio.dev;
> +	struct regulator_config config = { };
> +
> +	config.dev = dev;
> +	config.driver_data = phydev;
> +
> +	priv->vddio_rdev = devm_regulator_register(dev, &vddio_desc, 
> &config);
> +	if (IS_ERR(priv->vddio_rdev)) {
> +		phydev_err(phydev, "failed to register VDDIO regulator\n");
> +		return PTR_ERR(priv->vddio_rdev);
> +	}
> +
> +	priv->vddh_rdev = devm_regulator_register(dev, &vddh_desc, &config);
> +	if (IS_ERR(priv->vddh_rdev)) {
> +		phydev_err(phydev, "failed to register VDDH regulator\n");
> +		return PTR_ERR(priv->vddh_rdev);
> +	}
> +
> +	return 0;
> +}
> +
> +static bool at803x_match_phy_id(struct phy_device *phydev, u32 phy_id)
> +{
> +	return (phydev->phy_id & phydev->drv->phy_id_mask)
> +		== (phy_id & phydev->drv->phy_id_mask);
> +}
> +
> +static int at803x_parse_dt(struct phy_device *phydev)
> +{
> +	struct device_node *node = phydev->mdio.dev.of_node;
> +	struct at803x_priv *priv = phydev->priv;
> +	unsigned int sel, mask;
> +	u32 freq, strength;
> +	int ret;
> +
> +	if (!IS_ENABLED(CONFIG_OF_MDIO))
> +		return 0;
> +
> +	ret = of_property_read_u32(node, "qca,clk-out-frequency", &freq);
> +	if (!ret) {
> +		mask = AT803X_CLK_OUT_MASK;
> +		switch (freq) {
> +		case 25000000:
> +			sel = AT803X_CLK_OUT_25MHZ_XTAL;
> +			break;
> +		case 50000000:
> +			sel = AT803X_CLK_OUT_50MHZ_PLL;
> +			break;
> +		case 62500000:
> +			sel = AT803X_CLK_OUT_62_5MHZ_PLL;
> +			break;
> +		case 125000000:
> +			sel = AT803X_CLK_OUT_125MHZ_PLL;
> +			break;
> +		default:
> +			phydev_err(phydev, "invalid qca,clk-out-frequency\n");
> +			return -EINVAL;
> +		}
> +
> +		/* Fixup for the AR8030/AR8035. This chip has another mask and
> +		 * supports only 25MHz and 50MHz output.

This is actually wrong. There are two different datasheets with 
contradictory information. The AR8035 actually supports up to 125MHz, 
just the DSP option. I'll fix that in the v2.


> +		 *
> +		 * Warning:
> +		 *   There was no datasheet for the AR8030 available so this is
> +		 *   just a guess. But the AR8035 is listed as pin compatible
> +		 *   to the AR8030 so there might be a good chance it works on
> +		 *   the AR8030 too.
> +		 */
> +		if (at803x_match_phy_id(phydev, ATH8030_PHY_ID) ||
> +		    at803x_match_phy_id(phydev, ATH8035_PHY_ID)) {
> +			mask = AT8035_CLK_OUT_MASK;
> +			if (freq > 50000000)
> +				phydev_err(phydev,
> +					   "invalid qca,clk-out-frequency\n");
> +				return -EINVAL;
> +		}
> +
> +		priv->clk_25m_reg |= FIELD_PREP(mask, sel);
> +		priv->clk_25m_mask |= mask;


-michael



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/5] dt-bindings: net: phy: Add support for AT803X
  2019-11-02  1:13 ` [PATCH 2/5] dt-bindings: net: phy: Add support for AT803X Michael Walle
  2019-11-02  2:59   ` Florian Fainelli
@ 2019-11-06  4:37   ` Rob Herring
  1 sibling, 0 replies; 14+ messages in thread
From: Rob Herring @ 2019-11-06  4:37 UTC (permalink / raw)
  To: Michael Walle; +Cc: linux-kernel, devicetree, netdev, Michael Walle

On Sat,  2 Nov 2019 02:13:48 +0100, Michael Walle wrote:
> Document the Atheros AR803x PHY bindings.
> 
> Signed-off-by: Michael Walle <michael@walle.cc>
> ---
>  .../devicetree/bindings/net/qca,ar803x.yaml   | 111 ++++++++++++++++++
>  MAINTAINERS                                   |   2 +
>  include/dt-bindings/net/qca-ar803x.h          |  13 ++
>  3 files changed, 126 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/net/qca,ar803x.yaml
>  create mode 100644 include/dt-bindings/net/qca-ar803x.h
> 

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2019-11-06  4:37 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-02  1:13 [PATCH 0/5] net: phy: at803x device tree binding Michael Walle
2019-11-02  1:13 ` [PATCH 1/5] net: phy: at803x: fix Kconfig description Michael Walle
2019-11-02  2:57   ` Florian Fainelli
2019-11-02  1:13 ` [PATCH 2/5] dt-bindings: net: phy: Add support for AT803X Michael Walle
2019-11-02  2:59   ` Florian Fainelli
2019-11-06  4:37   ` Rob Herring
2019-11-02  1:13 ` [PATCH 3/5] net: phy: at803x: add device tree binding Michael Walle
2019-11-02  3:01   ` Florian Fainelli
2019-11-05 22:28   ` Michael Walle
2019-11-02  1:13 ` [PATCH 4/5] net: phy: at803x: mention AR8033 as same as AR8031 Michael Walle
2019-11-02  1:13 ` [PATCH 5/5] net: phy: at803x: fix the PHY names Michael Walle
2019-11-02  3:21   ` Florian Fainelli
2019-11-05 22:06 ` [PATCH 0/5] net: phy: at803x device tree binding David Miller
2019-11-05 22:22   ` Michael Walle

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).