1 From be083fb29207201d3db279f9d5654c5f8c2cb6de Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org>
3 Date: Fri, 26 Jun 2015 14:26:10 +0200
4 Subject: [PATCH 115/121] firmware: bcm2835: Support legacy mailbox API
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 Add support for the bcm_mailbox_*() functions.
10 This is temporary until all drivers have been converted to the
11 firmware API (rpi_firmware_property*()).
13 Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
15 drivers/firmware/raspberrypi.c | 15 +++++++++++++--
16 include/soc/bcm2835/raspberrypi-firmware.h | 2 ++
17 2 files changed, 15 insertions(+), 2 deletions(-)
19 --- a/drivers/firmware/raspberrypi.c
20 +++ b/drivers/firmware/raspberrypi.c
22 #define MBOX_MSG(chan, data28) (((data28) & ~0xf) | ((chan) & 0xf))
23 #define MBOX_CHAN(msg) ((msg) & 0xf)
24 #define MBOX_DATA28(msg) ((msg) & ~0xf)
25 +#define MBOX_CHAN_VCHIQ 3
26 #define MBOX_CHAN_PROPERTY 8
29 @@ -26,6 +27,7 @@ struct rpi_firmware {
30 struct mbox_chan *chan; /* The property channel. */
36 static struct platform_device *g_pdev;
37 @@ -35,6 +37,7 @@ static DEFINE_MUTEX(transaction_lock);
38 static void response_callback(struct mbox_client *cl, void *msg)
40 struct rpi_firmware *fw = container_of(cl, struct rpi_firmware, cl);
41 + fw->received = *(u32 *)msg;
45 @@ -42,7 +45,7 @@ static void response_callback(struct mbo
46 * Sends a request to the firmware through the BCM2835 mailbox driver,
47 * and synchronously waits for the reply.
51 rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data)
53 u32 message = MBOX_MSG(chan, data);
54 @@ -54,7 +57,8 @@ rpi_firmware_transaction(struct rpi_firm
55 reinit_completion(&fw->c);
56 ret = mbox_send_message(fw->chan, &message);
58 - wait_for_completion(&fw->c);
59 + if (chan != MBOX_CHAN_VCHIQ)
60 + wait_for_completion(&fw->c);
63 dev_err(fw->cl.dev, "mbox_send_message returned %d\n", ret);
64 @@ -63,6 +67,13 @@ rpi_firmware_transaction(struct rpi_firm
68 +EXPORT_SYMBOL(rpi_firmware_transaction);
70 +u32 rpi_firmware_transaction_received(struct rpi_firmware *fw)
72 + return MBOX_DATA28(fw->received);
74 +EXPORT_SYMBOL(rpi_firmware_transaction_received);
77 * rpi_firmware_property_list - Submit firmware property list
78 --- a/include/soc/bcm2835/raspberrypi-firmware.h
79 +++ b/include/soc/bcm2835/raspberrypi-firmware.h
80 @@ -116,6 +116,8 @@ enum rpi_firmware_property_tag {
81 RPI_FIRMWARE_GET_DMA_CHANNELS = 0x00060001,
84 +int rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data);
85 +u32 rpi_firmware_transaction_received(struct rpi_firmware *fw);
86 int rpi_firmware_property(struct rpi_firmware *fw,
87 u32 tag, void *data, size_t len);
88 int rpi_firmware_property_list(struct rpi_firmware *fw,