diff options
author | Chris Lew <clew@codeaurora.org> | 2016-10-31 17:51:51 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-06-30 17:00:57 -0700 |
commit | f7efb003b3a14ebdd9764588c14d8937d1b970a1 (patch) | |
tree | 1de5105fd9f831971500d6c1eb4f4b065cce3018 | |
parent | c1a5075d60955f6e4a15ce94aebd746c27684466 (diff) |
soc: qcom: ipc_router_mhi_xprt: Refactor for MHI register
The MHI driver is changing their APIs to use the device
node during registration. This change accommodates the
API changes and callback state changes.
CRs-Fixed: 1095436
Change-Id: I1899d97d676c28b89bb5f85c1a92732f6cfec904
Signed-off-by: Chris Lew <clew@codeaurora.org>
Signed-off-by: Sujeev Dias <sdias@codeaurora.org>
-rw-r--r-- | Documentation/devicetree/bindings/arm/msm/msm_ipc_router_mhi_xprt.txt | 14 | ||||
-rw-r--r-- | drivers/soc/qcom/ipc_router_mhi_xprt.c | 46 |
2 files changed, 41 insertions, 19 deletions
diff --git a/Documentation/devicetree/bindings/arm/msm/msm_ipc_router_mhi_xprt.txt b/Documentation/devicetree/bindings/arm/msm/msm_ipc_router_mhi_xprt.txt index de5ab2c37967..2ef119e74bda 100644 --- a/Documentation/devicetree/bindings/arm/msm/msm_ipc_router_mhi_xprt.txt +++ b/Documentation/devicetree/bindings/arm/msm/msm_ipc_router_mhi_xprt.txt @@ -1,18 +1,20 @@ Qualcomm Technologies, Inc. IPC Router MHI Transport Required properties: --compatible: should be "qcom,ipc_router_mhi_xprt" --qcom,out-chan-id: MHI Channel ID for the transmit path --qcom,in-chan-id: MHI Channel ID for the receive path --qcom,xprt-remote: string that defines the edge of the transport (PIL Name) +-compatible: should be "qcom,ipc_router_mhi_xprt". +-qcom,mhi: phandle of MHI Device to connect to. +-qcom,out-chan-id: MHI Channel ID for the transmit path. +-qcom,in-chan-id: MHI Channel ID for the receive path. +-qcom,xprt-remote: string that defines the edge of the transport(PIL Name). -qcom,xprt-linkid: unique integer to identify the tier to which the link belongs to in the network and is used to avoid the - routing loops while forwarding the broadcast messages --qcom,xprt-version: unique version ID used by MHI transport header + routing loops while forwarding the broadcast messages. +-qcom,xprt-version: unique version ID used by MHI transport header. Example: qcom,ipc_router_external_modem_xprt2 { compatible = "qcom,ipc_router_mhi_xprt"; + qcom,mhi = <&mhi_wlan>; qcom,out-chan-id = <34>; qcom,in-chan-id = <35>; qcom,xprt-remote = "external-modem"; diff --git a/drivers/soc/qcom/ipc_router_mhi_xprt.c b/drivers/soc/qcom/ipc_router_mhi_xprt.c index e5f6104bd7de..313b3fa7b1be 100644 --- a/drivers/soc/qcom/ipc_router_mhi_xprt.c +++ b/drivers/soc/qcom/ipc_router_mhi_xprt.c @@ -753,7 +753,8 @@ static void ipc_router_mhi_xprt_cb(struct mhi_cb_info *cb_info) mhi_xprtp = (struct ipc_router_mhi_xprt *)(cb_info->result->user_data); switch (cb_info->cb_reason) { case MHI_CB_MHI_ENABLED: - case MHI_CB_MHI_DISABLED: + case MHI_CB_MHI_SHUTDOWN: + case MHI_CB_SYS_ERROR: xprt_work = kmalloc(sizeof(*xprt_work), GFP_KERNEL); if (!xprt_work) { IPC_RTR_ERR("%s: Couldn't handle %d event on %s\n", @@ -772,6 +773,9 @@ static void ipc_router_mhi_xprt_cb(struct mhi_cb_info *cb_info) case MHI_CB_XFER: mhi_xprt_xfer_event(cb_info); break; + case MHI_CB_MHI_DISABLED: + D("%s: Recv DISABLED cb on chan %d\n", __func__, cb_info->chan); + break; default: IPC_RTR_ERR("%s: Invalid cb reason %x\n", __func__, cb_info->cb_reason); @@ -788,22 +792,37 @@ static void ipc_router_mhi_xprt_cb(struct mhi_cb_info *cb_info) * This function is called when a new XPRT is added. */ static int ipc_router_mhi_driver_register( - struct ipc_router_mhi_xprt *mhi_xprtp) + struct ipc_router_mhi_xprt *mhi_xprtp, struct device *dev) { - int rc_status; - - rc_status = mhi_register_channel(&mhi_xprtp->ch_hndl.out_handle, NULL); - if (rc_status) { + int rc; + const char *node_name = "qcom,mhi"; + struct mhi_client_info_t *mhi_info; + + if (!mhi_is_device_ready(dev, node_name)) + return -EPROBE_DEFER; + + mhi_info = &mhi_xprtp->ch_hndl.out_clnt_info; + mhi_info->chan = mhi_xprtp->ch_hndl.out_chan_id; + mhi_info->dev = dev; + mhi_info->node_name = node_name; + mhi_info->user_data = mhi_xprtp; + rc = mhi_register_channel(&mhi_xprtp->ch_hndl.out_handle, mhi_info); + if (rc) { IPC_RTR_ERR("%s: Error %d registering out_chan for %s\n", - __func__, rc_status, mhi_xprtp->xprt_name); + __func__, rc, mhi_xprtp->xprt_name); return -EFAULT; } - rc_status = mhi_register_channel(&mhi_xprtp->ch_hndl.in_handle, NULL); - if (rc_status) { + mhi_info = &mhi_xprtp->ch_hndl.in_clnt_info; + mhi_info->chan = mhi_xprtp->ch_hndl.in_chan_id; + mhi_info->dev = dev; + mhi_info->node_name = node_name; + mhi_info->user_data = mhi_xprtp; + rc = mhi_register_channel(&mhi_xprtp->ch_hndl.in_handle, mhi_info); + if (rc) { mhi_deregister_channel(mhi_xprtp->ch_hndl.out_handle); IPC_RTR_ERR("%s: Error %d registering in_chan for %s\n", - __func__, rc_status, mhi_xprtp->xprt_name); + __func__, rc, mhi_xprtp->xprt_name); return -EFAULT; } return 0; @@ -820,7 +839,8 @@ static int ipc_router_mhi_driver_register( * the MHI XPRT configurations from device tree. */ static int ipc_router_mhi_config_init( - struct ipc_router_mhi_xprt_config *mhi_xprt_config) + struct ipc_router_mhi_xprt_config *mhi_xprt_config, + struct device *dev) { struct ipc_router_mhi_xprt *mhi_xprtp; char wq_name[XPRT_NAME_LEN]; @@ -879,7 +899,7 @@ static int ipc_router_mhi_config_init( INIT_LIST_HEAD(&mhi_xprtp->rx_addr_map_list); spin_lock_init(&mhi_xprtp->rx_addr_map_list_lock); - rc = ipc_router_mhi_driver_register(mhi_xprtp); + rc = ipc_router_mhi_driver_register(mhi_xprtp, dev); return rc; } @@ -963,7 +983,7 @@ static int ipc_router_mhi_xprt_probe(struct platform_device *pdev) return rc; } - rc = ipc_router_mhi_config_init(&mhi_xprt_config); + rc = ipc_router_mhi_config_init(&mhi_xprt_config, &pdev->dev); if (rc) { IPC_RTR_ERR("%s: init failed\n", __func__); return rc; |