Skip to contentSkip to conversation

Add minimal boot support for IPQ6018

PATCH Superseded Sricharan R 4 participants 13 messages Jun 5, 2019 – Dec 19, 2019

Subsystems (9)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

cover Add minimal boot support for IPQ6018

The IPQ6018 is Qualcomm’s 802.11ax SoC for Routers, Gateways and Access Points.

This series adds minimal board boot support for ipq6018-cp01 board.

Sricharan R (6):
pinctrl: qcom: Add ipq6018 pinctrl driver
dt-bindings: qcom: Add ipq6018 bindings
clk: qcom: Add DT bindings for ipq6018 gcc clock controller
clk: qcom: Add ipq6018 Global Clock Controller support
arm64: dts: Add ipq6018 SoC and CP01 board support
arm64: defconfig: Enable qcom ipq6018 clock and pinctrl

 Documentation/devicetree/bindings/arm/qcom.yaml    |    2 +
 .../devicetree/bindings/clock/qcom,gcc.txt         |    1 +
 arch/arm64/boot/dts/qcom/Makefile                  |    1 +
 arch/arm64/boot/dts/qcom/ipq6018-cp01-c1.dts       |   35 +
 arch/arm64/boot/dts/qcom/ipq6018.dtsi              |  231 +
 arch/arm64/configs/defconfig                       |    2 +
 drivers/clk/qcom/Kconfig                           |    9 +
 drivers/clk/qcom/Makefile                          |    1 +
 drivers/clk/qcom/gcc-ipq6018.c                     | 5267 ++++++++++++++++++++
 drivers/pinctrl/qcom/Kconfig                       |   10 +
 drivers/pinctrl/qcom/Makefile                      |    1 +
 drivers/pinctrl/qcom/pinctrl-ipq6018.c             | 1183 +++++
 include/dt-bindings/clock/qcom,gcc-ipq6018.h       |  405 ++
 13 files changed, 7148 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/ipq6018-cp01-c1.dts
 create mode 100644 arch/arm64/boot/dts/qcom/ipq6018.dtsi
 create mode 100644 drivers/clk/qcom/gcc-ipq6018.c
 create mode 100644 drivers/pinctrl/qcom/pinctrl-ipq6018.c
 create mode 100644 include/dt-bindings/clock/qcom,gcc-ipq6018.h
Signature · 7 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#1 lore raw

PATCH 1/6 pinctrl: qcom: Add ipq6018 pinctrl driver

Add initial pinctrl driver to support pin configuration with pinctrl framework for ipq6018.

---
 .../bindings/pinctrl/qcom,ipq6018-pinctrl.txt      |  186 +++
 drivers/pinctrl/qcom/Kconfig                       |   10 +
 drivers/pinctrl/qcom/Makefile                      |    1 +
 drivers/pinctrl/qcom/pinctrl-ipq6018.c             | 1183 ++++++++++++++++++++
 4 files changed, 1380 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/qcom,ipq6018-pinctrl.txt
 create mode 100644 drivers/pinctrl/qcom/pinctrl-ipq6018.c
Documentation/devicetree/bindings/pinctrl/qcom,ipq6018-pinctrl.txt new file +186 -0
new file mode 100644
index 0000000..5a3edb1
@@ -0,0 +1,186 @@
+Qualcomm Technologies, Inc. IPQ6018 TLMM block
+
+This binding describes the Top Level Mode Multiplexer block found in the
+IPQ6018 platform.
+
+- compatible:
+	Usage: required
+	Value type: <string>
+	Definition: must be "qcom,ipq6018-pinctrl"
+
+- reg:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: the base address and size of the TLMM register space.
+
+- interrupts:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: should specify the TLMM summary IRQ.
+
+- interrupt-controller:
+	Usage: required
+	Value type: <none>
+	Definition: identifies this node as an interrupt controller
+
+- #interrupt-cells:
+	Usage: required
+	Value type: <u32>
+	Definition: must be 2. Specifying the pin number and flags, as defined
+		    in <dt-bindings/interrupt-controller/irq.h>
+
+- gpio-controller:
+	Usage: required
+	Value type: <none>
+	Definition: identifies this node as a gpio controller
+
+- #gpio-cells:
+	Usage: required
+	Value type: <u32>
+	Definition: must be 2. Specifying the pin number and flags, as defined
+		    in <dt-bindings/gpio/gpio.h>
+
+Please refer to ../gpio/gpio.txt and ../interrupt-controller/interrupts.txt for
+a general description of GPIO and interrupt bindings.
+
+Please refer to pinctrl-bindings.txt in this directory for details of the
+common pinctrl bindings used by client devices, including the meaning of the
+phrase "pin configuration node".
+
+The pin configuration nodes act as a container for an arbitrary number of
+subnodes. Each of these subnodes represents some desired configuration for a
+pin, a group, or a list of pins or groups. This configuration can include the
+mux function to select on those pin(s)/group(s), and various pin configuration
+parameters, such as pull-up, drive strength, etc.
+
+
+PIN CONFIGURATION NODES:
+
+The name of each subnode is not important; all subnodes should be enumerated
+and processed purely based on their content.
+
+Each subnode only affects those parameters that are explicitly listed. In
+other words, a subnode that lists a mux function but no pin configuration
+parameters implies no information about any pin configuration parameters.
+Similarly, a pin subnode that describes a pullup parameter implies no
+information about e.g. the mux function.
+
+
+The following generic properties as defined in pinctrl-bindings.txt are valid
+to specify in a pin configuration subnode:
+
+- pins:
+	Usage: required
+	Value type: <string-array>
+	Definition: List of gpio pins affected by the properties specified in
+		    this subnode.  Valid pins are:
+		    gpio0-gpio121,
+		    sdc1_clk,
+		    sdc1_cmd,
+		    sdc1_data
+		    sdc2_clk,
+		    sdc2_cmd,
+		    sdc2_data,
+		    qdsd_cmd,
+		    qdsd_data0,
+		    qdsd_data1,
+		    qdsd_data2,
+		    qdsd_data3
+
+- function:
+	Usage: required
+	Value type: <string>
+	Definition: Specify the alternative function to be configured for the
+		    specified pins. Functions are only valid for gpio pins.
+		    Valid values are:
+	adsp_ext, alsp_int, atest_bbrx0, atest_bbrx1, atest_char, atest_char0,
+	atest_char1, atest_char2, atest_char3, atest_combodac, atest_gpsadc0,
+	atest_gpsadc1, atest_tsens, atest_wlan0, atest_wlan1, backlight_en,
+	bimc_dte0,bimc_dte1, blsp_i2c1, blsp_i2c2, blsp_i2c3, blsp_i2c4,
+	blsp_i2c5, blsp_i2c6, blsp_spi1, blsp_spi1_cs1, blsp_spi1_cs2,
+	blsp_spi1_cs3, blsp_spi2, blsp_spi2_cs1, blsp_spi2_cs2, blsp_spi2_cs3,
+	blsp_spi3, blsp_spi3_cs1, blsp_spi3_cs2, blsp_spi3_cs3, blsp_spi4,
+	blsp_spi5, blsp_spi6, blsp_uart1, blsp_uart2, blsp_uim1, blsp_uim2,
+	cam1_rst, cam1_standby, cam_mclk0, cam_mclk1, cci_async, cci_i2c,
+	cci_timer0, cci_timer1, cci_timer2, cdc_pdm0, codec_mad, dbg_out,
+	display_5v, dmic0_clk, dmic0_data, dsi_rst, ebi0_wrcdc, euro_us,
+	ext_lpass, flash_strobe, gcc_gp1_clk_a, gcc_gp1_clk_b, gcc_gp2_clk_a,
+	gcc_gp2_clk_b, gcc_gp3_clk_a, gcc_gp3_clk_b, gpio, gsm0_tx0, gsm0_tx1,
+	gsm1_tx0, gsm1_tx1, gyro_accl, kpsns0, kpsns1, kpsns2, ldo_en,
+	ldo_update, mag_int, mdp_vsync, modem_tsync, m_voc, nav_pps, nav_tsync,
+	pa_indicator, pbs0, pbs1, pbs2, pri_mi2s, pri_mi2s_ws, prng_rosc,
+	pwr_crypto_enabled_a, pwr_crypto_enabled_b, pwr_modem_enabled_a,
+	pwr_modem_enabled_b, pwr_nav_enabled_a, pwr_nav_enabled_b,
+	qdss_ctitrig_in_a0, qdss_ctitrig_in_a1, qdss_ctitrig_in_b0,
+	qdss_ctitrig_in_b1, qdss_ctitrig_out_a0, qdss_ctitrig_out_a1,
+	qdss_ctitrig_out_b0, qdss_ctitrig_out_b1, qdss_traceclk_a,
+	qdss_traceclk_b, qdss_tracectl_a, qdss_tracectl_b, qdss_tracedata_a,
+	qdss_tracedata_b, reset_n, sd_card, sd_write, sec_mi2s, smb_int,
+	ssbi_wtr0, ssbi_wtr1, uim1, uim2, uim3, uim_batt, wcss_bt, wcss_fm,
+	wcss_wlan, webcam1_rst
+
+- bias-disable:
+	Usage: optional
+	Value type: <none>
+	Definition: The specified pins should be configued as no pull.
+
+- bias-pull-down:
+	Usage: optional
+	Value type: <none>
+	Definition: The specified pins should be configued as pull down.
+
+- bias-pull-up:
+	Usage: optional
+	Value type: <none>
+	Definition: The specified pins should be configued as pull up.
+
+- output-high:
+	Usage: optional
+	Value type: <none>
+	Definition: The specified pins are configured in output mode, driven
+		    high.
+		    Not valid for sdc pins.
+
+- output-low:
+	Usage: optional
+	Value type: <none>
+	Definition: The specified pins are configured in output mode, driven
+		    low.
+		    Not valid for sdc pins.
+
+- drive-strength:
+	Usage: optional
+	Value type: <u32>
+	Definition: Selects the drive strength for the specified pins, in mA.
+		    Valid values are: 2, 4, 6, 8, 10, 12, 14 and 16
+
+Example:
+
+	tlmm: pinctrl@1000000 {
+		compatible = "qcom,ipq6018-pinctrl";
+		reg = <0x1000000 0x300000>;
+		interrupts = <0 208 0>;
+		gpio-controller;
+		#gpio-cells = <2>;
+		interrupt-controller;
+		#interrupt-cells = <2>;
+
+		uart2: uart2-default {
+			mux {
+				pins = "gpio4", "gpio5";
+				function = "blsp_uart2";
+			};
+
+			tx {
+				pins = "gpio4";
+				drive-strength = <4>;
+				bias-disable;
+			};
+
+			rx {
+				pins = "gpio5";
+				drive-strength = <2>;
+				bias-pull-up;
+			};
+		};
+	};
drivers/pinctrl/qcom/Kconfig +10 -0
index 890d0a3..c7b32e8 100644
@@ -50,6 +50,16 @@ config PINCTRL_IPQ8074
 	  Qualcomm Technologies Inc. IPQ8074 platform. Select this for
 	  IPQ8074.
 
+config PINCTRL_IPQ6018
+	tristate "Qualcomm Technologies, Inc. IPQ6018 pin controller driver"
+	depends on GPIOLIB && OF
+	select PINCTRL_MSM
+	help
+	  This is the pinctrl, pinmux, pinconf and gpiolib driver for
+	  the Qualcomm Technologies Inc. TLMM block found on the
+	  Qualcomm Technologies Inc. IPQ6018 platform. Select this for
+	  IPQ6018.
+
 config PINCTRL_MSM8660
 	tristate "Qualcomm 8660 pin controller driver"
 	depends on GPIOLIB && OF
drivers/pinctrl/qcom/Makefile +1 -0
index 344b4c6..0b8b769 100644
@@ -6,6 +6,7 @@ obj-$(CONFIG_PINCTRL_APQ8084)	+= pinctrl-apq8084.o
 obj-$(CONFIG_PINCTRL_IPQ4019)	+= pinctrl-ipq4019.o
 obj-$(CONFIG_PINCTRL_IPQ8064)	+= pinctrl-ipq8064.o
 obj-$(CONFIG_PINCTRL_IPQ8074)	+= pinctrl-ipq8074.o
+obj-$(CONFIG_PINCTRL_IPQ6018)	+= pinctrl-ipq6018.o
 obj-$(CONFIG_PINCTRL_MSM8660)	+= pinctrl-msm8660.o
 obj-$(CONFIG_PINCTRL_MSM8960)	+= pinctrl-msm8960.o
 obj-$(CONFIG_PINCTRL_MSM8X74)	+= pinctrl-msm8x74.o
drivers/pinctrl/qcom/pinctrl-ipq6018.c new file +1183 -0

1,183 lines not on this page · raw message

Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
maintainer
#2 lore raw

Re: [PATCH 1/6] pinctrl: qcom: Add ipq6018 pinctrl driver

Quoted 8 lines · Sricharan R

Add initial pinctrl driver to support pin configuration with pinctrl framework for ipq6018.

---
 .../bindings/pinctrl/qcom,ipq6018-pinctrl.txt      |  186 +++

Please split bindings to separate patch. Using DT schema would be nice.

Quoted 6 lines
 drivers/pinctrl/qcom/Kconfig                       |   10 +
 drivers/pinctrl/qcom/Makefile                      |    1 +
 drivers/pinctrl/qcom/pinctrl-ipq6018.c             | 1183 ++++++++++++++++++++
 4 files changed, 1380 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/qcom,ipq6018-pinctrl.txt
 create mode 100644 drivers/pinctrl/qcom/pinctrl-ipq6018.c
#3 lore raw

PATCH 2/6 dt-bindings: qcom: Add ipq6018 bindings

In reply to Sricharan R
---
 Documentation/devicetree/bindings/arm/qcom.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/arm/qcom.yaml +2 -0
index f6316ab..7b19028 100644
@@ -36,6 +36,7 @@ description: |
   	mdm9615
   	ipq8074
   	sdm845
+	ipq6018
 
   The 'board' element must be one of the following strings:
 
@@ -45,6 +46,7 @@ description: |
   	mtp
   	sbc
   	hk01
+	cp01-c1
 
   The 'soc_version' and 'board_version' elements take the form of v<Major>.<Minor>
   where the minor number may be omitted when it's zero, i.e.  v1.0 is the same
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
#4 lore raw

PATCH 3/6 clk: qcom: Add DT bindings for ipq6018 gcc clock controller

In reply to Sricharan R

Add the compatible strings and the include file for ipq6018 gcc clock controller.

---
 .../devicetree/bindings/clock/qcom,gcc.txt         |   1 +
 include/dt-bindings/clock/qcom,gcc-ipq6018.h       | 405 +++++++++++++++++++++
 2 files changed, 406 insertions(+)
 create mode 100644 include/dt-bindings/clock/qcom,gcc-ipq6018.h
Documentation/devicetree/bindings/clock/qcom,gcc.txt +1 -0
index 8661c3c..40bb3de 100644
@@ -9,6 +9,7 @@ Required properties :
 			"qcom,gcc-ipq8064"
 			"qcom,gcc-ipq4019"
 			"qcom,gcc-ipq8074"
+			"qcom,gcc-ipq6018"
 			"qcom,gcc-msm8660"
 			"qcom,gcc-msm8916"
 			"qcom,gcc-msm8960"
include/dt-bindings/clock/qcom,gcc-ipq6018.h new file +405 -0

405 lines not on this page · raw message

Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
maintainer Reviewed-by on v1 3/6
#5 lore raw

Re: [PATCH 3/6] clk: qcom: Add DT bindings for ipq6018 gcc clock controller

Quoted 12 lines · Sricharan R

Add the compatible strings and the include file for ipq6018 gcc clock controller.

---
 .../devicetree/bindings/clock/qcom,gcc.txt         |   1 +
 include/dt-bindings/clock/qcom,gcc-ipq6018.h       | 405 +++++++++++++++++++++
 2 files changed, 406 insertions(+)
 create mode 100644 include/dt-bindings/clock/qcom,gcc-ipq6018.h
#6 lore raw

PATCH 4/6 clk: qcom: Add ipq6018 Global Clock Controller support

In reply to Sricharan R

This patch adds support for the global clock controller found on the ipq6018 based devices.

---
 drivers/clk/qcom/Kconfig       |    9 +
 drivers/clk/qcom/Makefile      |    1 +
 drivers/clk/qcom/gcc-ipq6018.c | 5267 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 5277 insertions(+)
 create mode 100644 drivers/clk/qcom/gcc-ipq6018.c
drivers/clk/qcom/Kconfig +9 -0
index e1ff83c..e5fb091 100644
@@ -120,6 +120,15 @@ config IPQ_GCC_8074
 	  i2c, USB, SD/eMMC, etc. Select this for the root clock
 	  of ipq8074.
 
+config IPQ_GCC_6018
+	tristate "IPQ6018 Global Clock Controller"
+	depends on COMMON_CLK_QCOM
+	help
+	  Support for global clock controller on ipq6018 devices.
+	  Say Y if you want to use peripheral devices such as UART, SPI,
+	  i2c, USB, SD/eMMC, etc. Select this for the root clock
+	  of ipq6018.
+
 config MSM_GCC_8660
 	tristate "MSM8660 Global Clock Controller"
 	help
drivers/clk/qcom/Makefile +1 -0
index f0768fb..025137d 100644
@@ -22,6 +22,7 @@ obj-$(CONFIG_APQ_MMCC_8084) += mmcc-apq8084.o
 obj-$(CONFIG_IPQ_GCC_4019) += gcc-ipq4019.o
 obj-$(CONFIG_IPQ_GCC_806X) += gcc-ipq806x.o
 obj-$(CONFIG_IPQ_GCC_8074) += gcc-ipq8074.o
+obj-$(CONFIG_IPQ_GCC_6018) += gcc-ipq6018.o
 obj-$(CONFIG_IPQ_LCC_806X) += lcc-ipq806x.o
 obj-$(CONFIG_MDM_GCC_9615) += gcc-mdm9615.o
 obj-$(CONFIG_MDM_LCC_9615) += lcc-mdm9615.o
drivers/clk/qcom/gcc-ipq6018.c new file +5267 -0

2,978 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

Part of the diff is not shown here. View the raw message.

maintainer
#7 lore raw

Re: [PATCH 4/6] clk: qcom: Add ipq6018 Global Clock Controller support

Quoting Sricharan R (2019-06-05 10:28:56)

drivers/clk/qcom/Kconfig config IPQ_GCC_8074 · line 125

Quoted 11 lines
drivers/clk/qcom/Kconfig +3 -0
index e1ff83c..e5fb091 100644
@@ -120,6 +120,15 @@ config IPQ_GCC_8074
          i2c, USB, SD/eMMC, etc. Select this for the root clock
          of ipq8074.
 
+config IPQ_GCC_6018
+       tristate "IPQ6018 Global Clock Controller"
+       depends on COMMON_CLK_QCOM

Not sure I commented on this, but this should be removed. The whole thing is inside an if now.

Quoted 43 lines
drivers/clk/qcom/Kconfig +6 -0
+       help
+         Support for global clock controller on ipq6018 devices.
+         Say Y if you want to use peripheral devices such as UART, SPI,
+         i2c, USB, SD/eMMC, etc. Select this for the root clock
+         of ipq6018.
+
 config MSM_GCC_8660
        tristate "MSM8660 Global Clock Controller"
        help
drivers/clk/qcom/gcc-ipq6018.c new file +28 -0
new file mode 100644
index 0000000..9f4552b
@@ -0,0 +1,5267 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ */
+
+#include <linux/kernel.h>
+#include <linux/err.h>
+#include <linux/platform_device.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/clk-provider.h>
+#include <linux/regmap.h>
+
+#include <linux/reset-controller.h>
+#include <dt-bindings/clock/qcom,gcc-ipq6018.h>
+
+#include "common.h"
+#include "clk-regmap.h"
+#include "clk-pll.h"
+#include "clk-rcg.h"
+#include "clk-branch.h"
+#include "clk-alpha-pll.h"
+#include "clk-regmap-divider.h"
+#include "clk-regmap-mux.h"
+#include "reset.h"
+
+#define F(f, s, h, m, n) { (f), (s), (2 * (h) - 1), (m), (n) }

[...]

Quoted 5 lines
drivers/clk/qcom/gcc-ipq6018.c new file +5 -0
+
+static struct clk_alpha_pll gpll0_main = {
+       .offset = 0x21000,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+       .clkr = {

drivers/clk/qcom/gcc-ipq6018.c line 423

Quoted 10 lines
drivers/clk/qcom/gcc-ipq6018.c new file +10 -0
+               .enable_reg = 0x0b000,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gpll0_main",
+                       .parent_names = (const char *[]){
+                               "xo"
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_alpha_pll_ops,
+                       .flags = CLK_IS_CRITICAL,

Can you add a comment on why this is critical?

Quoted 70 lines
drivers/clk/qcom/gcc-ipq6018.c new file +70 -0
+               },
+       },
+};
+
+static struct clk_fixed_factor gpll0_out_main_div2 = {
+       .mult = 1,
+       .div = 2,
+       .hw.init = &(struct clk_init_data){
+               .name = "gpll0_out_main_div2",
+               .parent_names = (const char *[]){
+                       "gpll0_main"
+               },
+               .num_parents = 1,
+               .ops = &clk_fixed_factor_ops,
+               .flags = CLK_SET_RATE_PARENT,
+       },
+};
+
+static struct clk_alpha_pll_postdiv gpll0 = {
+       .offset = 0x21000,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+       .width = 4,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "gpll0",
+               .parent_names = (const char *[]){
+                       "gpll0_main"
+               },
+               .num_parents = 1,
+               .ops = &clk_alpha_pll_postdiv_ro_ops,
+               .flags = CLK_SET_RATE_PARENT,
+       },
+};
+
+static struct clk_alpha_pll ubi32_pll_main = {
+       .offset = 0x25000,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_HUAYRA],
+       .flags = SUPPORTS_DYNAMIC_UPDATE,
+       .clkr = {
+               .enable_reg = 0x0b000,
+               .enable_mask = BIT(6),
+               .hw.init = &(struct clk_init_data){
+                       .name = "ubi32_pll_main",
+                       .parent_names = (const char *[]){
+                               "xo"
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_alpha_pll_huayra_ops,
+               },
+       },
+};
+
+static struct clk_alpha_pll_postdiv ubi32_pll = {
+       .offset = 0x25000,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_HUAYRA],
+       .width = 2,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "ubi32_pll",
+               .parent_names = (const char *[]){
+                       "ubi32_pll_main"
+               },
+               .num_parents = 1,
+               .ops = &clk_alpha_pll_postdiv_ro_ops,
+               .flags = CLK_SET_RATE_PARENT,
+       },
+};
+
+static struct clk_alpha_pll gpll6_main = {
+       .offset = 0x37000,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_BRAMMO],
+       .clkr = {

drivers/clk/qcom/gcc-ipq6018.c line 503

Quoted 10 lines
drivers/clk/qcom/gcc-ipq6018.c new file +10 -0
+               .enable_reg = 0x0b000,
+               .enable_mask = BIT(7),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gpll6_main",
+                       .parent_names = (const char *[]){
+                               "xo"
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_alpha_pll_ops,
+                       .flags = CLK_IS_CRITICAL,

Can you add a comment on why this is critical?

Quoted 23 lines
drivers/clk/qcom/gcc-ipq6018.c new file +23 -0
+               },
+       },
+};
+
+static struct clk_alpha_pll_postdiv gpll6 = {
+       .offset = 0x37000,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_BRAMMO],
+       .width = 2,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "gpll6",
+               .parent_names = (const char *[]){
+                       "gpll6_main"
+               },
+               .num_parents = 1,
+               .ops = &clk_alpha_pll_postdiv_ro_ops,
+               .flags = CLK_SET_RATE_PARENT,
+       },
+};
+
+static struct clk_alpha_pll gpll4_main = {
+       .offset = 0x24000,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+       .clkr = {

drivers/clk/qcom/gcc-ipq6018.c line 536

Quoted 10 lines
drivers/clk/qcom/gcc-ipq6018.c new file +10 -0
+               .enable_reg = 0x0b000,
+               .enable_mask = BIT(5),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gpll4_main",
+                       .parent_names = (const char *[]){
+                               "xo"
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_alpha_pll_ops,
+                       .flags = CLK_IS_CRITICAL,

Can you add a comment on why this is critical?

Quoted 27 lines
drivers/clk/qcom/gcc-ipq6018.c new file +27 -0
+               },
+       },
+};
+
+static struct clk_alpha_pll_postdiv gpll4 = {
+       .offset = 0x24000,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+       .width = 4,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "gpll4",
+               .parent_names = (const char *[]){
+                       "gpll4_main"
+               },
+               .num_parents = 1,
+               .ops = &clk_alpha_pll_postdiv_ro_ops,
+               .flags = CLK_SET_RATE_PARENT,
+       },
+};
+
+static const struct freq_tbl ftbl_pcnoc_bfdcd_clk_src[] = {
+       F(24000000, P_XO, 1, 0, 0),
+       F(50000000, P_GPLL0, 16, 0, 0),
+       F(100000000, P_GPLL0, 8, 0, 0),
+       { }
+};
+
+static struct clk_rcg2 pcnoc_bfdcd_clk_src = {

drivers/clk/qcom/gcc-ipq6018.c line 573

Quoted 10 lines
drivers/clk/qcom/gcc-ipq6018.c new file +10 -0
+       .cmd_rcgr = 0x27000,
+       .freq_tbl = ftbl_pcnoc_bfdcd_clk_src,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "pcnoc_bfdcd_clk_src",
+               .parent_names = gcc_xo_gpll0_gpll0_out_main_div2,
+               .num_parents = 3,
+               .ops = &clk_rcg2_ops,
+               .flags = CLK_IS_CRITICAL,

Can you add a comment on why this is critical?

Quoted 21 lines
drivers/clk/qcom/gcc-ipq6018.c new file +21 -0
+       },
+};
+
+static struct clk_fixed_factor pcnoc_clk_src = {
+       .mult = 1,
+       .div = 1,
+       .hw.init = &(struct clk_init_data){
+               .name = "pcnoc_clk_src",
+               .parent_names = (const char *[]){
+                       "pcnoc_bfdcd_clk_src"
+               },
+               .num_parents = 1,
+               .ops = &clk_fixed_factor_ops,
+               .flags = CLK_SET_RATE_PARENT,
+       },
+};
+
+static struct clk_alpha_pll gpll2_main = {
+       .offset = 0x4a000,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+       .clkr = {

drivers/clk/qcom/gcc-ipq6018.c line 604

Quoted 10 lines
drivers/clk/qcom/gcc-ipq6018.c new file +10 -0
+               .enable_reg = 0x0b000,
+               .enable_mask = BIT(2),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gpll2_main",
+                       .parent_names = (const char *[]){
+                               "xo"
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_alpha_pll_ops,
+                       .flags = CLK_IS_CRITICAL,

Can you add a comment on why this is critical?

Quoted 4 lines
drivers/clk/qcom/gcc-ipq6018.c new file +4 -0
+               },
+       },
+};
+

[...]

Quoted 4 lines
drivers/clk/qcom/gcc-ipq6018.c new file +4 -0
+
+static struct clk_fixed_factor system_noc_clk_src = {
+       .mult = 1,
+       .div = 1,

drivers/clk/qcom/gcc-ipq6018.c line 789

Quoted 10 lines
drivers/clk/qcom/gcc-ipq6018.c new file +10 -0
+       .hw.init = &(struct clk_init_data){
+               .name = "system_noc_clk_src",
+               .parent_names = (const char *[]){
+                       "system_noc_bfdcd_clk_src"
+               },
+               .num_parents = 1,
+               .ops = &clk_fixed_factor_ops,
+               .flags = CLK_SET_RATE_PARENT,
+       },
+};

What is the point of these fixed factor 1/1 clks? Just to rename things? Does it matter, or can we just specify system_noc_bfdcd_clk_src as the parent and drop this intermediate clk?

Quoted 18 lines
drivers/clk/qcom/gcc-ipq6018.c new file +18 -0
+
+static struct clk_branch gcc_sleep_clk_src = {
+       .halt_reg = 0x30000,
+       .clkr = {
+               .enable_reg = 0x30000,
+               .enable_mask = BIT(1),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_sleep_clk_src",
+                       .parent_names = (const char *[]){
+                               "sleep_clk"
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+                       .flags = CLK_IS_CRITICAL,
+               },
+       },
+};
+

[...]

drivers/clk/qcom/gcc-ipq6018.c line 4103

Quoted 13 lines
drivers/clk/qcom/gcc-ipq6018.c new file +13 -0
+
+static struct clk_branch gcc_qdss_at_clk = {
+       .halt_reg = 0x29024,
+       .clkr = {
+               .enable_reg = 0x29024,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_qdss_at_clk",
+                       .parent_names = (const char *[]){
+                               "qdss_at_clk_src"
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL,

Can you add a comment on why this is critical?

Quoted 7 lines
drivers/clk/qcom/gcc-ipq6018.c new file +7 -0
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_qdss_dap_clk = {
+       .halt_reg = 0x29084,

drivers/clk/qcom/gcc-ipq6018.c line 4120

Quoted 10 lines
drivers/clk/qcom/gcc-ipq6018.c new file +10 -0
+       .clkr = {
+               .enable_reg = 0x29084,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_qdss_dap_clk",
+                       .parent_names = (const char *[]){
+                               "qdss_dap_sync_clk_src"
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL,

Can you add a comment on why this is critical?

Quoted 22 lines
drivers/clk/qcom/gcc-ipq6018.c new file +22 -0
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_qpic_ahb_clk = {
+       .halt_reg = 0x57024,
+       .clkr = {
+               .enable_reg = 0x57024,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_qpic_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "pcnoc_clk_src"
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+

[...]

drivers/clk/qcom/gcc-ipq6018.c line 4778

Quoted 10 lines
drivers/clk/qcom/gcc-ipq6018.c new file +10 -0
+static struct clk_branch gcc_dcc_clk = {
+       .halt_reg = 0x77004,
+       .clkr = {
+               .enable_reg = 0x77004,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_dcc_clk",
+                       .parent_names = (const char *[]){
+                               "pcnoc_clk_src"
+                       },

Can you use the new method of specifying clk parents here? That will make this simpler.

Quoted 26 lines
drivers/clk/qcom/gcc-ipq6018.c new file +26 -0
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static const struct alpha_pll_config ubi32_pll_config = {
+       .l = 0x3e,
+       .alpha = 0x57,
+       .config_ctl_val = 0x200d6aa8,
+       .config_ctl_hi_val = 0x3c2,
+       .main_output_mask = BIT(0),
+       .aux_output_mask = BIT(1),
+       .pre_div_val = 0x0,
+       .pre_div_mask = BIT(12),
+       .post_div_val = 0x0,
+       .post_div_mask = GENMASK(9, 8),
+};
+
+static const struct alpha_pll_config nss_crypto_pll_config = {
+       .l = 0x32,
+       .alpha = 0x0,
+       .alpha_hi = 0x0,
+       .config_ctl_val = 0x4001055b,
+       .main_output_mask = BIT(0),

drivers/clk/qcom/gcc-ipq6018.c line 4814

Quoted 10 lines
drivers/clk/qcom/gcc-ipq6018.c new file +10 -0
+       .pre_div_val = 0x0,
+       .pre_div_mask = GENMASK(14, 12),
+       .post_div_val = 0x1 << 8,
+       .post_div_mask = GENMASK(11, 8),
+       .vco_mask = GENMASK(21, 20),
+       .vco_val = 0x0,
+       .alpha_en_mask = BIT(24),
+};
+
+static struct clk_hw *gcc_ipq6018_hws[] = {

It would be nice to trim this down to a list of 0.

drivers/clk/qcom/gcc-ipq6018.c line 4822

Quoted 8 lines
drivers/clk/qcom/gcc-ipq6018.c new file +8 -0
+       &gpll0_out_main_div2.hw,
+       &pcnoc_clk_src.hw,
+       &snoc_nssnoc_clk_src.hw,
+       &system_noc_clk_src.hw,
+       &gcc_xo_div4_clk_src.hw,
+       &ubi32_mem_noc_clk_src.hw,
+       &nss_ppe_cdiv_clk_src.hw,
+       &gpll6_out_main_div2.hw,

Why do we need this? Does anyone use it?

Quoted 4 lines
drivers/clk/qcom/gcc-ipq6018.c new file +4 -0
+       &qdss_dap_sync_clk_src.hw,
+       &qdss_tsctr_div2_clk_src.hw,
+};
+
#8 lore raw

Re: [PATCH 4/6] clk: qcom: Add ipq6018 Global Clock Controller support

Hi Stephen,
Sorry for the late response, started looking in to this again.

Quoted 9 lines · Stephen Boyd

Quoting Sricharan R (2019-06-05 10:28:56)

Quoted 8 lines
drivers/clk/qcom/Kconfig +0 -0
index e1ff83c..e5fb091 100644
@@ -120,6 +120,15 @@ config IPQ_GCC_8074
          i2c, USB, SD/eMMC, etc. Select this for the root clock
          of ipq8074.
 
Quoted 7 lines

drivers/clk/qcom/Kconfig config IPQ_GCC_8074 · line 125

Quoted 3 lines
drivers/clk/qcom/Kconfig +3 -0
+config IPQ_GCC_6018
+       tristate "IPQ6018 Global Clock Controller"
+       depends on COMMON_CLK_QCOM

Not sure I commented on this, but this should be removed. The whole thing is inside an if now.

ok, will change.

Quoted 53 lines
Quoted 43 lines
drivers/clk/qcom/Kconfig +6 -0
+       help
+         Support for global clock controller on ipq6018 devices.
+         Say Y if you want to use peripheral devices such as UART, SPI,
+         i2c, USB, SD/eMMC, etc. Select this for the root clock
+         of ipq6018.
+
 config MSM_GCC_8660
        tristate "MSM8660 Global Clock Controller"
        help
drivers/clk/qcom/gcc-ipq6018.c new file +28 -0
new file mode 100644
index 0000000..9f4552b
@@ -0,0 +1,5267 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ */
+
+#include <linux/kernel.h>
+#include <linux/err.h>
+#include <linux/platform_device.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/clk-provider.h>
+#include <linux/regmap.h>
+
+#include <linux/reset-controller.h>
+#include <dt-bindings/clock/qcom,gcc-ipq6018.h>
+
+#include "common.h"
+#include "clk-regmap.h"
+#include "clk-pll.h"
+#include "clk-rcg.h"
+#include "clk-branch.h"
+#include "clk-alpha-pll.h"
+#include "clk-regmap-divider.h"
+#include "clk-regmap-mux.h"
+#include "reset.h"
+
+#define F(f, s, h, m, n) { (f), (s), (2 * (h) - 1), (m), (n) }

[...]

Quoted 9 lines
drivers/clk/qcom/gcc-ipq6018.c new file +9 -0
+
+static struct clk_alpha_pll gpll0_main = {
+       .offset = 0x21000,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+       .clkr = {
+               .enable_reg = 0x0b000,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gpll0_main",
Quoted 9 lines

drivers/clk/qcom/gcc-ipq6018.c line 423

Quoted 6 lines
drivers/clk/qcom/gcc-ipq6018.c new file +6 -0
+                       .parent_names = (const char *[]){
+                               "xo"
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_alpha_pll_ops,
+                       .flags = CLK_IS_CRITICAL,

Can you add a comment on why this is critical?

Need not be critical, will remove it here and in
rest of the places as well.

Quoted 208 lines
Quoted 70 lines
drivers/clk/qcom/gcc-ipq6018.c new file +70 -0
+               },
+       },
+};
+
+static struct clk_fixed_factor gpll0_out_main_div2 = {
+       .mult = 1,
+       .div = 2,
+       .hw.init = &(struct clk_init_data){
+               .name = "gpll0_out_main_div2",
+               .parent_names = (const char *[]){
+                       "gpll0_main"
+               },
+               .num_parents = 1,
+               .ops = &clk_fixed_factor_ops,
+               .flags = CLK_SET_RATE_PARENT,
+       },
+};
+
+static struct clk_alpha_pll_postdiv gpll0 = {
+       .offset = 0x21000,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+       .width = 4,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "gpll0",
+               .parent_names = (const char *[]){
+                       "gpll0_main"
+               },
+               .num_parents = 1,
+               .ops = &clk_alpha_pll_postdiv_ro_ops,
+               .flags = CLK_SET_RATE_PARENT,
+       },
+};
+
+static struct clk_alpha_pll ubi32_pll_main = {
+       .offset = 0x25000,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_HUAYRA],
+       .flags = SUPPORTS_DYNAMIC_UPDATE,
+       .clkr = {
+               .enable_reg = 0x0b000,
+               .enable_mask = BIT(6),
+               .hw.init = &(struct clk_init_data){
+                       .name = "ubi32_pll_main",
+                       .parent_names = (const char *[]){
+                               "xo"
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_alpha_pll_huayra_ops,
+               },
+       },
+};
+
+static struct clk_alpha_pll_postdiv ubi32_pll = {
+       .offset = 0x25000,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_HUAYRA],
+       .width = 2,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "ubi32_pll",
+               .parent_names = (const char *[]){
+                       "ubi32_pll_main"
+               },
+               .num_parents = 1,
+               .ops = &clk_alpha_pll_postdiv_ro_ops,
+               .flags = CLK_SET_RATE_PARENT,
+       },
+};
+
+static struct clk_alpha_pll gpll6_main = {
+       .offset = 0x37000,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_BRAMMO],
+       .clkr = {

drivers/clk/qcom/gcc-ipq6018.c line 503

Quoted 10 lines
drivers/clk/qcom/gcc-ipq6018.c new file +10 -0
+               .enable_reg = 0x0b000,
+               .enable_mask = BIT(7),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gpll6_main",
+                       .parent_names = (const char *[]){
+                               "xo"
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_alpha_pll_ops,
+                       .flags = CLK_IS_CRITICAL,

Can you add a comment on why this is critical?

Quoted 23 lines
drivers/clk/qcom/gcc-ipq6018.c new file +23 -0
+               },
+       },
+};
+
+static struct clk_alpha_pll_postdiv gpll6 = {
+       .offset = 0x37000,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_BRAMMO],
+       .width = 2,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "gpll6",
+               .parent_names = (const char *[]){
+                       "gpll6_main"
+               },
+               .num_parents = 1,
+               .ops = &clk_alpha_pll_postdiv_ro_ops,
+               .flags = CLK_SET_RATE_PARENT,
+       },
+};
+
+static struct clk_alpha_pll gpll4_main = {
+       .offset = 0x24000,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+       .clkr = {

drivers/clk/qcom/gcc-ipq6018.c line 536

Quoted 10 lines
drivers/clk/qcom/gcc-ipq6018.c new file +10 -0
+               .enable_reg = 0x0b000,
+               .enable_mask = BIT(5),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gpll4_main",
+                       .parent_names = (const char *[]){
+                               "xo"
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_alpha_pll_ops,
+                       .flags = CLK_IS_CRITICAL,

Can you add a comment on why this is critical?

Quoted 27 lines
drivers/clk/qcom/gcc-ipq6018.c new file +27 -0
+               },
+       },
+};
+
+static struct clk_alpha_pll_postdiv gpll4 = {
+       .offset = 0x24000,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+       .width = 4,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "gpll4",
+               .parent_names = (const char *[]){
+                       "gpll4_main"
+               },
+               .num_parents = 1,
+               .ops = &clk_alpha_pll_postdiv_ro_ops,
+               .flags = CLK_SET_RATE_PARENT,
+       },
+};
+
+static const struct freq_tbl ftbl_pcnoc_bfdcd_clk_src[] = {
+       F(24000000, P_XO, 1, 0, 0),
+       F(50000000, P_GPLL0, 16, 0, 0),
+       F(100000000, P_GPLL0, 8, 0, 0),
+       { }
+};
+
+static struct clk_rcg2 pcnoc_bfdcd_clk_src = {

drivers/clk/qcom/gcc-ipq6018.c line 573

Quoted 10 lines
drivers/clk/qcom/gcc-ipq6018.c new file +10 -0
+       .cmd_rcgr = 0x27000,
+       .freq_tbl = ftbl_pcnoc_bfdcd_clk_src,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "pcnoc_bfdcd_clk_src",
+               .parent_names = gcc_xo_gpll0_gpll0_out_main_div2,
+               .num_parents = 3,
+               .ops = &clk_rcg2_ops,
+               .flags = CLK_IS_CRITICAL,

Can you add a comment on why this is critical?

Quoted 21 lines
drivers/clk/qcom/gcc-ipq6018.c new file +21 -0
+       },
+};
+
+static struct clk_fixed_factor pcnoc_clk_src = {
+       .mult = 1,
+       .div = 1,
+       .hw.init = &(struct clk_init_data){
+               .name = "pcnoc_clk_src",
+               .parent_names = (const char *[]){
+                       "pcnoc_bfdcd_clk_src"
+               },
+               .num_parents = 1,
+               .ops = &clk_fixed_factor_ops,
+               .flags = CLK_SET_RATE_PARENT,
+       },
+};
+
+static struct clk_alpha_pll gpll2_main = {
+       .offset = 0x4a000,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+       .clkr = {

drivers/clk/qcom/gcc-ipq6018.c line 604

Quoted 10 lines
drivers/clk/qcom/gcc-ipq6018.c new file +10 -0
+               .enable_reg = 0x0b000,
+               .enable_mask = BIT(2),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gpll2_main",
+                       .parent_names = (const char *[]){
+                               "xo"
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_alpha_pll_ops,
+                       .flags = CLK_IS_CRITICAL,

Can you add a comment on why this is critical?

Quoted 4 lines
drivers/clk/qcom/gcc-ipq6018.c new file +4 -0
+               },
+       },
+};
+

[...]

Quoted 10 lines
drivers/clk/qcom/gcc-ipq6018.c new file +10 -0
+
+static struct clk_fixed_factor system_noc_clk_src = {
+       .mult = 1,
+       .div = 1,
+       .hw.init = &(struct clk_init_data){
+               .name = "system_noc_clk_src",
+               .parent_names = (const char *[]){
+                       "system_noc_bfdcd_clk_src"
+               },
+               .num_parents = 1,
Quoted 9 lines

drivers/clk/qcom/gcc-ipq6018.c line 440

Quoted 4 lines
drivers/clk/qcom/gcc-ipq6018.c new file +4 -0
+               .ops = &clk_fixed_factor_ops,
+               .flags = CLK_SET_RATE_PARENT,
+       },
+};

What is the point of these fixed factor 1/1 clks? Just to rename things? Does it matter, or can we just specify system_noc_bfdcd_clk_src as the parent and drop this intermediate clk?

ok, will remove it.

Quoted 89 lines
Quoted 18 lines
drivers/clk/qcom/gcc-ipq6018.c new file +18 -0
+
+static struct clk_branch gcc_sleep_clk_src = {
+       .halt_reg = 0x30000,
+       .clkr = {
+               .enable_reg = 0x30000,
+               .enable_mask = BIT(1),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_sleep_clk_src",
+                       .parent_names = (const char *[]){
+                               "sleep_clk"
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+                       .flags = CLK_IS_CRITICAL,
+               },
+       },
+};
+

[...]

drivers/clk/qcom/gcc-ipq6018.c line 4103

Quoted 13 lines
drivers/clk/qcom/gcc-ipq6018.c new file +13 -0
+
+static struct clk_branch gcc_qdss_at_clk = {
+       .halt_reg = 0x29024,
+       .clkr = {
+               .enable_reg = 0x29024,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_qdss_at_clk",
+                       .parent_names = (const char *[]){
+                               "qdss_at_clk_src"
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL,

Can you add a comment on why this is critical?

Quoted 7 lines
drivers/clk/qcom/gcc-ipq6018.c new file +7 -0
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_qdss_dap_clk = {
+       .halt_reg = 0x29084,

drivers/clk/qcom/gcc-ipq6018.c line 4120

Quoted 10 lines
drivers/clk/qcom/gcc-ipq6018.c new file +10 -0
+       .clkr = {
+               .enable_reg = 0x29084,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_qdss_dap_clk",
+                       .parent_names = (const char *[]){
+                               "qdss_dap_sync_clk_src"
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL,

Can you add a comment on why this is critical?

Quoted 22 lines
drivers/clk/qcom/gcc-ipq6018.c new file +22 -0
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_qpic_ahb_clk = {
+       .halt_reg = 0x57024,
+       .clkr = {
+               .enable_reg = 0x57024,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_qpic_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "pcnoc_clk_src"
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+

[...]

drivers/clk/qcom/gcc-ipq6018.c line 4778

Quoted 10 lines
drivers/clk/qcom/gcc-ipq6018.c new file +10 -0
+static struct clk_branch gcc_dcc_clk = {
+       .halt_reg = 0x77004,
+       .clkr = {
+               .enable_reg = 0x77004,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_dcc_clk",
+                       .parent_names = (const char *[]){
+                               "pcnoc_clk_src"
+                       },
Quoted 3 lines

Can you use the new method of specifying clk parents here? That will make this simpler.

ok, will use it.

Quoted 48 lines
Quoted 26 lines
drivers/clk/qcom/gcc-ipq6018.c new file +26 -0
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static const struct alpha_pll_config ubi32_pll_config = {
+       .l = 0x3e,
+       .alpha = 0x57,
+       .config_ctl_val = 0x200d6aa8,
+       .config_ctl_hi_val = 0x3c2,
+       .main_output_mask = BIT(0),
+       .aux_output_mask = BIT(1),
+       .pre_div_val = 0x0,
+       .pre_div_mask = BIT(12),
+       .post_div_val = 0x0,
+       .post_div_mask = GENMASK(9, 8),
+};
+
+static const struct alpha_pll_config nss_crypto_pll_config = {
+       .l = 0x32,
+       .alpha = 0x0,
+       .alpha_hi = 0x0,
+       .config_ctl_val = 0x4001055b,
+       .main_output_mask = BIT(0),

drivers/clk/qcom/gcc-ipq6018.c line 4814

Quoted 10 lines
drivers/clk/qcom/gcc-ipq6018.c new file +10 -0
+       .pre_div_val = 0x0,
+       .pre_div_mask = GENMASK(14, 12),
+       .post_div_val = 0x1 << 8,
+       .post_div_mask = GENMASK(11, 8),
+       .vco_mask = GENMASK(21, 20),
+       .vco_val = 0x0,
+       .alpha_en_mask = BIT(24),
+};
+
+static struct clk_hw *gcc_ipq6018_hws[] = {

It would be nice to trim this down to a list of 0.

drivers/clk/qcom/gcc-ipq6018.c line 4822

Quoted 8 lines
drivers/clk/qcom/gcc-ipq6018.c new file +8 -0
+       &gpll0_out_main_div2.hw,
+       &pcnoc_clk_src.hw,
+       &snoc_nssnoc_clk_src.hw,
+       &system_noc_clk_src.hw,
+       &gcc_xo_div4_clk_src.hw,
+       &ubi32_mem_noc_clk_src.hw,
+       &nss_ppe_cdiv_clk_src.hw,
+       &gpll6_out_main_div2.hw,
Quoted 2 lines

Why do we need this? Does anyone use it?

Yes, will remove the fixed factor 1/1 parents from this list. But other div clks are still required.

Regards,
Sricharan

Signature · 1 line
"QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
#9 lore raw

PATCH 5/6 arm64: dts: Add ipq6018 SoC and CP01 board support

In reply to Sricharan R

Add initial device tree support for the Qualcomm IPQ6018 SoC and CP01 evaluation board.

---
 arch/arm64/boot/dts/qcom/Makefile            |   1 +
 arch/arm64/boot/dts/qcom/ipq6018-cp01-c1.dts |  35 ++++
 arch/arm64/boot/dts/qcom/ipq6018.dtsi        | 231 +++++++++++++++++++++++++++
 3 files changed, 267 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/ipq6018-cp01-c1.dts
 create mode 100644 arch/arm64/boot/dts/qcom/ipq6018.dtsi
arch/arm64/boot/dts/qcom/Makefile +1 -0
index 21d548f..ac22dbb 100644
@@ -2,6 +2,7 @@
 dtb-$(CONFIG_ARCH_QCOM)	+= apq8016-sbc.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= apq8096-db820c.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= ipq8074-hk01.dtb
+dtb-$(CONFIG_ARCH_QCOM)	+= ipq6018-cp01-c1.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= msm8916-mtp.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= msm8992-bullhead-rev-101.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= msm8994-angler-rev-101.dtb
arch/arm64/boot/dts/qcom/ipq6018-cp01-c1.dts new file +35 -0
new file mode 100644
index 0000000..ac7cb22
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * IPQ6018 CP01 board device tree source
+ *
+ * Copyright (c) 2019, The Linux Foundation. All rights reserved.
+ */
+
+/dts-v1/;
+
+#include "ipq6018.dtsi"
+
+/ {
+	#address-cells = <0x2>;
+	#size-cells = <0x2>;
+	model = "Qualcomm Technologies, Inc. IPQ6018/AP-CP01-C1";
+	compatible = "qcom,ipq6018-cp01", "qcom,ipq6018";
+	interrupt-parent = <&intc>;
+};
+
+&tlmm {
+	uart_pins: uart_pins {
+		mux {
+			pins = "gpio44", "gpio45";
+			function = "blsp2_uart";
+			drive-strength = <8>;
+			bias-pull-down;
+		};
+	};
+};
+
+&blsp1_uart3 {
+	pinctrl-0 = <&uart_pins>;
+	pinctrl-names = "default";
+	status = "ok";
+};
arch/arm64/boot/dts/qcom/ipq6018.dtsi new file +231 -0

231 lines not on this page · raw message

Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
#10 lore raw

Re: [PATCH 5/6] arm64: dts: Add ipq6018 SoC and CP01 board support

Quoted 13 lines · Sricharan R

Add initial device tree support for the Qualcomm IPQ6018 SoC and CP01 evaluation board.

---
 arch/arm64/boot/dts/qcom/Makefile            |   1 +
 arch/arm64/boot/dts/qcom/ipq6018-cp01-c1.dts |  35 ++++
 arch/arm64/boot/dts/qcom/ipq6018.dtsi        | 231 +++++++++++++++++++++++++++
 3 files changed, 267 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/ipq6018-cp01-c1.dts
 create mode 100644 arch/arm64/boot/dts/qcom/ipq6018.dtsi

[...]

Quoted 7 lines
arch/arm64/boot/dts/qcom/ipq6018.dtsi new file +7 -0
+
+		CPU3: cpu@3 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			enable-method = "psci";
+			reg = <0x3>;
+			next-level-cache = <&L2_0>;

arch/arm64/boot/dts/qcom/ipq6018.dtsi line 195

Quoted 10 lines
arch/arm64/boot/dts/qcom/ipq6018.dtsi new file +10 -0
+		};
+
+		L2_0: l2-cache {
+			compatible = "cache";
+			cache-level = <0x2>;
+		};
+	};
+
+	pmuv8: pmu {
+		compatible = "arm,armv8-pmuv3";

We know these are Cortex-A53s, why not update these accordingly ?

--
Regards,
Sudeep

#11 lore raw

Re: [PATCH 5/6] arm64: dts: Add ipq6018 SoC and CP01 board support

Hi Sudeep,

Quoted 28 lines · Sudeep Holla
Quoted 13 lines · Sricharan R

Add initial device tree support for the Qualcomm IPQ6018 SoC and CP01 evaluation board.

---
 arch/arm64/boot/dts/qcom/Makefile            |   1 +
 arch/arm64/boot/dts/qcom/ipq6018-cp01-c1.dts |  35 ++++
 arch/arm64/boot/dts/qcom/ipq6018.dtsi        | 231 +++++++++++++++++++++++++++
 3 files changed, 267 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/ipq6018-cp01-c1.dts
 create mode 100644 arch/arm64/boot/dts/qcom/ipq6018.dtsi

[...]

Quoted 11 lines
arch/arm64/boot/dts/qcom/ipq6018.dtsi new file +11 -0
+
+		CPU3: cpu@3 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			enable-method = "psci";
+			reg = <0x3>;
+			next-level-cache = <&L2_0>;
+		};
+
+		L2_0: l2-cache {
+			compatible = "cache";
Quoted 9 lines

arch/arm64/boot/dts/qcom/ipq6018.dtsi line 195

Quoted 6 lines
arch/arm64/boot/dts/qcom/ipq6018.dtsi new file +6 -0
+			cache-level = <0x2>;
+		};
+	};
+
+	pmuv8: pmu {
+		compatible = "arm,armv8-pmuv3";

We know these are Cortex-A53s, why not update these accordingly ?

Ok, will change this.

Regards,
Sricharan

Signature · 1 line
"QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
#12 lore raw

PATCH 6/6 arm64: defconfig: Enable qcom ipq6018 clock and pinctrl

In reply to Sricharan R

These configs are required for booting kernel in qcom ipq6018 boards.

---
 arch/arm64/configs/defconfig | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/configs/defconfig +2 -0
index 4d58351..abf64ee 100644
@@ -373,6 +373,7 @@ CONFIG_PINCTRL_MAX77620=y
 CONFIG_PINCTRL_IMX8MQ=y
 CONFIG_PINCTRL_IMX8QXP=y
 CONFIG_PINCTRL_IPQ8074=y
+CONFIG_PINCTRL_IPQ6018=y
 CONFIG_PINCTRL_MSM8916=y
 CONFIG_PINCTRL_MSM8994=y
 CONFIG_PINCTRL_MSM8996=y
@@ -646,6 +647,7 @@ CONFIG_COMMON_CLK_QCOM=y
 CONFIG_QCOM_CLK_SMD_RPM=y
 CONFIG_QCOM_CLK_RPMH=y
 CONFIG_IPQ_GCC_8074=y
+CONFIG_IPQ_GCC_6018=y
 CONFIG_MSM_GCC_8916=y
 CONFIG_MSM_GCC_8994=y
 CONFIG_MSM_MMCC_8996=y
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation