Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/208831/?format=api
{ "id": 208831, "url": "http://patchwork.ozlabs.org/api/patches/208831/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/1356952428-19824-2-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-2-git-send-email-jagannadh.teki@gmail.com>", "list_archive_url": null, "date": "2012-12-31T11:13:40", "name": "[U-Boot,01/12] cmd_sf: Add wr_inst argument to 'sf write' command", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "f3b15acc222cfe77e44608e235c659d8f2ea4ca0", "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-2-git-send-email-jagannadh.teki@gmail.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/208831/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/208831/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 4D23F2C009A\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 31 Dec 2012 22:15:43 +1100 (EST)", "from localhost (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id E22AF4A15F;\n\tMon, 31 Dec 2012 12:15:38 +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 NYY+OB9UMyUk; Mon, 31 Dec 2012 12:15:36 +0100 (CET)", "from theia.denx.de (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id 463DF4A026;\n\tMon, 31 Dec 2012 12:15:26 +0100 (CET)", "from localhost (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id 88B524A14A\n\tfor <u-boot@lists.denx.de>; Mon, 31 Dec 2012 12:14:52 +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 WrKMtg6v10zN for <u-boot@lists.denx.de>;\n\tMon, 31 Dec 2012 12:14:26 +0100 (CET)", "from mail-da0-f49.google.com (mail-da0-f49.google.com\n\t[209.85.210.49]) by theia.denx.de (Postfix) with ESMTPS id 0886C4A11F\n\tfor <u-boot@lists.denx.de>; Mon, 31 Dec 2012 12:14:13 +0100 (CET)", "by mail-da0-f49.google.com with SMTP id v40so5742472dad.36\n\tfor <u-boot@lists.denx.de>; Mon, 31 Dec 2012 03:14:12 -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.10\n\t(version=TLSv1/SSLv3 cipher=OTHER);\n\tMon, 31 Dec 2012 03:14:11 -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=ktEkXXhJtc2ZQpD1uRanx1z07yDbjtvzK8SZNUTTeOY=;\n\tb=bSljunnVtL62be8U5SbtSoNcQainGpG+HbOUvx0TVcUmyu1lfQAembM5yiEY56XYMT\n\tW4OJ7d64jO4CUrr9AhnwazWM36Ui0U+3xCtK/SntKakG8aLKO4OH7VfeLf362dg173W5\n\ter385EPiItCboMSFz9WiGRSq5eMUqA7tB2EiyKRI8QKZS6acDdUoIi5mBb+N6SHxVSlo\n\thYiVcz/ABkBHpCZea/m+QRzkfZDqyFi54u92cnkfDbSHFn4LT1tafXnhikKn3vmpAN6+\n\tKifY2fL1qwqZF9RVVukCIMypz5pC/DX8g39W0LoVJ+gF2U6YSgNjgHUOWtedYEXX3RCa\n\t4GMg==", "X-Received": "by 10.68.227.73 with SMTP id ry9mr125088219pbc.73.1356952452193; \n\tMon, 31 Dec 2012 03:14:12 -0800 (PST)", "From": "Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>", "To": "u-boot@lists.denx.de", "Date": "Mon, 31 Dec 2012 16:43:40 +0530", "Message-Id": "<1356952428-19824-2-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 01/12] cmd_sf: Add wr_inst argument to 'sf write'\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 write instruction(wr_inst)\nargument to 'sf write' command.\n\nUser will dynamically use the specific write instruction while\nprogramming the flash using 'sf write' command.\nCurrently added an existing write instruction called pp(Page Program).\n\nExample:\nwrite 0x2000 length bytes from memory at 0x10000 address to\nflash offset at 0x0 using pp write instruction.\nu-boot> sf write pp 0x10000 0x0 0x2000\n\nSigned-off-by: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>\n---\n common/cmd_sf.c | 36 +++++++++++++++++++++++----------\n drivers/mtd/spi/spi_flash.c | 4 +-\n drivers/mtd/spi/spi_flash_internal.h | 2 +-\n include/spi_flash.h | 10 ++++----\n include/spi_flash_inst.h | 30 ++++++++++++++++++++++++++++\n 5 files changed, 63 insertions(+), 19 deletions(-)\n create mode 100644 include/spi_flash_inst.h", "diff": "diff --git a/common/cmd_sf.c b/common/cmd_sf.c\nindex b175358..e7843f3 100644\n--- a/common/cmd_sf.c\n+++ b/common/cmd_sf.c\n@@ -9,6 +9,7 @@\n #include <common.h>\n #include <malloc.h>\n #include <spi_flash.h>\n+#include <spi_flash_inst.h>\n \n #include <asm/io.h>\n \n@@ -234,20 +235,21 @@ static int do_spi_flash_read_write(int argc, char * const argv[])\n \tunsigned long len;\n \tvoid *buf;\n \tchar *endp;\n+\tu8 wr_inst;\n \tint ret;\n \n-\tif (argc < 4)\n+\tif (argc < 5)\n \t\treturn -1;\n \n-\taddr = simple_strtoul(argv[1], &endp, 16);\n-\tif (*argv[1] == 0 || *endp != 0)\n-\t\treturn -1;\n-\toffset = simple_strtoul(argv[2], &endp, 16);\n+\taddr = simple_strtoul(argv[2], &endp, 16);\n \tif (*argv[2] == 0 || *endp != 0)\n \t\treturn -1;\n-\tlen = simple_strtoul(argv[3], &endp, 16);\n+\toffset = simple_strtoul(argv[3], &endp, 16);\n \tif (*argv[3] == 0 || *endp != 0)\n \t\treturn -1;\n+\tlen = simple_strtoul(argv[4], &endp, 16);\n+\tif (*argv[4] == 0 || *endp != 0)\n+\t\treturn -1;\n \n \t/* Consistency checking */\n \tif (offset + len > flash->size) {\n@@ -266,8 +268,17 @@ static int do_spi_flash_read_write(int argc, char * const argv[])\n \t\tret = spi_flash_update(flash, offset, len, buf);\n \telse if (strcmp(argv[0], \"read\") == 0)\n \t\tret = spi_flash_read(flash, offset, len, buf);\n-\telse\n-\t\tret = spi_flash_write(flash, offset, len, buf);\n+\telse {\n+\t\tif (strcmp(argv[1], \"pp\") == 0)\n+\t\t\twr_inst = CMD_PAGE_PROGRAM;\n+\t\telse {\n+\t\t\tprintf(\"SF: Unknown %s wr_inst on 'sf write'\\n\",\n+\t\t\t\t\targv[1]);\n+\t\t\treturn 1;\n+\t\t}\n+\n+\t\tret = spi_flash_write(flash, wr_inst, offset, len, buf);\n+\t}\n \n \tunmap_physmem(buf, len);\n \n@@ -520,14 +531,17 @@ usage:\n #endif\n \n U_BOOT_CMD(\n-\tsf,\t5,\t1,\tdo_spi_flash,\n+\tsf,\t6,\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 \t\"sf read addr offset len \t- read `len' bytes starting at\\n\"\n \t\"\t\t\t\t `offset' to memory at `addr'\\n\"\n-\t\"sf write addr offset len\t- write `len' bytes from memory\\n\"\n-\t\"\t\t\t\t at `addr' to flash at `offset'\\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+\t\"\t\t\t\t pp `wr_inst' write instruction\\n\"\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 addr offset len\t- erase and write `len' bytes from memory\\n\"\ndiff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c\nindex 4dacdc7..8ba2c65 100644\n--- a/drivers/mtd/spi/spi_flash.c\n+++ b/drivers/mtd/spi/spi_flash.c\n@@ -65,7 +65,7 @@ int spi_flash_cmd_write(struct spi_slave *spi, const u8 *cmd, size_t cmd_len,\n \treturn spi_flash_read_write(spi, cmd, cmd_len, data, NULL, data_len);\n }\n \n-int spi_flash_cmd_write_multi(struct spi_flash *flash, u32 offset,\n+int spi_flash_cmd_write_multi(struct spi_flash *flash, u8 wr_inst, u32 offset,\n \t\tsize_t len, const void *buf)\n {\n \tunsigned long page_addr, byte_addr, page_size;\n@@ -83,7 +83,7 @@ int spi_flash_cmd_write_multi(struct spi_flash *flash, u32 offset,\n \t\treturn ret;\n \t}\n \n-\tcmd[0] = CMD_PAGE_PROGRAM;\n+\tcmd[0] = wr_inst;\n \tfor (actual = 0; actual < len; actual += chunk_len) {\n \t\tchunk_len = min(len - actual, page_size - byte_addr);\n \ndiff --git a/drivers/mtd/spi/spi_flash_internal.h b/drivers/mtd/spi/spi_flash_internal.h\nindex 15c7ac4..0d416b3 100644\n--- a/drivers/mtd/spi/spi_flash_internal.h\n+++ b/drivers/mtd/spi/spi_flash_internal.h\n@@ -57,7 +57,7 @@ int spi_flash_cmd_write(struct spi_slave *spi, const u8 *cmd, size_t cmd_len,\n * Write the requested data out breaking it up into multiple write\n * commands as needed per the write size.\n */\n-int spi_flash_cmd_write_multi(struct spi_flash *flash, u32 offset,\n+int spi_flash_cmd_write_multi(struct spi_flash *flash, u8 wr_inst, u32 offset,\n \t\tsize_t len, const void *buf);\n \n /*\ndiff --git a/include/spi_flash.h b/include/spi_flash.h\nindex 9da9062..9b3a6a1 100644\n--- a/include/spi_flash.h\n+++ b/include/spi_flash.h\n@@ -41,8 +41,8 @@ struct spi_flash {\n \n \tint\t\t(*read)(struct spi_flash *flash, u32 offset,\n \t\t\t\tsize_t len, void *buf);\n-\tint\t\t(*write)(struct spi_flash *flash, u32 offset,\n-\t\t\t\tsize_t len, const void *buf);\n+\tint\t\t(*write)(struct spi_flash *flash, u8 wr_inst,\n+\t\t\t\tu32 offset, size_t len, const void *buf);\n \tint\t\t(*erase)(struct spi_flash *flash, u32 offset,\n \t\t\t\tsize_t len);\n };\n@@ -57,10 +57,10 @@ static inline int spi_flash_read(struct spi_flash *flash, u32 offset,\n \treturn flash->read(flash, offset, len, buf);\n }\n \n-static inline int spi_flash_write(struct spi_flash *flash, u32 offset,\n-\t\tsize_t len, const void *buf)\n+static inline int spi_flash_write(struct spi_flash *flash, u8 wr_inst,\n+\t\tu32 offset, size_t len, const void *buf)\n {\n-\treturn flash->write(flash, offset, len, buf);\n+\treturn flash->write(flash, wr_inst, offset, len, buf);\n }\n \n static inline int spi_flash_erase(struct spi_flash *flash, u32 offset,\ndiff --git a/include/spi_flash_inst.h b/include/spi_flash_inst.h\nnew file mode 100644\nindex 0000000..139f45b\n--- /dev/null\n+++ b/include/spi_flash_inst.h\n@@ -0,0 +1,30 @@\n+/*\n+ * (C) Copyright 2012\n+ * Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>\n+ *\n+ * See file CREDITS for list of people who contributed to this\n+ * project.\n+ *\n+ * This program is free software; you can redistribute it and/or\n+ * modify it under the terms of the GNU General Public License as\n+ * published by the Free Software Foundation; either version 2 of\n+ * the License, or (at your option) any later version.\n+ *\n+ * This program is distributed in the hope that it will be useful,\n+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n+ * GNU General Public License for more details.\n+ *\n+ * You should have received a copy of the GNU General Public License\n+ * along with this program; if not, write to the Free Software\n+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,\n+ * MA 02111-1307 USA\n+ */\n+\n+#ifndef _SPI_FLASH_INST_H_\n+#define _SPI_FLASH_INST_H_\n+\n+/* Write commands */\n+#define CMD_PAGE_PROGRAM\t\t0x02\n+\n+#endif /* _SPI_FLASH_INST_H_ */\n", "prefixes": [ "U-Boot", "01/12" ] }