diff options
author | Han Xu <b45815@freescale.com> | 2015-10-09 10:18:20 -0500 |
---|---|---|
committer | Han Xu <b45815@freescale.com> | 2015-10-15 12:03:49 -0500 |
commit | 8a373e796c21f4e9b714039e5f0b7d9388ef5a32 (patch) | |
tree | af612f3c0231576d6b7a4360cfded45e90b76860 /drivers | |
parent | a4a31e73897b51b73b1be994d36759584407914f (diff) |
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 <b45815@freescale.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mtd/nand/gpmi-nand/gpmi-lib.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c index 9fa6ec49fa83..9cc79da9d234 100644 --- a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c +++ b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c @@ -22,12 +22,16 @@ #include <linux/clk.h> #include <linux/slab.h> #include <linux/pm_runtime.h> +#include <linux/debugfs.h> #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), @@ -261,6 +265,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; @@ -272,6 +277,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"); |