linux/drivers/mtd/nand/raw/nand_hynix.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Copyright (C) 2017 Free Electrons
 * Copyright (C) 2017 NextThing Co
 *
 * Author: Boris Brezillon <[email protected]>
 */

#include <linux/sizes.h>
#include <linux/slab.h>

#include "internals.h"

#define NAND_HYNIX_CMD_SET_PARAMS
#define NAND_HYNIX_CMD_APPLY_PARAMS

#define NAND_HYNIX_1XNM_RR_REPEAT

/**
 * struct hynix_read_retry - read-retry data
 * @nregs: number of register to set when applying a new read-retry mode
 * @regs: register offsets (NAND chip dependent)
 * @values: array of values to set in registers. The array size is equal to
 *	    (nregs * nmodes)
 */
struct hynix_read_retry {};

/**
 * struct hynix_nand - private Hynix NAND struct
 * @read_retry: read-retry information
 */
struct hynix_nand {};

/**
 * struct hynix_read_retry_otp - structure describing how the read-retry OTP
 *				 area
 * @nregs: number of hynix private registers to set before reading the reading
 *	   the OTP area
 * @regs: registers that should be configured
 * @values: values that should be set in regs
 * @page: the address to pass to the READ_PAGE command. Depends on the NAND
 *	  chip
 * @size: size of the read-retry OTP section
 */
struct hynix_read_retry_otp {};

static bool hynix_nand_has_valid_jedecid(struct nand_chip *chip)
{}

static int hynix_nand_cmd_op(struct nand_chip *chip, u8 cmd)
{}

static int hynix_nand_reg_write_op(struct nand_chip *chip, u8 addr, u8 val)
{}

static int hynix_nand_setup_read_retry(struct nand_chip *chip, int retry_mode)
{}

/**
 * hynix_get_majority - get the value that is occurring the most in a given
 *			set of values
 * @in: the array of values to test
 * @repeat: the size of the in array
 * @out: pointer used to store the output value
 *
 * This function implements the 'majority check' logic that is supposed to
 * overcome the unreliability of MLC NANDs when reading the OTP area storing
 * the read-retry parameters.
 *
 * It's based on a pretty simple assumption: if we repeat the same value
 * several times and then take the one that is occurring the most, we should
 * find the correct value.
 * Let's hope this dummy algorithm prevents us from losing the read-retry
 * parameters.
 */
static int hynix_get_majority(const u8 *in, int repeat, u8 *out)
{}

static int hynix_read_rr_otp(struct nand_chip *chip,
			     const struct hynix_read_retry_otp *info,
			     void *buf)
{}

#define NAND_HYNIX_1XNM_RR_COUNT_OFFS
#define NAND_HYNIX_1XNM_RR_REG_COUNT_OFFS
#define NAND_HYNIX_1XNM_RR_SET_OFFS(x, setsize, inv)

static int hynix_mlc_1xnm_rr_value(const u8 *buf, int nmodes, int nregs,
				   int mode, int reg, bool inv, u8 *val)
{}

static u8 hynix_1xnm_mlc_read_retry_regs[] =;

static int hynix_mlc_1xnm_rr_init(struct nand_chip *chip,
				  const struct hynix_read_retry_otp *info)
{}

static const u8 hynix_mlc_1xnm_rr_otp_regs[] =;
static const u8 hynix_mlc_1xnm_rr_otp_values[] =;

static const struct hynix_read_retry_otp hynix_mlc_1xnm_rr_otps[] =;

static int hynix_nand_rr_init(struct nand_chip *chip)
{}

static void hynix_nand_extract_oobsize(struct nand_chip *chip,
				       bool valid_jedecid)
{}

static void hynix_nand_extract_ecc_requirements(struct nand_chip *chip,
						bool valid_jedecid)
{}

static void hynix_nand_extract_scrambling_requirements(struct nand_chip *chip,
						       bool valid_jedecid)
{}

static void hynix_nand_decode_id(struct nand_chip *chip)
{}

static void hynix_nand_cleanup(struct nand_chip *chip)
{}

static int
h27ucg8t2atrbc_choose_interface_config(struct nand_chip *chip,
				       struct nand_interface_config *iface)
{}

static int h27ucg8t2etrbc_init(struct nand_chip *chip)
{}

static int hynix_nand_init(struct nand_chip *chip)
{}

static void hynix_fixup_onfi_param_page(struct nand_chip *chip,
					struct nand_onfi_params *p)
{}

const struct nand_manufacturer_ops hynix_nand_manuf_ops =;