From 09a7e4cac36ac5348f95eb928dd0192355955556 Mon Sep 17 00:00:00 2001 From: Han Xu Date: Fri, 9 Oct 2015 10:18:20 -0500 Subject: [PATCH] MLK-11719-2: mtd: gpmi: save the bch layout setting in debugfs save the bch layout setting in debugfs for the upper layer applications, such as kobs-ng. Signed-off-by: Han Xu (cherry picked from commit 8a373e796c21f4e9b714039e5f0b7d9388ef5a32) --- drivers/mtd/nand/gpmi-nand/gpmi-lib.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c index 016758b87948..1fac1303d1ef 100644 --- a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c +++ b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c @@ -22,12 +22,16 @@ #include #include #include +#include #include "gpmi-nand.h" #include "gpmi-regs.h" #include "bch-regs.h" +/* export the bch geometry to dbgfs */ +static struct debugfs_blob_wrapper dbg_bch_geo; + static struct timing_threshod timing_default_threshold = { .max_data_setup_cycles = (BM_GPMI_TIMING0_DATA_SETUP >> BP_GPMI_TIMING0_DATA_SETUP), @@ -260,6 +264,7 @@ int bch_set_geometry(struct gpmi_nand_data *this) unsigned int page_size; unsigned int gf_len; int ret; + struct dentry *dbg_root; if (common_nfc_set_geometry(this)) return !0; @@ -271,6 +276,20 @@ int bch_set_geometry(struct gpmi_nand_data *this) page_size = bch_geo->page_size; gf_len = bch_geo->gf_len; + dbg_root = debugfs_create_dir("gpmi-nand", NULL); + if (!dbg_root) { + dev_err(this->dev, "failed to create debug directory\n"); + return -EINVAL; + } + + dbg_bch_geo.data = (void *)bch_geo; + dbg_bch_geo.size = sizeof(struct bch_geometry); + if (!debugfs_create_blob("bch_geometry", S_IRUGO, + dbg_root, &dbg_bch_geo)) { + dev_err(this->dev, "failed to create debug bch geometry\n"); + return -EINVAL; + } + ret = pm_runtime_get_sync(this->dev); if (ret < 0) { dev_err(this->dev, "Failed to enable clock\n"); -- 2.17.1