Skip to content

Commit eee64b7

Browse files
saschahauerBoris Brezillon
authored andcommitted
mtd: nand: Introduce nand_data_interface
Currently we have no data structure to fully describe a NAND timing. We only have struct nand_sdr_timings for NAND timings in SDR mode, but nothing for DDR mode and also no container to store both types of timing. This patch adds struct nand_data_interface which stores the timing type and a union of different timings. This can be used to pass to drivers in order to configure the timing. Add kerneldoc for struct nand_sdr_timings while touching it anyway. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
1 parent 2f94abf commit eee64b7

1 file changed

Lines changed: 117 additions & 49 deletions

File tree

‎include/linux/mtd/nand.h‎

Lines changed: 117 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,123 @@ struct nand_buffers {
572572
uint8_t *databuf;
573573
};
574574

575+
/**
576+
* struct nand_sdr_timings - SDR NAND chip timings
577+
*
578+
* This struct defines the timing requirements of a SDR NAND chip.
579+
* These information can be found in every NAND datasheets and the timings
580+
* meaning are described in the ONFI specifications:
581+
* www.onfi.org/~/media/ONFI/specs/onfi_3_1_spec.pdf (chapter 4.15 Timing
582+
* Parameters)
583+
*
584+
* All these timings are expressed in picoseconds.
585+
*
586+
* @tALH_min: ALE hold time
587+
* @tADL_min: ALE to data loading time
588+
* @tALS_min: ALE setup time
589+
* @tAR_min: ALE to RE# delay
590+
* @tCEA_max: CE# access time
591+
* @tCEH_min:
592+
* @tCH_min: CE# hold time
593+
* @tCHZ_max: CE# high to output hi-Z
594+
* @tCLH_min: CLE hold time
595+
* @tCLR_min: CLE to RE# delay
596+
* @tCLS_min: CLE setup time
597+
* @tCOH_min: CE# high to output hold
598+
* @tCS_min: CE# setup time
599+
* @tDH_min: Data hold time
600+
* @tDS_min: Data setup time
601+
* @tFEAT_max: Busy time for Set Features and Get Features
602+
* @tIR_min: Output hi-Z to RE# low
603+
* @tITC_max: Interface and Timing Mode Change time
604+
* @tRC_min: RE# cycle time
605+
* @tREA_max: RE# access time
606+
* @tREH_min: RE# high hold time
607+
* @tRHOH_min: RE# high to output hold
608+
* @tRHW_min: RE# high to WE# low
609+
* @tRHZ_max: RE# high to output hi-Z
610+
* @tRLOH_min: RE# low to output hold
611+
* @tRP_min: RE# pulse width
612+
* @tRR_min: Ready to RE# low (data only)
613+
* @tRST_max: Device reset time, measured from the falling edge of R/B# to the
614+
* rising edge of R/B#.
615+
* @tWB_max: WE# high to SR[6] low
616+
* @tWC_min: WE# cycle time
617+
* @tWH_min: WE# high hold time
618+
* @tWHR_min: WE# high to RE# low
619+
* @tWP_min: WE# pulse width
620+
* @tWW_min: WP# transition to WE# low
621+
*/
622+
struct nand_sdr_timings {
623+
u32 tALH_min;
624+
u32 tADL_min;
625+
u32 tALS_min;
626+
u32 tAR_min;
627+
u32 tCEA_max;
628+
u32 tCEH_min;
629+
u32 tCH_min;
630+
u32 tCHZ_max;
631+
u32 tCLH_min;
632+
u32 tCLR_min;
633+
u32 tCLS_min;
634+
u32 tCOH_min;
635+
u32 tCS_min;
636+
u32 tDH_min;
637+
u32 tDS_min;
638+
u32 tFEAT_max;
639+
u32 tIR_min;
640+
u32 tITC_max;
641+
u32 tRC_min;
642+
u32 tREA_max;
643+
u32 tREH_min;
644+
u32 tRHOH_min;
645+
u32 tRHW_min;
646+
u32 tRHZ_max;
647+
u32 tRLOH_min;
648+
u32 tRP_min;
649+
u32 tRR_min;
650+
u64 tRST_max;
651+
u32 tWB_max;
652+
u32 tWC_min;
653+
u32 tWH_min;
654+
u32 tWHR_min;
655+
u32 tWP_min;
656+
u32 tWW_min;
657+
};
658+
659+
/**
660+
* enum nand_data_interface_type - NAND interface timing type
661+
* @NAND_SDR_IFACE: Single Data Rate interface
662+
*/
663+
enum nand_data_interface_type {
664+
NAND_SDR_IFACE,
665+
};
666+
667+
/**
668+
* struct nand_data_interface - NAND interface timing
669+
* @type: type of the timing
670+
* @timings: The timing, type according to @type
671+
*/
672+
struct nand_data_interface {
673+
enum nand_data_interface_type type;
674+
union {
675+
struct nand_sdr_timings sdr;
676+
} timings;
677+
};
678+
679+
/**
680+
* nand_get_sdr_timings - get SDR timing from data interface
681+
* @conf: The data interface
682+
*/
683+
static inline const struct nand_sdr_timings *
684+
nand_get_sdr_timings(const struct nand_data_interface *conf)
685+
{
686+
if (conf->type != NAND_SDR_IFACE)
687+
return ERR_PTR(-EINVAL);
688+
689+
return &conf->timings.sdr;
690+
}
691+
575692
/**
576693
* struct nand_chip - NAND Private Flash Chip Data
577694
* @mtd: MTD device registered to the MTD framework
@@ -1030,55 +1147,6 @@ static inline int jedec_feature(struct nand_chip *chip)
10301147
: 0;
10311148
}
10321149

1033-
/*
1034-
* struct nand_sdr_timings - SDR NAND chip timings
1035-
*
1036-
* This struct defines the timing requirements of a SDR NAND chip.
1037-
* These informations can be found in every NAND datasheets and the timings
1038-
* meaning are described in the ONFI specifications:
1039-
* www.onfi.org/~/media/ONFI/specs/onfi_3_1_spec.pdf (chapter 4.15 Timing
1040-
* Parameters)
1041-
*
1042-
* All these timings are expressed in picoseconds.
1043-
*/
1044-
1045-
struct nand_sdr_timings {
1046-
u32 tALH_min;
1047-
u32 tADL_min;
1048-
u32 tALS_min;
1049-
u32 tAR_min;
1050-
u32 tCEA_max;
1051-
u32 tCEH_min;
1052-
u32 tCH_min;
1053-
u32 tCHZ_max;
1054-
u32 tCLH_min;
1055-
u32 tCLR_min;
1056-
u32 tCLS_min;
1057-
u32 tCOH_min;
1058-
u32 tCS_min;
1059-
u32 tDH_min;
1060-
u32 tDS_min;
1061-
u32 tFEAT_max;
1062-
u32 tIR_min;
1063-
u32 tITC_max;
1064-
u32 tRC_min;
1065-
u32 tREA_max;
1066-
u32 tREH_min;
1067-
u32 tRHOH_min;
1068-
u32 tRHW_min;
1069-
u32 tRHZ_max;
1070-
u32 tRLOH_min;
1071-
u32 tRP_min;
1072-
u32 tRR_min;
1073-
u64 tRST_max;
1074-
u32 tWB_max;
1075-
u32 tWC_min;
1076-
u32 tWH_min;
1077-
u32 tWHR_min;
1078-
u32 tWP_min;
1079-
u32 tWW_min;
1080-
};
1081-
10821150
/* get timing characteristics from ONFI timing mode. */
10831151
const struct nand_sdr_timings *onfi_async_timing_mode_to_sdr_timings(int mode);
10841152

0 commit comments

Comments
 (0)