Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3cc6e44b authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'net-phy-Add-AST2600-MDIO-support'

Andrew Jeffery says:

====================
net: phy: Add AST2600 MDIO support

v2 of the ASPEED MDIO series addresses comments from Rob on the devicetree
bindings and Andrew on the driver itself.

v1 of the series can be found here:

http://patchwork.ozlabs.org/cover/1138140/


====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 7c5b4205 82f151de
Loading
Loading
Loading
Loading
+45 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-or-later
%YAML 1.2
---
$id: http://devicetree.org/schemas/net/aspeed,ast2600-mdio.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: ASPEED AST2600 MDIO Controller

maintainers:
  - Andrew Jeffery <andrew@aj.id.au>

description: |+
  The ASPEED AST2600 MDIO controller is the third iteration of ASPEED's MDIO
  bus register interface, this time also separating out the controller from the
  MAC.

allOf:
  - $ref: "mdio.yaml#"

properties:
  compatible:
    const: aspeed,ast2600-mdio
  reg:
    maxItems: 1
    description: The register range of the MDIO controller instance

required:
  - compatible
  - reg
  - "#address-cells"
  - "#size-cells"

examples:
  - |
    mdio0: mdio@1e650000 {
            compatible = "aspeed,ast2600-mdio";
            reg = <0x1e650000 0x8>;
            #address-cells = <1>;
            #size-cells = <0>;

            ethphy0: ethernet-phy@0 {
                    compatible = "ethernet-phy-ieee802.3-c22";
                    reg = <0>;
            };
    };
+1 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ config FTGMAC100
	depends on ARM || NDS32 || COMPILE_TEST
	depends on !64BIT || BROKEN
	select PHYLIB
	select MDIO_ASPEED if MACH_ASPEED_G6
	---help---
	  This driver supports the FTGMAC100 Gigabit Ethernet controller
	  from Faraday. It is used on Faraday A369, Andes AG102 and some
+33 −4
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/of.h>
#include <linux/of_mdio.h>
#include <linux/phy.h>
#include <linux/platform_device.h>
#include <linux/property.h>
@@ -1619,8 +1620,13 @@ static int ftgmac100_setup_mdio(struct net_device *netdev)
	if (!priv->mii_bus)
		return -EIO;

	if (priv->is_aspeed) {
		/* This driver supports the old MDIO interface */
	if (of_device_is_compatible(np, "aspeed,ast2400-mac") ||
	    of_device_is_compatible(np, "aspeed,ast2500-mac")) {
		/* The AST2600 has a separate MDIO controller */

		/* For the AST2400 and AST2500 this driver only supports the
		 * old MDIO interface
		 */
		reg = ioread32(priv->base + FTGMAC100_OFFSET_REVR);
		reg &= ~FTGMAC100_REVR_NEW_MDIO_INTERFACE;
		iowrite32(reg, priv->base + FTGMAC100_OFFSET_REVR);
@@ -1797,7 +1803,8 @@ static int ftgmac100_probe(struct platform_device *pdev)

	np = pdev->dev.of_node;
	if (np && (of_device_is_compatible(np, "aspeed,ast2400-mac") ||
		   of_device_is_compatible(np, "aspeed,ast2500-mac"))) {
		   of_device_is_compatible(np, "aspeed,ast2500-mac") ||
		   of_device_is_compatible(np, "aspeed,ast2600-mac"))) {
		priv->rxdes0_edorr_mask = BIT(30);
		priv->txdes0_edotr_mask = BIT(30);
		priv->is_aspeed = true;
@@ -1817,7 +1824,29 @@ static int ftgmac100_probe(struct platform_device *pdev)
		priv->ndev = ncsi_register_dev(netdev, ftgmac100_ncsi_handler);
		if (!priv->ndev)
			goto err_ncsi_dev;
	} else {
	} else if (np && of_get_property(np, "phy-handle", NULL)) {
		struct phy_device *phy;

		phy = of_phy_get_and_connect(priv->netdev, np,
					     &ftgmac100_adjust_link);
		if (!phy) {
			dev_err(&pdev->dev, "Failed to connect to phy\n");
			goto err_setup_mdio;
		}

		/* Indicate that we support PAUSE frames (see comment in
		 * Documentation/networking/phy.txt)
		 */
		phy_support_asym_pause(phy);

		/* Display what we found */
		phy_attached_info(phy);
	} else if (np && !of_get_child_by_name(np, "mdio")) {
		/* Support legacy ASPEED devicetree descriptions that decribe a
		 * MAC with an embedded MDIO controller but have no "mdio"
		 * child node. Automatically scan the MDIO bus for available
		 * PHYs.
		 */
		priv->use_ncsi = false;
		err = ftgmac100_setup_mdio(netdev);
		if (err)
+13 −0
Original line number Diff line number Diff line
@@ -21,6 +21,19 @@ config MDIO_BUS

if MDIO_BUS

config MDIO_ASPEED
	tristate "ASPEED MDIO bus controller"
	depends on ARCH_ASPEED || COMPILE_TEST
	depends on OF_MDIO && HAS_IOMEM
	help
	  This module provides a driver for the independent MDIO bus
	  controllers found in the ASPEED AST2600 SoC. This is a driver for the
	  third revision of the ASPEED MDIO register interface - the first two
	  revisions are the "old" and "new" interfaces found in the AST2400 and
	  AST2500, embedded in the MAC. For legacy reasons, FTGMAC100 driver
	  continues to drive the embedded MDIO controller for the AST2400 and
	  AST2500 SoCs, so say N if AST2600 support is not required.

config MDIO_BCM_IPROC
	tristate "Broadcom iProc MDIO bus controller"
	depends on ARCH_BCM_IPROC || COMPILE_TEST
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ libphy-$(CONFIG_LED_TRIGGER_PHY) += phy_led_triggers.o
obj-$(CONFIG_PHYLINK)		+= phylink.o
obj-$(CONFIG_PHYLIB)		+= libphy.o

obj-$(CONFIG_MDIO_ASPEED)	+= mdio-aspeed.o
obj-$(CONFIG_MDIO_BCM_IPROC)	+= mdio-bcm-iproc.o
obj-$(CONFIG_MDIO_BCM_UNIMAC)	+= mdio-bcm-unimac.o
obj-$(CONFIG_MDIO_BITBANG)	+= mdio-bitbang.o
Loading