Hi Jian,It is a useless comment actually. I will remove it.
my comments and questions below
please keep in mind that I don't have access to the A1 datasheets, so
I may ask stupid questions :)
On Fri, Dec 27, 2019 at 10:47 AM Jian Hu <jian.hu@xxxxxxxxxxx> wrote:
[...]
+/* PLLs clock in gates, its parent is xtal */yes. doesn't the code below describe exactly this (what is so special
about it that we need an extra comment)?
OK, I will fix it.
[...]
+static const struct clk_parent_data sys_clk_parents[] = {the last three values are missing a space before "}"
+ { .fw_name = "xtal" },
+ { .fw_name = "fclk_div2"},
+ { .fw_name = "fclk_div3"},
+ { .fw_name = "fclk_div5"},
[...]Yes, same with the PLL driver. Romcode is boot ROM.
+ .hw.init = &(struct clk_init_data){like in the PLL clkc patch:
+ .name = "sys_clk",
+ .ops = &clk_regmap_mux_ro_ops,
+ .parent_hws = (const struct clk_hw *[]) {
+ &a1_sys_a.hw, &a1_sys_b.hw,
+ },
+ .num_parents = 2,
+ /*
+ * This clock is used by APB bus which setted in Romcode
- setted -> "is set"
- Romcode == boot ROM ?
Here is a reference to g12a-aoclkc.c
[...]
+static struct clk_regmap a1_rtc_32k_sel = {CLK_MUX_ROUND_CLOSEST means the common clock framework will also
+ .data = &(struct clk_regmap_mux_data) {
+ .offset = RTC_CTRL,
+ .mask = 0x3,
+ .shift = 0,
+ .flags = CLK_MUX_ROUND_CLOSEST,
accept rates greater than 32kHz.
is that fine for this case?
Yes, it is index 2, it is the third parent in datasheet. I will change it
[...]
+/*I was confused by this but I assume you mean the parent with index 2?
+ * the second parent is sys_pll_div16, it will complete in the CPU clock,
Yes, it is index 4 .
+ * the forth parent is the clock measurement source, it relies on...and parent with index 4 here
+ * the clock measurement register configuration.
For A1 ad401 board, the cpu voltage is controlled by PMU regulator. And for A1 ad409 board, the cpu voltage is controlled by PWM regulator, The PWM A channel feeds the cpu voltage, it is initialized in BL2. So it is necessary to add critical flag.
[...]
+static struct clk_regmap a1_pwm_a = {on G12A and G12B Linux has to manage the CPU voltage regulator
+ .data = &(struct clk_regmap_gate_data){
+ .offset = PWM_CLK_AB_CTRL,
+ .bit_idx = 8,
+ },
+ .hw.init = &(struct clk_init_data) {
+ .name = "pwm_a",
+ .ops = &clk_regmap_gate_ops,
+ .parent_hws = (const struct clk_hw *[]) {
+ &a1_pwm_a_div.hw
+ },
+ .num_parents = 1,
+ /*
+ * The CPU working voltage is controlled by pwm_a
+ * in BL2 firmware. add the CLK_IS_CRITICAL flag
+ * to avoid changing at runtime.
can you confirm that for the A1 SoC this is really done by BL2? (I'm
wondering since A1 is newer than G12)
Yes, it is fclk_div2. I will replace it as fdiv2 for short
+/*does that "div2" stand for fclk_div2?
+ * spicc clk
+ * div2 |\ |\ _____
+ * ---------| |---DIV--| | | | spicc out
+ * ---------| | | |-----|GATE |---------
+ * ..... |/ | / |_____|
+ * --------------------|/
+ * 24M
OK, I will remove meson_eeclkc_data here. And use the variables directly.
[...]
+static const struct meson_eeclkc_data a1_periphs_data = {same comment as for the PLL clkc: please drop this and use the
+ .regmap_clks = a1_periphs_regmaps,
+ .regmap_clk_num = ARRAY_SIZE(a1_periphs_regmaps),
+ .hw_onecell_data = &a1_periphs_hw_onecell_data,
+};
variables directly inside _probe to get rid of the struct
meson_eeclkc_data (so I won't be confused about "EE clocks" on A1,
while according to your description there's no "EE" domain)
Martin
.