Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 56be5bb9 authored by Chris Lew's avatar Chris Lew Committed by Gerrit - the friendly Code Review server
Browse files

mailbox: Add snapshot of MSM QMP driver



This is a snapshot of the MSM QMP driver taken of msm-4.9 commit
<ea5c48deabd8> (Merge "msm: sde: avoid request dereference with cached
sequence id").

In addition, remove dependency on MSM_SMEM from KConfig.

Change-Id: I465e09a7d49d808d0388d2795db2fcfb577b1514
Signed-off-by: default avatarChris Lew <clew@codeaurora.org>
parent e8a6c8c8
Loading
Loading
Loading
Loading
+57 −0
Original line number Diff line number Diff line
Qualcomm Technologies, Inc. QTI Mailbox Protocol

QMP Driver
===================

Required properties:
- compatible : should be "qcom,qmp-mbox".
- label : the name of the remote proc this link connects to.
- reg : The location and size of shared memory.
	The irq register base address for triggering interrupts.
- reg-names : "msgram" - string to identify the shared memory region.
	"irq-reg-base" - string to identify the irq register region.
- qcom,irq-mask : the bitmask to trigger an interrupt.
- interrupt : the receiving interrupt line.
- mbox-desc-offset : offset of mailbox descriptor from start of the msgram.
- priority : the priority of this mailbox compared to other mailboxes.
- #mbox-cells: Common mailbox binding property to identify the number of cells
		required for the mailbox specifier, should be 1.

Optional properties:
- mbox-offset : offset of the mcore mailbox from the offset of msgram. If this
			property is not used, qmp will use the configuration
			provided by the ucore.
- mbox-size : size of the mcore mailbox. If this property is not used, qmp will
			use the configuration provided by the ucore.

Example:
	qmp_aop: qcom,qmp-aop {
		compatible = "qcom,qmp-mbox";
		label = "aop";
		reg = <0xc300000 0x100000>,
			<0x1799000C 0x4>;
		reg-names = "msgram", "irq-reg-base";
		qcom,irq-mask = <0x1>;
		interrupt = <0 389 1>;
		mbox-desc-offset = <0x100>;
		priority = <1>;
		mbox-offset = <0x500>;
		mbox-size = <0x400>;
		#mbox-cells = <1>;
	};

Mailbox Client
==============
"mboxes" and the optional "mbox-names" (please see
Documentation/devicetree/bindings/mailbox/mailbox.txt for details). Each value
of the mboxes property should contain a phandle to the mailbox controller
device node and second argument is the channel index. It must be 0 (qmp
supports only one channel).The equivalent "mbox-names" property value can be
used to give a name to the communication channel to be used by the client user.

Example:
	qmp-client {
		compatible = "qcom,qmp-client";
		mbox-names = "aop";
		mboxes = <&qmp_aop 0>,
	};
+7 −0
Original line number Diff line number Diff line
@@ -178,4 +178,11 @@ config QTI_RPMH_MBOX
	  Support for communication with the hardened-RPM blocks in
	  Qualcomm Technologies Inc (QTI) SoCs using TCS hardware mailbox.

config MSM_QMP
         bool "QTI Mailbox Protocol(QMP)"
         help
           QMP is a lightweight communication protocol for sending messages to
           a remote processor. This protocol fits into the Generic Mailbox
           Framework. QMP uses a mailbox located in shared memory.

endif
+2 −0
Original line number Diff line number Diff line
@@ -38,3 +38,5 @@ obj-$(CONFIG_QCOM_APCS_IPC) += qcom-apcs-ipc-mailbox.o
obj-$(CONFIG_TEGRA_HSP_MBOX)	+= tegra-hsp.o

obj-$(CONFIG_QTI_RPMH_MBOX)	+= qcom-rpmh-mailbox.o

obj-$(CONFIG_MSM_QMP)   += msm_qmp.o
+936 −0

File added.

Preview size limit exceeded, changes collapsed.

+28 −0
Original line number Diff line number Diff line
/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
 *
 * 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.
 */

#ifndef _QMP_H_
#define _QMP_H_

#include <linux/types.h>

/**
 * struct qmp_pkt - Packet structure to be used for TX and RX with QMP
 * @size	size of data
 * @data	Buffer holding data of this packet
 */
struct qmp_pkt {
	u32 size;
	void *data;
};

#endif /* _QMP_H_ */