summaryrefslogtreecommitdiff
path: root/include/linux/msm_mhi.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/msm_mhi.h')
-rw-r--r--include/linux/msm_mhi.h110
1 files changed, 92 insertions, 18 deletions
diff --git a/include/linux/msm_mhi.h b/include/linux/msm_mhi.h
index f8ba31ea7573..b9fd610f92da 100644
--- a/include/linux/msm_mhi.h
+++ b/include/linux/msm_mhi.h
@@ -12,12 +12,14 @@
#ifndef MSM_MHI_H
#define MSM_MHI_H
#include <linux/types.h>
-
-struct mhi_client_handle;
+#include <linux/device.h>
#define MHI_DMA_MASK 0xFFFFFFFFFFULL
#define MHI_MAX_MTU 0xFFFF
+struct mhi_client_config;
+struct mhi_device_ctxt;
+
enum MHI_CLIENT_CHANNEL {
MHI_CLIENT_LOOPBACK_OUT = 0,
MHI_CLIENT_LOOPBACK_IN = 1,
@@ -70,11 +72,11 @@ enum MHI_CLIENT_CHANNEL {
};
enum MHI_CB_REASON {
- MHI_CB_XFER = 0x0,
- MHI_CB_MHI_DISABLED = 0x4,
- MHI_CB_MHI_ENABLED = 0x8,
- MHI_CB_CHAN_RESET_COMPLETE = 0x10,
- MHI_CB_reserved = 0x80000000,
+ MHI_CB_XFER,
+ MHI_CB_MHI_DISABLED,
+ MHI_CB_MHI_ENABLED,
+ MHI_CB_MHI_SHUTDOWN,
+ MHI_CB_SYS_ERROR,
};
enum MHI_FLAGS {
@@ -99,10 +101,90 @@ struct mhi_cb_info {
};
struct mhi_client_info_t {
+ enum MHI_CLIENT_CHANNEL chan;
+ const struct device *dev;
+ const char *node_name;
void (*mhi_client_cb)(struct mhi_cb_info *);
+ bool pre_allocate;
+ size_t max_payload;
+ void *user_data;
+};
+
+struct mhi_client_handle {
+ u32 dev_id;
+ u32 domain;
+ u32 bus;
+ u32 slot;
+ struct mhi_client_config *client_config;
+};
+
+struct __packed bhi_vec_entry {
+ u64 phys_addr;
+ u64 size;
+};
+
+/**
+ * struct mhi_device - IO resources for MHI
+ * @dev: device node points to of_node
+ * @pdev: pci device node
+ * @resource: bar memory space and IRQ resources
+ * @pm_runtime_get: fp for bus masters rpm pm_runtime_get
+ * @pm_runtime_noidle: fp for bus masters rpm pm_runtime_noidle
+ * @mhi_dev_ctxt: private data for host
+ */
+struct mhi_device {
+ struct device *dev;
+ struct pci_dev *pci_dev;
+ struct resource resources[2];
+ int (*pm_runtime_get)(struct pci_dev *pci_dev);
+ void (*pm_runtime_noidle)(struct pci_dev *pci_dev);
+ struct mhi_device_ctxt *mhi_dev_ctxt;
+};
+
+enum mhi_dev_ctrl {
+ MHI_DEV_CTRL_INIT,
+ MHI_DEV_CTRL_DE_INIT,
+ MHI_DEV_CTRL_SUSPEND,
+ MHI_DEV_CTRL_RESUME,
+ MHI_DEV_CTRL_POWER_OFF,
+ MHI_DEV_CTRL_POWER_ON,
+ MHI_DEV_CTRL_RAM_DUMP,
+ MHI_DEV_CTRL_NOTIFY_LINK_ERROR,
};
/**
+ * mhi_is_device_ready - Check if MHI is ready to register clients
+ *
+ * @dev: device node that points to DT node
+ * @node_name: device tree node that links MHI node
+ *
+ * @Return true if ready
+ */
+bool mhi_is_device_ready(const struct device * const dev,
+ const char *node_name);
+
+/**
+ * mhi_resgister_device - register hardware resources with MHI
+ *
+ * @mhi_device: resources to be used
+ * @node_name: DT node name
+ * @userdata: cb data for client
+ * @Return 0 on success
+ */
+int mhi_register_device(struct mhi_device *mhi_device,
+ const char *node_name,
+ unsigned long user_data);
+
+/**
+ * mhi_pm_control_device - power management control api
+ * @mhi_device: registered device structure
+ * @ctrl: specific command
+ * @Return 0 on success
+ */
+int mhi_pm_control_device(struct mhi_device *mhi_device,
+ enum mhi_dev_ctrl ctrl);
+
+/**
* mhi_deregister_channel - de-register callbacks from MHI
*
* @client_handle: Handle populated by MHI, opaque to client
@@ -116,21 +198,13 @@ int mhi_deregister_channel(struct mhi_client_handle *client_handle);
* any MHI operations
*
* @client_handle: Handle populated by MHI, opaque to client
- * @chan: Channel provided by client to which the handle
- * maps to.
- * @device_index: MHI device for which client wishes to register, if
- * there are multiple devices supporting MHI. Client
- * should specify 0 for the first device 1 for second etc.
- * @info: Client provided callbacks which MHI will invoke on events
- * @user_data: Client provided context to be returned to client upon
- * callback invocation.
- * Not thread safe, caller must ensure concurrency protection.
+ * @client_info: Channel\device information provided by client to
+ * which the handle maps to.
*
* @Return errno
*/
int mhi_register_channel(struct mhi_client_handle **client_handle,
- enum MHI_CLIENT_CHANNEL chan, s32 device_index,
- struct mhi_client_info_t *client_info, void *user_data);
+ struct mhi_client_info_t *client_info);
/**
* mhi_open_channel - Client must call this function to open a channel