Skip to contentSkip to conversation

Add support for SDM845 based boards, and SM-G9600

PATCH Superseded [email protected] 3 participants 14 messages Sep 23, 2021 – Oct 5, 2021

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Add support for SDM845 based boards, and SM-G9600

From: Dzmitry Sankouski <[email protected]>

Snapdragon 845 - hi-end qualcomm chip, introduced in late 2017. Mostly used in flagship phones and tablets of 2018. Features:
- arm64 arch
- total of 8 Kryo 385 Gold / Silver cores
- Hexagon 685 DSP
- Adreno 630 GPU

Tested only as second-stage bootloader.

Samsung S9 SM-G9600 - Snapdragon SDM845 version of the phone, for China \ Hong Kong markets.
Has unlockable bootloader, unlike SM-G960U (American market version), which allows running u-boot as a chain-loaded bootloader.

Dzmitry Sankouski (6):
serial: qcom: add support for GENI serial driver
spmi: msm: add arbiter version 5 support
pinctrl: qcom: add pinctrl and gpio drivers for SDM845 SoC
clocks: qcom: add clocks for SDM845 debug uart
SoC: qcom: add support for SDM845
board: samsung: add Samsung Galaxy S9/S9+(SM-G96x0) board

 MAINTAINERS                                   |   2 +
 arch/arm/dts/Makefile                         |   1 +
 arch/arm/dts/sdm845.dtsi                      | 118 ++++
 arch/arm/dts/starqltechn-uboot.dtsi           |  39 ++
 arch/arm/dts/starqltechn.dts                  |  53 ++
 arch/arm/mach-snapdragon/Kconfig              |  17 +
 arch/arm/mach-snapdragon/Makefile             |   4 +
 arch/arm/mach-snapdragon/clock-sdm845.c       |  92 +++
 arch/arm/mach-snapdragon/clock-snapdragon.c   |   1 +
 arch/arm/mach-snapdragon/clock-snapdragon.h   |   3 +-
 .../include/mach/sysmap-sdm845.h              |  42 ++
 arch/arm/mach-snapdragon/init_sdm845.c        |  82 +++
 arch/arm/mach-snapdragon/pinctrl-sdm845.c     |  44 ++
 arch/arm/mach-snapdragon/pinctrl-snapdragon.c |   1 +
 arch/arm/mach-snapdragon/pinctrl-snapdragon.h |   1 +
 arch/arm/mach-snapdragon/sysmap-sdm845.c      |  31 +
 board/samsung/starqltechn/Kconfig             |  14 +
 board/samsung/starqltechn/MAINTAINERS         |   6 +
 board/samsung/starqltechn/Makefile            |   9 +
 board/samsung/starqltechn/starqltechn.c       |  10 +
 configs/starqltechn_defconfig                 |  33 +
 doc/board/qualcomm/index.rst                  |   1 +
 doc/board/qualcomm/sdm845.rst                 |  38 ++
 .../serial/msm-geni-serial.txt                |   6 +
 drivers/gpio/msm_gpio.c                       |   1 +
 drivers/gpio/pm8916_gpio.c                    |   8 +-
 drivers/serial/Kconfig                        |  17 +
 drivers/serial/Makefile                       |   1 +
 drivers/serial/serial_msm_geni.c              | 602 ++++++++++++++++++
 drivers/spmi/spmi-msm.c                       | 156 +++--
 include/configs/sdm845.h                      |  33 +
 include/configs/starqltechn.h                 |  16 +
 32 files changed, 1428 insertions(+), 54 deletions(-)
 create mode 100644 arch/arm/dts/sdm845.dtsi
 create mode 100644 arch/arm/dts/starqltechn-uboot.dtsi
 create mode 100644 arch/arm/dts/starqltechn.dts
 create mode 100644 arch/arm/mach-snapdragon/clock-sdm845.c
 create mode 100644 arch/arm/mach-snapdragon/include/mach/sysmap-sdm845.h
 create mode 100644 arch/arm/mach-snapdragon/init_sdm845.c
 create mode 100644 arch/arm/mach-snapdragon/pinctrl-sdm845.c
 create mode 100644 arch/arm/mach-snapdragon/sysmap-sdm845.c
 create mode 100644 board/samsung/starqltechn/Kconfig
 create mode 100644 board/samsung/starqltechn/MAINTAINERS
 create mode 100644 board/samsung/starqltechn/Makefile
 create mode 100644 board/samsung/starqltechn/starqltechn.c
 create mode 100644 configs/starqltechn_defconfig
 create mode 100644 doc/board/qualcomm/sdm845.rst
 create mode 100644 doc/device-tree-bindings/serial/msm-geni-serial.txt
 create mode 100644 drivers/serial/serial_msm_geni.c
 create mode 100644 include/configs/sdm845.h
 create mode 100644 include/configs/starqltechn.h
Signature · 1 line
2.20.1
#1 lore raw

PATCH v3 1/6 serial: qcom: add support for GENI serial driver

From: Dzmitry Sankouski <[email protected]>

Generic Interface (GENI) Serial Engine (SE) based uart can be found on newer qualcomm SOCs, starting from SDM845. Tested on Samsung SM-G9600(starqltechn)
by chain-loading u-boot with stock bootloader.

---
Changes for v2:
- change functions return type to void, where possible
- remove '.' from summary line
Changes for v3:
- move function open brace on new line
- use tab between define name and value
- define: wrap expression with braces, remove braces from constants

 MAINTAINERS                                   |   1 +
 .../serial/msm-geni-serial.txt                |   6 +
 drivers/serial/Kconfig                        |  17 +
 drivers/serial/Makefile                       |   1 +
 drivers/serial/serial_msm_geni.c              | 602 ++++++++++++++++++
 5 files changed, 627 insertions(+)
 create mode 100644 doc/device-tree-bindings/serial/msm-geni-serial.txt
 create mode 100644 drivers/serial/serial_msm_geni.c
MAINTAINERS +1 -0
index 776ff703b9..52ddc99cda 100644
@@ -390,6 +390,7 @@ F:	drivers/gpio/msm_gpio.c
 F:	drivers/mmc/msm_sdhci.c
 F:	drivers/phy/msm8916-usbh-phy.c
 F:	drivers/serial/serial_msm.c
+F:	drivers/serial/serial_msm_geni.c
 F:	drivers/smem/msm_smem.c
 F:	drivers/usb/host/ehci-msm.c
 
doc/device-tree-bindings/serial/msm-geni-serial.txt new file +6 -0
new file mode 100644
index 0000000000..9eadc2561b
@@ -0,0 +1,6 @@
+Qualcomm GENI UART
+
+Required properties:
+- compatible: must be "qcom,msm-geni-uart"
+- reg: start address and size of the registers
+- clock: interface clock (must accept baudrate as a frequency)
drivers/serial/Kconfig +17 -0
index 93348c0929..b420a5720d 100644
@@ -278,6 +278,14 @@ config DEBUG_UART_S5P
 	  will need to provide parameters to make this work. The driver will
 	  be available until the real driver-model serial is running.
 
+config DEBUG_UART_MSM_GENI
+	bool "Qualcomm snapdragon"
+	depends on ARCH_SNAPDRAGON
+	help
+	  Select this to enable a debug UART using the serial_msm driver. You
+	  will need to provide parameters to make this work. The driver will
+	  be available until the real driver-model serial is running.
+
 config DEBUG_UART_MESON
 	bool "Amlogic Meson"
 	depends on MESON_SERIAL
@@ -783,6 +791,15 @@ config MSM_SERIAL
 	  for example APQ8016 and MSM8916.
 	  Single baudrate is supported in current implementation (115200).
 
+config MSM_GENI_SERIAL
+	bool "Qualcomm on-chip GENI UART"
+	help
+	  Support UART based on Generic Interface (GENI) Serial Engine (SE), used on Qualcomm Snapdragon SoCs.
+	  Should support all qualcomm SOCs with Qualcomm Universal Peripheral (QUP) Wrapper cores,
+	  i.e. newer ones, starting from SDM845.
+	  Driver works in FIFO mode.
+	  Multiple baudrates supported.
+
 config OCTEON_SERIAL_BOOTCMD
 	bool "MIPS Octeon PCI remote bootcmd input"
 	depends on ARCH_OCTEON
drivers/serial/Makefile +1 -0
index 3cbea8156f..d44caf4ea2 100644
@@ -62,6 +62,7 @@ obj-$(CONFIG_PIC32_SERIAL) += serial_pic32.o
 obj-$(CONFIG_BCM283X_MU_SERIAL) += serial_bcm283x_mu.o
 obj-$(CONFIG_BCM283X_PL011_SERIAL) += serial_bcm283x_pl011.o
 obj-$(CONFIG_MSM_SERIAL) += serial_msm.o
+obj-$(CONFIG_MSM_GENI_SERIAL) += serial_msm_geni.o
 obj-$(CONFIG_MVEBU_A3700_UART) += serial_mvebu_a3700.o
 obj-$(CONFIG_MPC8XX_CONS) += serial_mpc8xx.o
 obj-$(CONFIG_NULLDEV_SERIAL) += serial_nulldev.o
drivers/serial/serial_msm_geni.c new file +602 -0

602 lines not on this page · raw message

Signature · 1 line
2.20.1
#6 lore raw

PATCH 4/6 clocks: qcom: add clocks for SDM845 debug uart

In reply to [email protected]

From: Dzmitry Sankouski <[email protected]>

Allows to change clock frequency of debug uart,
thus supporting wide range of baudrates.
Enable / disable functionality is not implemented yet. In most use cases of SDM845 (i.e. mobile phones and tablets) it's not needed, because qualcomm first stage bootloader leaves it initialized, and on the other hand there's no possibility to replace signed first stage bootloader with u-boot.

---
 arch/arm/mach-snapdragon/clock-sdm845.c     | 92 +++++++++++++++++++++
 arch/arm/mach-snapdragon/clock-snapdragon.c |  1 +
 arch/arm/mach-snapdragon/clock-snapdragon.h |  3 +-
 3 files changed, 95 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-snapdragon/clock-sdm845.c
arch/arm/mach-snapdragon/clock-sdm845.c new file +92 -0
new file mode 100644
index 0000000000..9572639238
@@ -0,0 +1,92 @@
+// SPDX-License-Identifier: BSD-3-Clause
+/*
+ * Clock drivers for Qualcomm SDM845
+ *
+ * (C) Copyright 2017 Jorge Ramirez Ortiz <[email protected]>
+ * (C) Copyright 2021 Dzmitry Sankouski <[email protected]>
+ *
+ * Based on Little Kernel driver, simplified
+ */
+
+#include <common.h>
+#include <clk-uclass.h>
+#include <dm.h>
+#include <errno.h>
+#include <asm/io.h>
+#include <linux/bitops.h>
+#include "clock-snapdragon.h"
+
+#define F(f, s, h, m, n) { (f), (s), (2 * (h) - 1), (m), (n) }
+
+struct freq_tbl {
+	uint freq;
+	uint src;
+	u8 pre_div;
+	u16 m;
+	u16 n;
+};
+
+static const struct freq_tbl ftbl_gcc_qupv3_wrap0_s0_clk_src[] = {
+	F(7372800, CFG_CLK_SRC_GPLL0_EVEN, 1, 384, 15625),
+	F(14745600, CFG_CLK_SRC_GPLL0_EVEN, 1, 768, 15625),
+	F(19200000, CFG_CLK_SRC_CXO, 1, 0, 0),
+	F(29491200, CFG_CLK_SRC_GPLL0_EVEN, 1, 1536, 15625),
+	F(32000000, CFG_CLK_SRC_GPLL0_EVEN, 1, 8, 75),
+	F(48000000, CFG_CLK_SRC_GPLL0_EVEN, 1, 4, 25),
+	F(64000000, CFG_CLK_SRC_GPLL0_EVEN, 1, 16, 75),
+	F(80000000, CFG_CLK_SRC_GPLL0_EVEN, 1, 4, 15),
+	F(96000000, CFG_CLK_SRC_GPLL0_EVEN, 1, 8, 25),
+	F(100000000, CFG_CLK_SRC_GPLL0_EVEN, 3, 0, 0),
+	F(102400000, CFG_CLK_SRC_GPLL0_EVEN, 1, 128, 375),
+	F(112000000, CFG_CLK_SRC_GPLL0_EVEN, 1, 28, 75),
+	F(117964800, CFG_CLK_SRC_GPLL0_EVEN, 1, 6144, 15625),
+	F(120000000, CFG_CLK_SRC_GPLL0_EVEN, 2.5, 0, 0),
+	F(128000000, CFG_CLK_SRC_GPLL0, 1, 16, 75),
+	{ }
+};
+
+static const struct bcr_regs uart2_regs = {
+	.cfg_rcgr = SE9_UART_APPS_CFG_RCGR,
+	.cmd_rcgr = SE9_UART_APPS_CMD_RCGR,
+	.M = SE9_UART_APPS_M,
+	.N = SE9_UART_APPS_N,
+	.D = SE9_UART_APPS_D,
+};
+
+const struct freq_tbl *qcom_find_freq(const struct freq_tbl *f, uint rate)
+{
+	if (!f)
+		return NULL;
+
+	if (!f->freq)
+		return f;
+
+	for (; f->freq; f++)
+		if (rate <= f->freq)
+			return f;
+
+	/* Default to our fastest rate */
+	return f - 1;
+}
+
+static int clk_init_uart(struct msm_clk_priv *priv, uint rate)
+{
+	const struct freq_tbl *freq = qcom_find_freq(ftbl_gcc_qupv3_wrap0_s0_clk_src, rate);
+
+	clk_rcg_set_rate_mnd(priv->base, &uart2_regs,
+						freq->pre_div, freq->m, freq->n, freq->src);
+
+	return 0;
+}
+
+ulong msm_set_rate(struct clk *clk, ulong rate)
+{
+	struct msm_clk_priv *priv = dev_get_priv(clk->dev);
+
+	switch (clk->id) {
+	case 0x58: /*UART2*/
+		return clk_init_uart(priv, rate);
+	default:
+		return 0;
+	}
+}
arch/arm/mach-snapdragon/clock-snapdragon.c +1 -0
index 2b76371718..3deb08ac4a 100644
@@ -135,6 +135,7 @@ static const struct udevice_id msm_clk_ids[] = {
 	{ .compatible = "qcom,gcc-apq8016" },
 	{ .compatible = "qcom,gcc-msm8996" },
 	{ .compatible = "qcom,gcc-apq8096" },
+	{ .compatible = "qcom,gcc-sdm845" },
 	{ }
 };
 
arch/arm/mach-snapdragon/clock-snapdragon.h +2 -1
index 58fab40a2e..2ac53b538d 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
- * Qualcomm APQ8016, APQ8096
+ * Qualcomm APQ8016, APQ8096, SDM845
  *
  * (C) Copyright 2017 Jorge Ramirez-Ortiz <[email protected]>
  */
@@ -9,6 +9,7 @@
 
 #define CFG_CLK_SRC_CXO   (0 << 8)
 #define CFG_CLK_SRC_GPLL0 (1 << 8)
+#define CFG_CLK_SRC_GPLL0_EVEN (6 << 8)
 #define CFG_CLK_SRC_MASK  (7 << 8)
 
 struct pll_vote_clk {
Signature · 1 line
2.20.1
#4 lore raw

PATCH v3 2/6 spmi: msm: add arbiter version 5 support

In reply to [email protected]

From: Dzmitry Sankouski <[email protected]>

Currently driver supports only version 1 and 2. Version 5 has slightly different registers structure

---
Changes for v2:
- change string formats in debug statements Changes for v3
- remove if else braces where possible

 MAINTAINERS             |   1 +
 drivers/spmi/spmi-msm.c | 156 +++++++++++++++++++++++++++-------------
 2 files changed, 107 insertions(+), 50 deletions(-)
MAINTAINERS +1 -0
index 52ddc99cda..6b8b0783d2 100644
@@ -392,6 +392,7 @@ F:	drivers/phy/msm8916-usbh-phy.c
 F:	drivers/serial/serial_msm.c
 F:	drivers/serial/serial_msm_geni.c
 F:	drivers/smem/msm_smem.c
+F:	drivers/spmi/spmi-msm.c
 F:	drivers/usb/host/ehci-msm.c
 
 ARM STI
drivers/spmi/spmi-msm.c +106 -50

236 lines not on this page · raw message

Signature · 1 line
2.20.1
#2 lore raw

PATCH 3/6 pinctrl: qcom: add pinctrl and gpio drivers for SDM845 SoC

In reply to [email protected]

From: Dzmitry Sankouski <[email protected]>

---
 arch/arm/mach-snapdragon/pinctrl-sdm845.c     | 44 +++++++++++++++++++
 arch/arm/mach-snapdragon/pinctrl-snapdragon.c |  1 +
 arch/arm/mach-snapdragon/pinctrl-snapdragon.h |  1 +
 drivers/gpio/msm_gpio.c                       |  1 +
 drivers/gpio/pm8916_gpio.c                    |  8 ++--
 5 files changed, 52 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/mach-snapdragon/pinctrl-sdm845.c
arch/arm/mach-snapdragon/pinctrl-sdm845.c new file +44 -0
new file mode 100644
index 0000000000..6d66582aa6
@@ -0,0 +1,44 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Qualcomm SDM845 pinctrl
+ *
+ * (C) Copyright 2021 Dzmitry Sankouski <[email protected]>
+ *
+ */
+
+#include "pinctrl-snapdragon.h"
+#include <common.h>
+
+#define MAX_PIN_NAME_LEN 32
+static char pin_name[MAX_PIN_NAME_LEN];
+
+static const struct pinctrl_function msm_pinctrl_functions[] = {
+	{"qup9", 1},
+	{"gpio", 0},
+};
+
+static const char *sdm845_get_function_name(struct udevice *dev,
+					     unsigned int selector)
+{
+	return msm_pinctrl_functions[selector].name;
+}
+
+static const char *sdm845_get_pin_name(struct udevice *dev,
+					unsigned int selector)
+{
+	snprintf(pin_name, MAX_PIN_NAME_LEN, "GPIO_%u", selector);
+	return pin_name;
+}
+
+static unsigned int sdm845_get_function_mux(unsigned int selector)
+{
+	return msm_pinctrl_functions[selector].val;
+}
+
+struct msm_pinctrl_data sdm845_data = {
+	.pin_count = 150,
+	.functions_count = ARRAY_SIZE(msm_pinctrl_functions),
+	.get_function_name = sdm845_get_function_name,
+	.get_function_mux = sdm845_get_function_mux,
+	.get_pin_name = sdm845_get_pin_name,
+};
arch/arm/mach-snapdragon/pinctrl-snapdragon.c +1 -0
index e6b87c3573..c0ed943036 100644
@@ -116,6 +116,7 @@ static struct pinctrl_ops msm_pinctrl_ops = {
 static const struct udevice_id msm_pinctrl_ids[] = {
 	{ .compatible = "qcom,tlmm-apq8016", .data = (ulong)&apq8016_data },
 	{ .compatible = "qcom,tlmm-apq8096", .data = (ulong)&apq8096_data },
+	{ .compatible = "qcom,tlmm-sdm845", .data = (ulong)&sdm845_data },
 	{ }
 };
 
arch/arm/mach-snapdragon/pinctrl-snapdragon.h +1 -0
index 61d466f4d8..ea524312a0 100644
@@ -27,5 +27,6 @@ struct pinctrl_function {
 
 extern struct msm_pinctrl_data apq8016_data;
 extern struct msm_pinctrl_data apq8096_data;
+extern struct msm_pinctrl_data sdm845_data;
 
 #endif
drivers/gpio/msm_gpio.c +1 -0
index e1ff84c1c0..a3c3cd7824 100644
@@ -120,6 +120,7 @@ static const struct udevice_id msm_gpio_ids[] = {
 	{ .compatible = "qcom,msm8916-pinctrl" },
 	{ .compatible = "qcom,apq8016-pinctrl" },
 	{ .compatible = "qcom,ipq4019-pinctrl" },
+	{ .compatible = "qcom,sdm845-pinctrl" },
 	{ }
 };
 
drivers/gpio/pm8916_gpio.c +5 -3
index 40b0f2578b..7ad95784a8 100644
@@ -202,6 +202,7 @@ static int pm8916_gpio_of_to_plat(struct udevice *dev)
 static const struct udevice_id pm8916_gpio_ids[] = {
 	{ .compatible = "qcom,pm8916-gpio" },
 	{ .compatible = "qcom,pm8994-gpio" },	/* 22 GPIO's */
+	{ .compatible = "qcom,pm8998-gpio" },
 	{ }
 };
 
@@ -266,7 +267,7 @@ static int pm8941_pwrkey_probe(struct udevice *dev)
 		return log_msg_ret("bad type", -ENXIO);
 
 	reg = pmic_reg_read(dev->parent, priv->pid + REG_SUBTYPE);
-	if (reg != 0x1)
+	if ((reg & 0x5) == 0)
 		return log_msg_ret("bad subtype", -ENXIO);
 
 	return 0;
@@ -287,11 +288,12 @@ static int pm8941_pwrkey_of_to_plat(struct udevice *dev)
 static const struct udevice_id pm8941_pwrkey_ids[] = {
 	{ .compatible = "qcom,pm8916-pwrkey" },
 	{ .compatible = "qcom,pm8994-pwrkey" },
+	{ .compatible = "qcom,pm8998-pwrkey" },
 	{ }
 };
 
-U_BOOT_DRIVER(pwrkey_pm8941) = {
-	.name	= "pwrkey_pm8916",
+U_BOOT_DRIVER(pwrkey_pm89xx) = {
+	.name	= "pwrkey_pm89xx",
 	.id	= UCLASS_GPIO,
 	.of_match = pm8941_pwrkey_ids,
 	.of_to_plat = pm8941_pwrkey_of_to_plat,
Signature · 1 line
2.20.1
#7 lore raw

PATCH 5/6 SoC: qcom: add support for SDM845

In reply to [email protected]

From: Dzmitry Sankouski <[email protected]>

Hi-end qualcomm chip, introduced in late 2017. Mostly used in flagship phones and tablets of 2018. Features:
- arm64 arch
- total of 8 Kryo 385 Gold / Silver cores
- Hexagon 685 DSP
- Adreno 630 GPU

Tested only as second-stage bootloader.

---
 arch/arm/dts/sdm845.dtsi                      | 118 ++++++++++++++++++
 arch/arm/mach-snapdragon/Kconfig              |   4 +
 arch/arm/mach-snapdragon/Makefile             |   4 +
 .../include/mach/sysmap-sdm845.h              |  42 +++++++
 arch/arm/mach-snapdragon/init_sdm845.c        |  82 ++++++++++++
 arch/arm/mach-snapdragon/sysmap-sdm845.c      |  31 +++++
 include/configs/sdm845.h                      |  33 +++++
 7 files changed, 314 insertions(+)
 create mode 100644 arch/arm/dts/sdm845.dtsi
 create mode 100644 arch/arm/mach-snapdragon/include/mach/sysmap-sdm845.h
 create mode 100644 arch/arm/mach-snapdragon/init_sdm845.c
 create mode 100644 arch/arm/mach-snapdragon/sysmap-sdm845.c
 create mode 100644 include/configs/sdm845.h
arch/arm/dts/sdm845.dtsi new file +118 -0
new file mode 100644
index 0000000000..bf32c6995d
@@ -0,0 +1,118 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Qualcomm SDM845 chip device tree source
+ *
+ * (C) Copyright 2021 Dzmitry Sankouski <[email protected]>
+ *
+ */
+
+/dts-v1/;
+
+#include "skeleton64.dtsi"
+
+/ {
+	soc: soc {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges = <0 0 0 0xffffffff>;
+		compatible = "simple-bus";
+
+		gcc: clock-controller@100000 {
+			u-boot,dm-pre-reloc;
+			compatible = "qcom,gcc-sdm845";
+			reg = <0x00100000 0x1f0000>;
+			#clock-cells = <1>;
+			#reset-cells = <1>;
+			#power-domain-cells = <1>;
+		};
+
+		gpio_north: gpio_north@3900000 {
+			u-boot,dm-pre-reloc;
+			#gpio-cells = <2>;
+			compatible = "qcom,sdm845-pinctrl";
+			reg = <0x3900000 0x400000>;
+			gpio-count = <150>;
+			gpio-controller;
+			gpio-ranges = <&gpio_north 0 0 150>;
+			gpio-bank-name = "soc_north.";
+		};
+
+		tlmm_north: pinctrl_north@3900000 {
+			u-boot,dm-pre-reloc;
+			compatible = "qcom,tlmm-sdm845";
+			reg = <0x03900000 0x400000>;
+			gpio-count = <150>;
+			gpio-controller;
+			#gpio-cells = <2>;
+			gpio-ranges = <&tlmm_north 0 0 150>;
+
+			/* DEBUG UART */
+			qup_uart9: qup-uart9-default {
+				pinmux {
+					pins = "GPIO_4", "GPIO_5";
+					function = "qup9";
+				};
+			};
+		};
+
+		debug_uart: serial@0xa84000 {
+			compatible = "qcom,msm-geni-uart";
+			reg = <0xa84000 0x4000>;
+			reg-names = "se_phys";
+			clock-names = "se-clk";
+			clocks = <&gcc 0x58>;
+			pinctrl-names = "default";
+			pinctrl-0 = <&qup_uart9>;
+			qcom,wrapper-core = <0x8a>;
+			status = "disabled";
+		};
+
+		spmi@c440000 {
+			compatible = "qcom,spmi-pmic-arb";
+			reg = <0xc440000 0x1100>,
+			      <0xc600000 0x2000000>,
+			      <0xe600000 0x100000>;
+			reg-names = "cnfg", "core", "obsrvr";
+			#address-cells = <0x1>;
+			#size-cells = <0x1>;
+
+			qcom,revid@100 {
+				compatible = "qcom,qpnp-revid";
+				reg = <0x100 0x100>;
+				linux,phandle = <0x3ac>;
+				phandle = <0x3ac>;
+			};
+
+			pmic0: pm8998@0 {
+				compatible = "qcom,spmi-pmic";
+				reg = <0x0 0x1>;
+				#address-cells = <0x1>;
+				#size-cells = <0x1>;
+
+				pm8998_pon: pm8998_pon@800 {
+					compatible = "qcom,pm8998-pwrkey";
+					reg = <0x800 0x100>;
+					#gpio-cells = <2>;
+					gpio-controller;
+					gpio-bank-name="pm8998_key.";
+				};
+
+				pm8998_gpios: pm8998_gpios@c000 {
+					compatible = "qcom,pm8998-gpio";
+					reg = <0xc000 0x1a00>;
+					gpio-controller;
+					gpio-count = <21>;
+					#gpio-cells = <2>;
+					gpio-bank-name="pm8998.";
+				};
+			};
+
+			pmic1: pm8998@1 {
+				compatible = "qcom,spmi-pmic";
+				reg = <0x1 0x0>;
+				#address-cells = <0x2>;
+				#size-cells = <0x0>;
+			};
+		};
+	};
+};
arch/arm/mach-snapdragon/Kconfig +4 -0
index 0ec74fa5d3..1a6a608967 100644
@@ -9,6 +9,10 @@ config SYS_MALLOC_F_LEN
 config SPL_SYS_MALLOC_F_LEN
 	default 0x2000
 
+config SDM845
+	bool "Qualcomm Snapdragon 845 SoC"
+	default n
+
 choice
 	prompt "Snapdragon board select"
 
arch/arm/mach-snapdragon/Makefile +4 -0
index 709919fce4..962855eb8c 100644
@@ -2,6 +2,9 @@
 #
 # (C) Copyright 2015 Mateusz Kulikowski <[email protected]>
 
+obj-$(CONFIG_SDM845) += clock-sdm845.o
+obj-$(CONFIG_SDM845) += sysmap-sdm845.o
+obj-$(CONFIG_SDM845) += init_sdm845.o
 obj-$(CONFIG_TARGET_DRAGONBOARD820C) += clock-apq8096.o
 obj-$(CONFIG_TARGET_DRAGONBOARD820C) += sysmap-apq8096.o
 obj-$(CONFIG_TARGET_DRAGONBOARD410C) += clock-apq8016.o
@@ -12,3 +15,4 @@ obj-y += dram.o
 obj-y += pinctrl-snapdragon.o
 obj-y += pinctrl-apq8016.o
 obj-y += pinctrl-apq8096.o
+obj-$(CONFIG_SDM845) += pinctrl-sdm845.o
arch/arm/mach-snapdragon/include/mach/sysmap-sdm845.h new file +42 -0

42 lines not on this page · raw message

arch/arm/mach-snapdragon/init_sdm845.c new file +82 -0

82 lines not on this page · raw message

arch/arm/mach-snapdragon/sysmap-sdm845.c new file +31 -0
new file mode 100644
index 0000000000..721ac41166
@@ -0,0 +1,31 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Qualcomm SDM845 memory map
+ *
+ * (C) Copyright 2021 Dzmitry Sankouski <[email protected]>
+ */
+
+#include <common.h>
+#include <asm/armv8/mmu.h>
+
+static struct mm_region sdm845_mem_map[] = {
+	{
+		.virt = 0x0UL, /* Peripheral block */
+		.phys = 0x0UL, /* Peripheral block */
+		.size = 0x10000000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+			 PTE_BLOCK_NON_SHARE |
+			 PTE_BLOCK_PXN | PTE_BLOCK_UXN
+	}, {
+		.virt = 0x80000000UL, /* DDR */
+		.phys = 0x80000000UL, /* DDR */
+		.size = 0x200000000UL, /* 8GiB - maximum allowed memory */
+		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
+			 PTE_BLOCK_INNER_SHARE
+	}, {
+		/* List terminator */
+		0,
+	}
+};
+
+struct mm_region *mem_map = sdm845_mem_map;
include/configs/sdm845.h new file +33 -0
new file mode 100644
index 0000000000..c77d0acac6
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Configuration file for boards, based on Qualcomm SDM845 chip
+ *
+ * (C) Copyright 2021 Dzmitry Sankouski <[email protected]>
+ */
+
+#ifndef __CONFIGS_SDM845_H
+#define __CONFIGS_SDM845_H
+
+#include <linux/sizes.h>
+#include <asm/arch/sysmap-sdm845.h>
+
+#define CONFIG_SYS_LOAD_ADDR	0x80000000
+#define CONFIG_SYS_BAUDRATE_TABLE	{ 115200, 230400, 460800, 921600 }
+
+/* Generic Timer Definitions */
+#define COUNTER_FREQUENCY	19000000
+
+#define EXTRA_ENV_SETTINGS \
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	"loadaddr=0x80000000\0"
+
+/* Size of malloc() pool */
+#define CONFIG_SYS_MALLOC_LEN   (CONFIG_ENV_SIZE + SZ_8M)
+#define CONFIG_SYS_BOOTM_LEN	SZ_64M
+
+/* Monitor Command Prompt */
+#define CONFIG_SYS_CBSIZE	512
+#define CONFIG_SYS_MAXARGS	64
+
+#endif
Signature · 1 line
2.20.1
#9 lore raw

PATCH v3 6/6 board: samsung: add Samsung Galaxy S9/S9+(SM-G96x0) board

In reply to [email protected]

From: Dzmitry Sankouski <[email protected]>

Samsung S9 SM-G9600 - Snapdragon SDM845 version of the phone, for China \ Hong Kong markets.
Has unlockable bootloader, unlike SM-G960U (American market version), which allows running u-boot as a chain-loaded bootloader.

---
Changes for v2:
- Create documentation file for SDM845 boards
- Add starqltechn board documentation
Changes for v3:
- fix comment in starqltechn.c

 arch/arm/dts/Makefile                   |  1 +
 arch/arm/dts/starqltechn-uboot.dtsi     | 39 ++++++++++++++++++
 arch/arm/dts/starqltechn.dts            | 53 +++++++++++++++++++++++++
 arch/arm/mach-snapdragon/Kconfig        | 13 ++++++
 board/samsung/starqltechn/Kconfig       | 14 +++++++
 board/samsung/starqltechn/MAINTAINERS   |  6 +++
 board/samsung/starqltechn/Makefile      |  9 +++++
 board/samsung/starqltechn/starqltechn.c | 10 +++++
 configs/starqltechn_defconfig           | 33 +++++++++++++++
 doc/board/qualcomm/index.rst            |  1 +
 doc/board/qualcomm/sdm845.rst           | 38 ++++++++++++++++++
 include/configs/starqltechn.h           | 16 ++++++++
 12 files changed, 233 insertions(+)
 create mode 100644 arch/arm/dts/starqltechn-uboot.dtsi
 create mode 100644 arch/arm/dts/starqltechn.dts
 create mode 100644 board/samsung/starqltechn/Kconfig
 create mode 100644 board/samsung/starqltechn/MAINTAINERS
 create mode 100644 board/samsung/starqltechn/Makefile
 create mode 100644 board/samsung/starqltechn/starqltechn.c
 create mode 100644 configs/starqltechn_defconfig
 create mode 100644 doc/board/qualcomm/sdm845.rst
 create mode 100644 include/configs/starqltechn.h
arch/arm/dts/Makefile +1 -0
index 82a0790cc0..90d922dab7 100644
@@ -467,6 +467,7 @@ dtb-$(CONFIG_TARGET_SL28) += fsl-ls1028a-kontron-sl28.dtb \
 
 dtb-$(CONFIG_TARGET_DRAGONBOARD410C) += dragonboard410c.dtb
 dtb-$(CONFIG_TARGET_DRAGONBOARD820C) += dragonboard820c.dtb
+dtb-$(CONFIG_TARGET_STARQLTECHN) += starqltechn.dtb
 
 dtb-$(CONFIG_TARGET_STEMMY) += ste-ux500-samsung-stemmy.dtb
 
arch/arm/dts/starqltechn-uboot.dtsi new file +39 -0
new file mode 100644
index 0000000000..d8d75e018a
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * U-Boot addition to handle Samsung S9 SM-G9600 (starqltechn) pins
+ *
+ * (C) Copyright 2021 Dzmitry Sankouski <[email protected]>
+ *
+ */
+
+/
+{
+	soc {
+		u-boot,dm-pre-reloc;
+		gcc {
+			clock-controller@100000 {
+				u-boot,dm-pre-reloc;
+			};
+			serial@0xa84000 {
+				u-boot,dm-pre-reloc;
+			};
+			gpio_north@3900000 {
+				u-boot,dm-pre-reloc;
+			};
+			pinctrl@3900000 {
+				u-boot,dm-pre-reloc;
+			};
+		};
+	};
+};
+
+&pm8998_pon {
+	key_vol_down {
+		gpios = <&pm8998_pon 1 0>;
+		label = "key_vol_down";
+	};
+	key_power {
+		gpios = <&pm8998_pon 0 0>;
+		label = "key_power";
+	};
+};
arch/arm/dts/starqltechn.dts new file +53 -0

53 lines not on this page · raw message

arch/arm/mach-snapdragon/Kconfig +13 -0
index 1a6a608967..90c9fcca2c 100644
@@ -40,9 +40,22 @@ config TARGET_DRAGONBOARD820C
 	  - 3GiB RAM
 	  - 32GiB UFS drive
 
+config TARGET_STARQLTECHN
+	bool "Samsung S9 SM-G9600(starqltechn)"
+	help
+	  Support for Samsung S9 SM-G9600(starqltechn) board.
+	  Features:
+	  - Qualcomm Snapdragon SDM845 SoC
+	  - 4GiB RAM
+	  - 64GiB UFS drive
+	select MISC_INIT_R
+	select SDM845
+	select DM_ETH if NET
+
 endchoice
 
 source "board/qualcomm/dragonboard410c/Kconfig"
 source "board/qualcomm/dragonboard820c/Kconfig"
+source "board/samsung/starqltechn/Kconfig"
 
 endif
board/samsung/starqltechn/Kconfig new file +14 -0
new file mode 100644
index 0000000000..7662eb87ab
@@ -0,0 +1,14 @@
+if TARGET_STARQLTECHN
+
+config SYS_BOARD
+	default "starqltechn"
+	help
+	  starqltechn is a production board for S9 and S9+ phones(SM-G96x0) phones based on SDM845 SoC.
+
+config SYS_VENDOR
+	default "samsung"
+
+config SYS_CONFIG_NAME
+	default "starqltechn"
+
+endif
board/samsung/starqltechn/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000000..135cafdd69
@@ -0,0 +1,6 @@
+Samsung S9 (SM-G9600)(starqltechn)  Board
+M:	Dzmitry Sankouski <[email protected]>
+S:	Maintained
+F:	board/samsung/starqltechn/
+F:	include/configs/starqltechn.h
+F:	configs/starqltechn_defconfig
board/samsung/starqltechn/Makefile new file +9 -0
new file mode 100644
index 0000000000..c38c0b4710
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2021 Dzmitry Sankouski <[email protected]>
+#
+# This empty file prevents make error.
+# Board logic defined in board/qualcomm/common/sdm845.c, no custom logic for starqltechn so far.
+#
+
+obj-y += starqltechn.o
board/samsung/starqltechn/starqltechn.c new file +10 -0
new file mode 100644
index 0000000000..f2cdb4eec2
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * This empty file prevents make linking error.
+ * No custom logic for starqltechn so far.
+ *
+ * (C) Copyright 2021 Dzmitry Sankouski <[email protected]>
+ *
+ */
+
+void nooop(void) {}
configs/starqltechn_defconfig new file +33 -0
new file mode 100644
index 0000000000..8f729e1048
@@ -0,0 +1,33 @@
+CONFIG_TARGET_STARQLTECHN=y
+CONFIG_ARM=y
+CONFIG_ARM_SMCCC=y
+CONFIG_ARCH_SNAPDRAGON=y
+CONFIG_IDENT_STRING="\nSamsung S9 SM-G9600"
+CONFIG_DEFAULT_DEVICE_TREE="starqltechn"
+CONFIG_SYS_TEXT_BASE=0x000000016cb00000
+CONFIG_POSITION_INDEPENDENT=y
+CONFIG_BOARD_EARLY_INIT_F=n
+CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_DISPLAY_CPUINFO=n
+CONFIG_STANDALONE_LOAD_ADDR=0x000000016cb00000
+CONFIG_SYS_MALLOC_F_LEN=0x8000
+CONFIG_HUSH_PARSER=y
+CONFIG_OF_CONTROL=y
+CONFIG_DM_STDIO=n
+CONFIG_MSM_GPIO=y
+CONFIG_DM_PMIC=y
+CONFIG_PMIC_PM8916=y
+CONFIG_PM8916_GPIO=y
+CONFIG_SPMI_MSM=y
+CONFIG_CLK=y
+CONFIG_NET=n
+CONFIG_USE_PREBOOT=y
+CONFIG_CMD_GPIO=y
+CONFIG_PINCTRL=y
+CONFIG_MSM_GENI_SERIAL=y
+# CONFIG_DEBUG_UART=y
+# CONFIG_DEBUG_UART_MSM_GENI=y
+# CONFIG_DEBUG_UART_BASE=0xa84000
+# CONFIG_DEBUG_UART_CLOCK=7372800
+# CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_BAUDRATE=921600
doc/board/qualcomm/index.rst +1 -0
index f7e0aa9298..10b98214e9 100644
@@ -7,3 +7,4 @@ Qualcomm
    :maxdepth: 2
 
    dragonboard410c
+   sdm845
doc/board/qualcomm/sdm845.rst new file +38 -0
new file mode 100644
index 0000000000..cd46cbe9cf
@@ -0,0 +1,38 @@
+.. SPDX-License-Identifier: GPL-2.0+
+.. sectionauthor:: Dzmitry Sankouski <[email protected]>
+
+Snapdragon 845
+================
+
+About this
+----------
+This document describes the information about Qualcomm Snapdragon 845
+supported boards and it's usage steps.
+
+SDM845 - hi-end qualcomm chip, introduced in late 2017.
+Mostly used in flagship phones and tablets of 2018.
+
+U-Boot can be used as a replacement for Qualcomm's original ABL (UEFI) bootloader.
+It is loaded as an Android boot image through ABL
+
+Installation
+------------
+First, setup ``CROSS_COMPILE`` for aarch64. Then, build U-Boot for your board::
+
+	$ export CROSS_COMPILE=<aarch64 toolchain prefix>
+	$ make <your board name here, see Boards section>_defconfig
+	$ make
+
+This will build ``u-boot.bin`` in the configured output directory.
+
+Boards
+------------
+starqlte
+^^^^^^^^^^^^
+
+The starqltechn is a production board for Samsung S9 (SM-G9600) phone,
+based on the Qualcomm SDM845 SoC.
+
+More information can be found on the `Samsung S9 page`_.
+
+.. _Samsung S9 page: https://en.wikipedia.org/wiki/Samsung_Galaxy_S9
include/configs/starqltechn.h new file +16 -0
new file mode 100644
index 0000000000..c9736a443b
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Board configuration file for Samsung S9(SM-G9600)(starqltechn)
+ *
+ * (C) Copyright 2017 Jorge Ramirez-Ortiz <[email protected]>
+ */
+
+#ifndef __CONFIGS_STARQLTECHN_H
+#define __CONFIGS_STARQLTECHN_H
+
+#include <configs/sdm845.h>
+
+#define CONFIG_LNX_KRNL_IMG_TEXT_OFFSET_BASE    CONFIG_SYS_LOAD_ADDR
+#define CONFIG_LINUX_KERNEL_IMAGE_HEADER
+
+#endif
Signature · 1 line
2.20.1
#3 lore raw

Re: [PATCH 3/6] pinctrl: qcom: add pinctrl and gpio drivers for SDM845 SoC

In reply to [email protected]

Hi,

Quoted 23 lines · On Thu, Sep 23, 2021 at 09:57:29PM +0300, [email protected] wrote:

From: Dzmitry Sankouski <[email protected]>

---
 arch/arm/mach-snapdragon/pinctrl-sdm845.c     | 44 +++++++++++++++++++
 arch/arm/mach-snapdragon/pinctrl-snapdragon.c |  1 +
 arch/arm/mach-snapdragon/pinctrl-snapdragon.h |  1 +
 drivers/gpio/msm_gpio.c                       |  1 +
 drivers/gpio/pm8916_gpio.c                    |  8 ++--
 5 files changed, 52 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/mach-snapdragon/pinctrl-sdm845.c
arch/arm/mach-snapdragon/pinctrl-sdm845.c new file +3 -0
new file mode 100644
index 0000000000..6d66582aa6
@@ -0,0 +1,44 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Qualcomm SDM845 pinctrl

arch/arm/mach-snapdragon/pinctrl-sdm845.c line 13

Quoted 10 lines
arch/arm/mach-snapdragon/pinctrl-sdm845.c new file +10 -0
+ *
+ * (C) Copyright 2021 Dzmitry Sankouski <[email protected]>
+ *
+ */
+
+#include "pinctrl-snapdragon.h"
+#include <common.h>
+
+#define MAX_PIN_NAME_LEN 32
+static char pin_name[MAX_PIN_NAME_LEN];

Since this is used before relocation (when setting up pinctrl for serial) you should really add __section(".data") here. I would expect that you are currently corrupting some random part of your appended DTB and are just lucky enough this does not cause any crashes. :)

See: https://source.denx.de/u-boot/u-boot/-/commit/548b89f8ad396d238d594f6f6fa1df902b74a303

Thanks,
Stephan

#8 lore raw

Re: [PATCH 5/6] SoC: qcom: add support for SDM845

In reply to [email protected]

Hi,

Quoted 69 lines · On Thu, Sep 23, 2021 at 09:57:31PM +0300, [email protected] wrote:

From: Dzmitry Sankouski <[email protected]>

Hi-end qualcomm chip, introduced in late 2017. Mostly used in flagship phones and tablets of 2018. Features:
- arm64 arch
- total of 8 Kryo 385 Gold / Silver cores
- Hexagon 685 DSP
- Adreno 630 GPU

Tested only as second-stage bootloader.

---
 arch/arm/dts/sdm845.dtsi                      | 118 ++++++++++++++++++
 arch/arm/mach-snapdragon/Kconfig              |   4 +
 arch/arm/mach-snapdragon/Makefile             |   4 +
 .../include/mach/sysmap-sdm845.h              |  42 +++++++
 arch/arm/mach-snapdragon/init_sdm845.c        |  82 ++++++++++++
 arch/arm/mach-snapdragon/sysmap-sdm845.c      |  31 +++++
 include/configs/sdm845.h                      |  33 +++++
 7 files changed, 314 insertions(+)
 create mode 100644 arch/arm/dts/sdm845.dtsi
 create mode 100644 arch/arm/mach-snapdragon/include/mach/sysmap-sdm845.h
 create mode 100644 arch/arm/mach-snapdragon/init_sdm845.c
 create mode 100644 arch/arm/mach-snapdragon/sysmap-sdm845.c
 create mode 100644 include/configs/sdm845.h
arch/arm/dts/sdm845.dtsi new file +33 -0
new file mode 100644
index 0000000000..bf32c6995d
@@ -0,0 +1,118 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Qualcomm SDM845 chip device tree source
+ *
+ * (C) Copyright 2021 Dzmitry Sankouski <[email protected]>
+ *
+ */
+
+/dts-v1/;
+
+#include "skeleton64.dtsi"
+
+/ {
+	soc: soc {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges = <0 0 0 0xffffffff>;
+		compatible = "simple-bus";
+
+		gcc: clock-controller@100000 {
+			u-boot,dm-pre-reloc;
+			compatible = "qcom,gcc-sdm845";
+			reg = <0x00100000 0x1f0000>;
+			#clock-cells = <1>;
+			#reset-cells = <1>;
+			#power-domain-cells = <1>;
+		};
+
+		gpio_north: gpio_north@3900000 {
+			u-boot,dm-pre-reloc;
+			#gpio-cells = <2>;
+			compatible = "qcom,sdm845-pinctrl";
+			reg = <0x3900000 0x400000>;

arch/arm/dts/sdm845.dtsi line 43

Quoted 10 lines
arch/arm/dts/sdm845.dtsi new file +10 -0
+			gpio-count = <150>;
+			gpio-controller;
+			gpio-ranges = <&gpio_north 0 0 150>;
+			gpio-bank-name = "soc_north.";
+		};
+
+		tlmm_north: pinctrl_north@3900000 {
+			u-boot,dm-pre-reloc;
+			compatible = "qcom,tlmm-sdm845";
+			reg = <0x03900000 0x400000>;

Can you consistently pad "reg" with zeroes or not?
"gcc" is padded with zeroes to 8 digits, gpio_north is not, then this is suddenly again. This makes it look like gpio_north and tlmm_north have a different address when it's actually the same.

Quoted 5 lines
arch/arm/dts/sdm845.dtsi new file +5 -0
+			gpio-count = <150>;
+			gpio-controller;
+			#gpio-cells = <2>;
+			gpio-ranges = <&tlmm_north 0 0 150>;
+

arch/arm/dts/sdm845.dtsi line 58

Quoted 10 lines
arch/arm/dts/sdm845.dtsi new file +10 -0
+			/* DEBUG UART */
+			qup_uart9: qup-uart9-default {
+				pinmux {
+					pins = "GPIO_4", "GPIO_5";
+					function = "qup9";
+				};
+			};
+		};
+
+		debug_uart: serial@0xa84000 {

The 0x should not be in the unit name (after @).

Quoted 17 lines
arch/arm/dts/sdm845.dtsi new file +17 -0
+			compatible = "qcom,msm-geni-uart";
+			reg = <0xa84000 0x4000>;
+			reg-names = "se_phys";
+			clock-names = "se-clk";
+			clocks = <&gcc 0x58>;
+			pinctrl-names = "default";
+			pinctrl-0 = <&qup_uart9>;
+			qcom,wrapper-core = <0x8a>;
+			status = "disabled";
+		};
+
+		spmi@c440000 {
+			compatible = "qcom,spmi-pmic-arb";
+			reg = <0xc440000 0x1100>,
+			      <0xc600000 0x2000000>,
+			      <0xe600000 0x100000>;
+			reg-names = "cnfg", "core", "obsrvr";

arch/arm/dts/sdm845.dtsi line 85

Quoted 10 lines
arch/arm/dts/sdm845.dtsi new file +10 -0
+			#address-cells = <0x1>;
+			#size-cells = <0x1>;
+
+			qcom,revid@100 {
+				compatible = "qcom,qpnp-revid";
+				reg = <0x100 0x100>;
+				linux,phandle = <0x3ac>;
+				phandle = <0x3ac>;
+			};
+

What is this used for? With the linux,phandle this looks a bit like something copied from a decompiled downstream dtb.

Quoted 11 lines
arch/arm/dts/sdm845.dtsi new file +11 -0
+			pmic0: pm8998@0 {
+				compatible = "qcom,spmi-pmic";
+				reg = <0x0 0x1>;
+				#address-cells = <0x1>;
+				#size-cells = <0x1>;
+
+				pm8998_pon: pm8998_pon@800 {
+					compatible = "qcom,pm8998-pwrkey";
+					reg = <0x800 0x100>;
+					#gpio-cells = <2>;
+					gpio-controller;

arch/arm/dts/sdm845.dtsi line 106

Quoted 10 lines
arch/arm/dts/sdm845.dtsi new file +10 -0
+					gpio-bank-name="pm8998_key.";
+				};
+
+				pm8998_gpios: pm8998_gpios@c000 {
+					compatible = "qcom,pm8998-gpio";
+					reg = <0xc000 0x1a00>;
+					gpio-controller;
+					gpio-count = <21>;
+					#gpio-cells = <2>;
+					gpio-bank-name="pm8998.";

Can you add spaces around '=' (gpio-bank-name = "pm8998.";), same for pm8998_pon.

Thanks,
Stephan

#10 lore raw

Re: [PATCH 6/6 v3] board: samsung: add Samsung Galaxy S9/S9+(SM-G96x0) board

In reply to [email protected]

Hi,

Quoted 75 lines · On Thu, Sep 23, 2021 at 09:57:32PM +0300, [email protected] wrote:

From: Dzmitry Sankouski <[email protected]>

Samsung S9 SM-G9600 - Snapdragon SDM845 version of the phone, for China \ Hong Kong markets.
Has unlockable bootloader, unlike SM-G960U (American market version), which allows running u-boot as a chain-loaded bootloader.

---
Changes for v2:
- Create documentation file for SDM845 boards
- Add starqltechn board documentation
Changes for v3:
- fix comment in starqltechn.c

 arch/arm/dts/Makefile                   |  1 +
 arch/arm/dts/starqltechn-uboot.dtsi     | 39 ++++++++++++++++++
 arch/arm/dts/starqltechn.dts            | 53 +++++++++++++++++++++++++
 arch/arm/mach-snapdragon/Kconfig        | 13 ++++++
 board/samsung/starqltechn/Kconfig       | 14 +++++++
 board/samsung/starqltechn/MAINTAINERS   |  6 +++
 board/samsung/starqltechn/Makefile      |  9 +++++
 board/samsung/starqltechn/starqltechn.c | 10 +++++
 configs/starqltechn_defconfig           | 33 +++++++++++++++
 doc/board/qualcomm/index.rst            |  1 +
 doc/board/qualcomm/sdm845.rst           | 38 ++++++++++++++++++
 include/configs/starqltechn.h           | 16 ++++++++
 12 files changed, 233 insertions(+)
 create mode 100644 arch/arm/dts/starqltechn-uboot.dtsi
 create mode 100644 arch/arm/dts/starqltechn.dts
 create mode 100644 board/samsung/starqltechn/Kconfig
 create mode 100644 board/samsung/starqltechn/MAINTAINERS
 create mode 100644 board/samsung/starqltechn/Makefile
 create mode 100644 board/samsung/starqltechn/starqltechn.c
 create mode 100644 configs/starqltechn_defconfig
 create mode 100644 doc/board/qualcomm/sdm845.rst
 create mode 100644 include/configs/starqltechn.h

[...]

doc/board/qualcomm/sdm845.rst new file +28 -0
new file mode 100644
index 0000000000..cd46cbe9cf
@@ -0,0 +1,38 @@
+.. SPDX-License-Identifier: GPL-2.0+
+.. sectionauthor:: Dzmitry Sankouski <[email protected]>
+
+Snapdragon 845
+================
+
+About this
+----------
+This document describes the information about Qualcomm Snapdragon 845
+supported boards and it's usage steps.
+
+SDM845 - hi-end qualcomm chip, introduced in late 2017.
+Mostly used in flagship phones and tablets of 2018.
+
+U-Boot can be used as a replacement for Qualcomm's original ABL (UEFI) bootloader.
+It is loaded as an Android boot image through ABL
+
+Installation
+------------
+First, setup ``CROSS_COMPILE`` for aarch64. Then, build U-Boot for your board::
+
+	$ export CROSS_COMPILE=<aarch64 toolchain prefix>
+	$ make <your board name here, see Boards section>_defconfig
+	$ make
+
+This will build ``u-boot.bin`` in the configured output directory.
+
+Boards

doc/board/qualcomm/sdm845.rst line 38

Quoted 10 lines
doc/board/qualcomm/sdm845.rst new file +10 -0
+------------
+starqlte
+^^^^^^^^^^^^
+
+The starqltechn is a production board for Samsung S9 (SM-G9600) phone,
+based on the Qualcomm SDM845 SoC.
+
+More information can be found on the `Samsung S9 page`_.
+
+.. _Samsung S9 page: https://en.wikipedia.org/wiki/Samsung_Galaxy_S9

Can you add a short explanation here how you would install the u-boot.bin on the Samsung S9? You say that it is loaded through an Android boot image, but how exactly is it built?

For example, do you use an empty ramdisk, does the bootloader expect some dt.img etc? Something similar to the DB820c README:
https://source.denx.de/u-boot/u-boot/-/blob/master/board/qualcomm/dragonboard820c/readme.txt#L32-61

This would be helpful if someone wants to install U-Boot on that phone I think :)

Thanks!
Stephan

#11 lore raw

Re: [PATCH 6/6 v3] board: samsung: add Samsung Galaxy S9/S9+(SM-G96x0) board

Hi!

I haven't tried to install u-boot on the phone with Android boot image yet(though another guy in the community project I contribute, reported it works).
I can only test u-boot with kexec, it's the only way to get debug uart for me, without disassembling the phone.

Also I have to track down the issues with booting linux.

So, once I'll got linux booted by u-boot, I will be able to pack and install it in Android boot partition, and write more detailed instructions.

пт, 24 сент. 2021 г. в 14:02, Stephan Gerhold <[email protected]>:

Quoted 107 lines

Hi,

Quoted 40 lines · On Thu, Sep 23, 2021 at 09:57:32PM +0300, [email protected] wrote:

From: Dzmitry Sankouski <[email protected]>

Samsung S9 SM-G9600 - Snapdragon SDM845 version of the phone, for China \ Hong Kong markets.
Has unlockable bootloader, unlike SM-G960U (American market version), which allows running u-boot as a chain-loaded bootloader.

---
Changes for v2:
- Create documentation file for SDM845 boards
- Add starqltechn board documentation
Changes for v3:
- fix comment in starqltechn.c

 arch/arm/dts/Makefile                   |  1 +
 arch/arm/dts/starqltechn-uboot.dtsi     | 39 ++++++++++++++++++
 arch/arm/dts/starqltechn.dts            | 53 +++++++++++++++++++++++++
 arch/arm/mach-snapdragon/Kconfig        | 13 ++++++
 board/samsung/starqltechn/Kconfig       | 14 +++++++
 board/samsung/starqltechn/MAINTAINERS   |  6 +++
 board/samsung/starqltechn/Makefile      |  9 +++++
 board/samsung/starqltechn/starqltechn.c | 10 +++++
 configs/starqltechn_defconfig           | 33 +++++++++++++++
 doc/board/qualcomm/index.rst            |  1 +
 doc/board/qualcomm/sdm845.rst           | 38 ++++++++++++++++++
 include/configs/starqltechn.h           | 16 ++++++++
 12 files changed, 233 insertions(+)
 create mode 100644 arch/arm/dts/starqltechn-uboot.dtsi
 create mode 100644 arch/arm/dts/starqltechn.dts
 create mode 100644 board/samsung/starqltechn/Kconfig
 create mode 100644 board/samsung/starqltechn/MAINTAINERS
 create mode 100644 board/samsung/starqltechn/Makefile
 create mode 100644 board/samsung/starqltechn/starqltechn.c
 create mode 100644 configs/starqltechn_defconfig
 create mode 100644 doc/board/qualcomm/sdm845.rst
 create mode 100644 include/configs/starqltechn.h

Review

Quoted 2 lines

[...]

(quoted diff) +0 -0

b/doc/board/qualcomm/sdm845.rst

Quoted 10 lines

new file mode 100644
index 0000000000..cd46cbe9cf

doc/board/qualcomm/sdm845.rst new file +5 -0
@@ -0,0 +1,38 @@
+.. SPDX-License-Identifier: GPL-2.0+
+.. sectionauthor:: Dzmitry Sankouski <[email protected]>
+
+Snapdragon 845
+================

doc/board/qualcomm/sdm845.rst line 15

Quoted 10 lines
doc/board/qualcomm/sdm845.rst new file +10 -0
+
+About this
+----------
+This document describes the information about Qualcomm Snapdragon 845
+supported boards and it's usage steps.
+
+SDM845 - hi-end qualcomm chip, introduced in late 2017.
+Mostly used in flagship phones and tablets of 2018.
+
+U-Boot can be used as a replacement for Qualcomm's original ABL (UEFI)

bootloader.

doc/board/qualcomm/sdm845.rst

Quoted 5 lines
doc/board/qualcomm/sdm845.rst new file +5 -0
+It is loaded as an Android boot image through ABL
+
+Installation
+------------
+First, setup ``CROSS_COMPILE`` for aarch64. Then, build U-Boot for your

board::

Quoted 8 lines
doc/board/qualcomm/sdm845.rst new file +8 -0
+
+     $ export CROSS_COMPILE=<aarch64 toolchain prefix>
+     $ make <your board name here, see Boards section>_defconfig
+     $ make
+
+This will build ``u-boot.bin`` in the configured output directory.
+
+Boards

doc/board/qualcomm/sdm845.rst line 38

Quoted 10 lines
doc/board/qualcomm/sdm845.rst new file +10 -0
+------------
+starqlte
+^^^^^^^^^^^^
+
+The starqltechn is a production board for Samsung S9 (SM-G9600) phone,
+based on the Qualcomm SDM845 SoC.
+
+More information can be found on the `Samsung S9 page`_.
+
+.. _Samsung S9 page: https://en.wikipedia.org/wiki/Samsung_Galaxy_S9

Can you add a short explanation here how you would install the u-boot.bin on the Samsung S9? You say that it is loaded through an Android boot image, but how exactly is it built?

For example, do you use an empty ramdisk, does the bootloader expect some dt.img etc? Something similar to the DB820c README:

https://source.denx.de/u-boot/u-boot/-/blob/master/board/qualcomm/dragonboard820c/readme.txt#L32-61

This would be helpful if someone wants to install U-Boot on that phone I think :)

Thanks!
Stephan

#12 lore raw

Re: [PATCH 6/6 v3] board: samsung: add Samsung Galaxy S9/S9+(SM-G96x0) board

Hi,

Quoted 6 lines · Dzmitry Sankouski

I haven't tried to install u-boot on the phone with Android boot image yet(though another guy in the community project I contribute, reported it works).
I can only test u-boot with kexec, it's the only way to get debug uart for me, without disassembling the phone.

Hmm, does Samsung not have UART via the USB connector anymore on newer devices? This is quite sad, on the Samsung devices I have used it was always quite comfortable. :)

Quoted 5 lines

Also I have to track down the issues with booting linux.

So, once I'll got linux booted by u-boot, I will be able to pack and install it in Android boot partition, and write more detailed instructions.

Ah okay, maybe just submit a follow-up patch later then once you have proper installation instructions. :)

Thanks!
Stephan

#13 lore raw

Re: [PATCH 6/6 v3] board: samsung: add Samsung Galaxy S9/S9+(SM-G96x0) board

In reply to [email protected]
Quoted 10 lines · On Thu, Sep 23, 2021 at 09:57:32PM +0300, [email protected] wrote:

From: Dzmitry Sankouski <[email protected]>

Samsung S9 SM-G9600 - Snapdragon SDM845 version of the phone, for China \ Hong Kong markets.
Has unlockable bootloader, unlike SM-G960U (American market version), which allows running u-boot as a chain-loaded bootloader.

Quoted 6 lines

---
Changes for v2:
- Create documentation file for SDM845 boards
- Add starqltechn board documentation
Changes for v3:
- fix comment in starqltechn.c

A few things. Aside from needing to migrate a few symbols to Kconfig, to build on current master, we need to:

Quoted 10 lines
include/configs/starqltechn.h new file +4 -0
new file mode 100644
index 0000000000..c9736a443b
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Board configuration file for Samsung S9(SM-G9600)(starqltechn)
+ *

include/configs/starqltechn.h line 14

Quoted 10 lines
include/configs/starqltechn.h new file +10 -0
+ * (C) Copyright 2017 Jorge Ramirez-Ortiz <[email protected]>
+ */
+
+#ifndef __CONFIGS_STARQLTECHN_H
+#define __CONFIGS_STARQLTECHN_H
+
+#include <configs/sdm845.h>
+
+#define CONFIG_LNX_KRNL_IMG_TEXT_OFFSET_BASE    CONFIG_SYS_LOAD_ADDR
+#define CONFIG_LINUX_KERNEL_IMAGE_HEADER

These two symbols need to be handled via Kconfig (xenguest_arm64 gets this wrong as well, I see) as done for example on Tegra. At that point, we can delete this file entirely and just use configs/sdm845.h.

Signature · 1 line
Tom
#5 lore raw

Re: [PATCH 2/6 v3] spmi: msm: add arbiter version 5 support

In reply to [email protected]
Quoted 8 lines · On Thu, Sep 23, 2021 at 09:57:28PM +0300, [email protected] wrote:

From: Dzmitry Sankouski <[email protected]>

Currently driver supports only version 1 and 2. Version 5 has slightly different registers structure

When building for the new platform, we get warnings such as:
In file included from /home/trini/work/u-boot/u-boot/drivers/spmi/spmi-msm.c:16:
/home/trini/work/u-boot/u-boot/drivers/spmi/spmi-msm.c: In function 'msm_spmi_probe':
/home/trini/work/u-boot/u-boot/arch/arm/include/asm/io.h:45:43: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
45 | #define __arch_getl(a) (*(volatile unsigned int *)(a))
| ^
/home/trini/work/u-boot/u-boot/arch/arm/include/asm/io.h:127:38: note: in expansion of macro '__arch_getl'
127 | #define readl(c) ({ u32 __v = __arch_getl(c); __iormb(); __v; })
| ^~~~~~~~~~~
/home/trini/work/u-boot/u-boot/drivers/spmi/spmi-msm.c:202:18: note: in expansion of macro 'readl'
202 | hw_ver = readl(config_addr + PMIC_ARB_VERSION);
| ^~~~~
/home/trini/work/u-boot/u-boot/drivers/serial/serial_msm_geni.c: In function 'qcom_geni_serial_poll_bit':
/home/trini/work/u-boot/u-boot/drivers/serial/serial_msm_geni.c:290:17: warning: implicit declaration of function 'udelay' [-Wimplicit-function-declaration]

  290 |                 udelay(10);
      |                 ^~~~~~

Please fix, thanks.

Signature · 1 line
Tom