diff options
author | Sujeev Dias <sdias@codeaurora.org> | 2016-11-29 18:02:23 -0800 |
---|---|---|
committer | Sujeev Dias <sdias@codeaurora.org> | 2017-03-11 12:02:02 -0800 |
commit | 75edc331a7bc105e5382f606d074f92b8d0a838c (patch) | |
tree | 84d9abc4762d1e74729bbfed26e8af0d78de195c /include/linux | |
parent | 6f370e6a8be6cf4cd01b9a3748fecb7a31924d57 (diff) |
mhi: core: add support for MHI to operate on slave mode
MHI host is not always the bus master. Add support to
operate on slave mode.
CRs-Fixed: 1095436
Change-Id: I4af92c8171cf9ba38267afa753cec33f291d55eb
Signed-off-by: Sujeev Dias <sdias@codeaurora.org>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/msm_mhi.h | 61 |
1 files changed, 56 insertions, 5 deletions
diff --git a/include/linux/msm_mhi.h b/include/linux/msm_mhi.h index d5325e038e07..b9fd610f92da 100644 --- a/include/linux/msm_mhi.h +++ b/include/linux/msm_mhi.h @@ -18,6 +18,7 @@ #define MHI_MAX_MTU 0xFFFF struct mhi_client_config; +struct mhi_device_ctxt; enum MHI_CLIENT_CHANNEL { MHI_CLIENT_LOOPBACK_OUT = 0, @@ -71,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 { @@ -123,6 +124,35 @@ struct __packed bhi_vec_entry { }; /** + * 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 @@ -134,6 +164,27 @@ 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 |