This pull request adds SPDX to BCM2835 drivers, and fixes some bugs in
the firmware driver (silently hanging if the VPU doesn't respond to a mailbox transaction, and undersized buffers in the firmware property transactions for tags that aren't used yet in the upstream). -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE/JuuFDWp9/ZkuCBXtdYpNtH8nugFAlv9sfwACgkQtdYpNtH8 nugJFxAAmcu7Z979i1tD7jiy/lgmVPsS9W2zYv/lKrZscFPVh1Mqq3UApypFHgkK 0qjtawFRAwRPzYV7RpHkVREvJsqPTygxxrSgkNEZPsP/r3ytygbZfB7KhFnoF93X h2HH3czBTxsbajEDwG8BUW2bK8YoefaoaVB72oW6kslv3Mh4RPScf1UJHCRyVOgo 2BH9tq8dOaN+geqDX1VSVUb7r/lnUtwdykC5kxMmEBx5O272vzqBRvFMTFyABXxM q9jEAd91PbNzX/YgjSM00ZqGmoB3MlchnHPbU2UzeTBuLMhpOc9TiD+ZWxTw0YI1 AHPIZnZ2yOpOhQcR+pF3BsAIG3lxWe0Es8QV1hZWYtOMgmVcwU8ahWGBhFO48v2l zZIWeBP67nWWlK4mYXLFUhcDnIeM5ddcMiy1hsPdYpZn+3hM7iWBuZx4swmcKqHj 5Dsc45UpFbNgv98U3SKFznn8FsHXHBUvUJrlURBf/RVLiNH5E/chdjRLLQ7wlBV/ 5gS41QgkUxz+QorFqrB3TH9HaEK1tIE/YSpz9At8XPaujWBMebssHZBVSddqNXFR YvRIgRJ0LUBWqcMTzvNes3zUmbY9FZUXZson1UxtcsSkigrOj7nRPUMrlnA23pHE wxBRHy7SbVEuWFrxi8GW+79OKgkwvqqU/5x/YPTxjSnoX7NM23w= =Wn6c -----END PGP SIGNATURE----- gpgsig -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEm+Rq3+YGJdiR9yuFh9CWnEQHBwQFAlv90nAACgkQh9CWnEQH BwSzIhAApvM869EXH3+SKWBNJYCPVk74eVlCsqEhPE21VHJxDo3i4S223ATkwUlP YrEtmbY1q61bfwaImlg8NhKPkbQ2MU9OKH5HOiOcfnftpHWfltGQWfhjFEGaY0zM aNxTMF/6JzY//VYF+nT3JL0Y3cZkBInjnr5Nm4XQAkuzUkpXnT3arYii9q4IFDId eHyBbANmAvkU6JbupEYe05pXdfFrN5W6sSUw9oAALR1SedphkcXBhgPklIO4mhsA E1LWswVl3PaoWlIycjjElU9I7Axb6A5ECpgZ0esbeIC7hQMbSMvXjxJorIfF6gq+ 4Dvcb9PFmHg/bBrC3gIndJP0W707dyJldIWqYtcZMzbjcLMFzO4l74EoiDOcUD2E ZCbipRLJqdA2jQ1DYcxgWfkdsomEAhqPOlMJ+OqvVXSBf36aYVNCVq+RGlUS5XMB uv02mvbJ5BHyKLf+VdZwkAU3WeIJ7cP35ywNdqWy47u89aRF0elOK6BWAuL6HI2Y FXrIgFxmb5QuL3JQVulpiij6iCwmSZjoOlcLDJhAGj0a6/AYcmYhn/nznZ9Y2uTM j+8yA//FrE5CnKW506OST31CSwf28u0Q2rFeFu581AJSvSeY3LLvarh7N5PNLvM3 l89TNCfWSKxvXA1/H6/Nrc4TCPKIH3egzpFMxQMAnyk35VV9CNE= =5L8p -----END PGP SIGNATURE----- Merge tag 'tags/bcm2835-drivers-next-2018-11-27' into drivers/next This pull request adds SPDX to BCM2835 drivers, and fixes some bugs in the firmware driver (silently hanging if the VPU doesn't respond to a mailbox transaction, and undersized buffers in the firmware property transactions for tags that aren't used yet in the upstream). Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
This commit is contained in:
commit
34758f8155
|
@ -1,12 +1,9 @@
|
||||||
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
/*
|
/*
|
||||||
* Defines interfaces for interacting wtih the Raspberry Pi firmware's
|
* Defines interfaces for interacting wtih the Raspberry Pi firmware's
|
||||||
* property channel.
|
* property channel.
|
||||||
*
|
*
|
||||||
* Copyright © 2015 Broadcom
|
* Copyright © 2015 Broadcom
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/dma-mapping.h>
|
#include <linux/dma-mapping.h>
|
||||||
|
@ -14,6 +11,7 @@
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/of_platform.h>
|
#include <linux/of_platform.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
|
#include <linux/slab.h>
|
||||||
#include <soc/bcm2835/raspberrypi-firmware.h>
|
#include <soc/bcm2835/raspberrypi-firmware.h>
|
||||||
|
|
||||||
#define MBOX_MSG(chan, data28) (((data28) & ~0xf) | ((chan) & 0xf))
|
#define MBOX_MSG(chan, data28) (((data28) & ~0xf) | ((chan) & 0xf))
|
||||||
|
@ -21,8 +19,6 @@
|
||||||
#define MBOX_DATA28(msg) ((msg) & ~0xf)
|
#define MBOX_DATA28(msg) ((msg) & ~0xf)
|
||||||
#define MBOX_CHAN_PROPERTY 8
|
#define MBOX_CHAN_PROPERTY 8
|
||||||
|
|
||||||
#define MAX_RPI_FW_PROP_BUF_SIZE 32
|
|
||||||
|
|
||||||
static struct platform_device *rpi_hwmon;
|
static struct platform_device *rpi_hwmon;
|
||||||
|
|
||||||
struct rpi_firmware {
|
struct rpi_firmware {
|
||||||
|
@ -56,8 +52,12 @@ rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data)
|
||||||
reinit_completion(&fw->c);
|
reinit_completion(&fw->c);
|
||||||
ret = mbox_send_message(fw->chan, &message);
|
ret = mbox_send_message(fw->chan, &message);
|
||||||
if (ret >= 0) {
|
if (ret >= 0) {
|
||||||
wait_for_completion(&fw->c);
|
if (wait_for_completion_timeout(&fw->c, HZ)) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
} else {
|
||||||
|
ret = -ETIMEDOUT;
|
||||||
|
WARN_ONCE(1, "Firmware transaction timeout");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
dev_err(fw->cl.dev, "mbox_send_message returned %d\n", ret);
|
dev_err(fw->cl.dev, "mbox_send_message returned %d\n", ret);
|
||||||
}
|
}
|
||||||
|
@ -144,28 +144,30 @@ EXPORT_SYMBOL_GPL(rpi_firmware_property_list);
|
||||||
int rpi_firmware_property(struct rpi_firmware *fw,
|
int rpi_firmware_property(struct rpi_firmware *fw,
|
||||||
u32 tag, void *tag_data, size_t buf_size)
|
u32 tag, void *tag_data, size_t buf_size)
|
||||||
{
|
{
|
||||||
/* Single tags are very small (generally 8 bytes), so the
|
struct rpi_firmware_property_tag_header *header;
|
||||||
* stack should be safe.
|
|
||||||
*/
|
|
||||||
u8 data[sizeof(struct rpi_firmware_property_tag_header) +
|
|
||||||
MAX_RPI_FW_PROP_BUF_SIZE];
|
|
||||||
struct rpi_firmware_property_tag_header *header =
|
|
||||||
(struct rpi_firmware_property_tag_header *)data;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (WARN_ON(buf_size > sizeof(data) - sizeof(*header)))
|
/* Some mailboxes can use over 1k bytes. Rather than checking
|
||||||
return -EINVAL;
|
* size and using stack or kmalloc depending on requirements,
|
||||||
|
* just use kmalloc. Mailboxes don't get called enough to worry
|
||||||
|
* too much about the time taken in the allocation.
|
||||||
|
*/
|
||||||
|
void *data = kmalloc(sizeof(*header) + buf_size, GFP_KERNEL);
|
||||||
|
|
||||||
|
if (!data)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
header = data;
|
||||||
header->tag = tag;
|
header->tag = tag;
|
||||||
header->buf_size = buf_size;
|
header->buf_size = buf_size;
|
||||||
header->req_resp_size = 0;
|
header->req_resp_size = 0;
|
||||||
memcpy(data + sizeof(struct rpi_firmware_property_tag_header),
|
memcpy(data + sizeof(*header), tag_data, buf_size);
|
||||||
tag_data, buf_size);
|
|
||||||
|
|
||||||
ret = rpi_firmware_property_list(fw, &data, buf_size + sizeof(*header));
|
ret = rpi_firmware_property_list(fw, data, buf_size + sizeof(*header));
|
||||||
memcpy(tag_data,
|
|
||||||
data + sizeof(struct rpi_firmware_property_tag_header),
|
memcpy(tag_data, data + sizeof(*header), buf_size);
|
||||||
buf_size);
|
|
||||||
|
kfree(data);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
/* (C) 2015 Pengutronix, Alexander Aring <aar@pengutronix.de>
|
/* (C) 2015 Pengutronix, Alexander Aring <aar@pengutronix.de>
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* Alexander Aring <aar@pengutronix.de>
|
* Alexander Aring <aar@pengutronix.de>
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
|
/* SPDX-License-Identifier: GPL-2.0 */
|
||||||
/*
|
/*
|
||||||
* Copyright © 2015 Broadcom
|
* Copyright © 2015 Broadcom
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _DT_BINDINGS_ARM_BCM2835_RPI_POWER_H
|
#ifndef _DT_BINDINGS_ARM_BCM2835_RPI_POWER_H
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
|
/* SPDX-License-Identifier: GPL-2.0 */
|
||||||
/*
|
/*
|
||||||
* Copyright © 2015 Broadcom
|
* Copyright © 2015 Broadcom
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __SOC_RASPBERRY_FIRMWARE_H__
|
#ifndef __SOC_RASPBERRY_FIRMWARE_H__
|
||||||
|
|
Loading…
Reference in New Issue