Lines Matching refs:ipcc
84 struct stm32_ipcc *ipcc = data; in stm32_ipcc_rx_irq() local
85 struct device *dev = ipcc->controller.dev; in stm32_ipcc_rx_irq()
91 proc_offset = ipcc->proc_id ? -IPCC_PROC_OFFST : IPCC_PROC_OFFST; in stm32_ipcc_rx_irq()
92 tosr = readl_relaxed(ipcc->reg_proc + proc_offset + IPCC_XTOYSR); in stm32_ipcc_rx_irq()
93 mr = readl_relaxed(ipcc->reg_proc + IPCC_XMR); in stm32_ipcc_rx_irq()
98 for (chan = 0; chan < ipcc->n_chans; chan++) { in stm32_ipcc_rx_irq()
104 mbox_chan_received_data(&ipcc->controller.chans[chan], NULL); in stm32_ipcc_rx_irq()
106 stm32_ipcc_set_bits(&ipcc->lock, ipcc->reg_proc + IPCC_XSCR, in stm32_ipcc_rx_irq()
117 struct stm32_ipcc *ipcc = data; in stm32_ipcc_tx_irq() local
118 struct device *dev = ipcc->controller.dev; in stm32_ipcc_tx_irq()
122 tosr = readl_relaxed(ipcc->reg_proc + IPCC_XTOYSR); in stm32_ipcc_tx_irq()
123 mr = readl_relaxed(ipcc->reg_proc + IPCC_XMR); in stm32_ipcc_tx_irq()
128 for (chan = 0; chan < ipcc->n_chans ; chan++) { in stm32_ipcc_tx_irq()
135 stm32_ipcc_set_bits(&ipcc->lock, ipcc->reg_proc + IPCC_XMR, in stm32_ipcc_tx_irq()
138 mbox_chan_txdone(&ipcc->controller.chans[chan], 0); in stm32_ipcc_tx_irq()
149 struct stm32_ipcc *ipcc = container_of(link->mbox, struct stm32_ipcc, in stm32_ipcc_send_data() local
152 dev_dbg(ipcc->controller.dev, "%s: chan:%lu\n", __func__, chan); in stm32_ipcc_send_data()
155 stm32_ipcc_set_bits(&ipcc->lock, ipcc->reg_proc + IPCC_XSCR, in stm32_ipcc_send_data()
159 stm32_ipcc_clr_bits(&ipcc->lock, ipcc->reg_proc + IPCC_XMR, in stm32_ipcc_send_data()
168 struct stm32_ipcc *ipcc = container_of(link->mbox, struct stm32_ipcc, in stm32_ipcc_startup() local
172 ret = clk_prepare_enable(ipcc->clk); in stm32_ipcc_startup()
174 dev_err(ipcc->controller.dev, "can not enable the clock\n"); in stm32_ipcc_startup()
179 stm32_ipcc_clr_bits(&ipcc->lock, ipcc->reg_proc + IPCC_XMR, in stm32_ipcc_startup()
188 struct stm32_ipcc *ipcc = container_of(link->mbox, struct stm32_ipcc, in stm32_ipcc_shutdown() local
192 stm32_ipcc_set_bits(&ipcc->lock, ipcc->reg_proc + IPCC_XMR, in stm32_ipcc_shutdown()
195 clk_disable_unprepare(ipcc->clk); in stm32_ipcc_shutdown()
208 struct stm32_ipcc *ipcc; in stm32_ipcc_probe() local
220 ipcc = devm_kzalloc(dev, sizeof(*ipcc), GFP_KERNEL); in stm32_ipcc_probe()
221 if (!ipcc) in stm32_ipcc_probe()
224 spin_lock_init(&ipcc->lock); in stm32_ipcc_probe()
227 if (of_property_read_u32(np, "st,proc-id", &ipcc->proc_id)) { in stm32_ipcc_probe()
232 if (ipcc->proc_id >= STM32_MAX_PROCS) { in stm32_ipcc_probe()
233 dev_err(dev, "Invalid proc_id (%d)\n", ipcc->proc_id); in stm32_ipcc_probe()
238 ipcc->reg_base = devm_platform_ioremap_resource(pdev, 0); in stm32_ipcc_probe()
239 if (IS_ERR(ipcc->reg_base)) in stm32_ipcc_probe()
240 return PTR_ERR(ipcc->reg_base); in stm32_ipcc_probe()
242 ipcc->reg_proc = ipcc->reg_base + ipcc->proc_id * IPCC_PROC_OFFST; in stm32_ipcc_probe()
245 ipcc->clk = devm_clk_get(dev, NULL); in stm32_ipcc_probe()
246 if (IS_ERR(ipcc->clk)) in stm32_ipcc_probe()
247 return PTR_ERR(ipcc->clk); in stm32_ipcc_probe()
249 ret = clk_prepare_enable(ipcc->clk); in stm32_ipcc_probe()
257 ipcc->irqs[i] = platform_get_irq_byname(pdev, irq_name[i]); in stm32_ipcc_probe()
258 if (ipcc->irqs[i] < 0) { in stm32_ipcc_probe()
259 ret = ipcc->irqs[i]; in stm32_ipcc_probe()
263 ret = devm_request_threaded_irq(dev, ipcc->irqs[i], NULL, in stm32_ipcc_probe()
265 dev_name(dev), ipcc); in stm32_ipcc_probe()
273 stm32_ipcc_set_bits(&ipcc->lock, ipcc->reg_proc + IPCC_XMR, in stm32_ipcc_probe()
275 stm32_ipcc_set_bits(&ipcc->lock, ipcc->reg_proc + IPCC_XCR, in stm32_ipcc_probe()
282 ret = dev_pm_set_wake_irq(dev, ipcc->irqs[IPCC_IRQ_RX]); in stm32_ipcc_probe()
290 ipcc->n_chans = readl_relaxed(ipcc->reg_base + IPCC_HWCFGR); in stm32_ipcc_probe()
291 ipcc->n_chans &= IPCFGR_CHAN_MASK; in stm32_ipcc_probe()
293 ipcc->controller.dev = dev; in stm32_ipcc_probe()
294 ipcc->controller.txdone_irq = true; in stm32_ipcc_probe()
295 ipcc->controller.ops = &stm32_ipcc_ops; in stm32_ipcc_probe()
296 ipcc->controller.num_chans = ipcc->n_chans; in stm32_ipcc_probe()
297 ipcc->controller.chans = devm_kcalloc(dev, ipcc->controller.num_chans, in stm32_ipcc_probe()
298 sizeof(*ipcc->controller.chans), in stm32_ipcc_probe()
300 if (!ipcc->controller.chans) { in stm32_ipcc_probe()
305 for (i = 0; i < ipcc->controller.num_chans; i++) in stm32_ipcc_probe()
306 ipcc->controller.chans[i].con_priv = (void *)i; in stm32_ipcc_probe()
308 ret = devm_mbox_controller_register(dev, &ipcc->controller); in stm32_ipcc_probe()
312 platform_set_drvdata(pdev, ipcc); in stm32_ipcc_probe()
314 ip_ver = readl_relaxed(ipcc->reg_base + IPCC_VER); in stm32_ipcc_probe()
319 ipcc->controller.num_chans, ipcc->proc_id); in stm32_ipcc_probe()
321 clk_disable_unprepare(ipcc->clk); in stm32_ipcc_probe()
330 clk_disable_unprepare(ipcc->clk); in stm32_ipcc_probe()
349 struct stm32_ipcc *ipcc = dev_get_drvdata(dev); in stm32_ipcc_suspend() local
351 ipcc->xmr = readl_relaxed(ipcc->reg_proc + IPCC_XMR); in stm32_ipcc_suspend()
352 ipcc->xcr = readl_relaxed(ipcc->reg_proc + IPCC_XCR); in stm32_ipcc_suspend()
359 struct stm32_ipcc *ipcc = dev_get_drvdata(dev); in stm32_ipcc_resume() local
361 writel_relaxed(ipcc->xmr, ipcc->reg_proc + IPCC_XMR); in stm32_ipcc_resume()
362 writel_relaxed(ipcc->xcr, ipcc->reg_proc + IPCC_XCR); in stm32_ipcc_resume()