get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 208839,
    "url": "http://patchwork.ozlabs.org/api/patches/208839/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/1356952428-19824-10-git-send-email-jagannadh.teki@gmail.com/",
    "project": {
        "id": 18,
        "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api",
        "name": "U-Boot",
        "link_name": "uboot",
        "list_id": "u-boot.lists.denx.de",
        "list_email": "u-boot@lists.denx.de",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<1356952428-19824-10-git-send-email-jagannadh.teki@gmail.com>",
    "list_archive_url": null,
    "date": "2012-12-31T11:13:48",
    "name": "[U-Boot,09/12] cmd_sf: Add QOFR(Quad Output Fast Read) read instruction support",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "d944aca8bcfb57211c56edbd8a62fbe588671ae5",
    "submitter": {
        "id": 20045,
        "url": "http://patchwork.ozlabs.org/api/people/20045/?format=api",
        "name": "Jagan Teki",
        "email": "jagannadh.teki@gmail.com"
    },
    "delegate": {
        "id": 17739,
        "url": "http://patchwork.ozlabs.org/api/users/17739/?format=api",
        "username": "jagan",
        "first_name": "Jagannadha Sutradharudu",
        "last_name": "Teki",
        "email": "jagannadh.teki@gmail.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/1356952428-19824-10-git-send-email-jagannadh.teki@gmail.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/208839/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/208839/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<u-boot-bounces@lists.denx.de>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Received": [
            "from theia.denx.de (theia.denx.de [85.214.87.163])\n\tby ozlabs.org (Postfix) with ESMTP id C92BC2C00A7\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 31 Dec 2012 22:17:24 +1100 (EST)",
            "from localhost (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id DE8954A167;\n\tMon, 31 Dec 2012 12:17:21 +0100 (CET)",
            "from theia.denx.de ([127.0.0.1])\n\tby localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id gP+8Tk-hNm9y; Mon, 31 Dec 2012 12:17:21 +0100 (CET)",
            "from theia.denx.de (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id A4A7E4A187;\n\tMon, 31 Dec 2012 12:15:54 +0100 (CET)",
            "from localhost (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id B53C04A01E\n\tfor <u-boot@lists.denx.de>; Mon, 31 Dec 2012 12:15:18 +0100 (CET)",
            "from theia.denx.de ([127.0.0.1])\n\tby localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id U8iRN03103Tg for <u-boot@lists.denx.de>;\n\tMon, 31 Dec 2012 12:15:15 +0100 (CET)",
            "from mail-da0-f53.google.com (mail-da0-f53.google.com\n\t[209.85.210.53]) by theia.denx.de (Postfix) with ESMTPS id 6F4244A02E\n\tfor <u-boot@lists.denx.de>; Mon, 31 Dec 2012 12:14:29 +0100 (CET)",
            "by mail-da0-f53.google.com with SMTP id x6so5698622dac.12\n\tfor <u-boot@lists.denx.de>; Mon, 31 Dec 2012 03:14:28 -0800 (PST)",
            "from localhost.localdomain ([49.204.11.250])\n\tby mx.google.com with ESMTPS id\n\tnw9sm24715215pbb.42.2012.12.31.03.14.26\n\t(version=TLSv1/SSLv3 cipher=OTHER);\n\tMon, 31 Dec 2012 03:14:27 -0800 (PST)"
        ],
        "X-Virus-Scanned": [
            "Debian amavisd-new at theia.denx.de",
            "Debian amavisd-new at theia.denx.de"
        ],
        "X-policyd-weight": "NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5\n\tNOT_IN_BL_NJABL=-1.5 (only DNSBL check requested)",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\n\th=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to\n\t:references; bh=N+8zvUv4dNgRW7mnzT7AurksdddJoZulAdjQ0e/Q2NE=;\n\tb=KtpkPpvEvDXCA/73jmmValQszteuq3ImUE59KsT+IJ7F9boYTZ/pRM+N7dlvcEudDj\n\t9c1V5aZl2i/pps1+Sjd1pqcbvFfWV7VzBSTDlNwmN1+tiGpdRh0wsFTagzQ7KWwLZxDj\n\tgk0LTarFZbZ4YXq68YWxNJL55nTZtpV2+57pPYPN8eLT+lBh5zaxS0WLE7GDehPFH7IN\n\twxFl5uGqghgzgbvaZAYpgN6nbAdybwiOi+JxlHCHw0WXZRr4U2Fp0okGFirofVnm+gQM\n\tybSzUa5eriHcwQewHdAVcISzbCL/ZExQHaiNxE7m9MeRfi1Eu64/4qLgM/fllMVf/dp9\n\tr3Pw==",
        "X-Received": "by 10.66.87.133 with SMTP id ay5mr120002017pab.59.1356952468117; \n\tMon, 31 Dec 2012 03:14:28 -0800 (PST)",
        "From": "Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>",
        "To": "u-boot@lists.denx.de",
        "Date": "Mon, 31 Dec 2012 16:43:48 +0530",
        "Message-Id": "<1356952428-19824-10-git-send-email-jagannadh.teki@gmail.com>",
        "X-Mailer": "git-send-email 1.7.0.4",
        "In-Reply-To": "<1356952428-19824-1-git-send-email-jagannadh.teki@gmail.com>",
        "References": "<1356952428-19824-1-git-send-email-jagannadh.teki@gmail.com>",
        "Subject": "[U-Boot] [PATCH 09/12] cmd_sf: Add QOFR(Quad Output Fast Read) read\n\tinstruction support",
        "X-BeenThere": "u-boot@lists.denx.de",
        "X-Mailman-Version": "2.1.11",
        "Precedence": "list",
        "List-Id": "U-Boot discussion <u-boot.lists.denx.de>",
        "List-Unsubscribe": "<http://lists.denx.de/mailman/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>",
        "List-Archive": "<http://lists.denx.de/pipermail/u-boot>",
        "List-Post": "<mailto:u-boot@lists.denx.de>",
        "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>",
        "List-Subscribe": "<http://lists.denx.de/mailman/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Sender": "u-boot-bounces@lists.denx.de",
        "Errors-To": "u-boot-bounces@lists.denx.de"
    },
    "content": "This patch provides a support to read a flash using 'qofr'\nread instruction(rd_inst) for 'sf read' and 'sf update' commands.\n\n'qofr' will effectively increases the data transfer rate\nby up to four times, as compared to the afr(Array Fast Read).\n\nExample:\nread 0x2000 length bytes starting at offset 0x0 to memory at 0x10000\nusing qofr read instruction.\nu-boot> sf read qofr 0x10000 0x0 0x2000\n\nerase and write 0x2000 length bytes from memory at 0x10000 address to\nflash offset at 0x0 using pp write instruction and qofr read instruction.\nu-boot> sf update pp qofr 0x10000 0x0 0x2000\n\nSigned-off-by: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>\n---\n common/cmd_sf.c                      |   43 ++++++++++++++++++++++------------\n drivers/mtd/spi/spi_flash.c          |   18 +++++++++++---\n drivers/mtd/spi/spi_flash_internal.h |    6 ++--\n include/spi_flash.h                  |    7 +++--\n include/spi_flash_inst.h             |    1 +\n 5 files changed, 50 insertions(+), 25 deletions(-)",
    "diff": "diff --git a/common/cmd_sf.c b/common/cmd_sf.c\nindex b971d2a..a07effd 100644\n--- a/common/cmd_sf.c\n+++ b/common/cmd_sf.c\n@@ -144,6 +144,7 @@ static int do_spi_flash_probe(int argc, char * const argv[])\n  * @param wr_inst\twrite instruction\n  * @param rd_inst\tread instruction\n  * @param wr_qeb_req\tquad enable bit is required for this write operation?\n+ * @param rd_qeb_req\tquad enable bit is required for this read operation?\n  * @param offset\tflash offset to write\n  * @param len\t\tnumber of bytes to write\n  * @param buf\t\tbuffer to write from\n@@ -152,12 +153,12 @@ static int do_spi_flash_probe(int argc, char * const argv[])\n  * @return NULL if OK, else a string containing the stage which failed\n  */\n static const char *spi_flash_update_block(struct spi_flash *flash, u8 wr_inst,\n-\t\tu8 rd_inst, u8 wr_qeb_req, u32 offset, size_t len,\n-\t\tconst char *buf, char *cmp_buf, size_t *skipped)\n+\t\tu8 rd_inst, u8 wr_qeb_req, u8 rd_qeb_req, u32 offset,\n+\t\tsize_t len, const char *buf, char *cmp_buf, size_t *skipped)\n {\n \tdebug(\"offset=%#x, sector_size=%#x, len=%#zx\\n\",\n \t\toffset, flash->sector_size, len);\n-\tif (spi_flash_read(flash, rd_inst, offset, len, cmp_buf))\n+\tif (spi_flash_read(flash, rd_inst, rd_qeb_req, offset, len, cmp_buf))\n \t\treturn \"read\";\n \tif (memcmp(cmp_buf, buf, len) == 0) {\n \t\tdebug(\"Skip region %x size %zx: no change\\n\",\n@@ -180,13 +181,15 @@ static const char *spi_flash_update_block(struct spi_flash *flash, u8 wr_inst,\n  * @param wr_inst\twrite instruction\n  * @param rd_inst\tread instruction\n  * @param wr_qeb_req\tquad enable bit is required for this write operation?\n+ * @param rd_qeb_req\tquad enable bit is required for this read operation?\n  * @param offset\tflash offset to write\n  * @param len\t\tnumber of bytes to write\n  * @param buf\t\tbuffer to write from\n  * @return 0 if ok, 1 on error\n  */\n static int spi_flash_update(struct spi_flash *flash, u8 wr_inst, u8 rd_inst,\n-\t\tu8 wr_qeb_req, u32 offset, size_t len, const char *buf)\n+\t\tu8 wr_qeb_req, u8 rd_qeb_req, u32 offset,\n+\t\tsize_t len, const char *buf)\n {\n \tconst char *err_oper = NULL;\n \tchar *cmp_buf;\n@@ -214,7 +217,7 @@ static int spi_flash_update(struct spi_flash *flash, u8 wr_inst, u8 rd_inst,\n \t\t\t\tlast_update = get_timer(0);\n \t\t\t}\n \t\t\terr_oper = spi_flash_update_block(flash, wr_inst,\n-\t\t\t\t\trd_inst, wr_qeb_req,\n+\t\t\t\t\trd_inst, wr_qeb_req, rd_qeb_req,\n \t\t\t\t\toffset, todo, buf,\n \t\t\t\t\tcmp_buf, &skipped);\n \t\t}\n@@ -271,19 +274,26 @@ static int sf_parse_wr_inst_arg(char *arg, u8 *wr_inst, u8 *wr_qeb_req)\n  *    arg: specified read instruction from user\n  * Output:\n  *    rd_inst: parsed read instruction for write operation\n+ *    rd_qeb_req: assign to 1 if this instruction require quad enable bit\n+ *\t\tneed to set prior to actual read operation\n  * Return:\n  *    1: for Unknown rd_inst from user\n  *    0: Success\n  */\n-static int sf_parse_rd_inst_arg(char *arg, u8 *rd_inst)\n+static int sf_parse_rd_inst_arg(char *arg, u8 *rd_inst, u8 *rd_qeb_req)\n {\n+\t*rd_qeb_req = 0;\n+\n \tif (strcmp(arg, \"afr\") == 0)\n \t\t*rd_inst = CMD_READ_ARRAY_FAST;\n \telse if (strcmp(arg, \"asr\") == 0)\n \t\t*rd_inst = CMD_READ_ARRAY_SLOW;\n \telse if (strcmp(arg, \"dofr\") == 0)\n \t\t*rd_inst = CMD_READ_DUAL_OUTPUT_FAST;\n-\telse\n+\telse if (strcmp(arg, \"qofr\") == 0) {\n+\t\t*rd_inst = CMD_READ_QUAD_OUTPUT_FAST;\n+\t\t*rd_qeb_req = 1;\n+\t} else\n \t\treturn 1;\n \n \treturn 0;\n@@ -297,7 +307,7 @@ static int do_spi_flash_read_write(int argc, char * const argv[])\n \tvoid *buf;\n \tchar *endp;\n \tu8 wr_inst, rd_inst;\n-\tu8 wr_qeb_req;\n+\tu8 wr_qeb_req, rd_qeb_req;\n \tint update_rd_inst;\n \tint ret;\n \n@@ -344,7 +354,7 @@ static int do_spi_flash_read_write(int argc, char * const argv[])\n \t\t\treturn ret;\n \t\t}\n \n-\t\tret = sf_parse_rd_inst_arg(argv[2], &rd_inst);\n+\t\tret = sf_parse_rd_inst_arg(argv[2], &rd_inst, &rd_qeb_req);\n \t\tif (ret) {\n \t\t\tprintf(\"SF: Unknown %s rd_inst on 'sf update'\\n\",\n \t\t\t\t\targv[2]);\n@@ -352,16 +362,17 @@ static int do_spi_flash_read_write(int argc, char * const argv[])\n \t\t}\n \n \t\tret = spi_flash_update(flash, wr_inst, rd_inst,\n-\t\t\t\twr_qeb_req, offset, len, buf);\n+\t\t\t\twr_qeb_req, rd_qeb_req, offset, len, buf);\n \t} else if (strcmp(argv[0], \"read\") == 0) {\n-\t\tret = sf_parse_rd_inst_arg(argv[1], &rd_inst);\n+\t\tret = sf_parse_rd_inst_arg(argv[1], &rd_inst, &rd_qeb_req);\n \t\tif (ret) {\n \t\t\tprintf(\"SF: Unknown %s rd_inst on 'sf read'\\n\",\n \t\t\t\t\targv[1]);\n \t\t\treturn ret;\n \t\t}\n \n-\t\tret = spi_flash_read(flash, rd_inst, offset, len, buf);\n+\t\tret = spi_flash_read(flash, rd_inst, rd_qeb_req,\n+\t\t\t\toffset, len, buf);\n \t} else {\n \t\tret = sf_parse_wr_inst_arg(argv[1], &wr_inst, &wr_qeb_req);\n \t\tif (ret) {\n@@ -632,10 +643,11 @@ U_BOOT_CMD(\n \t\"sf read rd_inst addr offset len\\n\"\n \t\"\t\t\t\t- read `len' bytes starting at\\n\"\n \t\"\t\t\t\t  `offset' to memory at `addr' using\\n\"\n-\t\"\t\t\t\t  afr | asr | dofr `rd_inst' read instructions\\n\"\n+\t\"\t\t\t\t  afr | asr | dofr | qofr `rd_inst' read instructions\\n\"\n \t\"\t\t\t\t  afr (Array Fast Read, 0bh)\\n\"\n \t\"\t\t\t\t  asr (Array Slow Read, 02b)\\n\"\n \t\"\t\t\t\t  dofr (Dual Output Fast Read, 3bh)\\n\"\n+\t\"\t\t\t\t  qofr (Quad Output Fast Read, 6bh)\\n\"\n \t\"sf write wr_inst addr offset len\\n\"\n \t\"\t\t\t\t- write `len' bytes from memory\\n\"\n \t\"\t\t\t\t  at `addr' to flash at `offset' using\\n\"\n@@ -650,9 +662,10 @@ U_BOOT_CMD(\n \t\"\t\t\t\t  pp | qpp `wr_inst' write instructions and\\n\"\n \t\"\t\t\t\t  pp (Page Program, 02h)\\n\"\n \t\"\t\t\t\t  qpp (Quad Page Program, 32h)\\n\"\n-\t\"\t\t\t\t  afr | asr | dofr `rd_inst' read instructions\\n\"\n+\t\"\t\t\t\t  afr | asr | dofr | qofr `rd_inst' read instructions\\n\"\n \t\"\t\t\t\t  afr (Array Fast Read, 0bh)\\n\"\n \t\"\t\t\t\t  asr (Array Slow Read, 02b)\\n\"\n-\t\"\t\t\t\t  dofr (Dual Output Fast Read, 3bh)\"\n+\t\"\t\t\t\t  dofr (Dual Output Fast Read, 3bh)\\n\"\n+\t\"\t\t\t\t  qofr (Quad Output Fast Read, 6bh)\"\n \tSF_TEST_HELP\n );\ndiff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c\nindex 3d57863..15ad05c 100644\n--- a/drivers/mtd/spi/spi_flash.c\n+++ b/drivers/mtd/spi/spi_flash.c\n@@ -130,21 +130,30 @@ int spi_flash_cmd_write_multi(struct spi_flash *flash, u8 wr_inst,\n \treturn ret;\n }\n \n-int spi_flash_read_common(struct spi_flash *flash, const u8 *cmd,\n+int spi_flash_read_common(struct spi_flash *flash, const u8 *cmd, u8 rd_qeb_req,\n \t\tsize_t cmd_len, void *data, size_t data_len)\n {\n \tstruct spi_slave *spi = flash->spi;\n \tint ret;\n \n \tspi_claim_bus(spi);\n+\n+\tif (rd_qeb_req) {\n+\t\tret = spi_flash_set_quad_enable_bit(flash);\n+\t\tif (ret) {\n+\t\t\tdebug(\"SF: set quad enable bit failed\\n\");\n+\t\t\treturn ret;\n+\t\t}\n+\t}\n+\n \tret = spi_flash_cmd_read(spi, cmd, cmd_len, data, data_len);\n \tspi_release_bus(spi);\n \n \treturn ret;\n }\n \n-int spi_flash_cmd_read_fast(struct spi_flash *flash, u8 rd_inst, u32 offset,\n-\t\tsize_t len, void *data)\n+int spi_flash_cmd_read_fast(struct spi_flash *flash, u8 rd_inst,\n+\t\tu8 rd_qeb_req, u32 offset, size_t len, void *data)\n {\n \tu8 cmd[5];\n \n@@ -152,7 +161,8 @@ int spi_flash_cmd_read_fast(struct spi_flash *flash, u8 rd_inst, u32 offset,\n \tspi_flash_addr(offset, cmd);\n \tcmd[4] = 0x00;\n \n-\treturn spi_flash_read_common(flash, cmd, sizeof(cmd), data, len);\n+\treturn spi_flash_read_common(flash, cmd, rd_qeb_req,\n+\t\t\t\tsizeof(cmd), data, len);\n }\n \n int spi_flash_cmd_poll_bit(struct spi_flash *flash, unsigned long timeout,\ndiff --git a/drivers/mtd/spi/spi_flash_internal.h b/drivers/mtd/spi/spi_flash_internal.h\nindex e36f216..feefdee 100644\n--- a/drivers/mtd/spi/spi_flash_internal.h\n+++ b/drivers/mtd/spi/spi_flash_internal.h\n@@ -43,8 +43,8 @@ int spi_flash_cmd(struct spi_slave *spi, u8 cmd, void *response, size_t len);\n int spi_flash_cmd_read(struct spi_slave *spi, const u8 *cmd,\n \t\tsize_t cmd_len, void *data, size_t data_len);\n \n-int spi_flash_cmd_read_fast(struct spi_flash *flash, u8 rd_inst, u32 offset,\n-\t\tsize_t len, void *data);\n+int spi_flash_cmd_read_fast(struct spi_flash *flash, u8 rd_inst, u8 rd_qeb_req,\n+\t\tu32 offset, size_t len, void *data);\n \n /*\n  * Send a multi-byte command to the device followed by (optional)\n@@ -96,7 +96,7 @@ int spi_flash_set_quad_enable_bit(struct spi_flash *flash);\n  * bus. Used as common part of the ->read() operation.\n  */\n int spi_flash_read_common(struct spi_flash *flash, const u8 *cmd,\n-\t\tsize_t cmd_len, void *data, size_t data_len);\n+\t\tu8 rd_qeb_req, size_t cmd_len, void *data, size_t data_len);\n \n /* Send a command to the device and wait for some bit to clear itself. */\n int spi_flash_cmd_poll_bit(struct spi_flash *flash, unsigned long timeout,\ndiff --git a/include/spi_flash.h b/include/spi_flash.h\nindex 31e7d9e..d3e6ca5 100644\n--- a/include/spi_flash.h\n+++ b/include/spi_flash.h\n@@ -40,7 +40,8 @@ struct spi_flash {\n \tu32\t\tsector_size;\n \n \tint\t\t(*read)(struct spi_flash *flash, u8 rd_inst,\n-\t\t\t\tu32 offset, size_t len, void *buf);\n+\t\t\t\tu8 rd_qeb_req, u32 offset, size_t len,\n+\t\t\t\tvoid *buf);\n \tint\t\t(*write)(struct spi_flash *flash, u8 wr_inst,\n \t\t\t\tu8 wr_qeb_req, u32 offset, size_t len,\n \t\t\t\tconst void *buf);\n@@ -53,9 +54,9 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,\n void spi_flash_free(struct spi_flash *flash);\n \n static inline int spi_flash_read(struct spi_flash *flash, u8 rd_inst,\n-\t\tu32 offset, size_t len, void *buf)\n+\t\tu8 rd_qeb_req, u32 offset, size_t len, void *buf)\n {\n-\treturn flash->read(flash, rd_inst, offset, len, buf);\n+\treturn flash->read(flash, rd_inst, rd_qeb_req, offset, len, buf);\n }\n \n static inline int spi_flash_write(struct spi_flash *flash, u8 wr_inst,\ndiff --git a/include/spi_flash_inst.h b/include/spi_flash_inst.h\nindex f8fcf5e..67b22c8 100644\n--- a/include/spi_flash_inst.h\n+++ b/include/spi_flash_inst.h\n@@ -32,5 +32,6 @@\n #define CMD_READ_ARRAY_FAST\t\t0x0b\n #define CMD_READ_ARRAY_SLOW\t\t0x03\n #define CMD_READ_DUAL_OUTPUT_FAST\t0x3b\n+#define CMD_READ_QUAD_OUTPUT_FAST\t0x6b\n \n #endif /* _SPI_FLASH_INST_H_ */\n",
    "prefixes": [
        "U-Boot",
        "09/12"
    ]
}