162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (c) 2004 Simtec Electronics
462306a36Sopenharmony_ci *	Ben Dooks <ben@simtec.co.uk>
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * S3C2410 - NAND device controller platform_device info
762306a36Sopenharmony_ci*/
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#ifndef __MTD_NAND_S3C2410_H
1062306a36Sopenharmony_ci#define __MTD_NAND_S3C2410_H
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#include <linux/mtd/rawnand.h>
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci/**
1562306a36Sopenharmony_ci * struct s3c2410_nand_set - define a set of one or more nand chips
1662306a36Sopenharmony_ci * @flash_bbt: 		Openmoko u-boot can create a Bad Block Table
1762306a36Sopenharmony_ci *			Setting this flag will allow the kernel to
1862306a36Sopenharmony_ci *			look for it at boot time and also skip the NAND
1962306a36Sopenharmony_ci *			scan.
2062306a36Sopenharmony_ci * @options:		Default value to set into 'struct nand_chip' options.
2162306a36Sopenharmony_ci * @nr_chips:		Number of chips in this set
2262306a36Sopenharmony_ci * @nr_partitions:	Number of partitions pointed to by @partitions
2362306a36Sopenharmony_ci * @name:		Name of set (optional)
2462306a36Sopenharmony_ci * @nr_map:		Map for low-layer logical to physical chip numbers (option)
2562306a36Sopenharmony_ci * @partitions:		The mtd partition list
2662306a36Sopenharmony_ci *
2762306a36Sopenharmony_ci * define a set of one or more nand chips registered with an unique mtd. Also
2862306a36Sopenharmony_ci * allows to pass flag to the underlying NAND layer. 'disable_ecc' will trigger
2962306a36Sopenharmony_ci * a warning at boot time.
3062306a36Sopenharmony_ci */
3162306a36Sopenharmony_cistruct s3c2410_nand_set {
3262306a36Sopenharmony_ci	unsigned int		flash_bbt:1;
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci	unsigned int		options;
3562306a36Sopenharmony_ci	int			nr_chips;
3662306a36Sopenharmony_ci	int			nr_partitions;
3762306a36Sopenharmony_ci	char			*name;
3862306a36Sopenharmony_ci	int			*nr_map;
3962306a36Sopenharmony_ci	struct mtd_partition	*partitions;
4062306a36Sopenharmony_ci	struct device_node	*of_node;
4162306a36Sopenharmony_ci};
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_cistruct s3c2410_platform_nand {
4462306a36Sopenharmony_ci	/* timing information for controller, all times in nanoseconds */
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci	int	tacls;	/* time for active CLE/ALE to nWE/nOE */
4762306a36Sopenharmony_ci	int	twrph0;	/* active time for nWE/nOE */
4862306a36Sopenharmony_ci	int	twrph1;	/* time for release CLE/ALE from nWE/nOE inactive */
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci	unsigned int	ignore_unset_ecc:1;
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci	enum nand_ecc_engine_type engine_type;
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci	int			nr_sets;
5562306a36Sopenharmony_ci	struct s3c2410_nand_set *sets;
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci	void			(*select_chip)(struct s3c2410_nand_set *,
5862306a36Sopenharmony_ci					       int chip);
5962306a36Sopenharmony_ci};
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci/**
6262306a36Sopenharmony_ci * s3c_nand_set_platdata() - register NAND platform data.
6362306a36Sopenharmony_ci * @nand: The NAND platform data to register with s3c_device_nand.
6462306a36Sopenharmony_ci *
6562306a36Sopenharmony_ci * This function copies the given NAND platform data, @nand and registers
6662306a36Sopenharmony_ci * it with the s3c_device_nand. This allows @nand to be __initdata.
6762306a36Sopenharmony_ci*/
6862306a36Sopenharmony_ciextern void s3c_nand_set_platdata(struct s3c2410_platform_nand *nand);
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci#endif /*__MTD_NAND_S3C2410_H */
71