diff --git a/Documentation/devicetree/bindings/arm/msm/diagfwd_usb.txt b/Documentation/devicetree/bindings/arm/msm/diagfwd_usb.txt new file mode 100644 index 000000000000..bb72ffe5fe66 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/msm/diagfwd_usb.txt @@ -0,0 +1,9 @@ +QTI Diag Forward USB Driver + +Required properties: +-compatible : should be "qcom,diagfwd-usb". + +Example: + qcom,diag { + compatible = "qcom,diagfwd-usb"; + }; diff --git a/arch/arm64/configs/msm-auto-perf_defconfig b/arch/arm64/configs/msm-auto-perf_defconfig index acf8acd6375c..81e18d05b0d0 100644 --- a/arch/arm64/configs/msm-auto-perf_defconfig +++ b/arch/arm64/configs/msm-auto-perf_defconfig @@ -428,6 +428,7 @@ CONFIG_USB_DWC3=y CONFIG_USB_ISP1760=y CONFIG_USB_EHSET_TEST_FIXTURE=y CONFIG_USB_QTI_KS_BRIDGE=y +CONFIG_USB_QCOM_DIAG_BRIDGE=y CONFIG_NOP_USB_XCEIV=y CONFIG_USB_MSM_SSPHY_QMP=y CONFIG_MSM_QUSB_PHY=y diff --git a/arch/arm64/configs/msm-auto_defconfig b/arch/arm64/configs/msm-auto_defconfig index 15b059a621ac..cc1000edbef0 100644 --- a/arch/arm64/configs/msm-auto_defconfig +++ b/arch/arm64/configs/msm-auto_defconfig @@ -432,6 +432,7 @@ CONFIG_USB_DWC3=y CONFIG_USB_ISP1760=y CONFIG_USB_EHSET_TEST_FIXTURE=y CONFIG_USB_QTI_KS_BRIDGE=y +CONFIG_USB_QCOM_DIAG_BRIDGE=y CONFIG_NOP_USB_XCEIV=y CONFIG_USB_MSM_SSPHY_QMP=y CONFIG_MSM_QUSB_PHY=y diff --git a/drivers/char/diag/Makefile b/drivers/char/diag/Makefile index c5ec4f081c55..d57ebd8d671e 100644 --- a/drivers/char/diag/Makefile +++ b/drivers/char/diag/Makefile @@ -1,6 +1,5 @@ obj-$(CONFIG_DIAG_CHAR) := diagchar.o obj-$(CONFIG_DIAGFWD_BRIDGE_CODE) += diagfwd_bridge.o obj-$(CONFIG_USB_QCOM_DIAG_BRIDGE) += diagfwd_hsic.o -obj-$(CONFIG_USB_QCOM_DIAG_BRIDGE) += diagfwd_smux.o obj-$(CONFIG_MSM_MHI) += diagfwd_mhi.o diagchar-objs := diagchar_core.o diagchar_hdlc.o diagfwd.o diagfwd_glink.o diagfwd_peripheral.o diagfwd_smd.o diagfwd_socket.o diag_mux.o diag_memorydevice.o diag_usb.o diagmem.o diagfwd_cntl.o diag_dci.o diag_masks.o diag_debugfs.o diff --git a/drivers/char/diag/diag_debugfs.c b/drivers/char/diag/diag_debugfs.c index 5e455878ac3e..ad370ada335f 100644 --- a/drivers/char/diag/diag_debugfs.c +++ b/drivers/char/diag/diag_debugfs.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2018, 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 @@ -23,7 +23,6 @@ #endif #ifdef CONFIG_USB_QCOM_DIAG_BRIDGE #include "diagfwd_hsic.h" -#include "diagfwd_smux.h" #endif #ifdef CONFIG_MSM_MHI #include "diagfwd_mhi.h" diff --git a/drivers/char/diag/diagchar_core.c b/drivers/char/diag/diagchar_core.c index 6df597dfa750..32f70fa2d37c 100644 --- a/drivers/char/diag/diagchar_core.c +++ b/drivers/char/diag/diagchar_core.c @@ -1160,7 +1160,7 @@ static void diag_remote_exit(void) return; } -int diagfwd_bridge_init(void) +int diagfwd_bridge_init(bool use_mhi) { return 0; } @@ -3743,7 +3743,7 @@ static int diag_mhi_probe(struct platform_device *pdev) diag_remote_exit(); return ret; } - ret = diagfwd_bridge_init(); + ret = diagfwd_bridge_init(true); if (ret) { diagfwd_bridge_exit(); return ret; @@ -3766,6 +3766,39 @@ static struct platform_driver diag_mhi_driver = { }, }; +static int diagfwd_usb_probe(struct platform_device *pdev) +{ + int ret; + + driver->pdev = pdev; + ret = diag_remote_init(); + if (ret) { + diag_remote_exit(); + return ret; + } + ret = diagfwd_bridge_init(false); + if (ret) { + diagfwd_bridge_exit(); + return ret; + } + pr_debug("diag: usb device is ready\n"); + return 0; +} + +static const struct of_device_id diagfwd_usb_table[] = { + {.compatible = "qcom,diagfwd-usb"}, + {}, +}; + +static struct platform_driver diagfwd_usb_driver = { + .probe = diagfwd_usb_probe, + .driver = { + .name = "DIAGFWD USB Platform", + .owner = THIS_MODULE, + .of_match_table = diagfwd_usb_table, + }, +}; + static int __init diagchar_init(void) { dev_t dev; @@ -3892,6 +3925,7 @@ static int __init diagchar_init(void) pr_debug("diagchar initialized now"); platform_driver_register(&diag_mhi_driver); + platform_driver_register(&diagfwd_usb_driver); return 0; fail: diff --git a/drivers/char/diag/diagfwd_bridge.c b/drivers/char/diag/diagfwd_bridge.c index 3342984eb795..ad6203fe5684 100644 --- a/drivers/char/diag/diagfwd_bridge.c +++ b/drivers/char/diag/diagfwd_bridge.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2018, 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 @@ -18,22 +18,26 @@ #include #include #include -#ifdef USB_QCOM_DIAG_BRIDGE -#include -#endif #include "diag_mux.h" #include "diagfwd_bridge.h" -#ifdef USB_QCOM_DIAG_BRIDGE +#ifdef CONFIG_USB_QCOM_DIAG_BRIDGE #include "diagfwd_hsic.h" -#include "diagfwd_smux.h" #endif #include "diagfwd_mhi.h" #include "diag_dci.h" -#ifdef CONFIG_MSM_MHI -#define diag_mdm_init diag_mhi_init -#else -#define diag_mdm_init diag_hsic_init +#ifndef CONFIG_USB_QCOM_DIAG_BRIDGE +static int diag_hsic_init(void) +{ + return -EINVAL; +} +#endif + +#ifndef CONFIG_MSM_MHI +static int diag_mhi_init(void) +{ + return -EINVAL; +} #endif #define BRIDGE_TO_MUX(x) (x + DIAG_MUX_BRIDGE_BASE) @@ -265,18 +269,16 @@ int diag_remote_dev_write_done(int id, unsigned char *buf, int len, int ctxt) return err; } -int diagfwd_bridge_init() +int diagfwd_bridge_init(bool use_mhi) { int err = 0; - err = diag_mdm_init(); + if (use_mhi) + err = diag_mhi_init(); + else + err = diag_hsic_init(); if (err) goto fail; - #ifdef USB_QCOM_DIAG_BRIDGE - err = diag_smux_init(); - if (err) - goto fail; - #endif return 0; fail: @@ -288,7 +290,6 @@ void diagfwd_bridge_exit() { #ifdef USB_QCOM_DIAG_BRIDGE diag_hsic_exit(); - diag_smux_exit(); #endif } diff --git a/drivers/char/diag/diagfwd_bridge.h b/drivers/char/diag/diagfwd_bridge.h index 62d6b08b5b89..250ef07b0b04 100644 --- a/drivers/char/diag/diagfwd_bridge.h +++ b/drivers/char/diag/diagfwd_bridge.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2014, 2018, 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 @@ -51,7 +51,7 @@ struct diagfwd_bridge_info { }; extern struct diagfwd_bridge_info bridge_info[NUM_REMOTE_DEV]; -int diagfwd_bridge_init(void); +int diagfwd_bridge_init(bool use_mhi); void diagfwd_bridge_exit(void); int diagfwd_bridge_close(int id); int diagfwd_bridge_write(int id, unsigned char *buf, int len); diff --git a/drivers/usb/misc/diag_ipc_bridge.c b/drivers/usb/misc/diag_ipc_bridge.c index b9ced8d0062d..a652c8f9bab7 100644 --- a/drivers/usb/misc/diag_ipc_bridge.c +++ b/drivers/usb/misc/diag_ipc_bridge.c @@ -730,6 +730,8 @@ static int diag_bridge_resume(struct usb_interface *ifc) static const struct usb_device_id diag_bridge_ids[] = { { USB_DEVICE_INTERFACE_NUMBER(0x5c6, 0x9001, 0), .driver_info = DEV_ID(0), }, + { USB_DEVICE_INTERFACE_NUMBER(0x5c6, 0x901D, 0), + .driver_info = DEV_ID(0), }, { USB_DEVICE_INTERFACE_NUMBER(0x5c6, 0x9034, 0), .driver_info = DEV_ID(0), }, { USB_DEVICE_INTERFACE_NUMBER(0x5c6, 0x9048, 0),