diag: Convert diag bridge as a platform dev
In order to support DT on DIAG, convert diag bridge driver to platform driver. Change-Id: I0ddecc06d9b4845d822799f3cff942789d1441c6 Signed-off-by: Sujeev Dias <sdias@codeaurora.org>
This commit is contained in:
parent
7aa065cbc4
commit
a828392297
4 changed files with 56 additions and 9 deletions
12
Documentation/devicetree/bindings/arm/msm/diag_mhi.txt
Normal file
12
Documentation/devicetree/bindings/arm/msm/diag_mhi.txt
Normal file
|
@ -0,0 +1,12 @@
|
|||
Qualcomm Technologies, Inc. Diag MHI Driver
|
||||
|
||||
Required properties:
|
||||
-compatible : should be "qcom,diag-mhi".
|
||||
-qcom,mhi : phandle of MHI Device to connect to.
|
||||
|
||||
Example:
|
||||
qcom,diag {
|
||||
compatible = "qcom,diag-mhi";
|
||||
qcom,mhi = <&mhi_wlan>;
|
||||
};
|
||||
|
|
@ -642,6 +642,7 @@ struct diagchar_dev {
|
|||
#endif
|
||||
int time_sync_enabled;
|
||||
uint8_t uses_time_api;
|
||||
struct platform_device *pdev;
|
||||
};
|
||||
|
||||
extern struct diagchar_dev *driver;
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include <linux/sched.h>
|
||||
#include <linux/ratelimit.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/msm_mhi.h>
|
||||
#ifdef CONFIG_DIAG_OVER_USB
|
||||
#include <linux/usb/usbdiag.h>
|
||||
#endif
|
||||
|
@ -3589,6 +3591,41 @@ static int diagchar_cleanup(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int diag_mhi_probe(struct platform_device *pdev)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!mhi_is_device_ready(&pdev->dev, "qcom,mhi"))
|
||||
return -EPROBE_DEFER;
|
||||
driver->pdev = pdev;
|
||||
ret = diag_remote_init();
|
||||
if (ret) {
|
||||
diag_remote_exit();
|
||||
return ret;
|
||||
}
|
||||
ret = diagfwd_bridge_init();
|
||||
if (ret) {
|
||||
diagfwd_bridge_exit();
|
||||
return ret;
|
||||
}
|
||||
pr_debug("diag: mhi device is ready\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id diag_mhi_table[] = {
|
||||
{.compatible = "qcom,diag-mhi"},
|
||||
{},
|
||||
};
|
||||
|
||||
static struct platform_driver diag_mhi_driver = {
|
||||
.probe = diag_mhi_probe,
|
||||
.driver = {
|
||||
.name = "DIAG MHI Platform",
|
||||
.owner = THIS_MODULE,
|
||||
.of_match_table = diag_mhi_table,
|
||||
},
|
||||
};
|
||||
|
||||
static int __init diagchar_init(void)
|
||||
{
|
||||
dev_t dev;
|
||||
|
@ -3676,9 +3713,6 @@ static int __init diagchar_init(void)
|
|||
if (ret)
|
||||
goto fail;
|
||||
ret = diag_masks_init();
|
||||
if (ret)
|
||||
goto fail;
|
||||
ret = diag_remote_init();
|
||||
if (ret)
|
||||
goto fail;
|
||||
ret = diag_mux_init();
|
||||
|
@ -3717,9 +3751,7 @@ static int __init diagchar_init(void)
|
|||
goto fail;
|
||||
|
||||
pr_debug("diagchar initialized now");
|
||||
ret = diagfwd_bridge_init();
|
||||
if (ret)
|
||||
diagfwd_bridge_exit();
|
||||
platform_driver_register(&diag_mhi_driver);
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
|
@ -3733,9 +3765,7 @@ fail:
|
|||
diagfwd_cntl_exit();
|
||||
diag_dci_exit();
|
||||
diag_masks_exit();
|
||||
diag_remote_exit();
|
||||
return -1;
|
||||
|
||||
}
|
||||
|
||||
static void diagchar_exit(void)
|
||||
|
|
|
@ -678,7 +678,11 @@ static int diag_mhi_register_ch(int id, struct diag_mhi_ch_t *ch)
|
|||
atomic_set(&(ch->opened), 0);
|
||||
ctxt = SET_CH_CTXT(id, ch->type);
|
||||
ch->client_info.mhi_client_cb = mhi_notifier;
|
||||
return mhi_register_channel(&ch->hdl, NULL);
|
||||
ch->client_info.chan = ch->chan;
|
||||
ch->client_info.dev = &driver->pdev->dev;
|
||||
ch->client_info.node_name = "qcom,mhi";
|
||||
ch->client_info.user_data = (void *)(uintptr_t)ctxt;
|
||||
return mhi_register_channel(&ch->hdl, &ch->client_info);
|
||||
}
|
||||
|
||||
int diag_mhi_init()
|
||||
|
|
Loading…
Add table
Reference in a new issue