qinfo.h 2.5 KB

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