From patchwork Thu Jul 30 11:52:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Suchanek X-Patchwork-Id: 502123 X-Patchwork-Delegate: boris.brezillon@free-electrons.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3A8821402B2 for ; Thu, 30 Jul 2015 21:54:25 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZKmO2-0007qQ-Ac; Thu, 30 Jul 2015 11:52:34 +0000 Received: from dec59.ruk.cuni.cz ([2001:718:1e03:4::11]) by bombadil.infradead.org with smtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZKmNz-0007mt-NQ for linux-mtd@lists.infradead.org; Thu, 30 Jul 2015 11:52:32 +0000 Received: (qmail 27363 invoked by uid 2313); 30 Jul 2015 11:52:00 -0000 Date: 30 Jul 2015 11:52:00 -0000 MBOX-Line: From 7db2069b03cd249eed3d76a74bd1bfc83f2290be Mon Sep 17 00:00:00 2001 In-Reply-To: References: <1438192434-18363-1-git-send-email-hdegoede@redhat.com> <1438192434-18363-4-git-send-email-hdegoede@redhat.com> <20150730091730.1774291d@bbrezillon> Message-Id: <7db2069b03cd249eed3d76a74bd1bfc83f2290be.1438255877.git.hramrach@gmail.com> From: Michal Suchanek Subject: [PATCH v2] mtd: nand: print full chip ID To: Boris Brezillon , Hans de Goede , David Woodhouse , Brian Norris , MTD Maling List , linux-sunxi X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150730_045232_119851_9FD3FF3A X-CRM114-Status: UNSURE ( 8.38 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -4.5 (----) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-4.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [2001:718:1e03:4:0:0:0:11 listed in] [list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -1.4 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (hramrach[at]gmail.com) 0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 DKIM_ADSP_CUSTOM_MED No valid author signature, adsp_override is CUSTOM_MED -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different 0.9 NML_ADSP_CUSTOM_MED ADSP custom_med hit, and not from a mailing list X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Full chip ID is printed so user has data to paste from syslog in case of chip misidentification. Signed-off-by: Michal Suchanek --- v2: - remove superfluous hunk - join printed lines --- drivers/mtd/nand/nand_base.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index ceb68ca..7c10e06 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -3631,6 +3631,22 @@ static bool find_full_id_nand(struct mtd_info *mtd, struct nand_chip *chip, } /* + * Print full detail of chip ID read from chip. + */ +static void nand_print_chip_info(int maf_id, int dev_id, u8 id_data[8]) +{ + u8 delim[8] = { [0 ... 7] = ',' }; + + /* Kernel inserts newline after every other printk so format in one go. */ + delim[7] = ' '; + delim[nand_id_len(id_data, 8) - 1] = ';'; + pr_info("device found, Manufacturer ID: 0x%02x, Chip ID: 0x%02x, ID data: 0x%02x%c 0x%02x%c 0x%02x%c 0x%02x%c 0x%02x%c 0x%02x%c 0x%02x%c 0x%02x%c\n", + maf_id, dev_id, + id_data[0], delim[0], id_data[1], delim[1], id_data[2], delim[2], id_data[3], delim[3], + id_data[4], delim[4], id_data[5], delim[5], id_data[6], delim[6], id_data[7], delim[7]); +} + +/* * Get the flash and manufacturer id and lookup if the type is supported. */ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, @@ -3743,8 +3759,7 @@ ident_done: * Check, if buswidth is correct. Hardware drivers should set * chip correct! */ - pr_info("device found, Manufacturer ID: 0x%02x, Chip ID: 0x%02x\n", - *maf_id, *dev_id); + nand_print_chip_info(*maf_id, *dev_id, id_data); pr_info("%s %s\n", nand_manuf_ids[maf_idx].name, mtd->name); pr_warn("bus width %d instead %d bit\n", (chip->options & NAND_BUSWIDTH_16) ? 16 : 8, @@ -3775,8 +3790,7 @@ ident_done: if (mtd->writesize > 512 && chip->cmdfunc == nand_command) chip->cmdfunc = nand_command_lp; - pr_info("device found, Manufacturer ID: 0x%02x, Chip ID: 0x%02x\n", - *maf_id, *dev_id); + nand_print_chip_info(*maf_id, *dev_id, id_data); if (chip->onfi_version) pr_info("%s %s\n", nand_manuf_ids[maf_idx].name,