1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef __LINUX_MTD_QINFO_H 3 #define __LINUX_MTD_QINFO_H 4 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> 12 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 20 */ 21 struct lpddr_private { 22 uint16_t ManufactId; 23 uint16_t DevId; 24 struct qinfo_chip *qinfo; 25 int numchips; 26 unsigned long chipshift; 27 struct flchip chips[] __counted_by(numchips); 28 }; 29 30 /* qinfo_query_info structure contains request information for 31 * each qinfo record 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 36 */ 37 struct qinfo_query_info { 38 uint8_t major; 39 uint8_t minor; 40 char *id_str; 41 char *desc; 42 }; 43 44 /* 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 55 */ 56 struct qinfo_chip { 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 */ 64 uint16_t HWPartsNum; 65 /* Optional features */ 66 uint16_t SuspEraseSupp; 67 /* Operation typical time */ 68 uint16_t SingleWordProgTime; 69 uint16_t ProgBufferTime; 70 uint16_t BlockEraseTime; 71 }; 72 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 78 lpddr_build_cmd(u_long cmd,struct map_info * map)79static inline map_word lpddr_build_cmd(u_long cmd, struct map_info *map) 80 { 81 map_word val = { {0} }; 82 val.x[0] = cmd; 83 return val; 84 } 85 86 #define CMD(x) lpddr_build_cmd(x, map) 87 #define CMDVAL(cmd) cmd.x[0] 88 89 struct mtd_info *lpddr_cmdset(struct map_info *); 90 91 #endif 92 93