Lines Matching refs:sys_controller
39 int mpfs_blocking_transaction(struct mpfs_sys_controller *sys_controller, struct mpfs_mss_msg *msg) in mpfs_blocking_transaction() argument
48 reinit_completion(&sys_controller->c); in mpfs_blocking_transaction()
50 ret = mbox_send_message(sys_controller->chan, msg); in mpfs_blocking_transaction()
52 dev_warn(sys_controller->client.dev, "MPFS sys controller service timeout\n"); in mpfs_blocking_transaction()
67 if (!wait_for_completion_timeout(&sys_controller->c, timeout)) { in mpfs_blocking_transaction()
69 dev_warn(sys_controller->client.dev, in mpfs_blocking_transaction()
85 struct mpfs_sys_controller *sys_controller = in mpfs_sys_controller_rx_callback() local
88 complete(&sys_controller->c); in mpfs_sys_controller_rx_callback()
93 struct mpfs_sys_controller *sys_controller = in mpfs_sys_controller_delete() local
96 mbox_free_channel(sys_controller->chan); in mpfs_sys_controller_delete()
97 kfree(sys_controller); in mpfs_sys_controller_delete()
102 struct mpfs_sys_controller *sys_controller = data; in mpfs_sys_controller_put() local
104 kref_put(&sys_controller->consumers, mpfs_sys_controller_delete); in mpfs_sys_controller_put()
131 struct mpfs_sys_controller *sys_controller; in mpfs_sys_controller_probe() local
135 sys_controller = kzalloc(sizeof(*sys_controller), GFP_KERNEL); in mpfs_sys_controller_probe()
136 if (!sys_controller) in mpfs_sys_controller_probe()
143 sys_controller->flash = of_get_mtd_device_by_node(np); in mpfs_sys_controller_probe()
145 if (IS_ERR(sys_controller->flash)) in mpfs_sys_controller_probe()
146 return dev_err_probe(dev, PTR_ERR(sys_controller->flash), "Failed to get flash\n"); in mpfs_sys_controller_probe()
149 sys_controller->client.dev = dev; in mpfs_sys_controller_probe()
150 sys_controller->client.rx_callback = mpfs_sys_controller_rx_callback; in mpfs_sys_controller_probe()
151 sys_controller->client.tx_block = 1U; in mpfs_sys_controller_probe()
152 sys_controller->client.tx_tout = msecs_to_jiffies(MPFS_SYS_CTRL_TIMEOUT_MS); in mpfs_sys_controller_probe()
154 sys_controller->chan = mbox_request_channel(&sys_controller->client, 0); in mpfs_sys_controller_probe()
155 if (IS_ERR(sys_controller->chan)) { in mpfs_sys_controller_probe()
156 ret = dev_err_probe(dev, PTR_ERR(sys_controller->chan), in mpfs_sys_controller_probe()
158 kfree(sys_controller); in mpfs_sys_controller_probe()
162 init_completion(&sys_controller->c); in mpfs_sys_controller_probe()
163 kref_init(&sys_controller->consumers); in mpfs_sys_controller_probe()
165 platform_set_drvdata(pdev, sys_controller); in mpfs_sys_controller_probe()
181 struct mpfs_sys_controller *sys_controller = platform_get_drvdata(pdev); in mpfs_sys_controller_remove() local
183 mpfs_sys_controller_put(sys_controller); in mpfs_sys_controller_remove()
195 struct mpfs_sys_controller *sys_controller; in mpfs_sys_controller_get() local
206 sys_controller = dev_get_drvdata(dev->parent); in mpfs_sys_controller_get()
207 if (!sys_controller) in mpfs_sys_controller_get()
210 if (!kref_get_unless_zero(&sys_controller->consumers)) in mpfs_sys_controller_get()
213 ret = devm_add_action_or_reset(dev, mpfs_sys_controller_put, sys_controller); in mpfs_sys_controller_get()
217 return sys_controller; in mpfs_sys_controller_get()