diag: Add support for APQ8064
This change will add DIAG support for new target APQ8064.
Change-Id: Ic8d21dc39e42fc254f71ee62df8160641c8068f8
Signed-off-by: Shalabh Jain <shalabhj@codeaurora.org>
diff --git a/drivers/char/diag/diagfwd.c b/drivers/char/diag/diagfwd.c
index 226e5b5..caf3901 100644
--- a/drivers/char/diag/diagfwd.c
+++ b/drivers/char/diag/diagfwd.c
@@ -70,7 +70,7 @@
#define CHK_OVERFLOW(bufStart, start, end, length) \
((bufStart <= start) && (end - start >= length)) ? 1 : 0
-int chk_config_get_id()
+int chk_config_get_id(void)
{
switch (socinfo_get_id()) {
case APQ8060_MACHINE_ID:
@@ -78,6 +78,23 @@
return APQ8060_TOOLS_ID;
case AO8960_MACHINE_ID:
return AO8960_TOOLS_ID;
+ case APQ8064_MACHINE_ID:
+ return APQ8064_TOOLS_ID;
+ default:
+ return 0;
+ }
+}
+
+/*
+ * This will return TRUE for targets which support apps only mode.
+ * This applies to 8960 and newer targets.
+ */
+int chk_apps_only(void)
+{
+ switch (socinfo_get_id()) {
+ case AO8960_MACHINE_ID:
+ case APQ8064_MACHINE_ID:
+ return 1;
default:
return 0;
}
@@ -576,8 +593,8 @@
diag_update_event_mask(buf+1, 0, 0);
diag_update_userspace_clients(EVENT_MASKS_TYPE);
#if defined(CONFIG_DIAG_OVER_USB)
- /* Check for Apps Only 8960 */
- if (!(driver->ch) && (chk_config_get_id() == AO8960_TOOLS_ID)) {
+ /* Check for Apps Only */
+ if (!(driver->ch) && chk_apps_only()) {
/* echo response back for apps only DIAG */
driver->apps_rsp_buf[0] = 0x60;
driver->apps_rsp_buf[1] = 0x0;
@@ -594,8 +611,8 @@
diag_update_log_mask(*(int *)buf, buf+8, *(int *)(buf+4));
diag_update_userspace_clients(LOG_MASKS_TYPE);
#if defined(CONFIG_DIAG_OVER_USB)
- /* Check for Apps Only 8960 */
- if (!(driver->ch) && (chk_config_get_id() == AO8960_TOOLS_ID)) {
+ /* Check for Apps Only */
+ if (!(driver->ch) && chk_apps_only()) {
/* echo response back for Apps only DIAG */
driver->apps_rsp_buf[0] = 0x73;
*(int *)(driver->apps_rsp_buf + 4) = 0x3; /* op. ID */
@@ -617,7 +634,7 @@
diag_update_msg_mask(ssid_first, ssid_last , buf + 8);
diag_update_userspace_clients(MSG_MASKS_TYPE);
#if defined(CONFIG_DIAG_OVER_USB)
- if (!(driver->ch) && (chk_config_get_id() == AO8960_TOOLS_ID)) {
+ if (!(driver->ch) && chk_apps_only()) {
/* echo response back for apps only DIAG */
for (i = 0; i < 8 + ssid_range; i++)
*(driver->apps_rsp_buf + i) = *(buf+i);
@@ -627,9 +644,8 @@
#endif
}
#if defined(CONFIG_DIAG_OVER_USB)
- /* Check for Apps Only 8960 & get event mask request */
- else if (!(driver->ch) && (chk_config_get_id() == AO8960_TOOLS_ID)
- && *buf == 0x81) {
+ /* Check for Apps Only & get event mask request */
+ else if (!(driver->ch) && chk_apps_only() && *buf == 0x81) {
driver->apps_rsp_buf[0] = 0x81;
driver->apps_rsp_buf[1] = 0x0;
*(uint16_t *)(driver->apps_rsp_buf + 2) = 0x0;
@@ -639,8 +655,8 @@
ENCODE_RSP_AND_SEND(6 + EVENT_LAST_ID/8);
return 0;
}
- /* Get log ID range & Check for Apps Only 8960 */
- else if (!(driver->ch) && (chk_config_get_id() == AO8960_TOOLS_ID)
+ /* Get log ID range & Check for Apps Only */
+ else if (!(driver->ch) && chk_apps_only()
&& (*buf == 0x73) && *(int *)(buf+4) == 1) {
driver->apps_rsp_buf[0] = 0x73;
*(int *)(driver->apps_rsp_buf + 4) = 0x1; /* operation ID */
@@ -665,7 +681,7 @@
return 0;
}
/* Respond to Get SSID Range request message */
- else if (!(driver->ch) && (chk_config_get_id() == AO8960_TOOLS_ID)
+ else if (!(driver->ch) && chk_apps_only()
&& (*buf == 0x7d) && (*(buf+1) == 0x1)) {
driver->apps_rsp_buf[0] = 0x7d;
driver->apps_rsp_buf[1] = 0x1;
@@ -713,8 +729,8 @@
ENCODE_RSP_AND_SEND(83);
return 0;
}
- /* Check for AO8960 Respond to Get Subsys Build mask */
- else if (!(driver->ch) && (chk_config_get_id() == AO8960_TOOLS_ID)
+ /* Check for Apps Only Respond to Get Subsys Build mask */
+ else if (!(driver->ch) && chk_apps_only()
&& (*buf == 0x7d) && (*(buf+1) == 0x2)) {
ssid_first = *(uint16_t *)(buf + 2);
ssid_last = *(uint16_t *)(buf + 4);
@@ -901,13 +917,13 @@
driver->debug_flag = 0;
}
/* send error responses from APPS for Central Routing */
- if (type == 1 && chk_config_get_id() == AO8960_TOOLS_ID) {
+ if (type == 1 && chk_apps_only()) {
diag_send_error_rsp(hdlc.dest_idx);
type = 0;
}
/* implies this packet is NOT meant for apps */
if (!(driver->ch) && type == 1) {
- if (chk_config_get_id() == AO8960_TOOLS_ID) {
+ if (chk_apps_only()) {
diag_send_error_rsp(hdlc.dest_idx);
} else { /* APQ 8060, Let Q6 respond */
if (driver->chqdsp)
diff --git a/drivers/char/diag/diagfwd.h b/drivers/char/diag/diagfwd.h
index 0a271dd..6dacab7 100644
--- a/drivers/char/diag/diagfwd.h
+++ b/drivers/char/diag/diagfwd.h
@@ -26,8 +26,8 @@
long diagchar_ioctl(struct file *, unsigned int, unsigned long);
int diag_device_write(void *, int, struct diag_request *);
int mask_request_validate(unsigned char mask_buf[]);
-int chk_config_get_id(void);
void diag_clear_reg(int);
+int chk_apps_only(void);
/* State for diag forwarding */
#ifdef CONFIG_DIAG_OVER_USB
int diagfwd_connect(void);
diff --git a/drivers/char/diag/diagfwd_cntl.c b/drivers/char/diag/diagfwd_cntl.c
index 2b88a9f..534c016 100644
--- a/drivers/char/diag/diagfwd_cntl.c
+++ b/drivers/char/diag/diagfwd_cntl.c
@@ -138,7 +138,7 @@
int r = 0;
/* open control ports only on 8960 */
- if (chk_config_get_id() == AO8960_TOOLS_ID) {
+ if (chk_apps_only()) {
if (pdev->id == SMD_APPS_MODEM)
r = smd_open("DIAG_CNTL", &driver->ch_cntl, driver,
diag_smd_cntl_notify);
diff --git a/include/linux/diagchar.h b/include/linux/diagchar.h
index 91d67d5..5c94a3c 100644
--- a/include/linux/diagchar.h
+++ b/include/linux/diagchar.h
@@ -40,8 +40,10 @@
#define APQ8060_MACHINE_ID 86
#define AO8960_MACHINE_ID 87
#define MSM8660_MACHINE_ID 71
+#define APQ8064_MACHINE_ID 109
#define APQ8060_TOOLS_ID 4062
#define AO8960_TOOLS_ID 4064
+#define APQ8064_TOOLS_ID 4072
#define MSG_MASK_0 (0x00000001)
#define MSG_MASK_1 (0x00000002)