summaryrefslogtreecommitdiff
path: root/drivers/mtd
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2020-05-29 13:13:16 +0200
committerMiquel Raynal <miquel.raynal@bootlin.com>2020-06-26 08:35:07 +0200
commit26d014f0400e5ff54cc80c8329e3adbd74db1e04 (patch)
tree72a25c6e2f25c1b9658cdec6903cb4abe5af746b /drivers/mtd
parentb5b39f640c1f5621ed4ff6418e74ee35ff5d988e (diff)
mtd: rawnand: Add the ->choose_interface_config() hook
This hook can be overloaded by NAND manufacturer drivers to propose alternative timings when not following the main standards. In this case, the manufacturer drivers is responsible for choosing the best interface configuration that fits both the controller and chip capabilities. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Link: https://lore.kernel.org/linux-mtd/20200529111322.7184-23-miquel.raynal@bootlin.com
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/raw/nand_base.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index 742d099df5c6..2f4eba1a1082 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -1066,18 +1066,23 @@ int nand_choose_best_sdr_timings(struct nand_chip *chip,
* @chip: The NAND chip
*
* Find the best data interface and NAND timings supported by the chip
- * and the driver.
- * First tries to retrieve supported timing modes from ONFI information,
- * and if the NAND chip does not support ONFI, relies on the
- * ->onfi_timing_mode_default specified in the nand_ids table. After this
- * function nand_chip->interface_ is initialized with the best timing mode
- * available.
+ * and the driver. Eventually let the NAND manufacturer driver propose his own
+ * set of timings.
+ *
+ * After this function nand_chip->interface_config is initialized with the best
+ * timing mode available.
+ *
+ * Returns 0 for success or negative error code otherwise.
*/
static int nand_choose_interface_config(struct nand_chip *chip)
{
if (!nand_controller_can_setup_interface(chip))
return 0;
+ if (chip->ops.choose_interface_config)
+ return chip->ops.choose_interface_config(chip,
+ &chip->interface_config);
+
return nand_choose_best_sdr_timings(chip, &chip->interface_config,
NULL);
}