Merge "diag: Enable diagfwd via USB even when MHI is available"

This commit is contained in:
Linux Build Service Account 2018-07-16 21:54:10 -07:00 committed by Gerrit - the friendly Code Review server
commit 5468d13d1d
9 changed files with 71 additions and 25 deletions

View file

@ -0,0 +1,9 @@
QTI Diag Forward USB Driver
Required properties:
-compatible : should be "qcom,diagfwd-usb".
Example:
qcom,diag {
compatible = "qcom,diagfwd-usb";
};

View file

@ -428,6 +428,7 @@ CONFIG_USB_DWC3=y
CONFIG_USB_ISP1760=y CONFIG_USB_ISP1760=y
CONFIG_USB_EHSET_TEST_FIXTURE=y CONFIG_USB_EHSET_TEST_FIXTURE=y
CONFIG_USB_QTI_KS_BRIDGE=y CONFIG_USB_QTI_KS_BRIDGE=y
CONFIG_USB_QCOM_DIAG_BRIDGE=y
CONFIG_NOP_USB_XCEIV=y CONFIG_NOP_USB_XCEIV=y
CONFIG_USB_MSM_SSPHY_QMP=y CONFIG_USB_MSM_SSPHY_QMP=y
CONFIG_MSM_QUSB_PHY=y CONFIG_MSM_QUSB_PHY=y

View file

@ -432,6 +432,7 @@ CONFIG_USB_DWC3=y
CONFIG_USB_ISP1760=y CONFIG_USB_ISP1760=y
CONFIG_USB_EHSET_TEST_FIXTURE=y CONFIG_USB_EHSET_TEST_FIXTURE=y
CONFIG_USB_QTI_KS_BRIDGE=y CONFIG_USB_QTI_KS_BRIDGE=y
CONFIG_USB_QCOM_DIAG_BRIDGE=y
CONFIG_NOP_USB_XCEIV=y CONFIG_NOP_USB_XCEIV=y
CONFIG_USB_MSM_SSPHY_QMP=y CONFIG_USB_MSM_SSPHY_QMP=y
CONFIG_MSM_QUSB_PHY=y CONFIG_MSM_QUSB_PHY=y

View file

@ -1,6 +1,5 @@
obj-$(CONFIG_DIAG_CHAR) := diagchar.o obj-$(CONFIG_DIAG_CHAR) := diagchar.o
obj-$(CONFIG_DIAGFWD_BRIDGE_CODE) += diagfwd_bridge.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_hsic.o
obj-$(CONFIG_USB_QCOM_DIAG_BRIDGE) += diagfwd_smux.o
obj-$(CONFIG_MSM_MHI) += diagfwd_mhi.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 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

View file

@ -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 * 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 * it under the terms of the GNU General Public License version 2 and
@ -23,7 +23,6 @@
#endif #endif
#ifdef CONFIG_USB_QCOM_DIAG_BRIDGE #ifdef CONFIG_USB_QCOM_DIAG_BRIDGE
#include "diagfwd_hsic.h" #include "diagfwd_hsic.h"
#include "diagfwd_smux.h"
#endif #endif
#ifdef CONFIG_MSM_MHI #ifdef CONFIG_MSM_MHI
#include "diagfwd_mhi.h" #include "diagfwd_mhi.h"

View file

@ -1160,7 +1160,7 @@ static void diag_remote_exit(void)
return; return;
} }
int diagfwd_bridge_init(void) int diagfwd_bridge_init(bool use_mhi)
{ {
return 0; return 0;
} }
@ -3743,7 +3743,7 @@ static int diag_mhi_probe(struct platform_device *pdev)
diag_remote_exit(); diag_remote_exit();
return ret; return ret;
} }
ret = diagfwd_bridge_init(); ret = diagfwd_bridge_init(true);
if (ret) { if (ret) {
diagfwd_bridge_exit(); diagfwd_bridge_exit();
return ret; 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) static int __init diagchar_init(void)
{ {
dev_t dev; dev_t dev;
@ -3892,6 +3925,7 @@ static int __init diagchar_init(void)
pr_debug("diagchar initialized now"); pr_debug("diagchar initialized now");
platform_driver_register(&diag_mhi_driver); platform_driver_register(&diag_mhi_driver);
platform_driver_register(&diagfwd_usb_driver);
return 0; return 0;
fail: fail:

View file

@ -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 * 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 * it under the terms of the GNU General Public License version 2 and
@ -18,22 +18,26 @@
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/ratelimit.h> #include <linux/ratelimit.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#ifdef USB_QCOM_DIAG_BRIDGE
#include <linux/smux.h>
#endif
#include "diag_mux.h" #include "diag_mux.h"
#include "diagfwd_bridge.h" #include "diagfwd_bridge.h"
#ifdef USB_QCOM_DIAG_BRIDGE #ifdef CONFIG_USB_QCOM_DIAG_BRIDGE
#include "diagfwd_hsic.h" #include "diagfwd_hsic.h"
#include "diagfwd_smux.h"
#endif #endif
#include "diagfwd_mhi.h" #include "diagfwd_mhi.h"
#include "diag_dci.h" #include "diag_dci.h"
#ifdef CONFIG_MSM_MHI #ifndef CONFIG_USB_QCOM_DIAG_BRIDGE
#define diag_mdm_init diag_mhi_init static int diag_hsic_init(void)
#else {
#define diag_mdm_init diag_hsic_init return -EINVAL;
}
#endif
#ifndef CONFIG_MSM_MHI
static int diag_mhi_init(void)
{
return -EINVAL;
}
#endif #endif
#define BRIDGE_TO_MUX(x) (x + DIAG_MUX_BRIDGE_BASE) #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; return err;
} }
int diagfwd_bridge_init() int diagfwd_bridge_init(bool use_mhi)
{ {
int err = 0; int err = 0;
err = diag_mdm_init(); if (use_mhi)
err = diag_mhi_init();
else
err = diag_hsic_init();
if (err) if (err)
goto fail; goto fail;
#ifdef USB_QCOM_DIAG_BRIDGE
err = diag_smux_init();
if (err)
goto fail;
#endif
return 0; return 0;
fail: fail:
@ -288,7 +290,6 @@ void diagfwd_bridge_exit()
{ {
#ifdef USB_QCOM_DIAG_BRIDGE #ifdef USB_QCOM_DIAG_BRIDGE
diag_hsic_exit(); diag_hsic_exit();
diag_smux_exit();
#endif #endif
} }

View file

@ -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 * 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 * 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]; 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); void diagfwd_bridge_exit(void);
int diagfwd_bridge_close(int id); int diagfwd_bridge_close(int id);
int diagfwd_bridge_write(int id, unsigned char *buf, int len); int diagfwd_bridge_write(int id, unsigned char *buf, int len);

View file

@ -730,6 +730,8 @@ static int diag_bridge_resume(struct usb_interface *ifc)
static const struct usb_device_id diag_bridge_ids[] = { static const struct usb_device_id diag_bridge_ids[] = {
{ USB_DEVICE_INTERFACE_NUMBER(0x5c6, 0x9001, 0), { USB_DEVICE_INTERFACE_NUMBER(0x5c6, 0x9001, 0),
.driver_info = DEV_ID(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), { USB_DEVICE_INTERFACE_NUMBER(0x5c6, 0x9034, 0),
.driver_info = DEV_ID(0), }, .driver_info = DEV_ID(0), },
{ USB_DEVICE_INTERFACE_NUMBER(0x5c6, 0x9048, 0), { USB_DEVICE_INTERFACE_NUMBER(0x5c6, 0x9048, 0),