get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/1007191/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 1007191,
    "url": "http://patchwork.ozlabs.org/api/patches/1007191/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20181203201432.18252-2-stephend@silicom-usa.com/",
    "project": {
        "id": 46,
        "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api",
        "name": "Intel Wired Ethernet development",
        "link_name": "intel-wired-lan",
        "list_id": "intel-wired-lan.osuosl.org",
        "list_email": "intel-wired-lan@osuosl.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20181203201432.18252-2-stephend@silicom-usa.com>",
    "list_archive_url": null,
    "date": "2018-12-03T20:15:18",
    "name": "[net-next,v4,1/2] ixgbe: register a mdiobus",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": false,
    "hash": "9a44c59a6019a343f60d15b5bf744a7d7390eeb2",
    "submitter": {
        "id": 73588,
        "url": "http://patchwork.ozlabs.org/api/people/73588/?format=api",
        "name": "Stephen Douthit",
        "email": "stephend@silicom-usa.com"
    },
    "delegate": {
        "id": 68,
        "url": "http://patchwork.ozlabs.org/api/users/68/?format=api",
        "username": "jtkirshe",
        "first_name": "Jeff",
        "last_name": "Kirsher",
        "email": "jeffrey.t.kirsher@intel.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20181203201432.18252-2-stephend@silicom-usa.com/mbox/",
    "series": [
        {
            "id": 79530,
            "url": "http://patchwork.ozlabs.org/api/series/79530/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=79530",
            "date": "2018-12-03T20:15:18",
            "name": "Add mii_bus to ixgbe driver for dsa devs",
            "version": 4,
            "mbox": "http://patchwork.ozlabs.org/series/79530/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1007191/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1007191/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@osuosl.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=osuosl.org\n\t(client-ip=140.211.166.133; helo=hemlock.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org; dmarc=none (p=none dis=none)\n\theader.from=silicom-usa.com",
            "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=SILICOMLTD.onmicrosoft.com\n\theader.i=@SILICOMLTD.onmicrosoft.com header.b=\"bmPLoeat\"; \n\tdkim-atps=neutral",
            "spf=none (sender IP is )\n\tsmtp.mailfrom=stephend@silicom-usa.com; "
        ],
        "Received": [
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 437xTk1chFz9s8J\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue,  4 Dec 2018 07:31:05 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 2CAC387E7B;\n\tMon,  3 Dec 2018 20:31:04 +0000 (UTC)",
            "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id gQF7N5hILrnp; Mon,  3 Dec 2018 20:31:02 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id D386982813;\n\tMon,  3 Dec 2018 20:31:02 +0000 (UTC)",
            "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id 58AAC1BF2A2\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon,  3 Dec 2018 20:31:01 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 544BC863FF\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon,  3 Dec 2018 20:31:01 +0000 (UTC)",
            "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id ZhNFRK9y16ZC for <intel-wired-lan@lists.osuosl.org>;\n\tMon,  3 Dec 2018 20:30:59 +0000 (UTC)",
            "from EUR03-AM5-obe.outbound.protection.outlook.com\n\t(mail-eopbgr30127.outbound.protection.outlook.com [40.107.3.127])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id 0FE3985F82\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon,  3 Dec 2018 20:30:58 +0000 (UTC)",
            "from VI1PR0402MB3853.eurprd04.prod.outlook.com (52.134.16.149) by\n\tVI1PR0402MB3454.eurprd04.prod.outlook.com (52.134.3.146) with\n\tMicrosoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n\t15.20.1382.22; Mon, 3 Dec 2018 20:15:19 +0000",
            "from VI1PR0402MB3853.eurprd04.prod.outlook.com\n\t([fe80::457b:1a37:563c:a718]) by\n\tVI1PR0402MB3853.eurprd04.prod.outlook.com\n\t([fe80::457b:1a37:563c:a718%5]) with mapi id 15.20.1382.020;\n\tMon, 3 Dec 2018 20:15:18 +0000"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "delayed 03:28:11 by SQLgrey-1.7.6",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=SILICOMLTD.onmicrosoft.com; s=selector1-silicomusa-com01i;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n\tbh=dx7QRLtGiVmSurhZXmSnDqyH9+/ZoE3RUjuN++Cgd7A=;\n\tb=bmPLoeatAro92odE9SR/YKqLub90nycA8adhu3X4GnRraTdKOd1pTLU7qmRrB41yo1tx8u+8YzUqbhbdRqGKnHNQjsUYDyv3n5N3sQ+4dpikxxUrWbPH1dQU/A5daonGoSQwPua7wuunskowwJ8M9Vt1Dd0hyzqn8Y7etvjGQjU=",
        "From": "Steve Douthit <stephend@silicom-usa.com>",
        "To": "Jeff Kirsher <jeffrey.t.kirsher@intel.com>",
        "Thread-Topic": "[PATCH net-next v4 1/2] ixgbe: register a mdiobus",
        "Thread-Index": "AQHUi0TpGShGPns5qU24BKENte1FNQ==",
        "Date": "Mon, 3 Dec 2018 20:15:18 +0000",
        "Message-ID": "<20181203201432.18252-2-stephend@silicom-usa.com>",
        "References": "<20181203163227.5107-1-stephend@silicom-usa.com>\n\t<20181203201432.18252-1-stephend@silicom-usa.com>",
        "In-Reply-To": "<20181203201432.18252-1-stephend@silicom-usa.com>",
        "Accept-Language": "en-US",
        "Content-Language": "en-US",
        "X-MS-Has-Attach": "",
        "X-MS-TNEF-Correlator": "",
        "x-clientproxiedby": "BN6PR21CA0010.namprd21.prod.outlook.com\n\t(2603:10b6:404:8e::20) To VI1PR0402MB3853.eurprd04.prod.outlook.com\n\t(2603:10a6:803:21::21)",
        "authentication-results": [
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=osuosl.org\n\t(client-ip=140.211.166.133; helo=hemlock.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org; dmarc=none (p=none dis=none)\n\theader.from=silicom-usa.com",
            "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=SILICOMLTD.onmicrosoft.com\n\theader.i=@SILICOMLTD.onmicrosoft.com header.b=\"bmPLoeat\"; \n\tdkim-atps=neutral",
            "spf=none (sender IP is )\n\tsmtp.mailfrom=stephend@silicom-usa.com; "
        ],
        "x-ms-exchange-messagesentrepresentingtype": "1",
        "x-originating-ip": "[96.82.2.57]",
        "x-ms-publictraffictype": "Email",
        "x-microsoft-exchange-diagnostics": "1; VI1PR0402MB3454;\n\t6:fD7K9kV75nQ8vaRRS3zuSdnTaTRmDsa9DYTtufnVgexh8avjxMMPWX7Oh3FDblJJjI92CAekfUHVmbTSLqrhyfWCX+6cGAm+RM96qF33ImQDFoBPiFhwtO0pW8wkEKcs5ygaBsSe5i5msGuF8nq0Vk/Xg+h0TjUKLXM+TkkqNeALdakgxtSALMbKOwmJ+lraMGKdla53BtCuUA8tezGryLV9VyXoDonVcA9zbRm7gXT1ksNjMwoRtNcDizz1vY+6M8fCOJ4mfoKArCvtuXz7uMzgIT3A5S5uH+5zG4JR3gHGvPWOFBuAyGak9NTdkPEWA87KcYxKmFV1i47Pu+jeUzqGTJSaN08B0+ewGZYpG9/aDnFpMnhPXncZJKt3VU0LW9+Mgche8WCNCK+eh0EcqT83os/K1Dx1CPl4XuQEQxKixiEAqgyvmM3smDiaKsSbn2EPDu08WTswoplsJbPeXA==;\n\t5:egHD86lPmFtkbYHOn/s4r1NE3LOx5LbCurXANLVNu9PRVhUruUL63/wYW06Kvx1EDuDQC32XRgYON4N3tPdngXsZDXFZcm0J5GkTcYbYIKU4CGhlZFgdYu7t7TB9hADFxrYNpjYpzd6iIr3Q1DHgd+D6zqep37dttojOG9gJsUo=;\n\t7:gbV2Xj7zJLbvhBfyExn/66EP+jTX8Eq9JwNwAGR7X4JoBcG1EcU2okxkT58VGsQZP/mGCM2CzUKt96mchBRvOfRzHLdtTC4ApRwPSjRcGssak1ECZ8455XbYkx996f6v87YYD0aLAMf4/tcXMDWQ5g==",
        "x-ms-office365-filtering-correlation-id": "c12f7390-c6ea-4f31-77d1-08d6595c0b83",
        "x-microsoft-antispam": "BCL:0; PCL:0;\n\tRULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);\n\tSRVR:VI1PR0402MB3454; ",
        "x-ms-traffictypediagnostic": "VI1PR0402MB3454:",
        "x-microsoft-antispam-prvs": "<VI1PR0402MB3454F37DB5E995CD25AAACA194AE0@VI1PR0402MB3454.eurprd04.prod.outlook.com>",
        "x-ms-exchange-senderadcheck": "1",
        "x-exchange-antispam-report-cfa-test": "BCL:0; PCL:0;\n\tRULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231455)(999002)(944501493)(52105112)(93006095)(93001095)(148016)(149066)(150057)(6041310)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(201708071742011)(7699051)(76991095);\n\tSRVR:VI1PR0402MB3454; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0402MB3454; ",
        "x-forefront-prvs": "08756AC3C8",
        "x-forefront-antispam-report": "SFV:NSPM;\n\tSFS:(10019020)(346002)(376002)(136003)(39850400004)(396003)(366004)(199004)(189003)(105586002)(71200400001)(106356001)(478600001)(14444005)(97736004)(66066001)(68736007)(14454004)(6116002)(3846002)(4744004)(99286004)(1076002)(2906002)(71190400001)(8676002)(81156014)(8936002)(575784001)(256004)(86362001)(6916009)(81166006)(6512007)(53936002)(76176011)(39060400002)(186003)(4326008)(26005)(107886003)(52116002)(551934003)(102836004)(316002)(54906003)(446003)(7736002)(305945005)(25786009)(386003)(6506007)(6486002)(5660300001)(6436002)(486006)(11346002)(2616005)(476003)(36756003)(42262002);\n\tDIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0402MB3454;\n\tH:VI1PR0402MB3853.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; \n\tPTR:InfoNoRecords; A:1; MX:1; ",
        "received-spf": "None (protection.outlook.com: silicom-usa.com does not\n\tdesignate permitted sender hosts)",
        "x-microsoft-antispam-message-info": "w+AbDf4IZr2coM7n8ciqQUJVKiZ9CVv8ms/LtK5T5rVX+Ef0QVVez2fd1c189aipJEP6SUuoLbNwSBDHxifw4PD3K13WDmJzwl0qfOXc1PCCKQIlzPguUNRW7HJkhjchc8r9nsbPaKHkMUKI4HoeBDn+ZiZhTDujDx+OajUeeTY644yOMnlQj/CXoBj0EOrogeSiB9TBX6UyJEitcTX8IjONQ/DN1RNbLTtFgMS7HG5z1HIcYGnf6b3C4Tpy+BGWdjODweVC7wg2Y/L3KRTW1Fb0SqtBwfs9Z2D49TvYWDU8NVKkjivkXvh5sXS/fohl+yMZOT0nFOoIn+3CBfoc467nPGT/YMRnPPHmk5k5O3s=",
        "spamdiagnosticoutput": "1:99",
        "spamdiagnosticmetadata": "NSPM",
        "MIME-Version": "1.0",
        "X-OriginatorOrg": "silicom-usa.com",
        "X-MS-Exchange-CrossTenant-Network-Message-Id": "c12f7390-c6ea-4f31-77d1-08d6595c0b83",
        "X-MS-Exchange-CrossTenant-originalarrivaltime": "03 Dec 2018 20:15:18.8585\n\t(UTC)",
        "X-MS-Exchange-CrossTenant-fromentityheader": "Hosted",
        "X-MS-Exchange-CrossTenant-id": "c9e326d8-ce47-4930-8612-cc99d3c87ad1",
        "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "VI1PR0402MB3454",
        "Subject": "[Intel-wired-lan] [PATCH net-next v4 1/2] ixgbe: register a mdiobus",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.osuosl.org>",
        "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>",
        "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>",
        "Cc": "Andrew Lunn <andrew@lunn.ch>, Florian Fainelli <f.fainelli@gmail.com>,\n\t\"netdev@vger.kernel.org\" <netdev@vger.kernel.org>,\n\t\"intel-wired-lan@lists.osuosl.org\" <intel-wired-lan@lists.osuosl.org>,\n\t\"David S. Miller\" <davem@davemloft.net>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "intel-wired-lan-bounces@osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"
    },
    "content": "Most dsa devices expect a 'struct mii_bus' pointer to talk to switches\nvia the MII interface.\n\nWhile this works for dsa devices, it will not work safely with Linux\nPHYs in all configurations since the firmware of the ixgbe device may\nbe polling some PHY addresses in the background.\n\nSigned-off-by: Stephen Douthit <stephend@silicom-usa.com>\nReviewed-by: Andrew Lunn <andrew@lunn.ch>\nReviewed-by: Florian Fainelli <f.fainelli@gmail.com>\n---\n drivers/net/ethernet/intel/Kconfig            |   1 +\n drivers/net/ethernet/intel/ixgbe/ixgbe.h      |   2 +\n drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |   5 +\n drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c  | 299 ++++++++++++++++++\n drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h  |   2 +\n 5 files changed, 309 insertions(+)",
    "diff": "diff --git a/drivers/net/ethernet/intel/Kconfig b/drivers/net/ethernet/intel/Kconfig\nindex 59e1bc0f609e..79ad2c5860f0 100644\n--- a/drivers/net/ethernet/intel/Kconfig\n+++ b/drivers/net/ethernet/intel/Kconfig\n@@ -159,6 +159,7 @@ config IXGBE\n \ttristate \"Intel(R) 10GbE PCI Express adapters support\"\n \tdepends on PCI\n \tselect MDIO\n+\tselect MII\n \timply PTP_1588_CLOCK\n \t---help---\n \t  This driver supports Intel(R) 10GbE PCI Express family of\ndiff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h\nindex 143bdd5ee2a0..08d85e336bd4 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h\n@@ -12,6 +12,7 @@\n #include <linux/aer.h>\n #include <linux/if_vlan.h>\n #include <linux/jiffies.h>\n+#include <linux/phy.h>\n \n #include <linux/timecounter.h>\n #include <linux/net_tstamp.h>\n@@ -561,6 +562,7 @@ struct ixgbe_adapter {\n \tstruct net_device *netdev;\n \tstruct bpf_prog *xdp_prog;\n \tstruct pci_dev *pdev;\n+\tstruct mii_bus *mii_bus;\n \n \tunsigned long state;\n \ndiff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\nindex b57fa0cfb222..b7907674c565 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\n@@ -39,6 +39,7 @@\n #include \"ixgbe.h\"\n #include \"ixgbe_common.h\"\n #include \"ixgbe_dcb_82599.h\"\n+#include \"ixgbe_phy.h\"\n #include \"ixgbe_sriov.h\"\n #include \"ixgbe_model.h\"\n #include \"ixgbe_txrx_common.h\"\n@@ -11120,6 +11121,8 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)\n \t\t\tIXGBE_LINK_SPEED_10GB_FULL | IXGBE_LINK_SPEED_1GB_FULL,\n \t\t\ttrue);\n \n+\tixgbe_mii_bus_init(hw);\n+\n \treturn 0;\n \n err_register:\n@@ -11170,6 +11173,8 @@ static void ixgbe_remove(struct pci_dev *pdev)\n \tset_bit(__IXGBE_REMOVING, &adapter->state);\n \tcancel_work_sync(&adapter->service_task);\n \n+\tif (adapter->mii_bus)\n+\t\tmdiobus_unregister(adapter->mii_bus);\n \n #ifdef CONFIG_IXGBE_DCA\n \tif (adapter->flags & IXGBE_FLAG_DCA_ENABLED) {\ndiff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c\nindex 919a7af84b42..cc4907f9ff02 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c\n@@ -3,6 +3,7 @@\n \n #include <linux/pci.h>\n #include <linux/delay.h>\n+#include <linux/iopoll.h>\n #include <linux/sched.h>\n \n #include \"ixgbe.h\"\n@@ -658,6 +659,304 @@ s32 ixgbe_write_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr,\n \treturn status;\n }\n \n+#define IXGBE_HW_READ_REG(addr) IXGBE_READ_REG(hw, addr)\n+\n+/**\n+ *  ixgbe_msca_cmd - Write the command register and poll for completion/timeout\n+ *  @hw: pointer to hardware structure\n+ *  @cmd: command register value to write\n+ **/\n+static s32 ixgbe_msca_cmd(struct ixgbe_hw *hw, u32 cmd)\n+{\n+\tIXGBE_WRITE_REG(hw, IXGBE_MSCA, cmd);\n+\n+\treturn readx_poll_timeout(IXGBE_HW_READ_REG, IXGBE_MSCA, cmd,\n+\t\t\t\t  !(cmd & IXGBE_MSCA_MDI_COMMAND), 10,\n+\t\t\t\t  10 * IXGBE_MDIO_COMMAND_TIMEOUT);\n+}\n+\n+/**\n+ *  ixgbe_mii_bus_read_generic - Read a clause 22/45 register with gssr flags\n+ *  @hw: pointer to hardware structure\n+ *  @addr: address\n+ *  @regnum: register number\n+ *  @gssr: semaphore flags to acquire\n+ **/\n+static s32 ixgbe_mii_bus_read_generic(struct ixgbe_hw *hw, int addr,\n+\t\t\t\t      int regnum, u32 gssr)\n+{\n+\tu32 hwaddr, cmd;\n+\ts32 data;\n+\n+\tif (hw->mac.ops.acquire_swfw_sync(hw, gssr))\n+\t\treturn -EBUSY;\n+\n+\thwaddr = addr << IXGBE_MSCA_PHY_ADDR_SHIFT;\n+\tif (regnum & MII_ADDR_C45) {\n+\t\thwaddr |= regnum & GENMASK(21, 0);\n+\t\tcmd = hwaddr | IXGBE_MSCA_ADDR_CYCLE | IXGBE_MSCA_MDI_COMMAND;\n+\t} else {\n+\t\thwaddr |= (regnum & GENMASK(5, 0)) << IXGBE_MSCA_DEV_TYPE_SHIFT;\n+\t\tcmd = hwaddr | IXGBE_MSCA_OLD_PROTOCOL |\n+\t\t\tIXGBE_MSCA_READ_AUTOINC | IXGBE_MSCA_MDI_COMMAND;\n+\t}\n+\n+\tdata = ixgbe_msca_cmd(hw, cmd);\n+\tif (data < 0)\n+\t\tgoto mii_bus_read_done;\n+\n+\t/* For a clause 45 access the address cycle just completed, we still\n+\t * need to do the read command, otherwise just get the data\n+\t */\n+\tif (!(regnum & MII_ADDR_C45))\n+\t\tgoto do_mii_bus_read;\n+\n+\tcmd = hwaddr | IXGBE_MSCA_READ | IXGBE_MSCA_MDI_COMMAND;\n+\tdata = ixgbe_msca_cmd(hw, cmd);\n+\tif (data < 0)\n+\t\tgoto mii_bus_read_done;\n+\n+do_mii_bus_read:\n+\tdata = IXGBE_READ_REG(hw, IXGBE_MSRWD);\n+\tdata = (data >> IXGBE_MSRWD_READ_DATA_SHIFT) & GENMASK(16, 0);\n+\n+mii_bus_read_done:\n+\thw->mac.ops.release_swfw_sync(hw, gssr);\n+\treturn data;\n+}\n+\n+/**\n+ *  ixgbe_mii_bus_write_generic - Write a clause 22/45 register with gssr flags\n+ *  @hw: pointer to hardware structure\n+ *  @addr: address\n+ *  @regnum: register number\n+ *  @val: value to write\n+ *  @gssr: semaphore flags to acquire\n+ **/\n+static s32 ixgbe_mii_bus_write_generic(struct ixgbe_hw *hw, int addr,\n+\t\t\t\t       int regnum, u16 val, u32 gssr)\n+{\n+\tu32 hwaddr, cmd;\n+\ts32 err;\n+\n+\tif (hw->mac.ops.acquire_swfw_sync(hw, gssr))\n+\t\treturn -EBUSY;\n+\n+\tIXGBE_WRITE_REG(hw, IXGBE_MSRWD, (u32)val);\n+\n+\thwaddr = addr << IXGBE_MSCA_PHY_ADDR_SHIFT;\n+\tif (regnum & MII_ADDR_C45) {\n+\t\thwaddr |= regnum & GENMASK(21, 0);\n+\t\tcmd = hwaddr | IXGBE_MSCA_ADDR_CYCLE | IXGBE_MSCA_MDI_COMMAND;\n+\t} else {\n+\t\thwaddr |= (regnum & GENMASK(5, 0)) << IXGBE_MSCA_DEV_TYPE_SHIFT;\n+\t\tcmd = hwaddr | IXGBE_MSCA_OLD_PROTOCOL | IXGBE_MSCA_WRITE |\n+\t\t\tIXGBE_MSCA_MDI_COMMAND;\n+\t}\n+\n+\t/* For clause 45 this is an address cycle, for clause 22 this is the\n+\t * entire transaction\n+\t */\n+\terr = ixgbe_msca_cmd(hw, cmd);\n+\tif (err < 0 || !(regnum & MII_ADDR_C45))\n+\t\tgoto mii_bus_write_done;\n+\n+\tcmd = hwaddr | IXGBE_MSCA_WRITE | IXGBE_MSCA_MDI_COMMAND;\n+\terr = ixgbe_msca_cmd(hw, cmd);\n+\n+mii_bus_write_done:\n+\thw->mac.ops.release_swfw_sync(hw, gssr);\n+\treturn err;\n+}\n+\n+/**\n+ *  ixgbe_mii_bus_read - Read a clause 22/45 register\n+ *  @hw: pointer to hardware structure\n+ *  @addr: address\n+ *  @regnum: register number\n+ **/\n+static s32 ixgbe_mii_bus_read(struct mii_bus *bus, int addr, int regnum)\n+{\n+\tstruct ixgbe_adapter *adapter = bus->priv;\n+\tstruct ixgbe_hw *hw = &adapter->hw;\n+\tu32 gssr = hw->phy.phy_semaphore_mask;\n+\n+\treturn ixgbe_mii_bus_read_generic(hw, addr, regnum, gssr);\n+}\n+\n+/**\n+ *  ixgbe_mii_bus_write - Write a clause 22/45 register\n+ *  @hw: pointer to hardware structure\n+ *  @addr: address\n+ *  @regnum: register number\n+ *  @val: value to write\n+ **/\n+static s32 ixgbe_mii_bus_write(struct mii_bus *bus, int addr, int regnum,\n+\t\t\t       u16 val)\n+{\n+\tstruct ixgbe_adapter *adapter = bus->priv;\n+\tstruct ixgbe_hw *hw = &adapter->hw;\n+\tu32 gssr = hw->phy.phy_semaphore_mask;\n+\n+\treturn ixgbe_mii_bus_write_generic(hw, addr, regnum, val, gssr);\n+}\n+\n+/**\n+ *  ixgbe_x550em_a_mii_bus_read - Read a clause 22/45 register on x550em_a\n+ *  @hw: pointer to hardware structure\n+ *  @addr: address\n+ *  @regnum: register number\n+ **/\n+static s32 ixgbe_x550em_a_mii_bus_read(struct mii_bus *bus, int addr,\n+\t\t\t\t       int regnum)\n+{\n+\tstruct ixgbe_adapter *adapter = bus->priv;\n+\tstruct ixgbe_hw *hw = &adapter->hw;\n+\tu32 gssr = hw->phy.phy_semaphore_mask;\n+\n+\tgssr |= IXGBE_GSSR_TOKEN_SM | IXGBE_GSSR_PHY0_SM;\n+\treturn ixgbe_mii_bus_read_generic(hw, addr, regnum, gssr);\n+}\n+\n+/**\n+ *  ixgbe_x550em_a_mii_bus_write - Write a clause 22/45 register on x550em_a\n+ *  @hw: pointer to hardware structure\n+ *  @addr: address\n+ *  @regnum: register number\n+ *  @val: value to write\n+ **/\n+static s32 ixgbe_x550em_a_mii_bus_write(struct mii_bus *bus, int addr,\n+\t\t\t\t\tint regnum, u16 val)\n+{\n+\tstruct ixgbe_adapter *adapter = bus->priv;\n+\tstruct ixgbe_hw *hw = &adapter->hw;\n+\tu32 gssr = hw->phy.phy_semaphore_mask;\n+\n+\tgssr |= IXGBE_GSSR_TOKEN_SM | IXGBE_GSSR_PHY0_SM;\n+\treturn ixgbe_mii_bus_write_generic(hw, addr, regnum, val, gssr);\n+}\n+\n+/**\n+ * ixgbe_get_first_secondary_devfn - get first device downstream of root port\n+ * @devfn: PCI_DEVFN of root port on domain 0, bus 0\n+ *\n+ * Returns pci_dev pointer to PCI_DEVFN(0, 0) on subordinate side of root\n+ * on domain 0, bus 0, devfn = 'devfn'\n+ **/\n+static struct pci_dev *ixgbe_get_first_secondary_devfn(unsigned int devfn)\n+{\n+\tstruct pci_dev *rp_pdev;\n+\tint bus;\n+\n+\trp_pdev = pci_get_domain_bus_and_slot(0, 0, devfn);\n+\tif (rp_pdev && rp_pdev->subordinate) {\n+\t\tbus = rp_pdev->subordinate->number;\n+\t\treturn pci_get_domain_bus_and_slot(0, bus, 0);\n+\t}\n+\n+\treturn NULL;\n+}\n+\n+/**\n+ * ixgbe_x550em_a_has_mii - is this the first ixgbe x550em_a PCI function?\n+ * @hw: pointer to hardware structure\n+ *\n+ * Returns true if hw points to lowest numbered PCI B:D.F x550_em_a device in\n+ * the SoC.  There are up to 4 MACs sharing a single MDIO bus on the x550em_a,\n+ * but we only want to register one MDIO bus.\n+ **/\n+static bool ixgbe_x550em_a_has_mii(struct ixgbe_hw *hw)\n+{\n+\tstruct ixgbe_adapter *adapter = hw->back;\n+\tstruct pci_dev *pdev = adapter->pdev;\n+\tstruct pci_dev *func0_pdev;\n+\n+\t/* For the C3000 family of SoCs (x550em_a) the internal ixgbe devices\n+\t * are always downstream of root ports @ 0000:00:16.0 & 0000:00:17.0\n+\t * It's not valid for function 0 to be disabled and function 1 is up,\n+\t * so the lowest numbered ixgbe dev will be device 0 function 0 on one\n+\t * of those two root ports\n+\t */\n+\tfunc0_pdev = ixgbe_get_first_secondary_devfn(PCI_DEVFN(0x16, 0));\n+\tif (func0_pdev) {\n+\t\tif (func0_pdev == pdev)\n+\t\t\treturn true;\n+\t\telse\n+\t\t\treturn false;\n+\t}\n+\tfunc0_pdev = ixgbe_get_first_secondary_devfn(PCI_DEVFN(0x17, 0));\n+\tif (func0_pdev == pdev)\n+\t\treturn true;\n+\n+\treturn false;\n+}\n+\n+/**\n+ * ixgbe_mii_bus_init - mii_bus structure setup\n+ * @hw: pointer to hardware structure\n+ *\n+ * Returns 0 on success, negative on failure\n+ *\n+ * ixgbe_mii_bus_init initializes a mii_bus structure in adapter\n+ **/\n+s32 ixgbe_mii_bus_init(struct ixgbe_hw *hw)\n+{\n+\tstruct ixgbe_adapter *adapter = hw->back;\n+\tstruct pci_dev *pdev = adapter->pdev;\n+\tstruct device *dev = &adapter->netdev->dev;\n+\tstruct mii_bus *bus;\n+\n+\tadapter->mii_bus = devm_mdiobus_alloc(dev);\n+\tif (!adapter->mii_bus)\n+\t\treturn -ENOMEM;\n+\n+\tbus = adapter->mii_bus;\n+\n+\tswitch (hw->device_id) {\n+\t/* C3000 SoCs */\n+\tcase IXGBE_DEV_ID_X550EM_A_KR:\n+\tcase IXGBE_DEV_ID_X550EM_A_KR_L:\n+\tcase IXGBE_DEV_ID_X550EM_A_SFP_N:\n+\tcase IXGBE_DEV_ID_X550EM_A_SGMII:\n+\tcase IXGBE_DEV_ID_X550EM_A_SGMII_L:\n+\tcase IXGBE_DEV_ID_X550EM_A_10G_T:\n+\tcase IXGBE_DEV_ID_X550EM_A_SFP:\n+\tcase IXGBE_DEV_ID_X550EM_A_1G_T:\n+\tcase IXGBE_DEV_ID_X550EM_A_1G_T_L:\n+\t\tif (!ixgbe_x550em_a_has_mii(hw))\n+\t\t\tgoto ixgbe_no_mii_bus;\n+\t\tbus->read = &ixgbe_x550em_a_mii_bus_read;\n+\t\tbus->write = &ixgbe_x550em_a_mii_bus_write;\n+\t\tbreak;\n+\tdefault:\n+\t\tbus->read = &ixgbe_mii_bus_read;\n+\t\tbus->write = &ixgbe_mii_bus_write;\n+\t\tbreak;\n+\t}\n+\n+\t/* Use the position of the device in the PCI hierarchy as the id */\n+\tsnprintf(bus->id, MII_BUS_ID_SIZE, \"%s-mdio-%s\", ixgbe_driver_name,\n+\t\t pci_name(pdev));\n+\n+\tbus->name = \"ixgbe-mdio\";\n+\tbus->priv = adapter;\n+\tbus->parent = dev;\n+\tbus->phy_mask = GENMASK(31, 0);\n+\n+\t/* Support clause 22/45 natively.  ixgbe_probe() sets MDIO_EMULATE_C22\n+\t * unfortunately that causes some clause 22 frames to be sent with\n+\t * clause 45 addressing.  We don't want that.\n+\t */\n+\thw->phy.mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_SUPPORTS_C22;\n+\n+\treturn mdiobus_register(bus);\n+\n+ixgbe_no_mii_bus:\n+\tdevm_mdiobus_free(dev, bus);\n+\tadapter->mii_bus = NULL;\n+\treturn -ENODEV;\n+}\n+\n /**\n  *  ixgbe_setup_phy_link_generic - Set and restart autoneg\n  *  @hw: pointer to hardware structure\ndiff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h\nindex 64e44e01c973..214b01085718 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h\n@@ -120,6 +120,8 @@\n /* SFP+ SFF-8472 Compliance code */\n #define IXGBE_SFF_SFF_8472_UNSUP      0x00\n \n+s32 ixgbe_mii_bus_init(struct ixgbe_hw *hw);\n+\n s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw);\n s32 ixgbe_reset_phy_generic(struct ixgbe_hw *hw);\n s32 ixgbe_read_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr,\n",
    "prefixes": [
        "net-next",
        "v4",
        "1/2"
    ]
}