Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/556250/?format=api
{ "id": 556250, "url": "http://patchwork.ozlabs.org/api/patches/556250/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-mtd/patch/566DF6D9.2070904@simon.arlott.org.uk/", "project": { "id": 3, "url": "http://patchwork.ozlabs.org/api/projects/3/?format=api", "name": "Linux MTD development", "link_name": "linux-mtd", "list_id": "linux-mtd.lists.infradead.org", "list_email": "linux-mtd@lists.infradead.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<566DF6D9.2070904@simon.arlott.org.uk>", "list_archive_url": null, "date": "2015-12-13T22:53:13", "name": "[linux-next,v4,11/11] mtd: bcm63xxpart: Add NAND partitioning support", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "0c8467cc6ed8ca91a2a4f4f9054925d38d2b3038", "submitter": { "id": 1123, "url": "http://patchwork.ozlabs.org/api/people/1123/?format=api", "name": "Simon Arlott", "email": "simon@fire.lp0.eu" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-mtd/patch/566DF6D9.2070904@simon.arlott.org.uk/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/556250/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/556250/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Received": [ "from bombadil.infradead.org (bombadil.infradead.org\n\t[IPv6:2001:1868:205::9])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 5DF80140311\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 14 Dec 2015 09:55:06 +1100 (AEDT)", "from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux))\n\tid 1a8FWN-0000Ur-Jl; Sun, 13 Dec 2015 22:53:39 +0000", "from proxima.lp0.eu ([2001:8b0:ffea:0:205:b4ff:fe12:530])\n\tby bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux))\n\tid 1a8FWK-0000ML-L6\n\tfor linux-mtd@lists.infradead.org; Sun, 13 Dec 2015 22:53:38 +0000", "from redrum.lp0.eu ([2001:8b0:ffea:0:2e0:81ff:fe4d:2bec]:44509\n\tident=simon)\n\tby proxima.lp0.eu ([2001:8b0:ffea:0:205:b4ff:fe12:530]:465)\n\twith esmtpsav (UNKNOWN:DHE-RSA-AES256-SHA:256/CN=Simon Arlott)\n\tid 1a8FVy-0004BP-87 (Exim); Sun, 13 Dec 2015 22:53:15 +0000" ], "Authentication-Results": "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tsecure) header.d=fire.lp0.eu header.i=@fire.lp0.eu header.b=Ihux7j2G;\n\tdkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=fire.lp0.eu; s=exim; \n\th=Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:Cc:References:To:Subject;\n\tbh=PJxTLBKcz76+/4pT7A8K8QV8zaLnd0sI/zxYFPP+Hso=; \n\tb=Ihux7j2GsrR2IfBx8b8pd/wOmfq1WR9uA7VP4S1Ck9iwJBeLZVTHVXnMsTws4wet7LJLneBgY+UGERquNjGEBD2EY67ey6vgBESDZgR/Ls6NQPvvxetlZa00JJqr9a0qHxSqwpixnt9xusl9hSxAmWseWKMp6h7Nv4Z2sJrycz29XLB/1ImITrWEQRmopyBGj2NwQ+oCJjqsHAjvmrItcg1T2J62KHBQxCK9oZWH7GC0bqFZTgDpeX4iPQtBQQTnLURYQ31fSJI7AMF0a4R8hEuqY4Be2R/PWUyEt+bs073A9XzEmj2oCHwWKafAh4Ffd77oVnDOONSeP3lwAE0kcg==;", "Subject": "[PATCH linux-next v4 11/11] mtd: bcm63xxpart: Add NAND partitioning\n\tsupport", "To": "Ralf Baechle <ralf@linux-mips.org>, David Woodhouse\n\t<dwmw2@infradead.org>, Brian Norris <computersforpeace@gmail.com>,\n\tKevin Cernekee <cernekee@gmail.com>, Florian Fainelli\n\t<f.fainelli@gmail.com>, Jonas Gorski <jogo@openwrt.org>", "References": "<566DF43B.5010400@simon.arlott.org.uk>", "From": "Simon Arlott <simon@fire.lp0.eu>", "Message-ID": "<566DF6D9.2070904@simon.arlott.org.uk>", "Date": "Sun, 13 Dec 2015 22:53:13 +0000", "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101\n\tThunderbird/38.4.0", "MIME-Version": "1.0", "In-Reply-To": "<566DF43B.5010400@simon.arlott.org.uk>", "X-CRM114-Version": "20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ", "X-CRM114-CacheID": "sfid-20151213_145337_124866_078692B7 ", "X-CRM114-Status": "GOOD ( 21.59 )", "X-Spam-Score": "-4.3 (----)", "X-Spam-Report": "SpamAssassin version 3.4.0 on bombadil.infradead.org summary:\n\tContent analysis details: (-4.3 points)\n\tpts rule name description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\n\tmedium trust [2001:8b0:ffea:0:205:b4ff:fe12:530 listed in]\n\t[list.dnswl.org]\n\t-0.0 SPF_HELO_PASS SPF: HELO matches SPF record\n\t-0.0 SPF_PASS SPF: sender matches SPF record\n\t-0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay\n\tdomain\n\t-1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t0.1 DKIM_SIGNED Message has a DKIM or DK signature,\n\tnot necessarily valid\n\t-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from\n\tauthor's domain\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature", "X-BeenThere": "linux-mtd@lists.infradead.org", "X-Mailman-Version": "2.1.20", "Precedence": "list", "List-Id": "Linux MTD discussion mailing list <linux-mtd.lists.infradead.org>", "List-Unsubscribe": "<http://lists.infradead.org/mailman/options/linux-mtd>,\n\t<mailto:linux-mtd-request@lists.infradead.org?subject=unsubscribe>", "List-Archive": "<http://lists.infradead.org/pipermail/linux-mtd/>", "List-Post": "<mailto:linux-mtd@lists.infradead.org>", "List-Help": "<mailto:linux-mtd-request@lists.infradead.org?subject=help>", "List-Subscribe": "<http://lists.infradead.org/mailman/listinfo/linux-mtd>,\n\t<mailto:linux-mtd-request@lists.infradead.org?subject=subscribe>", "Cc": "MIPS Mailing List <linux-mips@linux-mips.org>,\n\tMTD Maling List <linux-mtd@lists.infradead.org>,\n\tLinux Kernel Mailing List <linux-kernel@vger.kernel.org>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Sender": "\"linux-mtd\" <linux-mtd-bounces@lists.infradead.org>", "Errors-To": "linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org" }, "content": "Add partitioning support for BCM963xx boards with NAND flash.\n\nThe following partitions are defined:\n \"boot\": CFE and nvram data\n \"rootfs\": Currently selected rootfs\n \"data\": Configuration data\n \"rootfs1_update\": Container for the whole flash area used\n for the first rootfs to allow it to be\n updated\n \"rootfs2_update\": Container for the whole flash area used\n for the second rootfs to allow it to be\n updated\n \"rootfs_other\": The other (not currently selected) rootfs\n\nExample:\n[ 2.157094] nand: device found, Manufacturer ID: 0xc2, Chip ID: 0xf1\n[ 2.163796] nand: Macronix NAND 128MiB 3,3V 8-bit\n[ 2.168648] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64\n[ 2.176588] bcm6368_nand 10000200.nand: detected 128MiB total, 128KiB blocks, 2KiB pages, 16B OOB, 8-bit, Hamming ECC\n[ 2.189782] Bad block table found at page 65472, version 0x01\n[ 2.196910] Bad block table found at page 65408, version 0x01\n[ 2.204003] nand_read_bbt: bad block at 0x000007480000\n[ 2.225220] bcm63xxpart: rootfs1: CFE image tag found at 0x20000 with version 6, board type 963168VX\n[ 2.236188] bcm63xxpart: rootfs2: CFE image tag found at 0x4000000 with version 6, board type 963168VX\n[ 2.246165] bcm63xxpart: CFE bootline selected latest image rootfs1 (rootfs1_seq=2, rootfs2_seq=1)\n[ 2.255800] 6 bcm63xxpart partitions found on MTD device brcmnand.0\n[ 2.275360] Creating 6 MTD partitions on \"brcmnand.0\":\n[ 2.280804] 0x000000000000-0x000000020000 : \"boot\"\n[ 2.294609] 0x000000040000-0x000001120000 : \"rootfs\"\n[ 2.310078] 0x000007b00000-0x000007f00000 : \"data\"\n[ 2.324052] 0x000000020000-0x000003ac0000 : \"rootfs1_update\"\n[ 2.339190] 0x000004000000-0x000007ac0000 : \"rootfs2_update\"\n[ 2.354290] 0x000004020000-0x000005060000 : \"rootfs_other\"\n\nThe nvram contains the offset and size of the boot, rootfs1, rootfs2\nand data partitions. The presence of CFE and nvram is already verified\nby reading from the boot partition which is assumed to be at offset 0\nand the NAND process aborts if the nvram read indicates that this is\nnot the case.\n\nThere is bcm_tag information at the start of each rootfs that is used\nto determine which rootfs is newer and what its real offset/size is.\n\nThe CFE bootline is used to select a rootfs.\n\nSigned-off-by: Simon Arlott <simon@fire.lp0.eu>\n---\nv4: Reorganised functions based on earlier new patches in the series,\n no real logic changes other than having to check for nvram->version\n >= 6 within the nand function instead of the nvram read function.\n\n Renamed \"curpart\" to \"i\" because it allows the partition layout\n lines to be under 80 characters.\n\nv3: Use COMPILE_TEST.\n\n Ensure that strings read from flash are null terminated and validate\n bcm_tag integer values (this also moves reporting of rootfs sequence\n numbers to later on).\n\nv2: Use external struct bcm963xx_nvram definition for bcm963268part.\n\n Removed support for the nand partition number field, it's not a\n standard Broadcom field (was added by MitraStar Technology Corp.).\n\n drivers/mtd/bcm63xxpart.c | 196 ++++++++++++++++++++++++++++++++++++++++++++--\n 1 file changed, 190 insertions(+), 6 deletions(-)", "diff": "diff --git a/drivers/mtd/bcm63xxpart.c b/drivers/mtd/bcm63xxpart.c\nindex 26c38a1..4576b78 100644\n--- a/drivers/mtd/bcm63xxpart.c\n+++ b/drivers/mtd/bcm63xxpart.c\n@@ -16,10 +16,9 @@\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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\n- *\n+ * NAND flash layout derived from bcm963xx_4.12L.06B_consumer/bcmdrivers/opensource/char/board/bcm963xx/impl1/board.c,\n+ *\tbcm963xx_4.12L.06B_consumer/shared/opensource/include/bcm963xx/bcm_hwdefs.h:\n+ * Copyright (c) 2002 Broadcom Corporation\n */\n \n #define pr_fmt(fmt) KBUILD_MODNAME \": \" fmt\n@@ -124,6 +123,25 @@ static int bcm63xx_read_image_tag(struct mtd_info *master, const char *name,\n \treturn 1;\n }\n \n+static bool bcm63xx_boot_latest(struct bcm963xx_nvram *nvram)\n+{\n+\tchar *p;\n+\n+\tSTR_NULL_TERMINATE(nvram->bootline);\n+\n+\t/* Find previous image parameter \"p\" */\n+\tif (!strncmp(nvram->bootline, \"p=\", 2))\n+\t\tp = nvram->bootline;\n+\telse\n+\t\tp = strstr(nvram->bootline, \" p=\");\n+\n+\tif (p == NULL)\n+\t\treturn true;\n+\n+\tp += 2;\n+\treturn *p != '0';\n+}\n+\n static int bcm63xx_parse_cfe_nor_partitions(struct mtd_info *master,\n \tconst struct mtd_partition **pparts, struct bcm963xx_nvram *nvram)\n {\n@@ -283,6 +301,171 @@ out:\n \treturn nrparts;\n }\n \n+static bool bcm63xx_parse_nand_image_tag(struct mtd_info *master,\n+\tconst char *name, loff_t tag_offset, u64 *rootfs_offset,\n+\tu64 *rootfs_size, unsigned int *rootfs_sequence)\n+{\n+\tstruct bcm_tag *buf;\n+\tint ret;\n+\tbool rootfs_ok = false;\n+\n+\t*rootfs_offset = 0;\n+\t*rootfs_size = 0;\n+\t*rootfs_sequence = 0;\n+\n+\tbuf = vmalloc(sizeof(struct bcm_tag));\n+\tif (!buf)\n+\t\tgoto out;\n+\n+\tret = bcm63xx_read_image_tag(master, name, tag_offset, buf);\n+\tif (!ret) {\n+\t\t/* Get rootfs offset and size from tag data */\n+\t\tSTR_NULL_TERMINATE(buf->flash_image_start);\n+\t\tif (kstrtou64(buf->flash_image_start, 10, rootfs_offset) ||\n+\t\t\t\t*rootfs_offset < BCM963XX_EXTENDED_SIZE) {\n+\t\t\tpr_err(\"%s: invalid rootfs offset: %*ph\\n\", name,\n+\t\t\t\tsizeof(buf->flash_image_start),\n+\t\t\t\tbuf->flash_image_start);\n+\t\t\tgoto out;\n+\t\t}\n+\n+\t\tSTR_NULL_TERMINATE(buf->root_length);\n+\t\tif (kstrtou64(buf->root_length, 10, rootfs_size) ||\n+\t\t\t\trootfs_size == 0) {\n+\t\t\tpr_err(\"%s: invalid rootfs size: %*ph\\n\", name,\n+\t\t\t\tsizeof(buf->root_length), buf->root_length);\n+\t\t\tgoto out;\n+\t\t}\n+\n+\t\t/* Adjust for flash offset */\n+\t\t*rootfs_offset -= BCM963XX_EXTENDED_SIZE;\n+\n+\t\t/* Remove bcm_tag data from length */\n+\t\t*rootfs_size -= *rootfs_offset - tag_offset;\n+\n+\t\t/* Get image sequence number to determine which one is newer */\n+\t\tSTR_NULL_TERMINATE(buf->image_sequence);\n+\t\tif (kstrtouint(buf->image_sequence, 10, rootfs_sequence)) {\n+\t\t\tpr_err(\"%s: invalid rootfs sequence: %*ph\\n\", name,\n+\t\t\t\tsizeof(buf->image_sequence),\n+\t\t\t\tbuf->image_sequence);\n+\t\t\tgoto out;\n+\t\t}\n+\n+\t\trootfs_ok = true;\n+\t}\n+\n+out:\n+\tvfree(buf);\n+\treturn rootfs_ok;\n+}\n+\n+static int bcm63xx_parse_cfe_nand_partitions(struct mtd_info *master,\n+\tconst struct mtd_partition **pparts,\n+\tstruct bcm963xx_nvram *nvram)\n+{\n+\tint nrparts, i;\n+\tstruct mtd_partition *parts;\n+\tu64 rootfs1_off, rootfs1_size;\n+\tunsigned int rootfs1_seq;\n+\tu64 rootfs2_off, rootfs2_size;\n+\tunsigned int rootfs2_seq;\n+\tbool rootfs1, rootfs2;\n+\tbool use_first;\n+\n+\tif (nvram->version < 6) {\n+\t\tpr_warn(\"nvram version %u not supported\\n\", nvram->version);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/* We've just read the nvram from offset 0,\n+\t * so it must be located there.\n+\t */\n+\tif (BCM963XX_NVRAM_NAND_PART_OFFSET(nvram, BOOT) != 0)\n+\t\treturn -EINVAL;\n+\n+\t/* Get the rootfs partition locations */\n+\trootfs1 = bcm63xx_parse_nand_image_tag(master, \"rootfs1\",\n+\t\tBCM963XX_NVRAM_NAND_PART_OFFSET(nvram, ROOTFS_1),\n+\t\t&rootfs1_off, &rootfs1_size, &rootfs1_seq);\n+\trootfs2 = bcm63xx_parse_nand_image_tag(master, \"rootfs2\",\n+\t\tBCM963XX_NVRAM_NAND_PART_OFFSET(nvram, ROOTFS_2),\n+\t\t&rootfs2_off, &rootfs2_size, &rootfs2_seq);\n+\n+\t/* Determine primary rootfs partition */\n+\tif (rootfs1 && rootfs2) {\n+\t\tbool use_latest = bcm63xx_boot_latest(nvram);\n+\n+\t\t/* Compare sequence numbers */\n+\t\tif (use_latest)\n+\t\t\tuse_first = rootfs1_seq > rootfs2_seq;\n+\t\telse\n+\t\t\tuse_first = rootfs1_seq < rootfs2_seq;\n+\n+\t\tpr_info(\"CFE bootline selected %s image rootfs%u (rootfs1_seq=%u, rootfs2_seq=%u)\\n\",\n+\t\t\tuse_latest ? \"latest\" : \"previous\",\n+\t\t\tuse_first ? 1 : 2,\n+\t\t\trootfs1_seq, rootfs2_seq);\n+\t} else {\n+\t\tuse_first = rootfs1;\n+\t}\n+\n+\t/* Partitions:\n+\t * 1 boot\n+\t * 2 rootfs\n+\t * 3 data\n+\t * 4 rootfs1_update\n+\t * 5 rootfs2_update\n+\t * 6 rootfs_other\n+\t */\n+\tnrparts = 6;\n+\ti = 0;\n+\n+\tparts = kcalloc(nrparts, sizeof(*parts), GFP_KERNEL);\n+\tif (!parts)\n+\t\treturn -ENOMEM;\n+\n+\tparts[i].name = \"boot\";\n+\tparts[i].offset = BCM963XX_NVRAM_NAND_PART_OFFSET(nvram, BOOT);\n+\tparts[i].size = BCM963XX_NVRAM_NAND_PART_SIZE(nvram, BOOT);\n+\ti++;\n+\n+\t/* Primary rootfs if either is available */\n+\tif (rootfs1 || rootfs2) {\n+\t\tparts[i].name = \"rootfs\";\n+\t\tparts[i].offset = use_first ? rootfs1_off : rootfs2_off;\n+\t\tparts[i].size = use_first ? rootfs1_size : rootfs2_size;\n+\t\ti++;\n+\t}\n+\n+\tparts[i].name = \"data\";\n+\tparts[i].offset = BCM963XX_NVRAM_NAND_PART_OFFSET(nvram, DATA);\n+\tparts[i].size = BCM963XX_NVRAM_NAND_PART_SIZE(nvram, DATA);\n+\ti++;\n+\n+\t/* Full rootfs partitions for updates */\n+\tparts[i].name = \"rootfs1_update\";\n+\tparts[i].offset = BCM963XX_NVRAM_NAND_PART_OFFSET(nvram, ROOTFS_1);\n+\tparts[i].size = BCM963XX_NVRAM_NAND_PART_SIZE(nvram, ROOTFS_1);\n+\ti++;\n+\n+\tparts[i].name = \"rootfs2_update\";\n+\tparts[i].offset = BCM963XX_NVRAM_NAND_PART_OFFSET(nvram, ROOTFS_2);\n+\tparts[i].size = BCM963XX_NVRAM_NAND_PART_SIZE(nvram, ROOTFS_2);\n+\ti++;\n+\n+\t/* Other rootfs if both are available */\n+\tif (rootfs1 && rootfs2) {\n+\t\tparts[i].name = \"rootfs_other\";\n+\t\tparts[i].offset = use_first ? rootfs2_off : rootfs1_off;\n+\t\tparts[i].size = use_first ? rootfs2_size : rootfs1_size;\n+\t\ti++;\n+\t}\n+\n+\t*pparts = parts;\n+\treturn nrparts;\n+}\n+\n static int bcm63xx_parse_cfe_partitions(struct mtd_info *master,\n \t\t\t\t\tconst struct mtd_partition **pparts,\n \t\t\t\t\tstruct mtd_part_parser_data *data)\n@@ -304,7 +487,7 @@ static int bcm63xx_parse_cfe_partitions(struct mtd_info *master,\n \tif (!mtd_type_is_nand(master))\n \t\tret = bcm63xx_parse_cfe_nor_partitions(master, pparts, nvram);\n \telse\n-\t\tret = -EINVAL;\n+\t\tret = bcm63xx_parse_cfe_nand_partitions(master, pparts, nvram);\n \n out:\n \tvfree(nvram);\n@@ -321,5 +504,6 @@ MODULE_LICENSE(\"GPL\");\n MODULE_AUTHOR(\"Daniel Dickinson <openwrt@cshore.neomailbox.net>\");\n MODULE_AUTHOR(\"Florian Fainelli <florian@openwrt.org>\");\n MODULE_AUTHOR(\"Mike Albon <malbon@openwrt.org>\");\n-MODULE_AUTHOR(\"Jonas Gorski <jonas.gorski@gmail.com\");\n+MODULE_AUTHOR(\"Jonas Gorski <jonas.gorski@gmail.com>\");\n+MODULE_AUTHOR(\"Simon Arlott\");\n MODULE_DESCRIPTION(\"MTD partitioning for BCM63XX CFE bootloaders\");\n", "prefixes": [ "linux-next", "v4", "11/11" ] }