// SPDX-License-Identifier: GPL-2.0-only /* * Copyright (C) 2014 Free Electrons * * Author: Boris BREZILLON <[email protected]> */ #include <linux/kernel.h> #include <linux/err.h> #include <linux/export.h> #include "internals.h" #define ONFI_DYN_TIMING_MAX … /* * For non-ONFI chips we use the highest possible value for tPROG and tBERS. * tR and tCCS will take the default values precised in the ONFI specification * for timing mode 0, respectively 200us and 500ns. * * These four values are tweaked to be more accurate in the case of ONFI chips. */ static const struct nand_interface_config onfi_sdr_timings[] = …; static const struct nand_interface_config onfi_nvddr_timings[] = …; /* All NAND chips share the same reset data interface: SDR mode 0 */ const struct nand_interface_config *nand_get_reset_interface_config(void) { … } /** * onfi_find_closest_sdr_mode - Derive the closest ONFI SDR timing mode given a * set of timings * @spec_timings: the timings to challenge */ unsigned int onfi_find_closest_sdr_mode(const struct nand_sdr_timings *spec_timings) { … } /** * onfi_find_closest_nvddr_mode - Derive the closest ONFI NVDDR timing mode * given a set of timings * @spec_timings: the timings to challenge */ unsigned int onfi_find_closest_nvddr_mode(const struct nand_nvddr_timings *spec_timings) { … } /* * onfi_fill_sdr_interface_config - Initialize a SDR interface config from a * given ONFI mode * @chip: The NAND chip * @iface: The interface configuration to fill * @timing_mode: The ONFI timing mode */ static void onfi_fill_sdr_interface_config(struct nand_chip *chip, struct nand_interface_config *iface, unsigned int timing_mode) { … } /** * onfi_fill_nvddr_interface_config - Initialize a NVDDR interface config from a * given ONFI mode * @chip: The NAND chip * @iface: The interface configuration to fill * @timing_mode: The ONFI timing mode */ static void onfi_fill_nvddr_interface_config(struct nand_chip *chip, struct nand_interface_config *iface, unsigned int timing_mode) { … } /** * onfi_fill_interface_config - Initialize an interface config from a given * ONFI mode * @chip: The NAND chip * @iface: The interface configuration to fill * @type: The interface type * @timing_mode: The ONFI timing mode */ void onfi_fill_interface_config(struct nand_chip *chip, struct nand_interface_config *iface, enum nand_interface_type type, unsigned int timing_mode) { … }