diff options
author | Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> | 2015-11-20 20:35:54 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-11-23 08:00:09 +0100 |
commit | 7cde58cc9d435d4a3eac844c7a2662bd5a725c92 (patch) | |
tree | 81d51e16503d5246a427dbebbe7f30b2478c1263 /drivers/of | |
parent | b9170a1bde192c691f15c4474ed2f1e7bfebbb41 (diff) | |
download | barebox-7cde58cc9d435d4a3eac844c7a2662bd5a725c92.tar.gz barebox-7cde58cc9d435d4a3eac844c7a2662bd5a725c92.tar.xz |
of: mtd: Import of_get_nand_ecc_{step_size, strength} from Linux
This imports DT helpers for MTD ECC step size and strength from
Linux kernel.
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/of')
-rw-r--r-- | drivers/of/of_mtd.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/of/of_mtd.c b/drivers/of/of_mtd.c index 97f3095740..0956ee15d3 100644 --- a/drivers/of/of_mtd.c +++ b/drivers/of/of_mtd.c @@ -49,6 +49,40 @@ int of_get_nand_ecc_mode(struct device_node *np) EXPORT_SYMBOL_GPL(of_get_nand_ecc_mode); /** + * of_get_nand_ecc_step_size - Get ECC step size associated to + * the required ECC strength (see below). + * @np: Pointer to the given device_node + * + * return the ECC step size, or errno in error case. + */ +int of_get_nand_ecc_step_size(struct device_node *np) +{ + int ret; + u32 val; + + ret = of_property_read_u32(np, "nand-ecc-step-size", &val); + return ret ? ret : val; +} +EXPORT_SYMBOL_GPL(of_get_nand_ecc_step_size); + +/** + * of_get_nand_ecc_strength - Get required ECC strength over the + * correspnding step size as defined by 'nand-ecc-size' + * @np: Pointer to the given device_node + * + * return the ECC strength, or errno in error case. + */ +int of_get_nand_ecc_strength(struct device_node *np) +{ + int ret; + u32 val; + + ret = of_property_read_u32(np, "nand-ecc-strength", &val); + return ret ? ret : val; +} +EXPORT_SYMBOL_GPL(of_get_nand_ecc_strength); + +/** * of_get_nand_bus_width - Get nand bus witdh for given device_node * @np: Pointer to the given device_node * |