From 75b0a3ebc6b463ad38554e731066c4c59d2cc177 Mon Sep 17 00:00:00 2001 From: Dhoat Harpal Date: Mon, 1 Aug 2016 19:25:52 +0530 Subject: [PATCH 1/4] soc: qcom: smem: Add SMEM items for CDSP SMP2P communication. Smem item definitions must be kept in sync with remote processors; if the definitions do not match, item lookup can fail between processors. Add smem item definitions so that the local definition table matches the table on remote processors. CRs-Fixed: 1043377 Change-Id: I7d23da099b5ed9deb3d074c1b72d286560fd705c Signed-off-by: Dhoat Harpal --- include/soc/qcom/smem.h | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/include/soc/qcom/smem.h b/include/soc/qcom/smem.h index 79bcc1b31cf8..c3e9c474ea8b 100644 --- a/include/soc/qcom/smem.h +++ b/include/soc/qcom/smem.h @@ -92,15 +92,8 @@ enum { SMEM_KEYPAD_STATE_UPDATED, SMEM_KEYPAD_STATE_IDX, SMEM_GPIO_INT, - SMEM_MDDI_LCD_IDX, - SMEM_MDDI_HOST_DRIVER_STATE, - SMEM_MDDI_LCD_DISP_STATE, - SMEM_LCD_CUR_PANEL, - SMEM_MARM_BOOT_SEGMENT_INFO, - SMEM_AARM_BOOT_SEGMENT_INFO, - SMEM_SLEEP_STATIC, - SMEM_SCORPION_FREQUENCY, - SMEM_SMD_PROFILES, + SMEM_SMP2P_CDSP_BASE, + SMEM_SMD_PROFILES = SMEM_SMP2P_CDSP_BASE + 8, SMEM_TSSC_BUSY, SMEM_HS_SUSPEND_FILTER_INFO, SMEM_BATT_INFO, From 7c0c7b0b3d39a5f7dd294a90c2fc1777dda74278 Mon Sep 17 00:00:00 2001 From: Dhoat Harpal Date: Fri, 22 Jul 2016 16:22:54 +0530 Subject: [PATCH 2/4] soc: qcom: smp2p: Add support for CDSP peripheral The CDSP peripheral now supports SMP2P communication, so add the necessary support to allow the apps subsystem to talk to CDSP peripheral. CRs-Fixed: 1043377 Change-Id: If28a0f801411a215b02647f8acfccb1edb1033d4 Signed-off-by: Dhoat Harpal --- Documentation/arm/msm/msm_smp2p.txt | 4 +++- .../devicetree/bindings/gpio/gpio-smp2p.txt | 2 ++ drivers/gpio/gpio-msm-smp2p-test.c | 10 +++++++++- drivers/soc/qcom/smp2p.c | 6 +++++- drivers/soc/qcom/smp2p_private_api.h | 4 ++-- drivers/soc/qcom/smp2p_spinlock_test.c | 14 ++++++++++++++ 6 files changed, 35 insertions(+), 5 deletions(-) diff --git a/Documentation/arm/msm/msm_smp2p.txt b/Documentation/arm/msm/msm_smp2p.txt index 8332cae6be5d..34d22f0e4635 100644 --- a/Documentation/arm/msm/msm_smp2p.txt +++ b/Documentation/arm/msm/msm_smp2p.txt @@ -181,7 +181,7 @@ added to the end of the list (Table 3). ------------------------------------------------- | Wireless processor | 4 | ------------------------------------------------- - | Modem Fw | 5 | + | CDSP processor | 5 | ------------------------------------------------- | Power processor | 6 | ------------------------------------------------- @@ -206,6 +206,8 @@ Item ID will be 427 + 1 = 428. --------------------------------------------------- | Description | SMEM ID value | --------------------------------------------------- + | CDSP SMEM Item base | 94 | + --------------------------------------------------- | Apps SMP2P SMEM Item base | 427 | --------------------------------------------------- | Modem SMP2P SMEM Item base | 435 | diff --git a/Documentation/devicetree/bindings/gpio/gpio-smp2p.txt b/Documentation/devicetree/bindings/gpio/gpio-smp2p.txt index c0a51afe18f1..7f5f939afa2d 100644 --- a/Documentation/devicetree/bindings/gpio/gpio-smp2p.txt +++ b/Documentation/devicetree/bindings/gpio/gpio-smp2p.txt @@ -31,6 +31,8 @@ Unit test devices ("smp2p" entries): "qcom,smp2pgpio_test_smp2p_3_in" "qcom,smp2pgpio_test_smp2p_4_out" "qcom,smp2pgpio_test_smp2p_4_in" + "qcom,smp2pgpio_test_smp2p_5_out" + "qcom,smp2pgpio_test_smp2p_5_in" "qcom,smp2pgpio_test_smp2p_7_out" "qcom,smp2pgpio_test_smp2p_7_in" "qcom,smp2pgpio_test_smp2p_15_out" diff --git a/drivers/gpio/gpio-msm-smp2p-test.c b/drivers/gpio/gpio-msm-smp2p-test.c index 067735b3026f..5907513b43c0 100644 --- a/drivers/gpio/gpio-msm-smp2p-test.c +++ b/drivers/gpio/gpio-msm-smp2p-test.c @@ -1,6 +1,6 @@ /* drivers/gpio/gpio-msm-smp2p-test.c * - * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2016, 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 @@ -95,6 +95,10 @@ static int smp2p_gpio_test_probe(struct platform_device *pdev) gpio_info_ptr = &gpio_info[SMP2P_WIRELESS_PROC].in; } else if (strcmp("qcom,smp2pgpio_test_smp2p_4_out", node->name) == 0) { gpio_info_ptr = &gpio_info[SMP2P_WIRELESS_PROC].out; + } else if (strcmp("qcom,smp2pgpio_test_smp2p_5_in", node->name) == 0) { + gpio_info_ptr = &gpio_info[SMP2P_CDSP_PROC].in; + } else if (strcmp("qcom,smp2pgpio_test_smp2p_5_out", node->name) == 0) { + gpio_info_ptr = &gpio_info[SMP2P_CDSP_PROC].out; } else if (strcmp("qcom,smp2pgpio_test_smp2p_7_in", node->name) == 0) { gpio_info_ptr = &gpio_info[SMP2P_TZ_PROC].in; } else if (strcmp("qcom,smp2pgpio_test_smp2p_7_out", node->name) == 0) { @@ -148,6 +152,10 @@ static struct of_device_id msm_smp2p_match_table[] = { {.compatible = "qcom,smp2pgpio_test_smp2p_4_out", }, {.compatible = "qcom,smp2pgpio_test_smp2p_4_in", }, + /* CDSP */ + {.compatible = "qcom,smp2pgpio_test_smp2p_5_out", }, + {.compatible = "qcom,smp2pgpio_test_smp2p_5_in", }, + /* TZ */ {.compatible = "qcom,smp2pgpio_test_smp2p_7_out", }, {.compatible = "qcom,smp2pgpio_test_smp2p_7_in", }, diff --git a/drivers/soc/qcom/smp2p.c b/drivers/soc/qcom/smp2p.c index fc5688b4bc8c..d85046875d7a 100644 --- a/drivers/soc/qcom/smp2p.c +++ b/drivers/soc/qcom/smp2p.c @@ -1,6 +1,6 @@ /* drivers/soc/qcom/smp2p.c * - * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2016, 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 @@ -214,6 +214,7 @@ static struct smp2p_interrupt_config smp2p_int_cfgs[SMP2P_NUM_PROCS] = { [SMP2P_AUDIO_PROC].name = "lpass", [SMP2P_SENSOR_PROC].name = "dsps", [SMP2P_WIRELESS_PROC].name = "wcnss", + [SMP2P_CDSP_PROC].name = "cdsp", [SMP2P_TZ_PROC].name = "tz", [SMP2P_REMOTE_MOCK_PROC].name = "mock", }; @@ -333,6 +334,9 @@ static int smp2p_get_smem_item_id(int write_pid, int read_pid) case SMP2P_WIRELESS_PROC: ret = SMEM_SMP2P_WIRLESS_BASE + read_pid; break; + case SMP2P_CDSP_PROC: + ret = SMEM_SMP2P_CDSP_BASE + read_pid; + break; case SMP2P_POWER_PROC: ret = SMEM_SMP2P_POWER_BASE + read_pid; break; diff --git a/drivers/soc/qcom/smp2p_private_api.h b/drivers/soc/qcom/smp2p_private_api.h index 4223a2e1bc90..5bff32f8c06a 100644 --- a/drivers/soc/qcom/smp2p_private_api.h +++ b/drivers/soc/qcom/smp2p_private_api.h @@ -1,6 +1,6 @@ /* drivers/soc/qcom/smp2p_private_api.h * - * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2016, 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 @@ -31,7 +31,7 @@ enum { SMP2P_AUDIO_PROC = 2, SMP2P_SENSOR_PROC = 3, SMP2P_WIRELESS_PROC = 4, - SMP2P_RESERVED_PROC_2 = 5, + SMP2P_CDSP_PROC = 5, SMP2P_POWER_PROC = 6, SMP2P_TZ_PROC = 7, /* add new processors here */ diff --git a/drivers/soc/qcom/smp2p_spinlock_test.c b/drivers/soc/qcom/smp2p_spinlock_test.c index d188bf0702c5..74aac52b5285 100644 --- a/drivers/soc/qcom/smp2p_spinlock_test.c +++ b/drivers/soc/qcom/smp2p_spinlock_test.c @@ -373,6 +373,11 @@ static void smp2p_ut_remote_spinlock_wcnss(struct seq_file *s) smp2p_ut_remote_spinlock_pid(s, SMP2P_WIRELESS_PROC, false); } +static void smp2p_ut_remote_spinlock_cdsp(struct seq_file *s) +{ + smp2p_ut_remote_spinlock_pid(s, SMP2P_CDSP_PROC, false); +} + static void smp2p_ut_remote_spinlock_tz(struct seq_file *s) { smp2p_ut_remote_spinlock_pid(s, SMP2P_TZ_PROC, false); @@ -752,6 +757,11 @@ static void smp2p_ut_remote_spinlock_track_wcnss(struct seq_file *s) smp2p_ut_remote_spinlock_track(s, SMP2P_WIRELESS_PROC); } +static void smp2p_ut_remote_spinlock_track_cdsp(struct seq_file *s) +{ + smp2p_ut_remote_spinlock_track(s, SMP2P_CDSP_PROC); +} + static void smp2p_ut_remote_spinlock_track_tz(struct seq_file *s) { smp2p_ut_remote_spinlock_track(s, SMP2P_TZ_PROC); @@ -782,6 +792,8 @@ static int __init smp2p_debugfs_init(void) smp2p_ut_remote_spinlock_dsps); smp2p_debug_create("ut_remote_spinlock_wcnss", smp2p_ut_remote_spinlock_wcnss); + smp2p_debug_create("ut_remote_spinlock_cdsp", + smp2p_ut_remote_spinlock_cdsp); smp2p_debug_create("ut_remote_spinlock_tz", smp2p_ut_remote_spinlock_tz); smp2p_debug_create("ut_remote_spinlock_rpm", @@ -798,6 +810,8 @@ static int __init smp2p_debugfs_init(void) &smp2p_ut_remote_spinlock_track_dsps); smp2p_debug_create("ut_remote_spinlock_track_wcnss", &smp2p_ut_remote_spinlock_track_wcnss); + smp2p_debug_create("ut_remote_spinlock_track_cdsp", + &smp2p_ut_remote_spinlock_track_cdsp); smp2p_debug_create("ut_remote_spinlock_track_tz", &smp2p_ut_remote_spinlock_track_tz); return 0; From 1a55bb30e0b6d6fd8bc4001eb95cfedb56ae8b7b Mon Sep 17 00:00:00 2001 From: Dhoat Harpal Date: Tue, 9 Aug 2016 17:07:43 +0530 Subject: [PATCH 3/4] soc: qcom: sleepstate: add sleep state compatible entry Current sleep state entry compatible string is tied with remote processor ID which is not always true. Use generic compatible string for sleep state entry to support for any remote processor ID. CRs-Fixed: 1043377 Change-Id: I6ef2810b07960006b0fe4c573d5ce2bead90ee97 Signed-off-by: Dhoat Harpal --- .../devicetree/bindings/arm/msm/sleepstate-smp2p.txt | 4 +++- drivers/soc/qcom/smp2p_sleepstate.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/arm/msm/sleepstate-smp2p.txt b/Documentation/devicetree/bindings/arm/msm/sleepstate-smp2p.txt index ad1067232870..adfa94f9d1ff 100644 --- a/Documentation/devicetree/bindings/arm/msm/sleepstate-smp2p.txt +++ b/Documentation/devicetree/bindings/arm/msm/sleepstate-smp2p.txt @@ -1,7 +1,9 @@ Qualcomm Technologies, Inc. SMSM Point-to-Point (SMP2P) Sleepstate driver Required properties: --compatible : should be "qcom,smp2pgpio_sleepstate_3_out"; +-compatible : should be one of the following: +- "qcom,smp2pgpio_sleepstate_3_out" - for sensor processor on remote pid 3 +- "qcom,smp2pgpio-sleepstate-out" - for other cases -gpios : the relevant gpio pins of the entry. Example: diff --git a/drivers/soc/qcom/smp2p_sleepstate.c b/drivers/soc/qcom/smp2p_sleepstate.c index dfebd201eeb0..04b043fbd8ec 100644 --- a/drivers/soc/qcom/smp2p_sleepstate.c +++ b/drivers/soc/qcom/smp2p_sleepstate.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2014-2016, 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 @@ -74,6 +74,7 @@ static int smp2p_sleepstate_probe(struct platform_device *pdev) static struct of_device_id msm_smp2p_slst_match_table[] = { {.compatible = "qcom,smp2pgpio_sleepstate_3_out"}, + {.compatible = "qcom,smp2pgpio-sleepstate-out"}, {}, }; From 994e3d829521052413bcf7448d0e89f7504f1da1 Mon Sep 17 00:00:00 2001 From: Dhoat Harpal Date: Tue, 28 Jun 2016 20:32:31 +0530 Subject: [PATCH 4/4] ARM: dts: msm: Add SMP2P entries for MSMFALCON Add the SMP2P entries to facilitate SMP2P interprocessor communication. CRs-Fixed: 1043377 Change-Id: Ica16f736cb3789490c0c309996b295a06260545d Signed-off-by: Dhoat Harpal --- arch/arm/boot/dts/qcom/msmfalcon-smp2p.dtsi | 175 ++++++++++++++++++++ arch/arm/boot/dts/qcom/msmfalcon.dtsi | 1 + 2 files changed, 176 insertions(+) create mode 100644 arch/arm/boot/dts/qcom/msmfalcon-smp2p.dtsi diff --git a/arch/arm/boot/dts/qcom/msmfalcon-smp2p.dtsi b/arch/arm/boot/dts/qcom/msmfalcon-smp2p.dtsi new file mode 100644 index 000000000000..bdbcd9d7b6f9 --- /dev/null +++ b/arch/arm/boot/dts/qcom/msmfalcon-smp2p.dtsi @@ -0,0 +1,175 @@ +/* Copyright (c) 2016, 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 + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +&soc { + qcom,smp2p-modem@17911008 { + compatible = "qcom,smp2p"; + reg = <0x17911008 0x4>; + qcom,remote-pid = <1>; + qcom,irq-bitmask = <0x4000>; + interrupts = <0 451 1>; + }; + + qcom,smp2p-adsp@17911008 { + compatible = "qcom,smp2p"; + reg = <0x17911008 0x4>; + qcom,remote-pid = <2>; + qcom,irq-bitmask = <0x400>; + interrupts = <0 158 1>; + }; + + qcom,smp2p-cdsp@17911008 { + compatible = "qcom,smp2p"; + reg = <0x17911008 0x4>; + qcom,remote-pid = <5>; + qcom,irq-bitmask = <0x40000000>; + interrupts = <0 514 1>; + }; + + smp2pgpio_smp2p_15_in: qcom,smp2pgpio-smp2p-15-in { + compatible = "qcom,smp2pgpio"; + qcom,entry-name = "smp2p"; + qcom,remote-pid = <15>; + qcom,is-inbound; + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + }; + + qcom,smp2pgpio_test_smp2p_15_in { + compatible = "qcom,smp2pgpio_test_smp2p_15_in"; + gpios = <&smp2pgpio_smp2p_15_in 0 0>; + }; + + smp2pgpio_smp2p_15_out: qcom,smp2pgpio-smp2p-15-out { + compatible = "qcom,smp2pgpio"; + qcom,entry-name = "smp2p"; + qcom,remote-pid = <15>; + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + }; + + qcom,smp2pgpio_test_smp2p_15_out { + compatible = "qcom,smp2pgpio_test_smp2p_15_out"; + gpios = <&smp2pgpio_smp2p_15_out 0 0>; + }; + + smp2pgpio_smp2p_1_in: qcom,smp2pgpio-smp2p-1-in { + compatible = "qcom,smp2pgpio"; + qcom,entry-name = "smp2p"; + qcom,remote-pid = <1>; + qcom,is-inbound; + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + }; + + qcom,smp2pgpio_test_smp2p_1_in { + compatible = "qcom,smp2pgpio_test_smp2p_1_in"; + gpios = <&smp2pgpio_smp2p_1_in 0 0>; + }; + + smp2pgpio_smp2p_1_out: qcom,smp2pgpio-smp2p-1-out { + compatible = "qcom,smp2pgpio"; + qcom,entry-name = "smp2p"; + qcom,remote-pid = <1>; + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + }; + + qcom,smp2pgpio_test_smp2p_1_out { + compatible = "qcom,smp2pgpio_test_smp2p_1_out"; + gpios = <&smp2pgpio_smp2p_1_out 0 0>; + }; + + smp2pgpio_smp2p_2_in: qcom,smp2pgpio-smp2p-2-in { + compatible = "qcom,smp2pgpio"; + qcom,entry-name = "smp2p"; + qcom,remote-pid = <2>; + qcom,is-inbound; + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + }; + + qcom,smp2pgpio_test_smp2p_2_in { + compatible = "qcom,smp2pgpio_test_smp2p_2_in"; + gpios = <&smp2pgpio_smp2p_2_in 0 0>; + }; + + smp2pgpio_smp2p_2_out: qcom,smp2pgpio-smp2p-2-out { + compatible = "qcom,smp2pgpio"; + qcom,entry-name = "smp2p"; + qcom,remote-pid = <2>; + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + }; + + qcom,smp2pgpio_test_smp2p_2_out { + compatible = "qcom,smp2pgpio_test_smp2p_2_out"; + gpios = <&smp2pgpio_smp2p_2_out 0 0>; + }; + + smp2pgpio_sleepstate_2_out: qcom,smp2pgpio-sleepstate-gpio-2-out { + compatible = "qcom,smp2pgpio"; + qcom,entry-name = "sleepstate"; + qcom,remote-pid = <2>; + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + }; + + qcom,smp2pgpio-sleepstate-2-out { + compatible = "qcom,smp2pgpio-sleepstate-out"; + gpios = <&smp2pgpio_sleepstate_2_out 0 0>; + }; + + smp2pgpio_smp2p_5_in: qcom,smp2pgpio-smp2p-5-in { + compatible = "qcom,smp2pgpio"; + qcom,entry-name = "smp2p"; + qcom,remote-pid = <5>; + qcom,is-inbound; + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + }; + + qcom,smp2pgpio_test_smp2p_5_in { + compatible = "qcom,smp2pgpio_test_smp2p_5_in"; + gpios = <&smp2pgpio_smp2p_5_in 0 0>; + }; + + smp2pgpio_smp2p_5_out: qcom,smp2pgpio-smp2p-5-out { + compatible = "qcom,smp2pgpio"; + qcom,entry-name = "smp2p"; + qcom,remote-pid = <5>; + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + }; + + qcom,smp2pgpio_test_smp2p_5_out { + compatible = "qcom,smp2pgpio_test_smp2p_5_out"; + gpios = <&smp2pgpio_smp2p_5_out 0 0>; + }; +}; diff --git a/arch/arm/boot/dts/qcom/msmfalcon.dtsi b/arch/arm/boot/dts/qcom/msmfalcon.dtsi index 9ccf55322de1..331b3c6fd818 100644 --- a/arch/arm/boot/dts/qcom/msmfalcon.dtsi +++ b/arch/arm/boot/dts/qcom/msmfalcon.dtsi @@ -194,6 +194,7 @@ }; }; +#include "msmfalcon-smp2p.dtsi" &soc { #address-cells = <1>; #size-cells = <1>;