remoteproc updates for v4.14

This adds and improves remoteproc support for TI DA8xx/OMAP-L13x DSP, TI
 Keystone 66AK2G DSP and iMX6SX/7D Cortex M4 coprocessors. It introduces the
 Qualcomm restart notifier and a few fixes.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJZswmrAAoJEAsfOT8Nma3FVAwP/1SEQkDsfrx9HIVtm9zSy7h5
 DJ2dAUVMATJkTiDU8djz/KttL9bOLIcG5u0hiNbtPELm/5t3qAHiN8axO0w5Oxrv
 0xO2yIwzxyhOU4cI8k+RWReTcihSqBYs5nHDXXhbhO5IKiaIfAQWljL6H1rL41gH
 SnKEuQuXfD6j/cvRyHEh10EWfDrVMnaim9aK3OiSz6i6YRyRC3r2VT+KiRnbaLq0
 XIk1HATM6xEd6YfAeiuPZh6SbKuEibsBoPVQpAl9HjZvKY+n1dC11solohAEMYFC
 r222I6LYPRy5eteLnSqhTYof5l+pd9/eECIuXCdvxGfbkPhyPf7/K3WI3iV9sD8a
 h+QM22IpiwSzxnJPNJzmYtPnhqfOHZQTb64Fp2xiTTYa/ILbSH7VCAohxofEaheS
 8rtIJqGhxT1WINvcBaoxwhL/CMMnBL+TlrqlAc5Qjd9zKFhJu4rcv1oQFNGMBMrN
 WY4R4x//oYgfmagIBEkmxMEcVMoJeI34AsbtSvazmcIQdvpcJ3Y0AMa+Ly0eyzBf
 RoTJY9y/Q3Y2DjcJoK+6iFeGRo0qI8/ytkKC6wb3RpaTnbDQ39X3GfCICwhsDCh7
 uv19AmG5M26VRHxjlNnLpJp8jG3Up335TYQhkXV/CZYZcOxTmfJjGe3ItxOK/tTz
 YMv+IR72T/M+feeAS4Ge
 =R9dP
 -----END PGP SIGNATURE-----

Merge tag 'rproc-v4.14' of git://github.com/andersson/remoteproc

Pull remoteproc updates from Bjorn Andersson:
 "This adds and improves remoteproc support for TI DA8xx/OMAP-L13x DSP,
  TI Keystone 66AK2G DSP and iMX6SX/7D Cortex M4 coprocessors. It
  introduces the Qualcomm restart notifier and a few fixes"

* tag 'rproc-v4.14' of git://github.com/andersson/remoteproc:
  remoteproc: Introduce rproc handle accessor for children
  remoteproc: qcom: Make ssr_notifiers local
  remoteproc: Stop subdevices in reverse order
  remoteproc: imx_rproc: add a NXP/Freescale imx_rproc driver
  remoteproc: dt: Provide bindings for iMX6SX/7D Remote Processor Controller driver
  remoteproc: qcom: Use PTR_ERR_OR_ZERO
  remoteproc: st: explicitly request exclusive reset control
  remoteproc: qcom: explicitly request exclusive reset control
  remoteproc/keystone: explicitly request exclusive reset control
  remoteproc/keystone: Add support for Keystone 66AK2G SOCs
  remoteproc/davinci: Add device tree support for OMAP-L138 DSP
  dt-bindings: remoteproc: Add bindings for Davinci DSP processors
  remoteproc/davinci: Add support to parse internal memories
  remoteproc/davinci: Switch to platform_get_resource_byname()
  remoteproc: make device_type const
  soc: qcom: GLINK SSR notifier
  remoteproc: qcom: Add support for SSR notifications
  remoteproc: Merge __rproc_boot() with rproc_boot()
This commit is contained in:
Linus Torvalds 2017-09-09 14:30:50 -07:00
commit d7efc352ab
20 changed files with 1032 additions and 37 deletions

View file

@ -1,6 +1,15 @@
#
# QCOM Soc drivers
#
config QCOM_GLINK_SSR
tristate "Qualcomm Glink SSR driver"
depends on RPMSG
depends on QCOM_RPROC_COMMON
help
Say y here to enable GLINK SSR support. The GLINK SSR driver
implements the SSR protocol for notifying the remote processor about
neighboring subsystems going up or down.
config QCOM_GSBI
tristate "QCOM General Serial Bus Interface"
depends on ARCH_QCOM

View file

@ -1,3 +1,4 @@
obj-$(CONFIG_QCOM_GLINK_SSR) += glink_ssr.o
obj-$(CONFIG_QCOM_GSBI) += qcom_gsbi.o
obj-$(CONFIG_QCOM_MDT_LOADER) += mdt_loader.o
obj-$(CONFIG_QCOM_PM) += spm.o

View file

@ -0,0 +1,164 @@
/*
* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
* Copyright (c) 2017, Linaro Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <linux/completion.h>
#include <linux/module.h>
#include <linux/notifier.h>
#include <linux/rpmsg.h>
#include <linux/remoteproc/qcom_rproc.h>
/**
* struct do_cleanup_msg - The data structure for an SSR do_cleanup message
* version: The G-Link SSR protocol version
* command: The G-Link SSR command - do_cleanup
* seq_num: Sequence number
* name_len: Length of the name of the subsystem being restarted
* name: G-Link edge name of the subsystem being restarted
*/
struct do_cleanup_msg {
__le32 version;
__le32 command;
__le32 seq_num;
__le32 name_len;
char name[32];
};
/**
* struct cleanup_done_msg - The data structure for an SSR cleanup_done message
* version: The G-Link SSR protocol version
* response: The G-Link SSR response to a do_cleanup command, cleanup_done
* seq_num: Sequence number
*/
struct cleanup_done_msg {
__le32 version;
__le32 response;
__le32 seq_num;
};
/**
* G-Link SSR protocol commands
*/
#define GLINK_SSR_DO_CLEANUP 0
#define GLINK_SSR_CLEANUP_DONE 1
struct glink_ssr {
struct device *dev;
struct rpmsg_endpoint *ept;
struct notifier_block nb;
u32 seq_num;
struct completion completion;
};
static int qcom_glink_ssr_callback(struct rpmsg_device *rpdev,
void *data, int len, void *priv, u32 addr)
{
struct cleanup_done_msg *msg = data;
struct glink_ssr *ssr = dev_get_drvdata(&rpdev->dev);
if (len < sizeof(*msg)) {
dev_err(ssr->dev, "message too short\n");
return -EINVAL;
}
if (le32_to_cpu(msg->version) != 0)
return -EINVAL;
if (le32_to_cpu(msg->response) != GLINK_SSR_CLEANUP_DONE)
return 0;
if (le32_to_cpu(msg->seq_num) != ssr->seq_num) {
dev_err(ssr->dev, "invalid sequence number of response\n");
return -EINVAL;
}
complete(&ssr->completion);
return 0;
}
static int qcom_glink_ssr_notify(struct notifier_block *nb, unsigned long event,
void *data)
{
struct glink_ssr *ssr = container_of(nb, struct glink_ssr, nb);
struct do_cleanup_msg msg;
char *ssr_name = data;
int ret;
ssr->seq_num++;
reinit_completion(&ssr->completion);
memset(&msg, 0, sizeof(msg));
msg.command = cpu_to_le32(GLINK_SSR_DO_CLEANUP);
msg.seq_num = cpu_to_le32(ssr->seq_num);
msg.name_len = cpu_to_le32(strlen(ssr_name));
strlcpy(msg.name, ssr_name, sizeof(msg.name));
ret = rpmsg_send(ssr->ept, &msg, sizeof(msg));
if (ret < 0)
dev_err(ssr->dev, "failed to send cleanup message\n");
ret = wait_for_completion_timeout(&ssr->completion, HZ);
if (!ret)
dev_err(ssr->dev, "timeout waiting for cleanup done message\n");
return NOTIFY_DONE;
}
static int qcom_glink_ssr_probe(struct rpmsg_device *rpdev)
{
struct glink_ssr *ssr;
ssr = devm_kzalloc(&rpdev->dev, sizeof(*ssr), GFP_KERNEL);
if (!ssr)
return -ENOMEM;
init_completion(&ssr->completion);
ssr->dev = &rpdev->dev;
ssr->ept = rpdev->ept;
ssr->nb.notifier_call = qcom_glink_ssr_notify;
dev_set_drvdata(&rpdev->dev, ssr);
return qcom_register_ssr_notifier(&ssr->nb);
}
static void qcom_glink_ssr_remove(struct rpmsg_device *rpdev)
{
struct glink_ssr *ssr = dev_get_drvdata(&rpdev->dev);
qcom_unregister_ssr_notifier(&ssr->nb);
}
static const struct rpmsg_device_id qcom_glink_ssr_match[] = {
{ "glink_ssr" },
{}
};
static struct rpmsg_driver qcom_glink_ssr_driver = {
.probe = qcom_glink_ssr_probe,
.remove = qcom_glink_ssr_remove,
.callback = qcom_glink_ssr_callback,
.id_table = qcom_glink_ssr_match,
.drv = {
.name = "qcom_glink_ssr",
},
};
module_rpmsg_driver(qcom_glink_ssr_driver);
MODULE_ALIAS("rpmsg:glink_ssr");
MODULE_DESCRIPTION("Qualcomm GLINK SSR notifier");
MODULE_LICENSE("GPL v2");