Skip to content

Commit 3e70192

Browse files
Huang ShijieDavid Woodhouse
authored andcommitted
mtd: add helpers to get the supportted ONFI timing mode
add onfi_get_async_timing_mode() to get the supportted asynchronous timing mode. add onfi_get_sync_timing_mode() to get the supportted synchronous timing mode. Also add the neccessary macros : the timing modes. Signed-off-by: Huang Shijie <b32955@freescale.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
1 parent 7db03ec commit 3e70192

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

‎include/linux/mtd/nand.h‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,15 @@ typedef enum {
231231
/* Keep gcc happy */
232232
struct nand_chip;
233233

234+
/* ONFI timing mode, used in both asynchronous and synchronous mode */
235+
#define ONFI_TIMING_MODE_0 (1 << 0)
236+
#define ONFI_TIMING_MODE_1 (1 << 1)
237+
#define ONFI_TIMING_MODE_2 (1 << 2)
238+
#define ONFI_TIMING_MODE_3 (1 << 3)
239+
#define ONFI_TIMING_MODE_4 (1 << 4)
240+
#define ONFI_TIMING_MODE_5 (1 << 5)
241+
#define ONFI_TIMING_MODE_UNKNOWN (1 << 6)
242+
234243
/* ONFI feature address */
235244
#define ONFI_FEATURE_ADDR_TIMING_MODE 0x1
236245

@@ -684,4 +693,20 @@ struct platform_nand_chip *get_platform_nandchip(struct mtd_info *mtd)
684693
return chip->priv;
685694
}
686695

696+
/* return the supported asynchronous timing mode. */
697+
static inline int onfi_get_async_timing_mode(struct nand_chip *chip)
698+
{
699+
if (!chip->onfi_version)
700+
return ONFI_TIMING_MODE_UNKNOWN;
701+
return le16_to_cpu(chip->onfi_params.async_timing_mode);
702+
}
703+
704+
/* return the supported synchronous timing mode. */
705+
static inline int onfi_get_sync_timing_mode(struct nand_chip *chip)
706+
{
707+
if (!chip->onfi_version)
708+
return ONFI_TIMING_MODE_UNKNOWN;
709+
return le16_to_cpu(chip->onfi_params.src_sync_timing_mode);
710+
}
711+
687712
#endif /* __LINUX_MTD_NAND_H */

0 commit comments

Comments
 (0)