Show a patch.

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

{
    "id": 73620,
    "url": "https://patches.dpdk.org/api/patches/73620/",
    "web_url": "https://patches.dpdk.org/patch/73620/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk"
    },
    "msgid": "<20200709163603.8798-1-tianfei.zhang@intel.com>",
    "date": "2020-07-09T16:36:03",
    "name": "[v1,2/2] raw/ifpga/base: fix NIOS SPI initial",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "9003b798ed00ffb437887c7c57f162240fb54d75",
    "submitter": {
        "id": 987,
        "url": "https://patches.dpdk.org/api/people/987/",
        "name": "Tianfei zhang",
        "email": "tianfei.zhang@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/patch/73620/mbox/",
    "series": [
        {
            "id": 10918,
            "url": "https://patches.dpdk.org/api/series/10918/",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=10918",
            "date": "2020-07-09T16:35:53",
            "name": "[v1,1/2] raw/ifpga/base: fix spi transaction issue",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/10918/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/73620/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/73620/checks/",
    "tags": {},
    "headers": {
        "X-Mailman-Version": "2.1.15",
        "X-ExtLoop1": "1",
        "Errors-To": "dev-bounces@dpdk.org",
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Mailer": "git-send-email 2.17.1",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 4082BA0526;\n\tThu,  9 Jul 2020 10:47:10 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 27F441DEEA;\n\tThu,  9 Jul 2020 10:47:10 +0200 (CEST)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n by dpdk.org (Postfix) with ESMTP id BDBA71DE62;\n Thu,  9 Jul 2020 10:47:08 +0200 (CEST)",
            "from orsmga008.jf.intel.com ([10.7.209.65])\n by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 09 Jul 2020 01:47:07 -0700",
            "from figo-optiplex-9020.sh.intel.com ([10.238.169.50])\n by orsmga008.jf.intel.com with ESMTP; 09 Jul 2020 01:47:06 -0700"
        ],
        "X-Amp-File-Uploaded": "False",
        "X-BeenThere": "dev@dpdk.org",
        "Message-Id": "<20200709163603.8798-1-tianfei.zhang@intel.com>",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9676\"; a=\"145452841\"",
            "E=Sophos;i=\"5.75,331,1589266800\"; d=\"scan'208\";a=\"145452841\"",
            "E=Sophos;i=\"5.75,331,1589266800\"; d=\"scan'208\";a=\"314896799\""
        ],
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "Precedence": "list",
        "From": "Tianfei zhang <tianfei.zhang@intel.com>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "To": "dev@dpdk.org,\n\trosen.xu@intel.com",
        "IronPort-SDR": [
            "\n NJVSER8ZY6bebjtzUwCQ4L6LlG2p9ZunUhMtkbI+5VDtlVKRGY+kw+zm+E43B3qHQS/2NJDWes\n OB/YB7TgxZzQ==",
            "\n O4HjCoX43fHU8jh5FEbTKjNsVIbTvDgvQhGJVIWzlQChOABd2ZDEm3j4Lm1eFmK5L/Ko37+o8e\n NohtEJDuS6DQ=="
        ],
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Date": "Fri, 10 Jul 2020 00:36:03 +0800",
        "Cc": "Tianfei Zhang <tianfei.zhang@intel.com>,\n\tstable@dpdk.org",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "Subject": "[dpdk-dev] [PATCH v1 2/2] raw/ifpga/base: fix NIOS SPI initial"
    },
    "content": "From: Tianfei Zhang <tianfei.zhang@intel.com>\n\nAdd fecmode setting on NIOS SPI master initialization.\nthis SPI is shared by NIOS core inside FPGA, NIOS will\nuse this SPI master to do some one time initialization\nafter power up, and then release the control to DPDK.\n\nFix the timeout initialization for polling the\nNIOS_INIT_DONE.\n\nFixes: bc44402f (\"raw/ifpga/base: configure FEC mode\")\nCc: stable@dpdk.org\n\nSigned-off-by: Tianfei Zhang <tianfei.zhang@intel.com>\n---\n drivers/raw/ifpga/base/ifpga_fme.c | 27 ++++++++++++++++++++-------\n drivers/raw/ifpga/base/opae_spi.h  |  1 +\n 2 files changed, 21 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/drivers/raw/ifpga/base/ifpga_fme.c b/drivers/raw/ifpga/base/ifpga_fme.c\nindex c31a94cf8..9057087b5 100644\n--- a/drivers/raw/ifpga/base/ifpga_fme.c\n+++ b/drivers/raw/ifpga/base/ifpga_fme.c\n@@ -979,28 +979,32 @@ struct ifpga_feature_ops fme_spi_master_ops = {\n static int nios_spi_wait_init_done(struct altera_spi_device *dev)\n {\n \tu32 val = 0;\n-\tunsigned long timeout = msecs_to_timer_cycles(10000);\n+\tunsigned long timeout = rte_get_timer_cycles() +\n+\t\t\tmsecs_to_timer_cycles(10000);\n \tunsigned long ticks;\n \tint major_version;\n+\tint fecmode = FEC_MODE_NO;\n \n \tif (spi_reg_read(dev, NIOS_VERSION, &val))\n \t\treturn -EIO;\n \n-\tmajor_version = (val >> NIOS_VERSION_MAJOR_SHIFT) &\n-\t\tNIOS_VERSION_MAJOR;\n-\tdev_debug(dev, \"A10 NIOS FW version %d\\n\", major_version);\n+\tmajor_version =\n+\t\t(val & NIOS_VERSION_MAJOR) >> NIOS_VERSION_MAJOR_SHIFT;\n+\tdev_info(dev, \"A10 NIOS FW version %d\\n\", major_version);\n \n \tif (major_version >= 3) {\n \t\t/* read NIOS_INIT to check if PKVL INIT done or not */\n \t\tif (spi_reg_read(dev, NIOS_INIT, &val))\n \t\t\treturn -EIO;\n \n+\t\tdev_debug(dev, \"read NIOS_INIT: 0x%x\\n\", val);\n+\n \t\t/* check if PKVLs are initialized already */\n \t\tif (val & NIOS_INIT_DONE || val & NIOS_INIT_START)\n \t\t\tgoto nios_init_done;\n \n \t\t/* start to config the default FEC mode */\n-\t\tval = NIOS_INIT_START;\n+\t\tval = fecmode | NIOS_INIT_START;\n \n \t\tif (spi_reg_write(dev, NIOS_INIT, val))\n \t\t\treturn -EIO;\n@@ -1010,14 +1014,23 @@ static int nios_spi_wait_init_done(struct altera_spi_device *dev)\n \tdo {\n \t\tif (spi_reg_read(dev, NIOS_INIT, &val))\n \t\t\treturn -EIO;\n-\t\tif (val)\n+\t\tif (val & NIOS_INIT_DONE)\n \t\t\tbreak;\n \n \t\tticks = rte_get_timer_cycles();\n \t\tif (time_after(ticks, timeout))\n \t\t\treturn -ETIMEDOUT;\n \t\tmsleep(100);\n-\t} while (!val);\n+\t} while (1);\n+\n+\t/* get the fecmode */\n+\tif (spi_reg_read(dev, NIOS_INIT, &val))\n+\t\treturn -EIO;\n+\tdev_debug(dev, \"read NIOS_INIT: 0x%x\\n\", val);\n+\tfecmode = (val & REQ_FEC_MODE) >> REQ_FEC_MODE_SHIFT;\n+\tdev_info(dev, \"fecmode: 0x%x, %s\\n\", fecmode,\n+\t\t\t(fecmode == FEC_MODE_KR) ? \"kr\" :\n+\t\t\t((fecmode == FEC_MODE_RS) ? \"rs\" : \"no\"));\n \n \treturn 0;\n }\ndiff --git a/drivers/raw/ifpga/base/opae_spi.h b/drivers/raw/ifpga/base/opae_spi.h\nindex d20a4c3ed..73a227673 100644\n--- a/drivers/raw/ifpga/base/opae_spi.h\n+++ b/drivers/raw/ifpga/base/opae_spi.h\n@@ -153,6 +153,7 @@ int spi_reg_read(struct altera_spi_device *dev, u32 reg, u32 *val);\n \n #define NIOS_INIT\t\t0x1000\n #define REQ_FEC_MODE\t\tGENMASK(23, 8)\n+#define REQ_FEC_MODE_SHIFT      8\n #define FEC_MODE_NO\t\t0x0\n #define FEC_MODE_KR\t\t0x5555\n #define FEC_MODE_RS\t\t0xaaaa\n",
    "prefixes": [
        "v1",
        "2/2"
    ]
}