• Home
  • Raw
  • Download

Lines Matching refs:mmc

113 __weak int mmc_get_env_addr(struct mmc *mmc, int copy, u32 *env_addr)  in mmc_get_env_addr()  argument
118 offset += mmc->capacity; in mmc_get_env_addr()
131 __weak uint mmc_get_env_part(struct mmc *mmc) in mmc_get_env_part() argument
138 static int mmc_set_env_part(struct mmc *mmc) in mmc_set_env_part() argument
140 uint part = mmc_get_env_part(mmc); in mmc_set_env_part()
144 env_mmc_orig_hwpart = mmc_get_blk_desc(mmc)->hwpart; in mmc_set_env_part()
152 static inline int mmc_set_env_part(struct mmc *mmc) {return 0; }; in mmc_set_env_part() argument
155 static const char *init_mmc_for_env(struct mmc *mmc) in init_mmc_for_env() argument
157 if (!mmc) in init_mmc_for_env()
163 if (blk_get_from_parent(mmc->dev, &dev)) in init_mmc_for_env()
166 if (mmc_init(mmc)) in init_mmc_for_env()
169 if (mmc_set_env_part(mmc)) in init_mmc_for_env()
175 static void fini_mmc_for_env(struct mmc *mmc) in fini_mmc_for_env() argument
185 static inline int write_env(struct mmc *mmc, unsigned long size, in write_env() argument
189 struct blk_desc *desc = mmc_get_blk_desc(mmc); in write_env()
191 blk_start = ALIGN(offset, mmc->write_bl_len) / mmc->write_bl_len; in write_env()
192 blk_cnt = ALIGN(size, mmc->write_bl_len) / mmc->write_bl_len; in write_env()
203 struct mmc *mmc = find_mmc_device(dev); in env_mmc_save() local
208 errmsg = init_mmc_for_env(mmc); in env_mmc_save()
223 if (mmc_get_env_addr(mmc, copy, &offset)) { in env_mmc_save()
229 if (write_env(mmc, CONFIG_ENV_SIZE, offset, (u_char *)env_new)) { in env_mmc_save()
242 fini_mmc_for_env(mmc); in env_mmc_save()
247 static inline int read_env(struct mmc *mmc, unsigned long size, in read_env() argument
251 struct blk_desc *desc = mmc_get_blk_desc(mmc); in read_env()
253 blk_start = ALIGN(offset, mmc->read_bl_len) / mmc->read_bl_len; in read_env()
254 blk_cnt = ALIGN(size, mmc->read_bl_len) / mmc->read_bl_len; in read_env()
265 struct mmc *mmc; in env_mmc_load() local
277 mmc = find_mmc_device(dev); in env_mmc_load()
279 errmsg = init_mmc_for_env(mmc); in env_mmc_load()
285 if (mmc_get_env_addr(mmc, 0, &offset1) || in env_mmc_load()
286 mmc_get_env_addr(mmc, 1, &offset2)) { in env_mmc_load()
291 read1_fail = read_env(mmc, CONFIG_ENV_SIZE, offset1, tmp_env1); in env_mmc_load()
292 read2_fail = read_env(mmc, CONFIG_ENV_SIZE, offset2, tmp_env2); in env_mmc_load()
298 fini_mmc_for_env(mmc); in env_mmc_load()
311 struct mmc *mmc; in env_mmc_load() local
317 mmc = find_mmc_device(dev); in env_mmc_load()
319 errmsg = init_mmc_for_env(mmc); in env_mmc_load()
325 if (mmc_get_env_addr(mmc, 0, &offset)) { in env_mmc_load()
330 if (read_env(mmc, CONFIG_ENV_SIZE, offset, buf)) { in env_mmc_load()
339 fini_mmc_for_env(mmc); in env_mmc_load()
348 U_BOOT_ENV_LOCATION(mmc) = {