diff options
author | Zoltan Herpai <wigyori@uid0.hu> | 2015-08-09 12:25:18 +0000 |
---|---|---|
committer | Zoltan Herpai <wigyori@uid0.hu> | 2015-08-09 12:25:18 +0000 |
commit | 50018a752771efce3ae222457d4d231d1f80a1a5 (patch) | |
tree | ced2b9c1e216ce0e3d0bb204e359a7a9d6d2a3ef /target/linux/sunxi/patches-4.1/121-mtd-print-full-chipid.patch | |
parent | 0b8643af4fa7eebd55b63d6d547f85da1409f83d (diff) | |
download | upstream-50018a752771efce3ae222457d4d231d1f80a1a5.tar.gz upstream-50018a752771efce3ae222457d4d231d1f80a1a5.tar.bz2 upstream-50018a752771efce3ae222457d4d231d1f80a1a5.zip |
sunxi: add support for 4.1
Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu>
SVN-Revision: 46571
Diffstat (limited to 'target/linux/sunxi/patches-4.1/121-mtd-print-full-chipid.patch')
-rw-r--r-- | target/linux/sunxi/patches-4.1/121-mtd-print-full-chipid.patch | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/target/linux/sunxi/patches-4.1/121-mtd-print-full-chipid.patch b/target/linux/sunxi/patches-4.1/121-mtd-print-full-chipid.patch new file mode 100644 index 0000000000..6894cc5a92 --- /dev/null +++ b/target/linux/sunxi/patches-4.1/121-mtd-print-full-chipid.patch @@ -0,0 +1,69 @@ +From fb177d5b534f263735dc6955703e3c711b950f35 Mon Sep 17 00:00:00 2001 +From: Michal Suchanek <hramrach@gmail.com> +Date: Thu, 1 Jan 2015 00:57:46 +0100 +Subject: [PATCH] mtd: nand: print full chip ID + +Full chip ID is printed so user has data to paste from syslog in case +of chip misidentification. + +Signed-off-by: Michal Suchanek <hramrach@gmail.com> +Signed-off-by: Hans de Goede <hdegoede@redhat.com> +--- + drivers/mtd/nand/nand_base.c | 23 ++++++++++++++++++----- + 1 file changed, 18 insertions(+), 5 deletions(-) + +diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c +index 5c6f465..05ec786 100644 +--- a/drivers/mtd/nand/nand_base.c ++++ b/drivers/mtd/nand/nand_base.c +@@ -4247,7 +4247,7 @@ static inline bool is_full_id_nand(struct nand_flash_dev *type) + } + + static bool find_full_id_nand(struct mtd_info *mtd, struct nand_chip *chip, +- struct nand_flash_dev *type, u8 *id_data, int *busw) ++ struct nand_flash_dev *type, const u8 *id_data, int *busw) + { + if (!strncmp(type->id, id_data, type->id_len)) { + mtd->writesize = type->pagesize; +@@ -4273,6 +4273,21 @@ 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 print_nand_chip_info(int maf_id, int dev_id, u8 id_data[8]) ++{ ++ u8 delim[8] = { [0 ... 7] = ',' }; ++ pr_info("device found, Manufacturer ID: 0x%02x, Chip ID: 0x%02x\n", maf_id, dev_id); ++ delim[7] = ' '; ++ delim[nand_id_len(id_data, 8) - 1] = ';'; ++ /* This sucks. Kernel seems to insert newline after every other printk so format in one go. */ ++ pr_info("chip 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", ++ 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, +@@ -4385,8 +4400,7 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, + * 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); ++ print_nand_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, +@@ -4424,8 +4438,7 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, + return ERR_PTR(err); + } + +- pr_info("device found, Manufacturer ID: 0x%02x, Chip ID: 0x%02x\n", +- *maf_id, *dev_id); ++ print_nand_chip_info(*maf_id, *dev_id, id_data); + + if (chip->onfi_version) + pr_info("%s %s\n", nand_manuf_ids[maf_idx].name, |