[PATCH 2/2] arm64: dts: qcom: msm8998: Disable MSS remoteproc by default

2021-04-05 Thread Jami Kettunen
This was already the case for ADSP and SLPI remoteprocs & doesn't affect
existing boards where it has been re-enabled.

Signed-off-by: Jami Kettunen 
---
 arch/arm64/boot/dts/qcom/msm8998-clamshell.dtsi | 4 
 arch/arm64/boot/dts/qcom/msm8998-mtp.dtsi   | 4 
 arch/arm64/boot/dts/qcom/msm8998.dtsi   | 2 ++
 3 files changed, 10 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/msm8998-clamshell.dtsi 
b/arch/arm64/boot/dts/qcom/msm8998-clamshell.dtsi
index b500f24d47bc..125d7923d713 100644
--- a/arch/arm64/boot/dts/qcom/msm8998-clamshell.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8998-clamshell.dtsi
@@ -281,6 +281,10 @@ vreg_lvs2a_1p8: lvs2 {
};
 };
 
+&remoteproc_mss {
+   status = "okay";
+};
+
 &tlmm {
gpio-reserved-ranges = <0 4>, <81 4>;
 
diff --git a/arch/arm64/boot/dts/qcom/msm8998-mtp.dtsi 
b/arch/arm64/boot/dts/qcom/msm8998-mtp.dtsi
index c1ef0c71d5f5..a1d15eab8553 100644
--- a/arch/arm64/boot/dts/qcom/msm8998-mtp.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8998-mtp.dtsi
@@ -328,6 +328,10 @@ &remoteproc_adsp {
status = "okay";
 };
 
+&remoteproc_mss {
+   status = "okay";
+};
+
 &remoteproc_slpi {
status = "okay";
 };
diff --git a/arch/arm64/boot/dts/qcom/msm8998.dtsi 
b/arch/arm64/boot/dts/qcom/msm8998.dtsi
index 1f2e93aa6553..e9d3ce29937c 100644
--- a/arch/arm64/boot/dts/qcom/msm8998.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8998.dtsi
@@ -1398,6 +1398,8 @@ remoteproc_mss: remoteproc@408 {
<&rpmpd MSM8998_VDDMX>;
power-domain-names = "cx", "mx";
 
+   status = "disabled";
+
mba {
memory-region = <&mba_mem>;
};
-- 
2.31.1



OnePlus 5/5T support

2021-04-05 Thread Jami Kettunen
Add device trees for OnePlus 5 (cheeseburger) and 5T (dumpling)
MSM8998 SoC smartphones.

v2:
-License DT under BSD-3-Clause instead of GPL-2.0
-Drop MSS remoteproc node in favor of disabling it by default (see patch 2/2)
-Shorten and move Wi-Fi disable comment inside wifi node

Jami Kettunen (2):
  arm64: dts: qcom: Add support for OnePlus 5/5T
  arm64: dts: qcom: msm8998: Disable MSS remoteproc by default

 arch/arm64/boot/dts/qcom/Makefile |   2 +
 .../boot/dts/qcom/msm8998-clamshell.dtsi  |   4 +
 arch/arm64/boot/dts/qcom/msm8998-mtp.dtsi |   4 +
 .../dts/qcom/msm8998-oneplus-cheeseburger.dts |  42 ++
 .../boot/dts/qcom/msm8998-oneplus-common.dtsi | 514 ++
 .../dts/qcom/msm8998-oneplus-dumpling.dts |  25 +
 arch/arm64/boot/dts/qcom/msm8998.dtsi |   2 +
 7 files changed, 593 insertions(+)



[PATCH v2 1/2] arm64: dts: qcom: Add support for OnePlus 5/5T

2021-04-05 Thread Jami Kettunen
Add device trees for OnePlus 5 (cheeseburger) and 5T (dumpling)
MSM8998 SoC smartphones with initial support included for:

- UFS internal storage
- USB peripheral mode
- Display
- Touch
- Bluetooth
- Hall effect sensor
- Power and volume buttons
- Capacitive keypad button backlight (on cheeseburger)

Signed-off-by: Jami Kettunen 
---
 arch/arm64/boot/dts/qcom/Makefile |   2 +
 .../dts/qcom/msm8998-oneplus-cheeseburger.dts |  42 ++
 .../boot/dts/qcom/msm8998-oneplus-common.dtsi | 514 ++
 .../dts/qcom/msm8998-oneplus-dumpling.dts |  25 +
 4 files changed, 583 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/msm8998-oneplus-cheeseburger.dts
 create mode 100644 arch/arm64/boot/dts/qcom/msm8998-oneplus-common.dtsi
 create mode 100644 arch/arm64/boot/dts/qcom/msm8998-oneplus-dumpling.dts

diff --git a/arch/arm64/boot/dts/qcom/Makefile 
b/arch/arm64/boot/dts/qcom/Makefile
index 549a7a2151d4..1beb73f564f7 100644
--- a/arch/arm64/boot/dts/qcom/Makefile
+++ b/arch/arm64/boot/dts/qcom/Makefile
@@ -27,6 +27,8 @@ dtb-$(CONFIG_ARCH_QCOM)   += 
msm8998-asus-novago-tp370ql.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= msm8998-hp-envy-x2.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= msm8998-lenovo-miix-630.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= msm8998-mtp.dtb
+dtb-$(CONFIG_ARCH_QCOM)+= msm8998-oneplus-cheeseburger.dtb
+dtb-$(CONFIG_ARCH_QCOM)+= msm8998-oneplus-dumpling.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= qcs404-evb-1000.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= qcs404-evb-4000.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= qrb5165-rb5.dtb
diff --git a/arch/arm64/boot/dts/qcom/msm8998-oneplus-cheeseburger.dts 
b/arch/arm64/boot/dts/qcom/msm8998-oneplus-cheeseburger.dts
new file mode 100644
index ..66b9297588ab
--- /dev/null
+++ b/arch/arm64/boot/dts/qcom/msm8998-oneplus-cheeseburger.dts
@@ -0,0 +1,42 @@
+// SPDX-License-Identifier: BSD-3-Clause
+/*
+ * OnePlus 5 (cheeseburger) device tree
+ *
+ * Copyright (c) 2021, Jami Kettunen 
+ */
+
+#include 
+#include "msm8998-oneplus-common.dtsi"
+
+/ {
+   model = "OnePlus 5";
+   compatible = "oneplus,cheeseburger", "qcom,msm8998";
+   /* Required for bootloader to select correct board */
+   qcom,board-id = <8 0 16859 23>;
+
+   /* Capacitive keypad button backlight */
+   leds {
+   compatible = "gpio-leds";
+
+   pinctrl-names = "default";
+   pinctrl-0 = <&button_backlight_default>;
+
+   button-backlight {
+   gpios = <&pmi8998_gpio 5 GPIO_ACTIVE_HIGH>;
+   color = ;
+   function = LED_FUNCTION_KBD_BACKLIGHT;
+   default-state = "off";
+   };
+   };
+};
+
+&pmi8998_gpio {
+   button_backlight_default: button-backlight-default {
+   pinconf {
+   pins = "gpio5";
+   function = "normal";
+   bias-pull-down;
+   qcom,drive-strength = ;
+   };
+   };
+};
diff --git a/arch/arm64/boot/dts/qcom/msm8998-oneplus-common.dtsi 
b/arch/arm64/boot/dts/qcom/msm8998-oneplus-common.dtsi
new file mode 100644
index ..0f5c7828a901
--- /dev/null
+++ b/arch/arm64/boot/dts/qcom/msm8998-oneplus-common.dtsi
@@ -0,0 +1,514 @@
+// SPDX-License-Identifier: BSD-3-Clause
+/*
+ * OnePlus 5(T) (cheeseburger / dumpling) common device tree source based on 
msm8998-mtp.dtsi
+ *
+ * Copyright (c) 2021, Jami Kettunen 
+ * Copyright (c) 2016, The Linux Foundation. All rights reserved.
+ */
+
+/dts-v1/;
+
+#include 
+#include 
+#include "msm8998.dtsi"
+#include "pm8998.dtsi"
+#include "pmi8998.dtsi"
+#include "pm8005.dtsi"
+
+/ {
+   /* Required for bootloader to select correct board */
+   qcom,msm-id = <292 0x20001>; /* 8998 v2.1 */
+
+   chosen {
+   #address-cells = <2>;
+   #size-cells = <2>;
+   ranges;
+
+   /* Use display framebuffer setup by the UEFI XBL bootloader for 
simplefb */
+   framebuffer0: framebuffer@9d40 {
+   compatible = "simple-framebuffer";
+   reg = <0x0 0x9d40 0x0 0x240>;
+   width = <1080>;
+   height = <1920>;
+   stride = <(1080 * 4)>;
+   format = "a8r8g8b8";
+   };
+   };
+
+   reserved-memory {
+   /* Bootloader display framebuffer region */
+   cont_splash_mem: memory@9d40 {
+   reg = <0x0 0x9d40 0x0 0x240>;
+   no-map;
+   };
+
+   /* For getting crash logs using Android downstream kernels */

[PATCH RESEND] arm64: dts: qcom: Add support for OnePlus 5/5T

2021-03-22 Thread Jami Kettunen
Add device trees for OnePlus 5 (cheeseburger) and 5T (dumpling)
MSM8998 SoC smartphones with initial support included for:

- UFS internal storage
- USB peripheral mode
- Display
- Touch
- Bluetooth
- Hall effect sensor
- Power and volume buttons
- Capacitive keypad button backlight (on cheeseburger)

Signed-off-by: Jami Kettunen 
Reviewed-by: Konrad Dybcio 
---
 arch/arm64/boot/dts/qcom/Makefile |   2 +
 .../dts/qcom/msm8998-oneplus-cheeseburger.dts |  42 ++
 .../boot/dts/qcom/msm8998-oneplus-common.dtsi | 519 ++
 .../dts/qcom/msm8998-oneplus-dumpling.dts |  25 +
 4 files changed, 588 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/msm8998-oneplus-cheeseburger.dts
 create mode 100644 arch/arm64/boot/dts/qcom/msm8998-oneplus-common.dtsi
 create mode 100644 arch/arm64/boot/dts/qcom/msm8998-oneplus-dumpling.dts

diff --git a/arch/arm64/boot/dts/qcom/Makefile 
b/arch/arm64/boot/dts/qcom/Makefile
index 549a7a2151d4..1beb73f564f7 100644
--- a/arch/arm64/boot/dts/qcom/Makefile
+++ b/arch/arm64/boot/dts/qcom/Makefile
@@ -27,6 +27,8 @@ dtb-$(CONFIG_ARCH_QCOM)   += 
msm8998-asus-novago-tp370ql.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= msm8998-hp-envy-x2.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= msm8998-lenovo-miix-630.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= msm8998-mtp.dtb
+dtb-$(CONFIG_ARCH_QCOM)+= msm8998-oneplus-cheeseburger.dtb
+dtb-$(CONFIG_ARCH_QCOM)+= msm8998-oneplus-dumpling.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= qcs404-evb-1000.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= qcs404-evb-4000.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= qrb5165-rb5.dtb
diff --git a/arch/arm64/boot/dts/qcom/msm8998-oneplus-cheeseburger.dts 
b/arch/arm64/boot/dts/qcom/msm8998-oneplus-cheeseburger.dts
new file mode 100644
index ..13b6b8ad4679
--- /dev/null
+++ b/arch/arm64/boot/dts/qcom/msm8998-oneplus-cheeseburger.dts
@@ -0,0 +1,42 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * OnePlus 5 (cheeseburger) device tree
+ *
+ * Copyright (c) 2021, Jami Kettunen 
+ */
+
+#include 
+#include "msm8998-oneplus-common.dtsi"
+
+/ {
+   model = "OnePlus 5";
+   compatible = "oneplus,cheeseburger", "qcom,msm8998";
+   /* Required for bootloader to select correct board */
+   qcom,board-id = <8 0 16859 23>;
+
+   /* Capacitive keypad button backlight */
+   leds {
+   compatible = "gpio-leds";
+
+   pinctrl-names = "default";
+   pinctrl-0 = <&button_backlight_default>;
+
+   button-backlight {
+   gpios = <&pmi8998_gpio 5 GPIO_ACTIVE_HIGH>;
+   color = ;
+   function = LED_FUNCTION_KBD_BACKLIGHT;
+   default-state = "off";
+   };
+   };
+};
+
+&pmi8998_gpio {
+   button_backlight_default: button-backlight-default {
+   pinconf {
+   pins = "gpio5";
+   function = "normal";
+   bias-pull-down;
+   qcom,drive-strength = ;
+   };
+   };
+};
diff --git a/arch/arm64/boot/dts/qcom/msm8998-oneplus-common.dtsi 
b/arch/arm64/boot/dts/qcom/msm8998-oneplus-common.dtsi
new file mode 100644
index ..1de4d19ed143
--- /dev/null
+++ b/arch/arm64/boot/dts/qcom/msm8998-oneplus-common.dtsi
@@ -0,0 +1,519 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * OnePlus 5(T) (cheeseburger / dumpling) common device tree source based on 
msm8998-mtp.dtsi
+ *
+ * Copyright (c) 2021, Jami Kettunen 
+ * Copyright (c) 2016, The Linux Foundation. All rights reserved.
+ */
+
+/dts-v1/;
+
+#include 
+#include 
+#include "msm8998.dtsi"
+#include "pm8998.dtsi"
+#include "pmi8998.dtsi"
+#include "pm8005.dtsi"
+
+/ {
+   /* Required for bootloader to select correct board */
+   qcom,msm-id = <292 0x20001>; /* 8998 v2.1 */
+
+   chosen {
+   #address-cells = <2>;
+   #size-cells = <2>;
+   ranges;
+
+   /* Use display framebuffer setup by the UEFI XBL bootloader for 
simplefb */
+   framebuffer0: framebuffer@9d40 {
+   compatible = "simple-framebuffer";
+   reg = <0x0 0x9d40 0x0 0x240>;
+   width = <1080>;
+   height = <1920>;
+   stride = <(1080 * 4)>;
+   format = "a8r8g8b8";
+   };
+   };
+
+   reserved-memory {
+   /* Bootloader display framebuffer region */
+   cont_splash_mem: memory@9d40 {
+   reg = <0x0 0x9d40 0x0 0x240>;
+   no-map;
+   };
+
+   /* For getting crash logs

Re: [PATCH] clk: qcom: Add missing msm8998 ufs_unipro_core_clk_src

2020-05-28 Thread Jami Kettunen

Tested-by: Jami Kettunen 

On 28.5.2020 17.22, Jeffrey Hugo wrote:

ufs_unipro_core_clk_src is required to allow UFS to clock scale for power
savings.

Fixes: b5f5f525c547 ("clk: qcom: Add MSM8998 Global Clock Control (GCC) driver")
Signed-off-by: Jeffrey Hugo 
---
  drivers/clk/qcom/gcc-msm8998.c   | 27 
  include/dt-bindings/clock/qcom,gcc-msm8998.h |  1 +
  2 files changed, 28 insertions(+)

diff --git a/drivers/clk/qcom/gcc-msm8998.c b/drivers/clk/qcom/gcc-msm8998.c
index df1d7056436c..9d7016bcd680 100644
--- a/drivers/clk/qcom/gcc-msm8998.c
+++ b/drivers/clk/qcom/gcc-msm8998.c
@@ -1110,6 +1110,27 @@ static struct clk_rcg2 ufs_axi_clk_src = {
},
  };
  
+static const struct freq_tbl ftbl_ufs_unipro_core_clk_src[] = {

+   F(3750, P_GPLL0_OUT_MAIN, 16, 0, 0),
+   F(7500, P_GPLL0_OUT_MAIN, 8, 0, 0),
+   F(15000, P_GPLL0_OUT_MAIN, 4, 0, 0),
+   { }
+};
+
+static struct clk_rcg2 ufs_unipro_core_clk_src = {
+   .cmd_rcgr = 0x76028,
+   .mnd_width = 8,
+   .hid_width = 5,
+   .parent_map = gcc_parent_map_0,
+   .freq_tbl = ftbl_ufs_unipro_core_clk_src,
+   .clkr.hw.init = &(struct clk_init_data){
+   .name = "ufs_unipro_core_clk_src",
+   .parent_names = gcc_parent_names_0,
+   .num_parents = 4,
+   .ops = &clk_rcg2_ops,
+   },
+};
+
  static const struct freq_tbl ftbl_usb30_master_clk_src[] = {
F(1920, P_XO, 1, 0, 0),
F(6000, P_GPLL0_OUT_MAIN, 10, 0, 0),
@@ -2549,6 +2570,11 @@ static struct clk_branch gcc_ufs_unipro_core_clk = {
.enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){
.name = "gcc_ufs_unipro_core_clk",
+   .parent_names = (const char *[]){
+   "ufs_unipro_core_clk_src",
+   },
+   .num_parents = 1,
+   .flags = CLK_SET_RATE_PARENT,
.ops = &clk_branch2_ops,
},
},
@@ -2904,6 +2930,7 @@ static struct clk_regmap *gcc_msm8998_clocks[] = {
[SDCC4_APPS_CLK_SRC] = &sdcc4_apps_clk_src.clkr,
[TSIF_REF_CLK_SRC] = &tsif_ref_clk_src.clkr,
[UFS_AXI_CLK_SRC] = &ufs_axi_clk_src.clkr,
+   [UFS_UNIPRO_CORE_CLK_SRC] = &ufs_unipro_core_clk_src.clkr,
[USB30_MASTER_CLK_SRC] = &usb30_master_clk_src.clkr,
[USB30_MOCK_UTMI_CLK_SRC] = &usb30_mock_utmi_clk_src.clkr,
[USB3_PHY_AUX_CLK_SRC] = &usb3_phy_aux_clk_src.clkr,
diff --git a/include/dt-bindings/clock/qcom,gcc-msm8998.h 
b/include/dt-bindings/clock/qcom,gcc-msm8998.h
index 63e02dc32a0b..6a73a174f049 100644
--- a/include/dt-bindings/clock/qcom,gcc-msm8998.h
+++ b/include/dt-bindings/clock/qcom,gcc-msm8998.h
@@ -183,6 +183,7 @@
  #define GCC_MSS_SNOC_AXI_CLK  174
  #define GCC_MSS_MNOC_BIMC_AXI_CLK 175
  #define GCC_BIMC_GFX_CLK  176
+#define UFS_UNIPRO_CORE_CLK_SRC177
  
  #define PCIE_0_GDSC		0

  #define UFS_GDSC  1