Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/949189/?format=api
{ "id": 949189, "url": "http://patchwork.ozlabs.org/api/1.2/patches/949189/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-mtd/patch/20180725133152.30898-7-miquel.raynal@bootlin.com/", "project": { "id": 3, "url": "http://patchwork.ozlabs.org/api/1.2/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": "<20180725133152.30898-7-miquel.raynal@bootlin.com>", "list_archive_url": null, "date": "2018-07-25T13:31:41", "name": "[v5,06/17] mtd: rawnand: atmel: convert driver to nand_scan()", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "34fa9cf87d40280982f4da5f0bb87b27d0ce3eba", "submitter": { "id": 73368, "url": "http://patchwork.ozlabs.org/api/1.2/people/73368/?format=api", "name": "Miquel Raynal", "email": "miquel.raynal@bootlin.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-mtd/patch/20180725133152.30898-7-miquel.raynal@bootlin.com/mbox/", "series": [ { "id": 57526, "url": "http://patchwork.ozlabs.org/api/1.2/series/57526/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-mtd/list/?series=57526", "date": "2018-07-25T13:31:36", "name": "Allow dynamic allocations during NAND chip identification phase", "version": 5, "mbox": "http://patchwork.ozlabs.org/series/57526/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/949189/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/949189/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", "Authentication-Results": [ "ozlabs.org; spf=none (mailfrom)\n\tsmtp.mailfrom=lists.infradead.org\n\t(client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org;\n\tenvelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org;\n\tdmarc=none (p=none dis=none) header.from=bootlin.com", "ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"P+c4n4o1\"; \n\tdkim-atps=neutral" ], "Received": [ "from bombadil.infradead.org (bombadil.infradead.org\n\t[IPv6:2607:7c80:54:e::133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 41bGRK5s8Lz9s3N\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 25 Jul 2018 23:34:21 +1000 (AEST)", "from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux))\n\tid 1fiJvi-0002oq-8M; Wed, 25 Jul 2018 13:34:14 +0000", "from mail.bootlin.com ([62.4.15.54])\n\tby bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux))\n\tid 1fiJu4-0000Ke-Tp\n\tfor linux-mtd@lists.infradead.org; Wed, 25 Jul 2018 13:32:47 +0000", "by mail.bootlin.com (Postfix, from userid 110)\n\tid 0A21F20994; Wed, 25 Jul 2018 15:32:17 +0200 (CEST)", "from localhost.localdomain\n\t(AAubervilliers-681-1-78-122.w90-88.abo.wanadoo.fr [90.88.20.122])\n\tby mail.bootlin.com (Postfix) with ESMTPSA id 1DDDD20876;\n\tWed, 25 Jul 2018 15:31:58 +0200 (CEST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe:\n\tList-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References:\n\tIn-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID:\n\tContent-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc\n\t:Resent-Message-ID:List-Owner;\n\tbh=D7jZ//4wIo0mtBhziamQh/6wVUGmNOQBFl2wdAmnSIc=;\n\tb=P+c4n4o1Q6Qu37tBU+AG2Cj1s5\n\tVepBqhD4LwY2Gm700DL+f5IZ5lYRZbD+hYL3tlAD14gFcvfNoc5MYwWd/LEzgP0InhxqISA6NirUQ\n\tKO7BBKeLtA+wbPVppopwuY0+ePdzShAJU+DwP2nCJIcUozB0bfrcMyubYSiHw7QNsk6My4JNfmlaK\n\tYT04pGgxPDItgSp37hfKdzD0cBrUkTrR/kF+LcoppZUuGOkH3Uz648WR+yLEY5XIPM7kQjn6xg+HT\n\tCl/UGLgypljpYe0cdfDO0srn6mxU3XBof83dHgV5g/s7g73JxeabzZqaRjqH8/M8y9Glz17JfmjEh\n\ttKliPy9A==;", "X-Spam-Checker-Version": "SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com", "X-Spam-Level": "", "X-Spam-Status": "No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT,\n\tURIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0", "From": "Miquel Raynal <miquel.raynal@bootlin.com>", "To": "Boris Brezillon <boris.brezillon@bootlin.com>,\n\tRichard Weinberger <richard@nod.at>,\n\tDavid Woodhouse <dwmw2@infradead.org>, \n\tBrian Norris <computersforpeace@gmail.com>,\n\tMarek Vasut <marek.vasut@gmail.com>", "Subject": "[PATCH v5 06/17] mtd: rawnand: atmel: convert driver to nand_scan()", "Date": "Wed, 25 Jul 2018 15:31:41 +0200", "Message-Id": "<20180725133152.30898-7-miquel.raynal@bootlin.com>", "X-Mailer": "git-send-email 2.14.1", "In-Reply-To": "<20180725133152.30898-1-miquel.raynal@bootlin.com>", "References": "<20180725133152.30898-1-miquel.raynal@bootlin.com>", "X-CRM114-Version": "20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ", "X-CRM114-CacheID": "sfid-20180725_063233_507750_A1528A57 ", "X-CRM114-Status": "GOOD ( 21.71 )", "X-Spam-Score": "-0.0 (/)", "X-Spam-Report": "SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details: (-0.0 points)\n\tpts rule name description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/,\n\tno trust [62.4.15.54 listed in list.dnswl.org]\n\t-0.0 SPF_PASS SPF: sender matches SPF record", "X-BeenThere": "linux-mtd@lists.infradead.org", "X-Mailman-Version": "2.1.21", "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": "Lucas Stach <dev@lynxeye.de>, Wenyou Yang <wenyou.yang@microchip.com>,\n\tJosh Wu <rainyfeeling@outlook.com>, Stefan Agner <stefan@agner.ch>,\n\tlinux-mtd@lists.infradead.org, Miquel Raynal <miquel.raynal@bootlin.com>", "MIME-Version": "1.0", "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": "Two helpers have been added to the core to do all kind of controller\nside configuration/initialization between the detection phase and the\nfinal NAND scan. Implement these hooks so that we can convert the driver\nto just use nand_scan() instead of the nand_scan_ident() +\nnand_scan_tail() pair.\n\nSigned-off-by: Miquel Raynal <miquel.raynal@bootlin.com>\n---\n drivers/mtd/nand/raw/atmel/nand-controller.c | 113 +++++++++++++--------------\n 1 file changed, 54 insertions(+), 59 deletions(-)", "diff": "diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c\nindex 143d029710f0..a068b214ebaa 100644\n--- a/drivers/mtd/nand/raw/atmel/nand-controller.c\n+++ b/drivers/mtd/nand/raw/atmel/nand-controller.c\n@@ -201,7 +201,7 @@ struct atmel_nand_controller_ops {\n \tint (*remove)(struct atmel_nand_controller *nc);\n \tvoid (*nand_init)(struct atmel_nand_controller *nc,\n \t\t\t struct atmel_nand *nand);\n-\tint (*ecc_init)(struct atmel_nand *nand);\n+\tint (*ecc_init)(struct nand_chip *chip);\n \tint (*setup_data_interface)(struct atmel_nand *nand, int csline,\n \t\t\t\t const struct nand_data_interface *conf);\n };\n@@ -1132,9 +1132,8 @@ static int atmel_nand_pmecc_init(struct nand_chip *chip)\n \treturn 0;\n }\n \n-static int atmel_nand_ecc_init(struct atmel_nand *nand)\n+static int atmel_nand_ecc_init(struct nand_chip *chip)\n {\n-\tstruct nand_chip *chip = &nand->base;\n \tstruct atmel_nand_controller *nc;\n \tint ret;\n \n@@ -1169,12 +1168,11 @@ static int atmel_nand_ecc_init(struct atmel_nand *nand)\n \treturn 0;\n }\n \n-static int atmel_hsmc_nand_ecc_init(struct atmel_nand *nand)\n+static int atmel_hsmc_nand_ecc_init(struct nand_chip *chip)\n {\n-\tstruct nand_chip *chip = &nand->base;\n \tint ret;\n \n-\tret = atmel_nand_ecc_init(nand);\n+\tret = atmel_nand_ecc_init(chip);\n \tif (ret)\n \t\treturn ret;\n \n@@ -1557,22 +1555,6 @@ static void atmel_hsmc_nand_init(struct atmel_nand_controller *nc,\n \tchip->select_chip = atmel_hsmc_nand_select_chip;\n }\n \n-static int atmel_nand_detect(struct atmel_nand *nand)\n-{\n-\tstruct nand_chip *chip = &nand->base;\n-\tstruct mtd_info *mtd = nand_to_mtd(chip);\n-\tstruct atmel_nand_controller *nc;\n-\tint ret;\n-\n-\tnc = to_nand_controller(chip->controller);\n-\n-\tret = nand_scan_ident(mtd, nand->numcs, NULL);\n-\tif (ret)\n-\t\tdev_err(nc->dev, \"nand_scan_ident() failed: %d\\n\", ret);\n-\n-\treturn ret;\n-}\n-\n static int atmel_nand_controller_remove_nand(struct atmel_nand *nand)\n {\n \tstruct nand_chip *chip = &nand->base;\n@@ -1700,6 +1682,8 @@ static int\n atmel_nand_controller_add_nand(struct atmel_nand_controller *nc,\n \t\t\t struct atmel_nand *nand)\n {\n+\tstruct nand_chip *chip = &nand->base;\n+\tstruct mtd_info *mtd = nand_to_mtd(chip);\n \tint ret;\n \n \t/* No card inserted, skip this NAND. */\n@@ -1710,44 +1694,9 @@ atmel_nand_controller_add_nand(struct atmel_nand_controller *nc,\n \n \tnc->caps->ops->nand_init(nc, nand);\n \n-\tret = atmel_nand_detect(nand);\n-\tif (ret)\n-\t\treturn ret;\n-\n-\tret = nc->caps->ops->ecc_init(nand);\n-\tif (ret)\n-\t\treturn ret;\n-\n-\tif (nc->caps->legacy_of_bindings || !nc->dev->of_node) {\n-\t\t/*\n-\t\t * We keep the MTD name unchanged to avoid breaking platforms\n-\t\t * where the MTD cmdline parser is used and the bootloader\n-\t\t * has not been updated to use the new naming scheme.\n-\t\t */\n-\t\tmtd->name = \"atmel_nand\";\n-\t} else if (!mtd->name) {\n-\t\t/*\n-\t\t * If the new bindings are used and the bootloader has not been\n-\t\t * updated to pass a new mtdparts parameter on the cmdline, you\n-\t\t * should define the following property in your nand node:\n-\t\t *\n-\t\t *\tlabel = \"atmel_nand\";\n-\t\t *\n-\t\t * This way, mtd->name will be set by the core when\n-\t\t * nand_set_flash_node() is called.\n-\t\t */\n-\t\tmtd->name = devm_kasprintf(nc->dev, GFP_KERNEL,\n-\t\t\t\t\t \"%s:nand.%d\", dev_name(nc->dev),\n-\t\t\t\t\t nand->cs[0].id);\n-\t\tif (!mtd->name) {\n-\t\t\tdev_err(nc->dev, \"Failed to allocate mtd->name\\n\");\n-\t\t\treturn -ENOMEM;\n-\t\t}\n-\t}\n-\n-\tret = nand_scan_tail(mtd);\n+\tret = nand_scan(mtd, nand->numcs);\n \tif (ret) {\n-\t\tdev_err(nc->dev, \"nand_scan_tail() failed: %d\\n\", ret);\n+\t\tdev_err(nc->dev, \"NAND scan failed: %d\\n\", ret);\n \t\treturn ret;\n \t}\n \n@@ -1945,6 +1894,51 @@ static const struct of_device_id atmel_matrix_of_ids[] = {\n \t{ /* sentinel */ },\n };\n \n+static int atmel_nand_attach_chip(struct nand_chip *chip)\n+{\n+\tstruct atmel_nand_controller *nc = to_nand_controller(chip->controller);\n+\tstruct atmel_nand *nand = to_atmel_nand(chip);\n+\tstruct mtd_info *mtd = nand_to_mtd(chip);\n+\tint ret;\n+\n+\tret = nc->caps->ops->ecc_init(chip);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tif (nc->caps->legacy_of_bindings || !nc->dev->of_node) {\n+\t\t/*\n+\t\t * We keep the MTD name unchanged to avoid breaking platforms\n+\t\t * where the MTD cmdline parser is used and the bootloader\n+\t\t * has not been updated to use the new naming scheme.\n+\t\t */\n+\t\tmtd->name = \"atmel_nand\";\n+\t} else if (!mtd->name) {\n+\t\t/*\n+\t\t * If the new bindings are used and the bootloader has not been\n+\t\t * updated to pass a new mtdparts parameter on the cmdline, you\n+\t\t * should define the following property in your nand node:\n+\t\t *\n+\t\t *\tlabel = \"atmel_nand\";\n+\t\t *\n+\t\t * This way, mtd->name will be set by the core when\n+\t\t * nand_set_flash_node() is called.\n+\t\t */\n+\t\tmtd->name = devm_kasprintf(nc->dev, GFP_KERNEL,\n+\t\t\t\t\t \"%s:nand.%d\", dev_name(nc->dev),\n+\t\t\t\t\t nand->cs[0].id);\n+\t\tif (!mtd->name) {\n+\t\t\tdev_err(nc->dev, \"Failed to allocate mtd->name\\n\");\n+\t\t\treturn -ENOMEM;\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static const struct nand_controller_ops atmel_nand_controller_ops = {\n+\t.attach_chip = atmel_nand_attach_chip,\n+};\n+\n static int atmel_nand_controller_init(struct atmel_nand_controller *nc,\n \t\t\t\tstruct platform_device *pdev,\n \t\t\t\tconst struct atmel_nand_controller_caps *caps)\n@@ -1954,6 +1948,7 @@ static int atmel_nand_controller_init(struct atmel_nand_controller *nc,\n \tint ret;\n \n \tnand_controller_init(&nc->base);\n+\tnc->base.ops = &atmel_nand_controller_ops;\n \tINIT_LIST_HEAD(&nc->chips);\n \tnc->dev = dev;\n \tnc->caps = caps;\n", "prefixes": [ "v5", "06/17" ] }