diff options
| author | Linux Build Service Account <lnxbuild@localhost> | 2018-07-16 21:54:10 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-07-16 21:54:10 -0700 |
| commit | 5468d13d1d184e0e078a342e2c7df10d17f9e866 (patch) | |
| tree | eefc4840593381b7addc0fa457ddd049cc1ed114 /drivers | |
| parent | 582f5092f37fd00d46b589fd9ae2bae6f0ffaf46 (diff) | |
| parent | 146820788aab993081e6dd902d51987e1cf8c855 (diff) | |
Merge "diag: Enable diagfwd via USB even when MHI is available"
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/char/diag/Makefile | 1 | ||||
| -rw-r--r-- | drivers/char/diag/diag_debugfs.c | 3 | ||||
| -rw-r--r-- | drivers/char/diag/diagchar_core.c | 38 | ||||
| -rw-r--r-- | drivers/char/diag/diagfwd_bridge.c | 37 | ||||
| -rw-r--r-- | drivers/char/diag/diagfwd_bridge.h | 4 | ||||
| -rw-r--r-- | drivers/usb/misc/diag_ipc_bridge.c | 2 |
6 files changed, 60 insertions, 25 deletions
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 <linux/workqueue.h> #include <linux/ratelimit.h> #include <linux/platform_device.h> -#ifdef USB_QCOM_DIAG_BRIDGE -#include <linux/smux.h> -#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), |
