get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 602654,
    "url": "http://patchwork.ozlabs.org/api/patches/602654/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20160328211811.68937.73141.stgit@mdrustad-wks.jf.intel.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": "<20160328211811.68937.73141.stgit@mdrustad-wks.jf.intel.com>",
    "list_archive_url": null,
    "date": "2016-03-28T21:18:11",
    "name": "[V3,08/11] ixgbe: Add support for SFPs with retimer",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "d6734e5cf33579de2c515c597dc33d2e8659f792",
    "submitter": {
        "id": 13252,
        "url": "http://patchwork.ozlabs.org/api/people/13252/?format=api",
        "name": "Rustad, Mark D",
        "email": "mark.d.rustad@intel.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/20160328211811.68937.73141.stgit@mdrustad-wks.jf.intel.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/602654/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/602654/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@lists.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"
        ],
        "Received": [
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ozlabs.org (Postfix) with ESMTP id 3qYmwR5dY5z9sBc\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 29 Mar 2016 08:18:15 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 2474689184;\n\tMon, 28 Mar 2016 21:18:15 +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 xO+NRHsTJ3UQ; Mon, 28 Mar 2016 21:18:14 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 29D4E87056;\n\tMon, 28 Mar 2016 21:18:14 +0000 (UTC)",
            "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id 12B3A1CF225\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 28 Mar 2016 21:18:13 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 0A8032E1C4\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 28 Mar 2016 21:18:13 +0000 (UTC)",
            "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id ipsoemmF3b2m for <intel-wired-lan@lists.osuosl.org>;\n\tMon, 28 Mar 2016 21:18:11 +0000 (UTC)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby silver.osuosl.org (Postfix) with ESMTP id 866242728E\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 28 Mar 2016 21:18:11 +0000 (UTC)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby fmsmga101.fm.intel.com with ESMTP; 28 Mar 2016 14:18:11 -0700",
            "from mdrustad-wks.jf.intel.com ([134.134.3.71])\n\tby FMSMGA003.fm.intel.com with ESMTP; 28 Mar 2016 14:18:11 -0700"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.24,408,1455004800\"; d=\"scan'208\";a=\"677003607\"",
        "From": "Mark D Rustad <mark.d.rustad@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Mon, 28 Mar 2016 14:18:11 -0700",
        "Message-ID": "<20160328211811.68937.73141.stgit@mdrustad-wks.jf.intel.com>",
        "In-Reply-To": "<20160328211623.68937.52252.stgit@mdrustad-wks.jf.intel.com>",
        "References": "<20160328211623.68937.52252.stgit@mdrustad-wks.jf.intel.com>",
        "User-Agent": "StGit/unknown-version",
        "MIME-Version": "1.0",
        "Subject": "[Intel-wired-lan] [PATCH V3 08/11] ixgbe: Add support for SFPs with\n\tretimer",
        "X-BeenThere": "intel-wired-lan@lists.osuosl.org",
        "X-Mailman-Version": "2.1.18-1",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.lists.osuosl.org>",
        "List-Unsubscribe": "<http://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@lists.osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@lists.osuosl.org?subject=help>",
        "List-Subscribe": "<http://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=subscribe>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "intel-wired-lan-bounces@lists.osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@lists.osuosl.org>"
    },
    "content": "Add support for SFPs with an external retimer.\n\nSigned-off-by: Mark Rustad <mark.d.rustad@intel.com>\n---\n drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |    2 \n drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h  |    6 +\n drivers/net/ethernet/intel/ixgbe/ixgbe_type.h |    5 +\n drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c |  133 +++++++++++++++++++++++++\n 4 files changed, 144 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\nindex ec57c2728b24..1712917cd0a3 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\n@@ -131,6 +131,7 @@ static const struct pci_device_id ixgbe_pci_tbl[] = {\n \t{PCI_VDEVICE(INTEL, IXGBE_DEV_ID_X550EM_X_10G_T), board_X550EM_x},\n \t{PCI_VDEVICE(INTEL, IXGBE_DEV_ID_X550EM_X_SFP), board_X550EM_x},\n \t{PCI_VDEVICE(INTEL, IXGBE_DEV_ID_X550EM_A_SFP_N), board_x550em_a },\n+\t{PCI_VDEVICE(INTEL, IXGBE_DEV_ID_X550EM_A_SFP), board_x550em_a },\n \t/* required last entry */\n \t{0, }\n };\n@@ -2680,6 +2681,7 @@ static inline void ixgbe_irq_enable(struct ixgbe_adapter *adapter, bool queues,\n \tcase ixgbe_mac_X550EM_x:\n \tcase ixgbe_mac_x550em_a:\n \t\tif (adapter->hw.device_id == IXGBE_DEV_ID_X550EM_X_SFP ||\n+\t\t    adapter->hw.device_id == IXGBE_DEV_ID_X550EM_A_SFP ||\n \t\t    adapter->hw.device_id == IXGBE_DEV_ID_X550EM_A_SFP_N)\n \t\t\tmask |= IXGBE_EIMS_GPI_SDP0(&adapter->hw);\n \t\tif (adapter->hw.phy.type == ixgbe_phy_x550em_ext_t)\ndiff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h\nindex 5abd66c84d00..cdf4c3800801 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h\n@@ -1,7 +1,7 @@\n /*******************************************************************************\n \n   Intel 10 Gigabit PCI Express Linux driver\n-  Copyright(c) 1999 - 2014 Intel Corporation.\n+  Copyright(c) 1999 - 2016 Intel Corporation.\n \n   This program is free software; you can redistribute it and/or modify it\n   under the terms and conditions of the GNU General Public License,\n@@ -81,7 +81,11 @@\n #define IXGBE_I2C_EEPROM_STATUS_FAIL\t\t0x2\n #define IXGBE_I2C_EEPROM_STATUS_IN_PROGRESS\t0x3\n #define IXGBE_CS4227\t\t\t\t0xBE    /* CS4227 address */\n+#define IXGBE_CS4227_GLOBAL_ID_LSB\t\t0\n+#define IXGBE_CS4227_GLOBAL_ID_MSB\t\t1\n #define IXGBE_CS4227_SCRATCH\t\t\t2\n+#define IXGBE_CS4223_PHY_ID\t\t\t0x7003\t/* Quad port */\n+#define IXGBE_CS4227_PHY_ID\t\t\t0x3003\t/* Dual port */\n #define IXGBE_CS4227_RESET_PENDING\t\t0x1357\n #define IXGBE_CS4227_RESET_COMPLETE\t\t0x5AA5\n #define IXGBE_CS4227_RETRIES\t\t\t15\ndiff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h\nindex 3e0dd5584d4e..40121b8b0220 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h\n@@ -1310,6 +1310,7 @@ struct ixgbe_thermal_sensor_data {\n \n /* MDIO definitions */\n \n+#define IXGBE_MDIO_ZERO_DEV_TYPE\t\t0x0\n #define IXGBE_MDIO_PMA_PMD_DEV_TYPE\t\t0x1\n #define IXGBE_MDIO_PCS_DEV_TYPE\t\t0x3\n #define IXGBE_MDIO_PHY_XS_DEV_TYPE\t\t0x4\n@@ -3579,6 +3580,7 @@ struct ixgbe_info {\n #define IXGBE_KRM_PORT_CAR_GEN_CTRL(P)\t((P) ? 0x8010 : 0x4010)\n #define IXGBE_KRM_LINK_CTRL_1(P)\t((P) ? 0x820C : 0x420C)\n #define IXGBE_KRM_AN_CNTL_1(P)\t\t((P) ? 0x822C : 0x422C)\n+#define IXGBE_KRM_AN_CNTL_8(P)\t\t((P) ? 0x8248 : 0x4248)\n #define IXGBE_KRM_DSP_TXFFE_STATE_4(P)\t((P) ? 0x8634 : 0x4634)\n #define IXGBE_KRM_DSP_TXFFE_STATE_5(P)\t((P) ? 0x8638 : 0x4638)\n #define IXGBE_KRM_RX_TRN_LINKUP_CTRL(P)\t((P) ? 0x8B00 : 0x4B00)\n@@ -3604,6 +3606,9 @@ struct ixgbe_info {\n #define IXGBE_KRM_AN_CNTL_1_SYM_PAUSE\t\t\t(1 << 28)\n #define IXGBE_KRM_AN_CNTL_1_ASM_PAUSE\t\t\t(1 << 29)\n \n+#define IXGBE_KRM_AN_CNTL_8_LINEAR\t\t\tBIT(0)\n+#define IXGBE_KRM_AN_CNTL_8_LIMITING\t\t\tBIT(1)\n+\n #define IXGBE_KRM_DSP_TXFFE_STATE_C0_EN\t\t\t(1 << 6)\n #define IXGBE_KRM_DSP_TXFFE_STATE_CP1_CN1_EN\t\t(1 << 15)\n #define IXGBE_KRM_DSP_TXFFE_STATE_CO_ADAPT_EN\t\t(1 << 16)\ndiff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c\nindex 952b604323e4..8b0f3abf3447 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c\n@@ -273,6 +273,12 @@ out:\n static s32 ixgbe_identify_phy_x550em(struct ixgbe_hw *hw)\n {\n \tswitch (hw->device_id) {\n+\tcase IXGBE_DEV_ID_X550EM_A_SFP:\n+\t\tif (hw->bus.lan_id)\n+\t\t\thw->phy.phy_semaphore_mask = IXGBE_GSSR_PHY1_SM;\n+\t\telse\n+\t\t\thw->phy.phy_semaphore_mask = IXGBE_GSSR_PHY0_SM;\n+\t\treturn ixgbe_identify_module_generic(hw);\n \tcase IXGBE_DEV_ID_X550EM_X_SFP:\n \t\t/* set up for CS4227 usage */\n \t\thw->phy.phy_semaphore_mask = IXGBE_GSSR_SHARED_I2C_SM;\n@@ -1363,6 +1369,117 @@ i2c_err:\n }\n \n /**\n+ * ixgbe_setup_mac_link_sfp_n - Setup internal PHY for native SFP\n+ * @hw: pointer to hardware structure\n+ *\n+ * Configure the the integrated PHY for native SFP support.\n+ */\n+static s32\n+ixgbe_setup_mac_link_sfp_n(struct ixgbe_hw *hw, ixgbe_link_speed speed,\n+\t\t\t   __always_unused bool autoneg_wait_to_complete)\n+{\n+\tbool setup_linear = false;\n+\tu32 reg_phy_int;\n+\ts32 rc;\n+\n+\t/* Check if SFP module is supported and linear */\n+\trc = ixgbe_supported_sfp_modules_X550em(hw, &setup_linear);\n+\n+\t/* If no SFP module present, then return success. Return success since\n+\t * SFP not present error is not excepted in the setup MAC link flow.\n+\t */\n+\tif (rc == IXGBE_ERR_SFP_NOT_PRESENT)\n+\t\treturn 0;\n+\n+\tif (!rc)\n+\t\treturn rc;\n+\n+\t/* Configure internal PHY for native SFI */\n+\trc = hw->mac.ops.read_iosf_sb_reg(hw,\n+\t\t\t\t\t  IXGBE_KRM_AN_CNTL_8(hw->bus.lan_id),\n+\t\t\t\t\t  IXGBE_SB_IOSF_TARGET_KR_PHY,\n+\t\t\t\t\t  &reg_phy_int);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\tif (setup_linear) {\n+\t\treg_phy_int &= ~IXGBE_KRM_AN_CNTL_8_LIMITING;\n+\t\treg_phy_int |= IXGBE_KRM_AN_CNTL_8_LINEAR;\n+\t} else {\n+\t\treg_phy_int |= IXGBE_KRM_AN_CNTL_8_LIMITING;\n+\t\treg_phy_int &= ~IXGBE_KRM_AN_CNTL_8_LINEAR;\n+\t}\n+\n+\trc = hw->mac.ops.write_iosf_sb_reg(hw,\n+\t\t\t\t\t   IXGBE_KRM_AN_CNTL_8(hw->bus.lan_id),\n+\t\t\t\t\t   IXGBE_SB_IOSF_TARGET_KR_PHY,\n+\t\t\t\t\t   reg_phy_int);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\t/* Setup XFI/SFI internal link */\n+\treturn ixgbe_setup_ixfi_x550em(hw, &speed);\n+}\n+\n+/**\n+ * ixgbe_setup_mac_link_sfp_x550a - Setup internal PHY for SFP\n+ * @hw: pointer to hardware structure\n+ *\n+ * Configure the the integrated PHY for SFP support.\n+ */\n+static s32\n+ixgbe_setup_mac_link_sfp_x550a(struct ixgbe_hw *hw, ixgbe_link_speed speed,\n+\t\t\t       __always_unused bool autoneg_wait_to_complete)\n+{\n+\tu32 reg_slice, slice_offset;\n+\tbool setup_linear = false;\n+\tu16 reg_phy_ext;\n+\ts32 rc;\n+\n+\t/* Check if SFP module is supported and linear */\n+\trc = ixgbe_supported_sfp_modules_X550em(hw, &setup_linear);\n+\n+\t/* If no SFP module present, then return success. Return success since\n+\t * SFP not present error is not excepted in the setup MAC link flow.\n+\t */\n+\tif (rc == IXGBE_ERR_SFP_NOT_PRESENT)\n+\t\treturn 0;\n+\n+\tif (!rc)\n+\t\treturn rc;\n+\n+\t/* Configure internal PHY for KR/KX. */\n+\tixgbe_setup_kr_speed_x550em(hw, speed);\n+\n+\tif (!hw->phy.mdio.prtad || hw->phy.mdio.prtad == 0xFFFF)\n+\t\treturn IXGBE_ERR_PHY_ADDR_INVALID;\n+\n+\t/* Get external PHY device id */\n+\trc = hw->phy.ops.read_reg(hw, IXGBE_CS4227_GLOBAL_ID_MSB,\n+\t\t\t\t  IXGBE_MDIO_ZERO_DEV_TYPE, &reg_phy_ext);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\t/* When configuring quad port CS4223, the MAC instance is part\n+\t * of the slice offset.\n+\t */\n+\tif (reg_phy_ext == IXGBE_CS4223_PHY_ID)\n+\t\tslice_offset = (hw->bus.lan_id +\n+\t\t\t\t(hw->bus.instance_id << 1)) << 12;\n+\telse\n+\t\tslice_offset = hw->bus.lan_id << 12;\n+\n+\t/* Configure CS4227/CS4223 LINE side to proper mode. */\n+\treg_slice = IXGBE_CS4227_LINE_SPARE24_LSB + slice_offset;\n+\tif (setup_linear)\n+\t\treg_phy_ext = (IXGBE_CS4227_EDC_MODE_CX1 << 1) | 1;\n+\telse\n+\t\treg_phy_ext = (IXGBE_CS4227_EDC_MODE_SR << 1) | 1;\n+\treturn hw->phy.ops.write_reg(hw, reg_slice, IXGBE_MDIO_ZERO_DEV_TYPE,\n+\t\t\t\t     reg_phy_ext);\n+}\n+\n+/**\n  * ixgbe_setup_mac_link_t_X550em - Sets the auto advertised link speed\n  * @hw: pointer to hardware structure\n  * @speed: new link speed\n@@ -1456,9 +1573,21 @@ static void ixgbe_init_mac_link_ops_X550em(struct ixgbe_hw *hw)\n \t\tmac->ops.disable_tx_laser = NULL;\n \t\tmac->ops.enable_tx_laser = NULL;\n \t\tmac->ops.flap_tx_laser = NULL;\n-\t\tmac->ops.setup_mac_link = ixgbe_setup_mac_link_sfp_x550em;\n \t\tmac->ops.setup_link = ixgbe_setup_mac_link_multispeed_fiber;\n \t\tmac->ops.setup_fc = ixgbe_setup_fc_x550em;\n+\t\tswitch (hw->device_id) {\n+\t\tcase IXGBE_DEV_ID_X550EM_A_SFP_N:\n+\t\t\tmac->ops.setup_mac_link = ixgbe_setup_mac_link_sfp_n;\n+\t\t\tbreak;\n+\t\tcase IXGBE_DEV_ID_X550EM_A_SFP:\n+\t\t\tmac->ops.setup_mac_link =\n+\t\t\t\t\t\tixgbe_setup_mac_link_sfp_x550a;\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tmac->ops.setup_mac_link =\n+\t\t\t\t\t\tixgbe_setup_mac_link_sfp_x550em;\n+\t\t\tbreak;\n+\t\t}\n \t\tmac->ops.set_rate_select_speed =\n \t\t\t\t\tixgbe_set_soft_rate_select_speed;\n \t\tbreak;\n@@ -2253,6 +2382,7 @@ static enum ixgbe_media_type ixgbe_get_media_type_X550em(struct ixgbe_hw *hw)\n \t\tmedia_type = ixgbe_media_type_backplane;\n \t\tbreak;\n \tcase IXGBE_DEV_ID_X550EM_X_SFP:\n+\tcase IXGBE_DEV_ID_X550EM_A_SFP:\n \tcase IXGBE_DEV_ID_X550EM_A_SFP_N:\n \t\tmedia_type = ixgbe_media_type_fiber;\n \t\tbreak;\n@@ -2316,6 +2446,7 @@ static void ixgbe_set_mdio_speed(struct ixgbe_hw *hw)\n \n \tswitch (hw->device_id) {\n \tcase IXGBE_DEV_ID_X550EM_X_10G_T:\n+\tcase IXGBE_DEV_ID_X550EM_A_SFP:\n \t\t/* Config MDIO clock speed before the first MDIO PHY access */\n \t\thlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0);\n \t\thlreg0 &= ~IXGBE_HLREG0_MDCSPD;\n",
    "prefixes": [
        "V3",
        "08/11"
    ]
}