Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/208835/?format=api
{ "id": 208835, "url": "http://patchwork.ozlabs.org/api/patches/208835/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/1356952428-19824-5-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-5-git-send-email-jagannadh.teki@gmail.com>", "list_archive_url": null, "date": "2012-12-31T11:13:43", "name": "[U-Boot,04/12] cmd_sf: Add rd_inst argument to 'sf update' command", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "e552f84ea917fd17cb26581df12abb2d2905b762", "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-5-git-send-email-jagannadh.teki@gmail.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/208835/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/208835/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 287502C0086\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 31 Dec 2012 22:16:47 +1100 (EST)", "from localhost (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id EF5C74A16D;\n\tMon, 31 Dec 2012 12:16:42 +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 tYckcJ9ExhJL; Mon, 31 Dec 2012 12:16:42 +0100 (CET)", "from theia.denx.de (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id 139C44A16E;\n\tMon, 31 Dec 2012 12:15:43 +0100 (CET)", "from localhost (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id 1C3BA4A11F\n\tfor <u-boot@lists.denx.de>; Mon, 31 Dec 2012 12:15:05 +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 HOKTsor+DxFn for <u-boot@lists.denx.de>;\n\tMon, 31 Dec 2012 12:14:59 +0100 (CET)", "from mail-da0-f48.google.com (mail-da0-f48.google.com\n\t[209.85.210.48]) by theia.denx.de (Postfix) with ESMTPS id 2567E4A026\n\tfor <u-boot@lists.denx.de>; Mon, 31 Dec 2012 12:14:19 +0100 (CET)", "by mail-da0-f48.google.com with SMTP id k18so5770949dae.7\n\tfor <u-boot@lists.denx.de>; Mon, 31 Dec 2012 03:14:18 -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.16\n\t(version=TLSv1/SSLv3 cipher=OTHER);\n\tMon, 31 Dec 2012 03:14:17 -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=f1VlqA26C+whtoriiE+OU9yHboX12oXGoG9WRwKBU4s=;\n\tb=AYg29hytWuaw+Jkoy71lV0TXJoa/C/ZcrpORf75kJysgoXknOCqGAcYkUU4Zd3rB2s\n\ttEM0kMsvM6g+Gi0tuNDJXzuNYu34bRHTL/+uQ8Ha0tlctgVw7MwxbglQ/G+WBF4bSh3J\n\tp2foSQ5eGuIF8gCRWCIgJ38mtvbalRCHAXHFVLKzEYWj7WHVZBf9QUtK6uyQYPN/7abW\n\ta45X254R0x2FvqYRHZ7sVqW6WTaKcI6AdyQOzMF2f9jp5HvVgH05Ne05O97PNJHZl/MK\n\tWqVUkeaBZjC9tA4nmMxWwj/Z/3I/uviA1UnFNbzEJG6Lcrk7fJ3bmnjyO4+SzT4Kqm0V\n\tMiLw==", "X-Received": "by 10.66.77.200 with SMTP id u8mr119947535paw.43.1356952458068; \n\tMon, 31 Dec 2012 03:14:18 -0800 (PST)", "From": "Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>", "To": "u-boot@lists.denx.de", "Date": "Mon, 31 Dec 2012 16:43:43 +0530", "Message-Id": "<1356952428-19824-5-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 04/12] cmd_sf: Add rd_inst argument to 'sf update'\n\tcommand", "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 add a read instruction(rd_inst)\nargument to 'sf update' command.\n\nUser will dynamically use the specific read instruction while\nreading the flash using 'sf update' command.\nCurrently added an existing read instruction called afr(Array Fast Read).\n\nExample:\nerase and write 0x2000 length bytes from memory at 0x10000 address to\nflash offset at 0x0 using pp write instruction and afr read instruction.\nu-boot> sf update pp afr 0x10000 0x0 0x2000\n\nSigned-off-by: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>\n---\n common/cmd_sf.c | 63 +++++++++++++++++++++++++++++++++++++-----------------\n 1 files changed, 43 insertions(+), 20 deletions(-)", "diff": "diff --git a/common/cmd_sf.c b/common/cmd_sf.c\nindex 0f4e440..4cfd48a 100644\n--- a/common/cmd_sf.c\n+++ b/common/cmd_sf.c\n@@ -142,6 +142,7 @@ static int do_spi_flash_probe(int argc, char * const argv[])\n *\n * @param flash\t\tflash context pointer\n * @param wr_inst\twrite instruction\n+ * @param rd_inst\tread instruction\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@@ -150,12 +151,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\tu32 offset, size_t len, const char *buf, char *cmp_buf,\n-\t\tsize_t *skipped)\n+\t\tu8 rd_inst, u32 offset, size_t len, const char *buf,\n+\t\tchar *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, offset, len, cmp_buf))\n+\tif (spi_flash_read(flash, rd_inst, 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@@ -176,13 +177,14 @@ static const char *spi_flash_update_block(struct spi_flash *flash, u8 wr_inst,\n *\n * @param flash\t\tflash context pointer\n * @param wr_inst\twrite instruction\n+ * @param rd_inst\tread instruction\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, u32 offset,\n-\t\tsize_t len, const char *buf)\n+static int spi_flash_update(struct spi_flash *flash, u8 wr_inst, u8 rd_inst,\n+\t\tu32 offset, size_t len, const char *buf)\n {\n \tconst char *err_oper = NULL;\n \tchar *cmp_buf;\n@@ -210,8 +212,8 @@ static int spi_flash_update(struct spi_flash *flash, u8 wr_inst, u32 offset,\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\toffset, todo, buf, cmp_buf,\n-\t\t\t\t\t&skipped);\n+\t\t\t\t\trd_inst, offset, todo, buf,\n+\t\t\t\t\tcmp_buf, &skipped);\n \t\t}\n \t} else {\n \t\terr_oper = \"malloc\";\n@@ -240,19 +242,29 @@ 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+\tint update_rd_inst;\n \tint ret;\n \n-\tif (argc < 5)\n-\t\treturn -1;\n+\tif (strcmp(argv[0], \"update\") == 0) {\n+\t\tif (argc < 6)\n+\t\t\treturn -1;\n \n-\taddr = simple_strtoul(argv[2], &endp, 16);\n-\tif (*argv[2] == 0 || *endp != 0)\n+\t\tupdate_rd_inst = 1;\n+\t} else {\n+\t\tif (argc < 5)\n+\t\t\treturn -1;\n+\n+\t\tupdate_rd_inst = 0;\n+\t}\n+\n+\taddr = simple_strtoul(argv[update_rd_inst + 2], &endp, 16);\n+\tif (*argv[update_rd_inst + 2] == 0 || *endp != 0)\n \t\treturn -1;\n-\toffset = simple_strtoul(argv[3], &endp, 16);\n-\tif (*argv[3] == 0 || *endp != 0)\n+\toffset = simple_strtoul(argv[update_rd_inst + 3], &endp, 16);\n+\tif (*argv[update_rd_inst + 3] == 0 || *endp != 0)\n \t\treturn -1;\n-\tlen = simple_strtoul(argv[4], &endp, 16);\n-\tif (*argv[4] == 0 || *endp != 0)\n+\tlen = simple_strtoul(argv[update_rd_inst + 4], &endp, 16);\n+\tif (*argv[update_rd_inst + 4] == 0 || *endp != 0)\n \t\treturn -1;\n \n \t/* Consistency checking */\n@@ -277,7 +289,16 @@ static int do_spi_flash_read_write(int argc, char * const argv[])\n \t\t\treturn 1;\n \t\t}\n \n-\t\tret = spi_flash_update(flash, wr_inst, offset, len, buf);\n+\t\tif (strcmp(argv[2], \"afr\") == 0)\n+\t\t\trd_inst = CMD_READ_ARRAY_FAST;\n+\t\telse {\n+\t\t\tprintf(\"SF: Unknown %s rd_inst on 'sf update'\\n\",\n+\t\t\t\t\targv[2]);\n+\t\t\treturn 1;\n+\t\t}\n+\n+\t\tret = spi_flash_update(flash, wr_inst, rd_inst,\n+\t\t\t\t\toffset, len, buf);\n \t} else if (strcmp(argv[0], \"read\") == 0) {\n \t\tif (strcmp(argv[1], \"afr\") == 0)\n \t\t\trd_inst = CMD_READ_ARRAY_FAST;\n@@ -551,7 +572,7 @@ usage:\n #endif\n \n U_BOOT_CMD(\n-\tsf,\t6,\t1,\tdo_spi_flash,\n+\tsf,\t7,\t1,\tdo_spi_flash,\n \t\"SPI flash sub-system\",\n \t\"probe [[bus:]cs] [hz] [mode]\t- init flash device on given SPI bus\\n\"\n \t\"\t\t\t\t and chip select\\n\"\n@@ -567,10 +588,12 @@ U_BOOT_CMD(\n \t\"\t\t\t\t pp (Page Program, 02h)\\n\"\n \t\"sf erase offset [+]len\t\t- erase `len' bytes from `offset'\\n\"\n \t\"\t\t\t\t `+len' round up `len' to block size\\n\"\n-\t\"sf update wr_inst addr offset len\\n\"\n+\t\"sf update wr_inst rd_inst addr offset len\\n\"\n \t\"\t\t\t\t- erase and write `len' bytes from memory\\n\"\n \t\"\t\t\t\t at `addr' to flash at `offset' using\\n\"\n-\t\"\t\t\t\t pp `wr_inst' write instruction\\n\"\n-\t\"\t\t\t\t pp (Page Program, 02h)\"\n+\t\"\t\t\t\t pp `wr_inst' write instruction and\\n\"\n+\t\"\t\t\t\t pp (Page Program, 02h)\\n\"\n+\t\"\t\t\t\t afr `rd_inst' read instruction\\n\"\n+\t\"\t\t\t\t afr (Array Fast Read, 0bh)\"\n \tSF_TEST_HELP\n );\n", "prefixes": [ "U-Boot", "04/12" ] }