1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __LINUX_MTD_QINFO_H
3 #define __LINUX_MTD_QINFO_H
5 #include <linux/mtd/map.h>
6 #include <linux/wait.h>
7 #include <linux/spinlock.h>
8 #include <linux/delay.h>
9 #include <linux/mtd/mtd.h>
10 #include <linux/mtd/flashchip.h>
11 #include <linux/mtd/partitions.h>
13 /* lpddr_private describes lpddr flash chip in memory map
14 * @ManufactId - Chip Manufacture ID
15 * @DevId - Chip Device ID
16 * @qinfo - pointer to qinfo records describing the chip
17 * @numchips - number of chips including virual RWW partitions
18 * @chipshift - Chip/partition size 2^chipshift
19 * @chips - per-chip data structure
21 struct lpddr_private
{
24 struct qinfo_chip
*qinfo
;
26 unsigned long chipshift
;
27 struct flchip chips
[0];
30 /* qinfo_query_info structure contains request information for
32 * @major - major number of qinfo record
33 * @major - minor number of qinfo record
34 * @id_str - descriptive string to access the record
35 * @desc - detailed description for the qinfo record
37 struct qinfo_query_info
{
45 * qinfo_chip structure contains necessary qinfo records data
46 * @DevSizeShift - Device size 2^n bytes
47 * @BufSizeShift - Program buffer size 2^n bytes
48 * @TotalBlocksNum - Total number of blocks
49 * @UniformBlockSizeShift - Uniform block size 2^UniformBlockSizeShift bytes
50 * @HWPartsNum - Number of hardware partitions
51 * @SuspEraseSupp - Suspend erase supported
52 * @SingleWordProgTime - Single word program 2^SingleWordProgTime u-sec
53 * @ProgBufferTime - Program buffer write 2^ProgBufferTime u-sec
54 * @BlockEraseTime - Block erase 2^BlockEraseTime m-sec
57 /* General device info */
58 uint16_t DevSizeShift
;
59 uint16_t BufSizeShift
;
60 /* Erase block information */
61 uint16_t TotalBlocksNum
;
62 uint16_t UniformBlockSizeShift
;
63 /* Partition information */
65 /* Optional features */
66 uint16_t SuspEraseSupp
;
67 /* Operation typical time */
68 uint16_t SingleWordProgTime
;
69 uint16_t ProgBufferTime
;
70 uint16_t BlockEraseTime
;
73 /* defines for fixup usage */
74 #define LPDDR_MFR_ANY 0xffff
75 #define LPDDR_ID_ANY 0xffff
76 #define NUMONYX_MFGR_ID 0x0089
77 #define R18_DEVICE_ID_1G 0x893c
79 static inline map_word
lpddr_build_cmd(u_long cmd
, struct map_info
*map
)
81 map_word val
= { {0} };
86 #define CMD(x) lpddr_build_cmd(x, map)
87 #define CMDVAL(cmd) cmd.x[0]
89 struct mtd_info
*lpddr_cmdset(struct map_info
*);