Lines Matching refs:pruss
56 struct pruss *pruss_get(struct rproc *rproc) in pruss_get()
58 struct pruss *pruss; in pruss_get() local
72 pruss = platform_get_drvdata(ppdev); in pruss_get()
73 if (!pruss) in pruss_get()
76 get_device(pruss->dev); in pruss_get()
78 return pruss; in pruss_get()
89 void pruss_put(struct pruss *pruss) in pruss_put() argument
91 if (IS_ERR_OR_NULL(pruss)) in pruss_put()
94 put_device(pruss->dev); in pruss_put()
112 int pruss_request_mem_region(struct pruss *pruss, enum pruss_mem mem_id, in pruss_request_mem_region() argument
115 if (!pruss || !region || mem_id >= PRUSS_MEM_MAX) in pruss_request_mem_region()
118 mutex_lock(&pruss->lock); in pruss_request_mem_region()
120 if (pruss->mem_in_use[mem_id]) { in pruss_request_mem_region()
121 mutex_unlock(&pruss->lock); in pruss_request_mem_region()
125 *region = pruss->mem_regions[mem_id]; in pruss_request_mem_region()
126 pruss->mem_in_use[mem_id] = region; in pruss_request_mem_region()
128 mutex_unlock(&pruss->lock); in pruss_request_mem_region()
145 int pruss_release_mem_region(struct pruss *pruss, in pruss_release_mem_region() argument
150 if (!pruss || !region) in pruss_release_mem_region()
153 mutex_lock(&pruss->lock); in pruss_release_mem_region()
157 if (pruss->mem_in_use[id] == region) in pruss_release_mem_region()
162 mutex_unlock(&pruss->lock); in pruss_release_mem_region()
166 pruss->mem_in_use[id] = NULL; in pruss_release_mem_region()
168 mutex_unlock(&pruss->lock); in pruss_release_mem_region()
182 int pruss_cfg_get_gpmux(struct pruss *pruss, enum pruss_pru_id pru_id, u8 *mux) in pruss_cfg_get_gpmux() argument
190 ret = pruss_cfg_read(pruss, PRUSS_CFG_GPCFG(pru_id), &val); in pruss_cfg_get_gpmux()
206 int pruss_cfg_set_gpmux(struct pruss *pruss, enum pruss_pru_id pru_id, u8 mux) in pruss_cfg_set_gpmux() argument
212 return pruss_cfg_update(pruss, PRUSS_CFG_GPCFG(pru_id), in pruss_cfg_set_gpmux()
229 int pruss_cfg_gpimode(struct pruss *pruss, enum pruss_pru_id pru_id, in pruss_cfg_gpimode() argument
235 return pruss_cfg_update(pruss, PRUSS_CFG_GPCFG(pru_id), in pruss_cfg_gpimode()
250 int pruss_cfg_miirt_enable(struct pruss *pruss, bool enable) in pruss_cfg_miirt_enable() argument
254 return pruss_cfg_update(pruss, PRUSS_CFG_MII_RT, in pruss_cfg_miirt_enable()
267 int pruss_cfg_xfr_enable(struct pruss *pruss, enum pru_type pru_type, in pruss_cfg_xfr_enable() argument
285 return pruss_cfg_update(pruss, PRUSS_CFG_SPP, mask, set); in pruss_cfg_xfr_enable()
302 static int pruss_clk_mux_setup(struct pruss *pruss, struct clk *clk_mux, in pruss_clk_mux_setup() argument
306 struct device *dev = pruss->dev; in pruss_clk_mux_setup()
348 reg = pruss->cfg_base + reg_offset; in pruss_clk_mux_setup()
381 static int pruss_clk_init(struct pruss *pruss, struct device_node *cfg_node) in pruss_clk_init() argument
383 struct device *dev = pruss->dev; in pruss_clk_init()
395 ret = pruss_clk_mux_setup(pruss, pruss->core_clk_mux, in pruss_clk_init()
402 ret = pruss_clk_mux_setup(pruss, pruss->iep_clk_mux, "iepclk-mux", in pruss_clk_init()
410 static int pruss_of_setup_memories(struct device *dev, struct pruss *pruss) in pruss_of_setup_memories() argument
443 pruss->mem_regions[i].va = devm_ioremap(dev, res.start, in pruss_of_setup_memories()
445 if (!pruss->mem_regions[i].va) in pruss_of_setup_memories()
449 pruss->mem_regions[i].pa = res.start; in pruss_of_setup_memories()
450 pruss->mem_regions[i].size = resource_size(&res); in pruss_of_setup_memories()
453 mem_names[i], &pruss->mem_regions[i].pa, in pruss_of_setup_memories()
454 pruss->mem_regions[i].size, pruss->mem_regions[i].va); in pruss_of_setup_memories()
466 static int pruss_cfg_of_init(struct device *dev, struct pruss *pruss) in pruss_cfg_of_init() argument
481 pruss->cfg_base = devm_ioremap(dev, res.start, resource_size(&res)); in pruss_cfg_of_init()
482 if (!pruss->cfg_base) in pruss_cfg_of_init()
489 pruss->cfg_regmap = devm_regmap_init_mmio(dev, pruss->cfg_base, in pruss_cfg_of_init()
492 if (IS_ERR(pruss->cfg_regmap)) in pruss_cfg_of_init()
493 return dev_err_probe(dev, PTR_ERR(pruss->cfg_regmap), in pruss_cfg_of_init()
496 ret = pruss_clk_init(pruss, child); in pruss_cfg_of_init()
506 struct pruss *pruss; in pruss_probe() local
515 pruss = devm_kzalloc(dev, sizeof(*pruss), GFP_KERNEL); in pruss_probe()
516 if (!pruss) in pruss_probe()
519 pruss->dev = dev; in pruss_probe()
520 mutex_init(&pruss->lock); in pruss_probe()
522 ret = pruss_of_setup_memories(dev, pruss); in pruss_probe()
526 platform_set_drvdata(pdev, pruss); in pruss_probe()
535 ret = pruss_cfg_of_init(dev, pruss); in pruss_probe()