Lines Matching refs:map

30 #include <linux/mtd/map.h>
34 static int lpddr_chip_setup(struct map_info *map, struct lpddr_private *lpddr);
35 struct mtd_info *lpddr_probe(struct map_info *map);
36 static struct lpddr_private *lpddr_probe_chip(struct map_info *map);
37 static int lpddr_pfow_present(struct map_info *map,
58 static long lpddr_get_qinforec_pos(struct map_info *map, char *id_str)
62 int bankwidth = map_bankwidth(map) * 8;
72 printk(KERN_ERR"%s qinfo id string is wrong! \n", map->name);
77 static uint16_t lpddr_info_query(struct map_info *map, char *id_str)
80 int bits_per_chip = map_bankwidth(map) * 8;
81 unsigned long adr = lpddr_get_qinforec_pos(map, id_str);
85 map_write(map, CMD(LPDDR_INFO_QUERY),
86 map->pfow_base + PFOW_COMMAND_CODE);
87 map_write(map, CMD(adr & ((1 << bits_per_chip) - 1)),
88 map->pfow_base + PFOW_COMMAND_ADDRESS_L);
89 map_write(map, CMD(adr >> bits_per_chip),
90 map->pfow_base + PFOW_COMMAND_ADDRESS_H);
91 map_write(map, CMD(LPDDR_START_EXECUTION),
92 map->pfow_base + PFOW_COMMAND_EXECUTE);
95 dsr = CMDVAL(map_read(map, map->pfow_base + PFOW_DSR));
101 val = CMDVAL(map_read(map, map->pfow_base + PFOW_COMMAND_DATA));
105 static int lpddr_pfow_present(struct map_info *map, struct lpddr_private *lpddr)
110 pfow_val[0] = map_read(map, map->pfow_base + PFOW_QUERY_STRING_P);
111 pfow_val[1] = map_read(map, map->pfow_base + PFOW_QUERY_STRING_F);
112 pfow_val[2] = map_read(map, map->pfow_base + PFOW_QUERY_STRING_O);
113 pfow_val[3] = map_read(map, map->pfow_base + PFOW_QUERY_STRING_W);
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]))
130 map->name, map->pfow_base);
134 static int lpddr_chip_setup(struct map_info *map, struct lpddr_private *lpddr)
140 map->name);
145 lpddr->ManufactId = CMDVAL(map_read(map, map->pfow_base + PFOW_MANUFACTURER_ID));
147 lpddr->DevId = CMDVAL(map_read(map, map->pfow_base + PFOW_DEVICE_ID));
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");
154 lpddr_info_query(map, "UniformBlockSizeShift");
155 lpddr->qinfo->SuspEraseSupp = lpddr_info_query(map, "SuspEraseSupp");
157 lpddr_info_query(map, "SingleWordProgTime");
158 lpddr->qinfo->ProgBufferTime = lpddr_info_query(map, "ProgBufferTime");
159 lpddr->qinfo->BlockEraseTime = lpddr_info_query(map, "BlockEraseTime");
162 static struct lpddr_private *lpddr_probe_chip(struct map_info *map)
169 if ((map->pfow_base + 0x1000) >= map->size) {
171 "the map(0x%08lx)\n", map->name,
172 (unsigned long)map->pfow_base, map->size - 1);
176 if (!lpddr_pfow_present(map, &lpddr))
179 if (!lpddr_chip_setup(map, &lpddr))
201 struct mtd_info *lpddr_probe(struct map_info *map)
206 /* First probe the map to see if we havecan open PFOW here */
207 lpddr = lpddr_probe_chip(map);
211 map->fldrv_priv = lpddr;
212 mtd = lpddr_cmdset(map);
214 if (mtd->size > map->size) {
217 (unsigned long)map->size >> 10);
218 mtd->size = map->size;
225 map->fldrv_priv = NULL;