21 #include <linux/module.h>
22 #include <linux/types.h>
23 #include <linux/kernel.h>
25 #include <linux/errno.h>
26 #include <linux/slab.h>
42 {0, 0,
"DevSizeShift",
"Device size 2^n bytes"},
43 {0, 3,
"BufSizeShift",
"Program buffer size 2^n bytes"},
45 {1, 1,
"TotalBlocksNum",
"Total number of blocks"},
46 {1, 2,
"UniformBlockSizeShift",
"Uniform block size 2^n bytes"},
48 {2, 1,
"HWPartsNum",
"Number of hardware partitions"},
50 {5, 1,
"SuspEraseSupp",
"Suspend erase supported"},
52 {10, 0,
"SingleWordProgTime",
"Single word program 2^n u-sec"},
53 {10, 1,
"ProgBufferTime",
"Program buffer write 2^n u-sec"},
54 {10, 2,
"BlockEraseTime",
"Block erase 2^n m-sec"},
55 {10, 3,
"FullChipEraseTime",
"Full chip erase 2^n m-sec"},
62 int bankwidth = map_bankwidth(map) * 8;
65 for (i = 0; i < qinfo_lines; i++) {
66 if (
strcmp(id_str, qinfo_array[i].id_str) == 0) {
67 major = qinfo_array[
i].
major & ((1 << bankwidth) - 1);
68 minor = qinfo_array[
i].
minor & ((1 << bankwidth) - 1);
69 return minor | (major << bankwidth);
79 unsigned int dsr,
val;
80 int bits_per_chip = map_bankwidth(map) * 8;
81 unsigned long adr = lpddr_get_qinforec_pos(map, id_str);
94 while ((attempts--) > 0) {
115 if (!map_word_equal(map,
CMD(
'P'), pfow_val[0]))
118 if (!map_word_equal(map,
CMD(
'F'), pfow_val[1]))
121 if (!map_word_equal(map,
CMD(
'O'), pfow_val[2]))
124 if (!map_word_equal(map,
CMD(
'W'), pfow_val[3]))
149 lpddr->
qinfo->DevSizeShift = lpddr_info_query(map,
"DevSizeShift");
150 lpddr->
qinfo->TotalBlocksNum = lpddr_info_query(map,
"TotalBlocksNum");
151 lpddr->
qinfo->BufSizeShift = lpddr_info_query(map,
"BufSizeShift");
152 lpddr->
qinfo->HWPartsNum = lpddr_info_query(map,
"HWPartsNum");
153 lpddr->
qinfo->UniformBlockSizeShift =
154 lpddr_info_query(map,
"UniformBlockSizeShift");
155 lpddr->
qinfo->SuspEraseSupp = lpddr_info_query(map,
"SuspEraseSupp");
156 lpddr->
qinfo->SingleWordProgTime =
157 lpddr_info_query(map,
"SingleWordProgTime");
158 lpddr->
qinfo->ProgBufferTime = lpddr_info_query(map,
"ProgBufferTime");
159 lpddr->
qinfo->BlockEraseTime = lpddr_info_query(map,
"BlockEraseTime");
171 "the map(0x%08lx)\n", map->
name,
176 if (!lpddr_pfow_present(map, &lpddr))
179 if (!lpddr_chip_setup(map, &lpddr))
207 lpddr = lpddr_probe_chip(map);
216 "to %ldKiB\n", (
unsigned long)mtd->
size >> 10,
217 (
unsigned long)map->
size >> 10);
231 .name =
"qinfo_probe",
235 static int __init lpddr_probe_init(
void)
241 static void __exit lpddr_probe_exit(
void)