Lines Matching refs:hpdma_d
92 static TEE_Result handle_available_semaphores(struct hpdma_pdata *hpdma_d) in handle_available_semaphores() argument
99 if (!(BIT(i) & hpdma_d->conf_data->access_mask[0])) in handle_available_semaphores()
102 cidcfgr = io_read32(hpdma_d->base + _HPDMA_CIDCFGR(i)); in handle_available_semaphores()
107 if (!(io_read32(hpdma_d->base + _HPDMA_SECCFGR) & BIT(i))) { in handle_available_semaphores()
109 stm32_rif_release_semaphore(hpdma_d->base + in handle_available_semaphores()
119 stm32_rif_acquire_semaphore(hpdma_d->base + in handle_available_semaphores()
134 static TEE_Result apply_rif_config(struct hpdma_pdata *hpdma_d, bool is_tdcid) in apply_rif_config() argument
139 if (!hpdma_d->conf_data) in apply_rif_config()
144 if (!(BIT(i) & hpdma_d->conf_data->access_mask[0])) in apply_rif_config()
152 io_clrbits32(hpdma_d->base + _HPDMA_CIDCFGR(i), in apply_rif_config()
156 res = handle_available_semaphores(hpdma_d); in apply_rif_config()
162 io_clrsetbits32(hpdma_d->base + _HPDMA_PRIVCFGR, _HPDMA_PRIVCFGR_MASK & in apply_rif_config()
163 hpdma_d->conf_data->access_mask[0], in apply_rif_config()
164 hpdma_d->conf_data->priv_conf[0]); in apply_rif_config()
165 io_clrsetbits32(hpdma_d->base + _HPDMA_SECCFGR, _HPDMA_SECCFGR_MASK & in apply_rif_config()
166 hpdma_d->conf_data->access_mask[0], in apply_rif_config()
167 hpdma_d->conf_data->sec_conf[0]); in apply_rif_config()
174 uint32_t cid_conf = hpdma_d->conf_data->cid_confs[i]; in apply_rif_config()
176 if (!(BIT(i) & hpdma_d->conf_data->access_mask[0])) in apply_rif_config()
184 if (hpdma_d->errata_ahbrisab && in apply_rif_config()
196 io_clrsetbits32(hpdma_d->base + _HPDMA_CIDCFGR(i), in apply_rif_config()
204 io_setbits32(hpdma_d->base + _HPDMA_RCFGLOCKR, in apply_rif_config()
205 hpdma_d->conf_data->lock_conf[0]); in apply_rif_config()
207 res = handle_available_semaphores(hpdma_d); in apply_rif_config()
214 if ((io_read32(hpdma_d->base + _HPDMA_PRIVCFGR) & in apply_rif_config()
215 hpdma_d->conf_data->access_mask[0]) != in apply_rif_config()
216 hpdma_d->conf_data->priv_conf[0]) in apply_rif_config()
219 if ((io_read32(hpdma_d->base + _HPDMA_SECCFGR) & in apply_rif_config()
220 hpdma_d->conf_data->access_mask[0]) != in apply_rif_config()
221 hpdma_d->conf_data->sec_conf[0]) in apply_rif_config()
229 struct hpdma_pdata *hpdma_d) in parse_dt() argument
243 hpdma_d->base = io_pa_or_va_secure(&addr, info.reg_size); in parse_dt()
246 res = clk_dt_get_by_index(fdt, node, 0, &hpdma_d->hpdma_clock); in parse_dt()
250 hpdma_d->errata_ahbrisab = fdt_getprop(fdt, node, "st,errata-ahbrisab", in parse_dt()
259 hpdma_d->conf_data = calloc(1, sizeof(*hpdma_d->conf_data)); in parse_dt()
260 if (!hpdma_d->conf_data) in parse_dt()
263 hpdma_d->nb_channels = (unsigned int)(lenp / sizeof(uint32_t)); in parse_dt()
264 assert(hpdma_d->nb_channels <= HPDMA_RIF_CHANNELS); in parse_dt()
266 hpdma_d->conf_data->cid_confs = calloc(HPDMA_RIF_CHANNELS, in parse_dt()
268 hpdma_d->conf_data->sec_conf = calloc(1, sizeof(uint32_t)); in parse_dt()
269 hpdma_d->conf_data->priv_conf = calloc(1, sizeof(uint32_t)); in parse_dt()
270 hpdma_d->conf_data->access_mask = calloc(1, sizeof(uint32_t)); in parse_dt()
271 hpdma_d->conf_data->lock_conf = calloc(1, sizeof(uint32_t)); in parse_dt()
272 if (!hpdma_d->conf_data->cid_confs || !hpdma_d->conf_data->sec_conf || in parse_dt()
273 !hpdma_d->conf_data->priv_conf || in parse_dt()
274 !hpdma_d->conf_data->access_mask || !hpdma_d->conf_data->lock_conf) in parse_dt()
277 for (i = 0; i < hpdma_d->nb_channels; i++) in parse_dt()
278 stm32_rif_parse_cfg(fdt32_to_cpu(cuint[i]), hpdma_d->conf_data, in parse_dt()
350 struct hpdma_pdata *hpdma_d = NULL; in stm32_hpdma_probe() local
357 hpdma_d = calloc(1, sizeof(*hpdma_d)); in stm32_hpdma_probe()
358 if (!hpdma_d) in stm32_hpdma_probe()
361 res = parse_dt(fdt, node, hpdma_d); in stm32_hpdma_probe()
363 free(hpdma_d); in stm32_hpdma_probe()
367 if (clk_enable(hpdma_d->hpdma_clock)) in stm32_hpdma_probe()
370 res = apply_rif_config(hpdma_d, is_tdcid); in stm32_hpdma_probe()
374 clk_disable(hpdma_d->hpdma_clock); in stm32_hpdma_probe()
376 SLIST_INSERT_HEAD(&hpdma_list, hpdma_d, link); in stm32_hpdma_probe()
378 register_pm_core_service_cb(stm32_hpdma_pm, hpdma_d, "stm32-hpdma"); in stm32_hpdma_probe()