Lines Matching +full:firmware +full:- +full:clocks
1 // SPDX-License-Identifier: GPL-2.0
3 * Defines interfaces for interacting with the Raspberry Pi firmware's
9 #include <linux/dma-mapping.h>
16 #include <soc/bcm2835/raspberrypi-firmware.h>
40 complete(&fw->c); in response_callback()
44 * Sends a request to the firmware through the BCM2835 mailbox driver,
56 reinit_completion(&fw->c); in rpi_firmware_transaction()
57 ret = mbox_send_message(fw->chan, &message); in rpi_firmware_transaction()
59 if (wait_for_completion_timeout(&fw->c, HZ)) { in rpi_firmware_transaction()
62 ret = -ETIMEDOUT; in rpi_firmware_transaction()
63 WARN_ONCE(1, "Firmware transaction timeout"); in rpi_firmware_transaction()
66 dev_err(fw->cl.dev, "mbox_send_message returned %d\n", ret); in rpi_firmware_transaction()
74 * rpi_firmware_property_list - Submit firmware property list
75 * @fw: Pointer to firmware structure from rpi_firmware_get().
79 * Submits a set of concatenated tags to the VPU firmware through the
84 * See struct rpi_firmware_property_tag_header for the per-tag
97 return -EINVAL; in rpi_firmware_property_list()
99 buf = dma_alloc_coherent(fw->cl.dev, PAGE_ALIGN(size), &bus_addr, in rpi_firmware_property_list()
102 return -ENOMEM; in rpi_firmware_property_list()
104 /* The firmware will error out without parsing in this case. */ in rpi_firmware_property_list()
110 buf[size / 4 - 1] = RPI_FIRMWARE_PROPERTY_END; in rpi_firmware_property_list()
121 * But single-tag is the most common, so go with it. in rpi_firmware_property_list()
123 dev_err(fw->cl.dev, "Request 0x%08x returned status 0x%08x\n", in rpi_firmware_property_list()
125 ret = -EINVAL; in rpi_firmware_property_list()
128 dma_free_coherent(fw->cl.dev, PAGE_ALIGN(size), buf, bus_addr); in rpi_firmware_property_list()
135 * rpi_firmware_property - Submit single firmware property
136 * @fw: Pointer to firmware structure from rpi_firmware_get().
141 * Submits a single tag to the VPU firmware through the mailbox
162 return -ENOMEM; in rpi_firmware_property()
165 header->tag = tag; in rpi_firmware_property()
166 header->buf_size = buf_size; in rpi_firmware_property()
167 header->req_resp_size = 0; in rpi_firmware_property()
194 dev_info(fw->cl.dev, "Attached to firmware from %ptT\n", &date_and_time); in rpi_firmware_print_firmware_revision()
207 rpi_hwmon = platform_device_register_data(dev, "raspberrypi-hwmon", in rpi_register_hwmon_driver()
208 -1, NULL, 0); in rpi_register_hwmon_driver()
213 struct device_node *firmware; in rpi_register_clk_driver() local
216 * Earlier DTs don't have a node for the firmware clocks but in rpi_register_clk_driver()
218 * have a node for the firmware clocks, just bail out here. in rpi_register_clk_driver()
220 firmware = of_get_compatible_child(dev->of_node, in rpi_register_clk_driver()
221 "raspberrypi,firmware-clocks"); in rpi_register_clk_driver()
222 if (firmware) { in rpi_register_clk_driver()
223 of_node_put(firmware); in rpi_register_clk_driver()
227 rpi_clk = platform_device_register_data(dev, "raspberrypi-clk", in rpi_register_clk_driver()
228 -1, NULL, 0); in rpi_register_clk_driver()
236 mbox_free_channel(fw->chan); in rpi_firmware_delete()
242 kref_put(&fw->consumers, rpi_firmware_delete); in rpi_firmware_put()
255 struct device *dev = &pdev->dev; in rpi_firmware_probe()
260 * released their firmware handles. Don't use devm_kzalloc() here. in rpi_firmware_probe()
264 return -ENOMEM; in rpi_firmware_probe()
266 fw->cl.dev = dev; in rpi_firmware_probe()
267 fw->cl.rx_callback = response_callback; in rpi_firmware_probe()
268 fw->cl.tx_block = true; in rpi_firmware_probe()
270 fw->chan = mbox_request_channel(&fw->cl, 0); in rpi_firmware_probe()
271 if (IS_ERR(fw->chan)) { in rpi_firmware_probe()
272 int ret = PTR_ERR(fw->chan); in rpi_firmware_probe()
273 if (ret != -EPROBE_DEFER) in rpi_firmware_probe()
278 init_completion(&fw->c); in rpi_firmware_probe()
279 kref_init(&fw->consumers); in rpi_firmware_probe()
315 * rpi_firmware_get - Get pointer to rpi_firmware structure.
316 * @firmware_node: Pointer to the firmware Device Tree node.
320 * Returns NULL is the firmware device is not ready.
334 if (!kref_get_unless_zero(&fw->consumers)) in rpi_firmware_get()
337 put_device(&pdev->dev); in rpi_firmware_get()
342 put_device(&pdev->dev); in rpi_firmware_get()
348 * devm_rpi_firmware_get - Get pointer to rpi_firmware structure.
349 * @firmware_node: Pointer to the firmware Device Tree node.
351 * Returns NULL is the firmware device is not ready.
370 { .compatible = "raspberrypi,bcm2835-firmware", },
377 .name = "raspberrypi-firmware",
387 MODULE_DESCRIPTION("Raspberry Pi firmware driver");