Lines Matching +full:bcm2835 +full:- +full:mbox
1 // SPDX-License-Identifier: GPL-2.0
9 #include <linux/dma-mapping.h>
18 #include <soc/bcm2835/raspberrypi-firmware.h>
42 complete(&fw->c); in response_callback()
46 * Sends a request to the firmware through the BCM2835 mailbox driver,
58 reinit_completion(&fw->c); in rpi_firmware_transaction()
59 ret = mbox_send_message(fw->chan, &message); in rpi_firmware_transaction()
61 if (wait_for_completion_timeout(&fw->c, HZ)) { in rpi_firmware_transaction()
64 ret = -ETIMEDOUT; in rpi_firmware_transaction()
68 dev_err(fw->cl.dev, "mbox_send_message returned %d\n", ret); in rpi_firmware_transaction()
76 * rpi_firmware_property_list - Submit firmware property list
86 * See struct rpi_firmware_property_tag_header for the per-tag
99 return -EINVAL; in rpi_firmware_property_list()
101 buf = dma_alloc_coherent(fw->chan->mbox->dev, PAGE_ALIGN(size), in rpi_firmware_property_list()
104 return -ENOMEM; in rpi_firmware_property_list()
112 buf[size / 4 - 1] = RPI_FIRMWARE_PROPERTY_END; in rpi_firmware_property_list()
123 * But single-tag is the most common, so go with it. in rpi_firmware_property_list()
125 dev_err(fw->cl.dev, "Request 0x%08x returned status 0x%08x\n", in rpi_firmware_property_list()
127 ret = -EINVAL; in rpi_firmware_property_list()
130 dma_free_coherent(fw->chan->mbox->dev, PAGE_ALIGN(size), buf, bus_addr); in rpi_firmware_property_list()
137 * rpi_firmware_property - Submit single firmware property
164 return -ENOMEM; in rpi_firmware_property()
167 header->tag = tag; in rpi_firmware_property()
168 header->buf_size = buf_size; in rpi_firmware_property()
169 header->req_resp_size = 0; in rpi_firmware_property()
196 dev_info(fw->cl.dev, "Attached to firmware from %ptT\n", &date_and_time); in rpi_firmware_print_firmware_revision()
209 rpi_hwmon = platform_device_register_data(dev, "raspberrypi-hwmon", in rpi_register_hwmon_driver()
210 -1, NULL, 0); in rpi_register_hwmon_driver()
222 firmware = of_get_compatible_child(dev->of_node, in rpi_register_clk_driver()
223 "raspberrypi,firmware-clocks"); in rpi_register_clk_driver()
229 rpi_clk = platform_device_register_data(dev, "raspberrypi-clk", in rpi_register_clk_driver()
230 -1, NULL, 0); in rpi_register_clk_driver()
258 mbox_free_channel(fw->chan); in rpi_firmware_delete()
264 kref_put(&fw->consumers, rpi_firmware_delete); in rpi_firmware_put()
277 struct device *dev = &pdev->dev; in rpi_firmware_probe()
286 return -ENOMEM; in rpi_firmware_probe()
288 fw->cl.dev = dev; in rpi_firmware_probe()
289 fw->cl.rx_callback = response_callback; in rpi_firmware_probe()
290 fw->cl.tx_block = true; in rpi_firmware_probe()
292 fw->chan = mbox_request_channel(&fw->cl, 0); in rpi_firmware_probe()
293 if (IS_ERR(fw->chan)) { in rpi_firmware_probe()
294 int ret = PTR_ERR(fw->chan); in rpi_firmware_probe()
296 return dev_err_probe(dev, ret, "Failed to get mbox channel\n"); in rpi_firmware_probe()
299 init_completion(&fw->c); in rpi_firmware_probe()
300 kref_init(&fw->consumers); in rpi_firmware_probe()
336 { .compatible = "raspberrypi,bcm2835-firmware", },
348 * rpi_firmware_get - Get pointer to rpi_firmware structure.
367 if (!kref_get_unless_zero(&fw->consumers)) in rpi_firmware_get()
370 put_device(&pdev->dev); in rpi_firmware_get()
375 put_device(&pdev->dev); in rpi_firmware_get()
381 * devm_rpi_firmware_get - Get pointer to rpi_firmware structure.
404 .name = "raspberrypi-firmware",