Lines Matching refs:dev

216 	struct etzpc_instance *dev = NULL;  in etzpc_pm()  local
222 dev = (struct etzpc_instance *)PM_CALLBACK_GET_HANDLE(pm_handle); in etzpc_pm()
224 for (n = 0; n < dev->num_per_sec; n++) { in etzpc_pm()
225 unsigned int attr = dev->periph_cfg[n] & PERIPH_PM_ATTR_MASK; in etzpc_pm()
229 if (dev->periph_cfg[n] & PERIPH_PM_LOCK_BIT) in etzpc_pm()
233 for (n = 0; n < dev->num_tzma; n++) { in etzpc_pm()
234 uint16_t value = dev->tzma_cfg[n] & TZMA_PM_VALUE_MASK; in etzpc_pm()
238 if (dev->tzma_cfg[n] & TZMA_PM_LOCK_BIT) in etzpc_pm()
246 static void init_pm(struct etzpc_instance *dev) in init_pm() argument
250 dev->periph_cfg = calloc(dev->num_per_sec, sizeof(*dev->periph_cfg)); in init_pm()
251 dev->tzma_cfg = calloc(dev->num_tzma, sizeof(*dev->tzma_cfg)); in init_pm()
252 if (!dev->periph_cfg || !dev->tzma_cfg) in init_pm()
255 for (n = 0; n < dev->num_per_sec; n++) { in init_pm()
256 dev->periph_cfg[n] = (uint8_t)etzpc_get_decprot(n); in init_pm()
258 dev->periph_cfg[n] |= PERIPH_PM_LOCK_BIT; in init_pm()
261 for (n = 0; n < dev->num_tzma; n++) { in init_pm()
262 dev->tzma_cfg[n] = (uint8_t)etzpc_get_tzma(n); in init_pm()
264 dev->tzma_cfg[n] |= TZMA_PM_LOCK_BIT; in init_pm()
267 register_pm_core_service_cb(etzpc_pm, dev, "stm32-etzpc"); in init_pm()
291 static void init_device_from_hw_config(struct etzpc_instance *dev, in init_device_from_hw_config() argument
296 assert(!dev->base.pa && cpu_mmu_enabled()); in init_device_from_hw_config()
297 dev->base.pa = pbase; in init_device_from_hw_config()
298 dev->base.va = (vaddr_t)phys_to_virt(dev->base.pa, MEM_AREA_IO_SEC, 1); in init_device_from_hw_config()
302 dev->num_tzma = hwcfg.num_tzma; in init_device_from_hw_config()
303 dev->num_per_sec = hwcfg.num_per_sec; in init_device_from_hw_config()
304 dev->num_ahb_sec = hwcfg.num_ahb_sec; in init_device_from_hw_config()
310 init_pm(dev); in init_device_from_hw_config()