* [PATCH v2 1/8] dt-bindings: soc: rockchip: Add RK3528 VO GRF syscon
2025-03-05 19:42 [PATCH v2 0/8] Support SD/SDIO controllers on RK3528 Yao Zi
@ 2025-03-05 19:42 ` Yao Zi
2025-03-05 19:42 ` [PATCH v2 2/8] dt-bindings: soc: rockchip: Add RK3528 VPU " Yao Zi
` (7 subsequent siblings)
8 siblings, 0 replies; 17+ messages in thread
From: Yao Zi @ 2025-03-05 19:42 UTC (permalink / raw)
To: Ulf Hansson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Heiko Stuebner, Michael Turquette, Stephen Boyd, Shresth Prasad,
Cristian Ciocaltea, Detlev Casanova, Jonas Karlman, Chukun Pan
Cc: linux-mmc, devicetree, linux-arm-kernel, linux-rockchip,
linux-kernel, linux-clk, Yao Zi
Add compatible string for VO GRF found on RK3528 SoC.
Signed-off-by: Yao Zi <ziyao@disroot.org>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
---
Documentation/devicetree/bindings/soc/rockchip/grf.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/soc/rockchip/grf.yaml b/Documentation/devicetree/bindings/soc/rockchip/grf.yaml
index b4ed4cb555bd..98a0670359f6 100644
--- a/Documentation/devicetree/bindings/soc/rockchip/grf.yaml
+++ b/Documentation/devicetree/bindings/soc/rockchip/grf.yaml
@@ -16,6 +16,7 @@ properties:
- enum:
- rockchip,rk3288-sgrf
- rockchip,rk3528-ioc-grf
+ - rockchip,rk3528-vo-grf
- rockchip,rk3566-pipe-grf
- rockchip,rk3568-pcie3-phy-grf
- rockchip,rk3568-pipe-grf
--
2.48.1
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH v2 2/8] dt-bindings: soc: rockchip: Add RK3528 VPU GRF syscon
2025-03-05 19:42 [PATCH v2 0/8] Support SD/SDIO controllers on RK3528 Yao Zi
2025-03-05 19:42 ` [PATCH v2 1/8] dt-bindings: soc: rockchip: Add RK3528 VO GRF syscon Yao Zi
@ 2025-03-05 19:42 ` Yao Zi
2025-03-05 19:42 ` [PATCH v2 3/8] dt-bindings: mmc: rockchip-dw-mshc: Add compatible string for RK3528 Yao Zi
` (6 subsequent siblings)
8 siblings, 0 replies; 17+ messages in thread
From: Yao Zi @ 2025-03-05 19:42 UTC (permalink / raw)
To: Ulf Hansson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Heiko Stuebner, Michael Turquette, Stephen Boyd, Shresth Prasad,
Cristian Ciocaltea, Detlev Casanova, Jonas Karlman, Chukun Pan
Cc: linux-mmc, devicetree, linux-arm-kernel, linux-rockchip,
linux-kernel, linux-clk, Yao Zi
Add compatible string for VPU GRF found on RK3528 SoC.
Signed-off-by: Yao Zi <ziyao@disroot.org>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
---
Documentation/devicetree/bindings/soc/rockchip/grf.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/soc/rockchip/grf.yaml b/Documentation/devicetree/bindings/soc/rockchip/grf.yaml
index 98a0670359f6..2f61c1b95fea 100644
--- a/Documentation/devicetree/bindings/soc/rockchip/grf.yaml
+++ b/Documentation/devicetree/bindings/soc/rockchip/grf.yaml
@@ -17,6 +17,7 @@ properties:
- rockchip,rk3288-sgrf
- rockchip,rk3528-ioc-grf
- rockchip,rk3528-vo-grf
+ - rockchip,rk3528-vpu-grf
- rockchip,rk3566-pipe-grf
- rockchip,rk3568-pcie3-phy-grf
- rockchip,rk3568-pipe-grf
--
2.48.1
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH v2 3/8] dt-bindings: mmc: rockchip-dw-mshc: Add compatible string for RK3528
2025-03-05 19:42 [PATCH v2 0/8] Support SD/SDIO controllers on RK3528 Yao Zi
2025-03-05 19:42 ` [PATCH v2 1/8] dt-bindings: soc: rockchip: Add RK3528 VO GRF syscon Yao Zi
2025-03-05 19:42 ` [PATCH v2 2/8] dt-bindings: soc: rockchip: Add RK3528 VPU " Yao Zi
@ 2025-03-05 19:42 ` Yao Zi
2025-03-05 19:42 ` [PATCH v2 4/8] dt-bindings: clock: Add GRF clock definition " Yao Zi
` (5 subsequent siblings)
8 siblings, 0 replies; 17+ messages in thread
From: Yao Zi @ 2025-03-05 19:42 UTC (permalink / raw)
To: Ulf Hansson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Heiko Stuebner, Michael Turquette, Stephen Boyd, Shresth Prasad,
Cristian Ciocaltea, Detlev Casanova, Jonas Karlman, Chukun Pan
Cc: linux-mmc, devicetree, linux-arm-kernel, linux-rockchip,
linux-kernel, linux-clk, Yao Zi
Add RK3528 compatible string for SD/SDIO interface.
Signed-off-by: Yao Zi <ziyao@disroot.org>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
---
Documentation/devicetree/bindings/mmc/rockchip-dw-mshc.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/mmc/rockchip-dw-mshc.yaml b/Documentation/devicetree/bindings/mmc/rockchip-dw-mshc.yaml
index 06df1269f247..ea0feb733e32 100644
--- a/Documentation/devicetree/bindings/mmc/rockchip-dw-mshc.yaml
+++ b/Documentation/devicetree/bindings/mmc/rockchip-dw-mshc.yaml
@@ -38,6 +38,7 @@ properties:
- rockchip,rk3328-dw-mshc
- rockchip,rk3368-dw-mshc
- rockchip,rk3399-dw-mshc
+ - rockchip,rk3528-dw-mshc
- rockchip,rk3568-dw-mshc
- rockchip,rk3588-dw-mshc
- rockchip,rv1108-dw-mshc
--
2.48.1
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH v2 4/8] dt-bindings: clock: Add GRF clock definition for RK3528
2025-03-05 19:42 [PATCH v2 0/8] Support SD/SDIO controllers on RK3528 Yao Zi
` (2 preceding siblings ...)
2025-03-05 19:42 ` [PATCH v2 3/8] dt-bindings: mmc: rockchip-dw-mshc: Add compatible string for RK3528 Yao Zi
@ 2025-03-05 19:42 ` Yao Zi
2025-03-06 8:40 ` Krzysztof Kozlowski
2025-03-05 19:45 ` [PATCH v2 5/8] clk: rockchip: Support MMC clocks in GRF region Yao Zi
` (4 subsequent siblings)
8 siblings, 1 reply; 17+ messages in thread
From: Yao Zi @ 2025-03-05 19:42 UTC (permalink / raw)
To: Ulf Hansson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Heiko Stuebner, Michael Turquette, Stephen Boyd, Shresth Prasad,
Cristian Ciocaltea, Detlev Casanova, Jonas Karlman, Chukun Pan
Cc: linux-mmc, devicetree, linux-arm-kernel, linux-rockchip,
linux-kernel, linux-clk, Yao Zi
These clocks are for SD/SDIO tuning purpose and come with registers
in GRF syscon.
Signed-off-by: Yao Zi <ziyao@disroot.org>
---
include/dt-bindings/clock/rockchip,rk3528-cru.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/dt-bindings/clock/rockchip,rk3528-cru.h b/include/dt-bindings/clock/rockchip,rk3528-cru.h
index 55a448f5ed6d..0245a53fc334 100644
--- a/include/dt-bindings/clock/rockchip,rk3528-cru.h
+++ b/include/dt-bindings/clock/rockchip,rk3528-cru.h
@@ -414,6 +414,12 @@
#define MCLK_I2S2_2CH_SAI_SRC_PRE 402
#define MCLK_I2S3_8CH_SAI_SRC_PRE 403
#define MCLK_SDPDIF_SRC_PRE 404
+#define SCLK_SDMMC_DRV 405
+#define SCLK_SDMMC_SAMPLE 406
+#define SCLK_SDIO0_DRV 407
+#define SCLK_SDIO0_SAMPLE 408
+#define SCLK_SDIO1_DRV 409
+#define SCLK_SDIO1_SAMPLE 410
/* scmi-clocks indices */
#define SCMI_PCLK_KEYREADER 0
--
2.48.1
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH v2 4/8] dt-bindings: clock: Add GRF clock definition for RK3528
2025-03-05 19:42 ` [PATCH v2 4/8] dt-bindings: clock: Add GRF clock definition " Yao Zi
@ 2025-03-06 8:40 ` Krzysztof Kozlowski
0 siblings, 0 replies; 17+ messages in thread
From: Krzysztof Kozlowski @ 2025-03-06 8:40 UTC (permalink / raw)
To: Yao Zi
Cc: Ulf Hansson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Heiko Stuebner, Michael Turquette, Stephen Boyd, Shresth Prasad,
Cristian Ciocaltea, Detlev Casanova, Jonas Karlman, Chukun Pan,
linux-mmc, devicetree, linux-arm-kernel, linux-rockchip,
linux-kernel, linux-clk
On Wed, Mar 05, 2025 at 07:42:13PM +0000, Yao Zi wrote:
> These clocks are for SD/SDIO tuning purpose and come with registers
> in GRF syscon.
>
> Signed-off-by: Yao Zi <ziyao@disroot.org>
> ---
> include/dt-bindings/clock/rockchip,rk3528-cru.h | 6 ++++++
> 1 file changed, 6 insertions(+)
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v2 5/8] clk: rockchip: Support MMC clocks in GRF region
2025-03-05 19:42 [PATCH v2 0/8] Support SD/SDIO controllers on RK3528 Yao Zi
` (3 preceding siblings ...)
2025-03-05 19:42 ` [PATCH v2 4/8] dt-bindings: clock: Add GRF clock definition " Yao Zi
@ 2025-03-05 19:45 ` Yao Zi
2025-03-05 19:45 ` [PATCH v2 6/8] clk: rockchip: rk3528: Add SD/SDIO tuning " Yao Zi
` (3 subsequent siblings)
8 siblings, 0 replies; 17+ messages in thread
From: Yao Zi @ 2025-03-05 19:45 UTC (permalink / raw)
To: Ulf Hansson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Heiko Stuebner, Michael Turquette, Stephen Boyd, Shresth Prasad,
Cristian Ciocaltea, Detlev Casanova, Jonas Karlman, Chukun Pan
Cc: linux-mmc, devicetree, linux-arm-kernel, linux-rockchip,
linux-kernel, linux-clk, Yao Zi
Registers of MMC drive/sample clocks in Rockchip RV1106 and RK3528
locate in GRF regions. Adjust MMC clock code to support register
operations through regmap. Also add a helper to ease registration of GRF
clocks.
Signed-off-by: Yao Zi <ziyao@disroot.org>
---
drivers/clk/rockchip/clk-mmc-phase.c | 24 +++++++++++++---
drivers/clk/rockchip/clk.c | 42 ++++++++++++++++++++++++++++
drivers/clk/rockchip/clk.h | 20 ++++++++++++-
3 files changed, 81 insertions(+), 5 deletions(-)
diff --git a/drivers/clk/rockchip/clk-mmc-phase.c b/drivers/clk/rockchip/clk-mmc-phase.c
index 91012078681b..b3ed8e7523e5 100644
--- a/drivers/clk/rockchip/clk-mmc-phase.c
+++ b/drivers/clk/rockchip/clk-mmc-phase.c
@@ -9,11 +9,14 @@
#include <linux/clk-provider.h>
#include <linux/io.h>
#include <linux/kernel.h>
+#include <linux/regmap.h>
#include "clk.h"
struct rockchip_mmc_clock {
struct clk_hw hw;
void __iomem *reg;
+ struct regmap *grf;
+ int grf_reg;
int shift;
int cached_phase;
struct notifier_block clk_rate_change_nb;
@@ -54,7 +57,12 @@ static int rockchip_mmc_get_phase(struct clk_hw *hw)
if (!rate)
return 0;
- raw_value = readl(mmc_clock->reg) >> (mmc_clock->shift);
+ if (mmc_clock->grf)
+ regmap_read(mmc_clock->grf, mmc_clock->grf_reg, &raw_value);
+ else
+ raw_value = readl(mmc_clock->reg);
+
+ raw_value >>= mmc_clock->shift;
degrees = (raw_value & ROCKCHIP_MMC_DEGREE_MASK) * 90;
@@ -134,8 +142,12 @@ static int rockchip_mmc_set_phase(struct clk_hw *hw, int degrees)
raw_value = delay_num ? ROCKCHIP_MMC_DELAY_SEL : 0;
raw_value |= delay_num << ROCKCHIP_MMC_DELAYNUM_OFFSET;
raw_value |= nineties;
- writel(HIWORD_UPDATE(raw_value, 0x07ff, mmc_clock->shift),
- mmc_clock->reg);
+ raw_value = HIWORD_UPDATE(raw_value, 0x07ff, mmc_clock->shift);
+
+ if (mmc_clock->grf)
+ regmap_write(mmc_clock->grf, mmc_clock->grf_reg, raw_value);
+ else
+ writel(raw_value, mmc_clock->reg);
pr_debug("%s->set_phase(%d) delay_nums=%u reg[0x%p]=0x%03x actual_degrees=%d\n",
clk_hw_get_name(hw), degrees, delay_num,
@@ -189,7 +201,9 @@ static int rockchip_mmc_clk_rate_notify(struct notifier_block *nb,
struct clk *rockchip_clk_register_mmc(const char *name,
const char *const *parent_names, u8 num_parents,
- void __iomem *reg, int shift)
+ void __iomem *reg,
+ struct regmap *grf, int grf_reg,
+ int shift)
{
struct clk_init_data init;
struct rockchip_mmc_clock *mmc_clock;
@@ -208,6 +222,8 @@ struct clk *rockchip_clk_register_mmc(const char *name,
mmc_clock->hw.init = &init;
mmc_clock->reg = reg;
+ mmc_clock->grf = grf;
+ mmc_clock->grf_reg = grf_reg;
mmc_clock->shift = shift;
clk = clk_register(NULL, &mmc_clock->hw);
diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c
index cbf93ea119a9..ce2f3323d84e 100644
--- a/drivers/clk/rockchip/clk.c
+++ b/drivers/clk/rockchip/clk.c
@@ -590,6 +590,7 @@ void rockchip_clk_register_branches(struct rockchip_clk_provider *ctx,
list->name,
list->parent_names, list->num_parents,
ctx->reg_base + list->muxdiv_offset,
+ NULL, 0,
list->div_shift
);
break;
@@ -619,6 +620,11 @@ void rockchip_clk_register_branches(struct rockchip_clk_provider *ctx,
break;
case branch_linked_gate:
/* must be registered late, fall-through for error message */
+ case branch_mmc_grf:
+ /*
+ * must be registered through rockchip_clk_register_grf_branches,
+ * fall-through for error message
+ */
break;
}
@@ -665,6 +671,42 @@ void rockchip_clk_register_late_branches(struct device *dev,
}
EXPORT_SYMBOL_GPL(rockchip_clk_register_late_branches);
+void rockchip_clk_register_grf_branches(struct rockchip_clk_provider *ctx,
+ struct rockchip_clk_branch *list,
+ struct regmap *grf,
+ unsigned int nr_clk)
+{
+ unsigned int idx;
+ struct clk *clk;
+
+ for (idx = 0; idx < nr_clk; idx++, list++) {
+ clk = NULL;
+
+ switch (list->branch_type) {
+ case branch_mmc_grf:
+ clk = rockchip_clk_register_mmc(
+ list->name,
+ list->parent_names, list->num_parents,
+ NULL,
+ grf, list->muxdiv_offset,
+ list->div_shift
+ );
+ break;
+ default:
+ pr_err("%s: unknown clock type %d\n",
+ __func__, list->branch_type);
+ break;
+ }
+
+ if (!clk)
+ pr_err("%s: failed to register clock %s: %ld\n",
+ __func__, list->name, PTR_ERR(clk));
+ else
+ rockchip_clk_set_lookup(ctx, clk, list->id);
+ }
+}
+EXPORT_SYMBOL_GPL(rockchip_clk_register_grf_branches);
+
void rockchip_clk_register_armclk(struct rockchip_clk_provider *ctx,
unsigned int lookup_id,
const char *name, const char *const *parent_names,
diff --git a/drivers/clk/rockchip/clk.h b/drivers/clk/rockchip/clk.h
index df2b2d706450..ec86ba1dd38c 100644
--- a/drivers/clk/rockchip/clk.h
+++ b/drivers/clk/rockchip/clk.h
@@ -594,7 +594,9 @@ struct clk *rockchip_clk_register_cpuclk(const char *name,
struct clk *rockchip_clk_register_mmc(const char *name,
const char *const *parent_names, u8 num_parents,
- void __iomem *reg, int shift);
+ void __iomem *reg,
+ struct regmap *grf, int grf_reg,
+ int shift);
/*
* DDRCLK flags, including method of setting the rate
@@ -633,6 +635,7 @@ enum rockchip_clk_branch_type {
branch_gate,
branch_linked_gate,
branch_mmc,
+ branch_mmc_grf,
branch_inverter,
branch_factor,
branch_ddrclk,
@@ -983,6 +986,17 @@ struct rockchip_clk_branch {
.div_shift = shift, \
}
+#define MMC_GRF(_id, cname, pname, offset, shift) \
+ { \
+ .id = _id, \
+ .branch_type = branch_mmc_grf, \
+ .name = cname, \
+ .parent_names = (const char *[]){ pname }, \
+ .num_parents = 1, \
+ .muxdiv_offset = offset, \
+ .div_shift = shift, \
+ }
+
#define INVERTER(_id, cname, pname, io, is, if) \
{ \
.id = _id, \
@@ -1132,6 +1146,10 @@ void rockchip_clk_register_late_branches(struct device *dev,
struct rockchip_clk_provider *ctx,
struct rockchip_clk_branch *list,
unsigned int nr_clk);
+void rockchip_clk_register_grf_branches(struct rockchip_clk_provider *ctx,
+ struct rockchip_clk_branch *list,
+ struct regmap *grf,
+ unsigned int nr_clk);
void rockchip_clk_register_plls(struct rockchip_clk_provider *ctx,
struct rockchip_pll_clock *pll_list,
unsigned int nr_pll, int grf_lock_offset);
--
2.48.1
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH v2 6/8] clk: rockchip: rk3528: Add SD/SDIO tuning clocks in GRF region
2025-03-05 19:42 [PATCH v2 0/8] Support SD/SDIO controllers on RK3528 Yao Zi
` (4 preceding siblings ...)
2025-03-05 19:45 ` [PATCH v2 5/8] clk: rockchip: Support MMC clocks in GRF region Yao Zi
@ 2025-03-05 19:45 ` Yao Zi
2025-03-05 19:46 ` [PATCH v2 7/8] arm64: dts: rockchip: Add SDMMC/SDIO controllers for RK3528 Yao Zi
` (2 subsequent siblings)
8 siblings, 0 replies; 17+ messages in thread
From: Yao Zi @ 2025-03-05 19:45 UTC (permalink / raw)
To: Ulf Hansson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Heiko Stuebner, Michael Turquette, Stephen Boyd, Shresth Prasad,
Cristian Ciocaltea, Detlev Casanova, Jonas Karlman, Chukun Pan
Cc: linux-mmc, devicetree, linux-arm-kernel, linux-rockchip,
linux-kernel, linux-clk, Yao Zi
These clocks locate in VO and VPU GRF, serving for SD/SDIO controller
tuning purpose. Add their definitions and register them in driver if
corresponding GRF is available.
GRFs are looked up by compatible to simplify devicetree binding.
Signed-off-by: Yao Zi <ziyao@disroot.org>
---
drivers/clk/rockchip/clk-rk3528.c | 61 ++++++++++++++++++++++++++++---
drivers/clk/rockchip/clk.h | 3 ++
2 files changed, 58 insertions(+), 6 deletions(-)
diff --git a/drivers/clk/rockchip/clk-rk3528.c b/drivers/clk/rockchip/clk-rk3528.c
index b8b577b902a0..5c133a642ff9 100644
--- a/drivers/clk/rockchip/clk-rk3528.c
+++ b/drivers/clk/rockchip/clk-rk3528.c
@@ -10,6 +10,8 @@
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
+#include <linux/mfd/syscon.h>
+#include <linux/minmax.h>
#include <dt-bindings/clock/rockchip,rk3528-cru.h>
@@ -1061,23 +1063,64 @@ static struct rockchip_clk_branch rk3528_clk_branches[] __initdata = {
0, 1, 1),
};
+static struct rockchip_clk_branch rk3528_vo_clk_branches[] __initdata = {
+ MMC_GRF(SCLK_SDMMC_DRV, "sdmmc_drv", "cclk_src_sdmmc0",
+ RK3528_SDMMC_CON(0), 1),
+ MMC_GRF(SCLK_SDMMC_SAMPLE, "sdmmc_sample", "cclk_src_sdmmc0",
+ RK3528_SDMMC_CON(1), 1),
+};
+
+static struct rockchip_clk_branch rk3528_vpu_clk_branches[] __initdata = {
+ MMC_GRF(SCLK_SDIO0_DRV, "sdio0_drv", "cclk_src_sdio0",
+ RK3528_SDIO0_CON(0), 1),
+ MMC_GRF(SCLK_SDIO0_SAMPLE, "sdio0_sample", "cclk_src_sdio0",
+ RK3528_SDIO0_CON(1), 1),
+ MMC_GRF(SCLK_SDIO1_DRV, "sdio1_drv", "cclk_src_sdio1",
+ RK3528_SDIO1_CON(0), 1),
+ MMC_GRF(SCLK_SDIO1_SAMPLE, "sdio1_sample", "cclk_src_sdio1",
+ RK3528_SDIO1_CON(1), 1),
+};
+
static int __init clk_rk3528_probe(struct platform_device *pdev)
{
- struct rockchip_clk_provider *ctx;
+ unsigned long nr_vpu_branches = ARRAY_SIZE(rk3528_vpu_clk_branches);
+ unsigned long nr_vo_branches = ARRAY_SIZE(rk3528_vo_clk_branches);
+ unsigned long nr_branches = ARRAY_SIZE(rk3528_clk_branches);
+ unsigned long nr_clks, nr_vo_clks, nr_vpu_clks;
struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node;
- unsigned long nr_branches = ARRAY_SIZE(rk3528_clk_branches);
- unsigned long nr_clks;
+ struct rockchip_clk_provider *ctx;
+ struct regmap *vo_grf, *vpu_grf;
void __iomem *reg_base;
- nr_clks = rockchip_clk_find_max_clk_id(rk3528_clk_branches,
- nr_branches) + 1;
-
reg_base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(reg_base))
return dev_err_probe(dev, PTR_ERR(reg_base),
"could not map cru region");
+ nr_clks = rockchip_clk_find_max_clk_id(rk3528_clk_branches,
+ nr_branches) + 1;
+
+ vo_grf = syscon_regmap_lookup_by_compatible("rockchip,rk3528-vo-grf");
+ if (!IS_ERR(vo_grf)) {
+ nr_vo_clks = rockchip_clk_find_max_clk_id(rk3528_vo_clk_branches,
+ nr_vo_branches) + 1;
+ nr_clks = max(nr_clks, nr_vo_clks);
+ } else if (PTR_ERR(vo_grf) != -ENODEV) {
+ return dev_err_probe(dev, PTR_ERR(vo_grf),
+ "failed to look up VO GRF\n");
+ }
+
+ vpu_grf = syscon_regmap_lookup_by_compatible("rockchip,rk3528-vpu-grf");
+ if (!IS_ERR(vpu_grf)) {
+ nr_vpu_clks = rockchip_clk_find_max_clk_id(rk3528_vpu_clk_branches,
+ nr_vpu_branches) + 1;
+ nr_clks = max(nr_clks, nr_vpu_clks);
+ } else if (PTR_ERR(vpu_grf) != -ENODEV) {
+ return dev_err_probe(dev, PTR_ERR(vpu_grf),
+ "failed to look up VPU GRF\n");
+ }
+
ctx = rockchip_clk_init(np, reg_base, nr_clks);
if (IS_ERR(ctx))
return dev_err_probe(dev, PTR_ERR(ctx),
@@ -1091,6 +1134,12 @@ static int __init clk_rk3528_probe(struct platform_device *pdev)
&rk3528_cpuclk_data, rk3528_cpuclk_rates,
ARRAY_SIZE(rk3528_cpuclk_rates));
rockchip_clk_register_branches(ctx, rk3528_clk_branches, nr_branches);
+ if (!IS_ERR(vo_grf))
+ rockchip_clk_register_grf_branches(ctx, rk3528_vo_clk_branches,
+ vo_grf, nr_vo_branches);
+ if (!IS_ERR(vpu_grf))
+ rockchip_clk_register_grf_branches(ctx, rk3528_vpu_clk_branches,
+ vpu_grf, nr_vpu_branches);
rk3528_rst_init(np, reg_base);
diff --git a/drivers/clk/rockchip/clk.h b/drivers/clk/rockchip/clk.h
index ec86ba1dd38c..f07cd1bb8952 100644
--- a/drivers/clk/rockchip/clk.h
+++ b/drivers/clk/rockchip/clk.h
@@ -217,6 +217,9 @@ struct clk;
#define RK3528_CLKSEL_CON(x) ((x) * 0x4 + 0x300)
#define RK3528_CLKGATE_CON(x) ((x) * 0x4 + 0x800)
#define RK3528_SOFTRST_CON(x) ((x) * 0x4 + 0xa00)
+#define RK3528_SDMMC_CON(x) ((x) * 0x4 + 0x24)
+#define RK3528_SDIO0_CON(x) ((x) * 0x4 + 0x4)
+#define RK3528_SDIO1_CON(x) ((x) * 0x4 + 0xc)
#define RK3528_PMU_CLKSEL_CON(x) ((x) * 0x4 + 0x300 + RK3528_PMU_CRU_BASE)
#define RK3528_PMU_CLKGATE_CON(x) ((x) * 0x4 + 0x800 + RK3528_PMU_CRU_BASE)
#define RK3528_PCIE_CLKSEL_CON(x) ((x) * 0x4 + 0x300 + RK3528_PCIE_CRU_BASE)
--
2.48.1
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH v2 7/8] arm64: dts: rockchip: Add SDMMC/SDIO controllers for RK3528
2025-03-05 19:42 [PATCH v2 0/8] Support SD/SDIO controllers on RK3528 Yao Zi
` (5 preceding siblings ...)
2025-03-05 19:45 ` [PATCH v2 6/8] clk: rockchip: rk3528: Add SD/SDIO tuning " Yao Zi
@ 2025-03-05 19:46 ` Yao Zi
2025-03-06 14:00 ` Chukun Pan
2025-03-07 23:22 ` Jonas Karlman
2025-03-05 19:46 ` [PATCH v2 8/8] arm64: dts: rockchip: Enable SD-card interface on Radxa E20C Yao Zi
2025-03-06 13:36 ` (subset) [PATCH v2 0/8] Support SD/SDIO controllers on RK3528 Heiko Stuebner
8 siblings, 2 replies; 17+ messages in thread
From: Yao Zi @ 2025-03-05 19:46 UTC (permalink / raw)
To: Ulf Hansson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Heiko Stuebner, Michael Turquette, Stephen Boyd, Shresth Prasad,
Cristian Ciocaltea, Detlev Casanova, Jonas Karlman, Chukun Pan
Cc: linux-mmc, devicetree, linux-arm-kernel, linux-rockchip,
linux-kernel, linux-clk, Yao Zi
RK3528 features two SDIO controllers and one SD/MMC controller, describe
them in devicetree. Since their sample and drive clocks are located in
the VO and VPU GRFs, corresponding syscons are added to make these
clocks available.
Signed-off-by: Yao Zi <ziyao@disroot.org>
---
arch/arm64/boot/dts/rockchip/rk3528.dtsi | 70 ++++++++++++++++++++++++
1 file changed, 70 insertions(+)
diff --git a/arch/arm64/boot/dts/rockchip/rk3528.dtsi b/arch/arm64/boot/dts/rockchip/rk3528.dtsi
index d3e2a64ff2d5..363023314e9c 100644
--- a/arch/arm64/boot/dts/rockchip/rk3528.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3528.dtsi
@@ -130,6 +130,16 @@ gic: interrupt-controller@fed01000 {
#interrupt-cells = <3>;
};
+ vpu_grf: syscon@ff340000 {
+ compatible = "rockchip,rk3528-vpu-grf", "syscon";
+ reg = <0x0 0xff340000 0x0 0x8000>;
+ };
+
+ vo_grf: syscon@ff360000 {
+ compatible = "rockchip,rk3528-vo-grf", "syscon";
+ reg = <0x0 0xff360000 0x0 0x10000>;
+ };
+
cru: clock-controller@ff4a0000 {
compatible = "rockchip,rk3528-cru";
reg = <0x0 0xff4a0000 0x0 0x30000>;
@@ -274,6 +284,66 @@ saradc: adc@ffae0000 {
resets = <&cru SRST_P_SARADC>;
reset-names = "saradc-apb";
#io-channel-cells = <1>;
+ };
+
+ sdio0: mmc@ffc10000 {
+ compatible = "rockchip,rk3528-dw-mshc",
+ "rockchip,rk3288-dw-mshc";
+ reg = <0x0 0xffc10000 0x0 0x4000>;
+ clocks = <&cru HCLK_SDIO0>,
+ <&cru CCLK_SRC_SDIO0>,
+ <&cru SCLK_SDIO0_DRV>,
+ <&cru SCLK_SDIO0_SAMPLE>;
+ clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
+ fifo-depth = <0x100>;
+ interrupts = <GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>;
+ max-frequency = <150000000>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&sdio0_bus4>, <&sdio0_clk>, <&sdio0_cmd>,
+ <&sdio0_det>, <&sdio0_pwren>;
+ resets = <&cru SRST_H_SDIO0>;
+ reset-names = "reset";
+ status = "disabled";
+ };
+
+ sdio1: mmc@ffc20000 {
+ compatible = "rockchip,rk3528-dw-mshc",
+ "rockchip,rk3288-dw-mshc";
+ reg = <0x0 0xffc20000 0x0 0x4000>;
+ clocks = <&cru HCLK_SDIO1>,
+ <&cru CCLK_SRC_SDIO1>,
+ <&cru SCLK_SDIO1_DRV>,
+ <&cru SCLK_SDIO1_SAMPLE>;
+ clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
+ fifo-depth = <0x100>;
+ interrupts = <GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>;
+ max-frequency = <150000000>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&sdio1_bus4>, <&sdio1_clk>, <&sdio1_cmd>,
+ <&sdio1_det>, <&sdio1_pwren>;
+ resets = <&cru SRST_H_SDIO1>;
+ reset-names = "reset";
+ status = "disabled";
+ };
+
+ sdmmc: mmc@ffc30000 {
+ compatible = "rockchip,rk3528-dw-mshc",
+ "rockchip,rk3288-dw-mshc";
+ reg = <0x0 0xffc30000 0x0 0x4000>;
+ clocks = <&cru HCLK_SDMMC0>,
+ <&cru CCLK_SRC_SDMMC0>,
+ <&cru SCLK_SDMMC_DRV>,
+ <&cru SCLK_SDMMC_SAMPLE>;
+ clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
+ fifo-depth = <0x100>;
+ interrupts = <GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>;
+ max-frequency = <150000000>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&sdmmc_bus4>, <&sdmmc_clk>, <&sdmmc_cmd>,
+ <&sdmmc_det>;
+ resets = <&cru SRST_H_SDMMC0>;
+ reset-names = "reset";
+ rockchip,default-sample-phase = <90>;
status = "disabled";
};
--
2.48.1
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH v2 7/8] arm64: dts: rockchip: Add SDMMC/SDIO controllers for RK3528
2025-03-05 19:46 ` [PATCH v2 7/8] arm64: dts: rockchip: Add SDMMC/SDIO controllers for RK3528 Yao Zi
@ 2025-03-06 14:00 ` Chukun Pan
2025-03-06 16:43 ` Yao Zi
2025-03-07 23:22 ` Jonas Karlman
1 sibling, 1 reply; 17+ messages in thread
From: Chukun Pan @ 2025-03-06 14:00 UTC (permalink / raw)
To: ziyao
Cc: amadeus, conor+dt, cristian.ciocaltea, detlev.casanova,
devicetree, heiko, jonas, krzk+dt, linux-arm-kernel, linux-clk,
linux-kernel, linux-mmc, linux-rockchip
Hi,
> + sdio0: mmc@ffc10000 {
> + compatible = "rockchip,rk3528-dw-mshc",
> + "rockchip,rk3288-dw-mshc";
> + reg = <0x0 0xffc10000 0x0 0x4000>;
> + clocks = <&cru HCLK_SDIO0>,
> + <&cru CCLK_SRC_SDIO0>,
> + <&cru SCLK_SDIO0_DRV>,
> + <&cru SCLK_SDIO0_SAMPLE>;
> + clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
> + fifo-depth = <0x100>;
> + interrupts = <GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>;
> + max-frequency = <150000000>;
> + pinctrl-names = "default";
> + pinctrl-0 = <&sdio0_bus4>, <&sdio0_clk>, <&sdio0_cmd>,
> + <&sdio0_det>, <&sdio0_pwren>;
The sdio module is usually "non-removable", no need det,
and pwren may be other gpio (use mmc-pwrseq). So it should
be `pinctrl-0 = <&sdio0_bus4>, <&sdio0_clk>, <&sdio0_cmd>;`
> + resets = <&cru SRST_H_SDIO0>;
> + reset-names = "reset";
> + status = "disabled";
> + };
> +
> + sdio1: mmc@ffc20000 {
> + compatible = "rockchip,rk3528-dw-mshc",
> + "rockchip,rk3288-dw-mshc";
> + reg = <0x0 0xffc20000 0x0 0x4000>;
> + clocks = <&cru HCLK_SDIO1>,
> + <&cru CCLK_SRC_SDIO1>,
> + <&cru SCLK_SDIO1_DRV>,
> + <&cru SCLK_SDIO1_SAMPLE>;
> + clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
> + fifo-depth = <0x100>;
> + interrupts = <GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>;
> + max-frequency = <150000000>;
> + pinctrl-names = "default";
> + pinctrl-0 = <&sdio1_bus4>, <&sdio1_clk>, <&sdio1_cmd>,
> + <&sdio1_det>, <&sdio1_pwren>;
Same here.
> + resets = <&cru SRST_H_SDIO1>;
> + reset-names = "reset";
> + status = "disabled";
> + };
Thanks,
Chukun
--
2.25.1
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH v2 7/8] arm64: dts: rockchip: Add SDMMC/SDIO controllers for RK3528
2025-03-06 14:00 ` Chukun Pan
@ 2025-03-06 16:43 ` Yao Zi
2025-03-06 23:05 ` Jonas Karlman
0 siblings, 1 reply; 17+ messages in thread
From: Yao Zi @ 2025-03-06 16:43 UTC (permalink / raw)
To: Chukun Pan
Cc: conor+dt, cristian.ciocaltea, detlev.casanova, devicetree, heiko,
jonas, krzk+dt, linux-arm-kernel, linux-clk, linux-kernel,
linux-mmc, linux-rockchip
On Thu, Mar 06, 2025 at 10:00:09PM +0800, Chukun Pan wrote:
> Hi,
>
> > + sdio0: mmc@ffc10000 {
> > + compatible = "rockchip,rk3528-dw-mshc",
> > + "rockchip,rk3288-dw-mshc";
> > + reg = <0x0 0xffc10000 0x0 0x4000>;
> > + clocks = <&cru HCLK_SDIO0>,
> > + <&cru CCLK_SRC_SDIO0>,
> > + <&cru SCLK_SDIO0_DRV>,
> > + <&cru SCLK_SDIO0_SAMPLE>;
> > + clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
> > + fifo-depth = <0x100>;
> > + interrupts = <GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>;
> > + max-frequency = <150000000>;
> > + pinctrl-names = "default";
> > + pinctrl-0 = <&sdio0_bus4>, <&sdio0_clk>, <&sdio0_cmd>,
> > + <&sdio0_det>, <&sdio0_pwren>;
>
> The sdio module is usually "non-removable", no need det,
> and pwren may be other gpio (use mmc-pwrseq). So it should
> be `pinctrl-0 = <&sdio0_bus4>, <&sdio0_clk>, <&sdio0_cmd>;`
This doesn't affect the fact that these two pins are assigned as
functional pins for SDIO0, as pointed out by the datasheet[1].
But with more digging, I found the reference design[2] of Rockchip
actually uses the two pins as normal GPIOs. This is more obvious in
downstream devicetree of an EVB[3]. Most of the existing boards (Radxa
2A, ArmSOM Sige 1) follow the reference design.
For me, it's kind of surprising that the SDIO IP functions with two
functional pins assigned as different modes. I'm not sure whether we
should apply pin configuration for these two pins in the SoC devicetree.
Jonas, what do you think about it?
> > + resets = <&cru SRST_H_SDIO0>;
> > + reset-names = "reset";
> > + status = "disabled";
> > + };
> > +
> > + sdio1: mmc@ffc20000 {
> > + compatible = "rockchip,rk3528-dw-mshc",
> > + "rockchip,rk3288-dw-mshc";
> > + reg = <0x0 0xffc20000 0x0 0x4000>;
> > + clocks = <&cru HCLK_SDIO1>,
> > + <&cru CCLK_SRC_SDIO1>,
> > + <&cru SCLK_SDIO1_DRV>,
> > + <&cru SCLK_SDIO1_SAMPLE>;
> > + clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
> > + fifo-depth = <0x100>;
> > + interrupts = <GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>;
> > + max-frequency = <150000000>;
> > + pinctrl-names = "default";
> > + pinctrl-0 = <&sdio1_bus4>, <&sdio1_clk>, <&sdio1_cmd>,
> > + <&sdio1_det>, <&sdio1_pwren>;
>
> Same here.
>
> > + resets = <&cru SRST_H_SDIO1>;
> > + reset-names = "reset";
> > + status = "disabled";
> > + };
>
> Thanks,
> Chukun
>
> --
> 2.25.1
>
Best regards,
Yao Zi
[1]: https://github.com/DeciHD/rockchip_docs/blob/main/rk3528/Rockchip%C2%A0RK3528%C2%A0Datasheet%C2%A0V1.0-20230522.pdf
[2]: https://github.com/DeciHD/rockchip_docs/blob/main/rk3528/RK3528_BOX_REF_V10_20230525.pdf
[3]: https://github.com/rockchip-linux/kernel/blob/604cec4004abe5a96c734f2fab7b74809d2d742f/arch/arm64/boot/dts/rockchip/rk3528-evb1-ddr4-v10.dtsi#L128
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH v2 7/8] arm64: dts: rockchip: Add SDMMC/SDIO controllers for RK3528
2025-03-06 16:43 ` Yao Zi
@ 2025-03-06 23:05 ` Jonas Karlman
2025-03-07 5:54 ` Yao Zi
0 siblings, 1 reply; 17+ messages in thread
From: Jonas Karlman @ 2025-03-06 23:05 UTC (permalink / raw)
To: Yao Zi, Chukun Pan
Cc: conor+dt, cristian.ciocaltea, detlev.casanova, devicetree, heiko,
krzk+dt, linux-arm-kernel, linux-clk, linux-kernel, linux-mmc,
linux-rockchip
On 2025-03-06 17:43, Yao Zi wrote:
> On Thu, Mar 06, 2025 at 10:00:09PM +0800, Chukun Pan wrote:
>> Hi,
>>
>>> + sdio0: mmc@ffc10000 {
>>> + compatible = "rockchip,rk3528-dw-mshc",
>>> + "rockchip,rk3288-dw-mshc";
>>> + reg = <0x0 0xffc10000 0x0 0x4000>;
>>> + clocks = <&cru HCLK_SDIO0>,
>>> + <&cru CCLK_SRC_SDIO0>,
>>> + <&cru SCLK_SDIO0_DRV>,
>>> + <&cru SCLK_SDIO0_SAMPLE>;
>>> + clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
>>> + fifo-depth = <0x100>;
>>> + interrupts = <GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>;
>>> + max-frequency = <150000000>;
>>> + pinctrl-names = "default";
>>> + pinctrl-0 = <&sdio0_bus4>, <&sdio0_clk>, <&sdio0_cmd>,
>>> + <&sdio0_det>, <&sdio0_pwren>;
>>
>> The sdio module is usually "non-removable", no need det,
>> and pwren may be other gpio (use mmc-pwrseq). So it should
>> be `pinctrl-0 = <&sdio0_bus4>, <&sdio0_clk>, <&sdio0_cmd>;`
>
> This doesn't affect the fact that these two pins are assigned as
> functional pins for SDIO0, as pointed out by the datasheet[1].
>
> But with more digging, I found the reference design[2] of Rockchip
> actually uses the two pins as normal GPIOs. This is more obvious in
> downstream devicetree of an EVB[3]. Most of the existing boards (Radxa
> 2A, ArmSOM Sige 1) follow the reference design.
>
> For me, it's kind of surprising that the SDIO IP functions with two
> functional pins assigned as different modes. I'm not sure whether we
> should apply pin configuration for these two pins in the SoC devicetree.
> Jonas, what do you think about it?
I think it make sense to match the pins used by reference boards, i.e.
the pinconf most likely to be used by majority of boards that will use
the sdio interface.
Of my RK3528 boards, only ArmSoM Sige1 use sdio for onboard wifi and
there I currently have following in my work-in-progress board DT [4]:
pinctrl-names = "default";
pinctrl-0 = <&sdio0_bus4>, <&sdio0_clk>, <&sdio0_cmd>, <&clkm1_32k_out>;
The Radxa ROCK 2A/2F seem to use USB for wifi/bt.
[4] https://github.com/Kwiboo/linux-rockchip/blob/next-20250305-rk3528/arch/arm64/boot/dts/rockchip/rk3528-armsom-sige1.dts
Regards,
Jonas
>
>>> + resets = <&cru SRST_H_SDIO0>;
>>> + reset-names = "reset";
>>> + status = "disabled";
>>> + };
>>> +
>>> + sdio1: mmc@ffc20000 {
>>> + compatible = "rockchip,rk3528-dw-mshc",
>>> + "rockchip,rk3288-dw-mshc";
>>> + reg = <0x0 0xffc20000 0x0 0x4000>;
>>> + clocks = <&cru HCLK_SDIO1>,
>>> + <&cru CCLK_SRC_SDIO1>,
>>> + <&cru SCLK_SDIO1_DRV>,
>>> + <&cru SCLK_SDIO1_SAMPLE>;
>>> + clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
>>> + fifo-depth = <0x100>;
>>> + interrupts = <GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>;
>>> + max-frequency = <150000000>;
>>> + pinctrl-names = "default";
>>> + pinctrl-0 = <&sdio1_bus4>, <&sdio1_clk>, <&sdio1_cmd>,
>>> + <&sdio1_det>, <&sdio1_pwren>;
>>
>> Same here.
>>
>>> + resets = <&cru SRST_H_SDIO1>;
>>> + reset-names = "reset";
>>> + status = "disabled";
>>> + };
>>
>> Thanks,
>> Chukun
>>
>> --
>> 2.25.1
>>
>
> Best regards,
> Yao Zi
>
> [1]: https://github.com/DeciHD/rockchip_docs/blob/main/rk3528/Rockchip%C2%A0RK3528%C2%A0Datasheet%C2%A0V1.0-20230522.pdf
> [2]: https://github.com/DeciHD/rockchip_docs/blob/main/rk3528/RK3528_BOX_REF_V10_20230525.pdf
> [3]: https://github.com/rockchip-linux/kernel/blob/604cec4004abe5a96c734f2fab7b74809d2d742f/arch/arm64/boot/dts/rockchip/rk3528-evb1-ddr4-v10.dtsi#L128
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH v2 7/8] arm64: dts: rockchip: Add SDMMC/SDIO controllers for RK3528
2025-03-06 23:05 ` Jonas Karlman
@ 2025-03-07 5:54 ` Yao Zi
0 siblings, 0 replies; 17+ messages in thread
From: Yao Zi @ 2025-03-07 5:54 UTC (permalink / raw)
To: Jonas Karlman, Chukun Pan
Cc: conor+dt, cristian.ciocaltea, detlev.casanova, devicetree, heiko,
krzk+dt, linux-arm-kernel, linux-clk, linux-kernel, linux-mmc,
linux-rockchip
On Fri, Mar 07, 2025 at 12:05:16AM +0100, Jonas Karlman wrote:
> On 2025-03-06 17:43, Yao Zi wrote:
> > On Thu, Mar 06, 2025 at 10:00:09PM +0800, Chukun Pan wrote:
> >> Hi,
> >>
> >>> + sdio0: mmc@ffc10000 {
> >>> + compatible = "rockchip,rk3528-dw-mshc",
> >>> + "rockchip,rk3288-dw-mshc";
> >>> + reg = <0x0 0xffc10000 0x0 0x4000>;
> >>> + clocks = <&cru HCLK_SDIO0>,
> >>> + <&cru CCLK_SRC_SDIO0>,
> >>> + <&cru SCLK_SDIO0_DRV>,
> >>> + <&cru SCLK_SDIO0_SAMPLE>;
> >>> + clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
> >>> + fifo-depth = <0x100>;
> >>> + interrupts = <GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>;
> >>> + max-frequency = <150000000>;
> >>> + pinctrl-names = "default";
> >>> + pinctrl-0 = <&sdio0_bus4>, <&sdio0_clk>, <&sdio0_cmd>,
> >>> + <&sdio0_det>, <&sdio0_pwren>;
> >>
> >> The sdio module is usually "non-removable", no need det,
> >> and pwren may be other gpio (use mmc-pwrseq). So it should
> >> be `pinctrl-0 = <&sdio0_bus4>, <&sdio0_clk>, <&sdio0_cmd>;`
> >
> > This doesn't affect the fact that these two pins are assigned as
> > functional pins for SDIO0, as pointed out by the datasheet[1].
> >
> > But with more digging, I found the reference design[2] of Rockchip
> > actually uses the two pins as normal GPIOs. This is more obvious in
> > downstream devicetree of an EVB[3]. Most of the existing boards (Radxa
> > 2A, ArmSOM Sige 1) follow the reference design.
> >
> > For me, it's kind of surprising that the SDIO IP functions with two
> > functional pins assigned as different modes. I'm not sure whether we
> > should apply pin configuration for these two pins in the SoC devicetree.
> > Jonas, what do you think about it?
>
> I think it make sense to match the pins used by reference boards, i.e.
> the pinconf most likely to be used by majority of boards that will use
> the sdio interface.
Thanks, will take it.
> Of my RK3528 boards, only ArmSoM Sige1 use sdio for onboard wifi and
> there I currently have following in my work-in-progress board DT [4]:
>
> pinctrl-names = "default";
> pinctrl-0 = <&sdio0_bus4>, <&sdio0_clk>, <&sdio0_cmd>, <&clkm1_32k_out>;
>
> The Radxa ROCK 2A/2F seem to use USB for wifi/bt.
>
> [4] https://github.com/Kwiboo/linux-rockchip/blob/next-20250305-rk3528/arch/arm64/boot/dts/rockchip/rk3528-armsom-sige1.dts
>
> Regards,
> Jonas
>
> >
> >>> + resets = <&cru SRST_H_SDIO0>;
> >>> + reset-names = "reset";
> >>> + status = "disabled";
> >>> + };
> >>> +
> >>> + sdio1: mmc@ffc20000 {
> >>> + compatible = "rockchip,rk3528-dw-mshc",
> >>> + "rockchip,rk3288-dw-mshc";
> >>> + reg = <0x0 0xffc20000 0x0 0x4000>;
> >>> + clocks = <&cru HCLK_SDIO1>,
> >>> + <&cru CCLK_SRC_SDIO1>,
> >>> + <&cru SCLK_SDIO1_DRV>,
> >>> + <&cru SCLK_SDIO1_SAMPLE>;
> >>> + clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
> >>> + fifo-depth = <0x100>;
> >>> + interrupts = <GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>;
> >>> + max-frequency = <150000000>;
> >>> + pinctrl-names = "default";
> >>> + pinctrl-0 = <&sdio1_bus4>, <&sdio1_clk>, <&sdio1_cmd>,
> >>> + <&sdio1_det>, <&sdio1_pwren>;
> >>
> >> Same here.
> >>
> >>> + resets = <&cru SRST_H_SDIO1>;
> >>> + reset-names = "reset";
> >>> + status = "disabled";
> >>> + };
> >>
> >> Thanks,
> >> Chukun
> >>
> >> --
> >> 2.25.1
> >>
> >
> > Best regards,
> > Yao Zi
> >
> > [1]: https://github.com/DeciHD/rockchip_docs/blob/main/rk3528/Rockchip%C2%A0RK3528%C2%A0Datasheet%C2%A0V1.0-20230522.pdf
> > [2]: https://github.com/DeciHD/rockchip_docs/blob/main/rk3528/RK3528_BOX_REF_V10_20230525.pdf
> > [3]: https://github.com/rockchip-linux/kernel/blob/604cec4004abe5a96c734f2fab7b74809d2d742f/arch/arm64/boot/dts/rockchip/rk3528-evb1-ddr4-v10.dtsi#L128
>
Best regards,
Yao Zi
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v2 7/8] arm64: dts: rockchip: Add SDMMC/SDIO controllers for RK3528
2025-03-05 19:46 ` [PATCH v2 7/8] arm64: dts: rockchip: Add SDMMC/SDIO controllers for RK3528 Yao Zi
2025-03-06 14:00 ` Chukun Pan
@ 2025-03-07 23:22 ` Jonas Karlman
2025-03-08 14:05 ` Yao Zi
1 sibling, 1 reply; 17+ messages in thread
From: Jonas Karlman @ 2025-03-07 23:22 UTC (permalink / raw)
To: Yao Zi
Cc: Ulf Hansson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Heiko Stuebner, Michael Turquette, Stephen Boyd, Shresth Prasad,
Cristian Ciocaltea, Detlev Casanova, Chukun Pan, linux-mmc,
devicetree, linux-arm-kernel, linux-rockchip, linux-kernel,
linux-clk
Hi Yao Zi,
On 2025-03-05 20:46, Yao Zi wrote:
> RK3528 features two SDIO controllers and one SD/MMC controller, describe
> them in devicetree. Since their sample and drive clocks are located in
> the VO and VPU GRFs, corresponding syscons are added to make these
> clocks available.
>
> Signed-off-by: Yao Zi <ziyao@disroot.org>
> ---
> arch/arm64/boot/dts/rockchip/rk3528.dtsi | 70 ++++++++++++++++++++++++
> 1 file changed, 70 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/rockchip/rk3528.dtsi b/arch/arm64/boot/dts/rockchip/rk3528.dtsi
> index d3e2a64ff2d5..363023314e9c 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3528.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/rk3528.dtsi
> @@ -130,6 +130,16 @@ gic: interrupt-controller@fed01000 {
> #interrupt-cells = <3>;
> };
>
> + vpu_grf: syscon@ff340000 {
> + compatible = "rockchip,rk3528-vpu-grf", "syscon";
> + reg = <0x0 0xff340000 0x0 0x8000>;
> + };
> +
> + vo_grf: syscon@ff360000 {
> + compatible = "rockchip,rk3528-vo-grf", "syscon";
> + reg = <0x0 0xff360000 0x0 0x10000>;
> + };
> +
> cru: clock-controller@ff4a0000 {
> compatible = "rockchip,rk3528-cru";
> reg = <0x0 0xff4a0000 0x0 0x30000>;
> @@ -274,6 +284,66 @@ saradc: adc@ffae0000 {
> resets = <&cru SRST_P_SARADC>;
> reset-names = "saradc-apb";
> #io-channel-cells = <1>;
> + };
Look like this patch accidentally drops status = "disabled" from the
adc@ffae0000 node.
Regards,
Jonas
> +
> + sdio0: mmc@ffc10000 {
> + compatible = "rockchip,rk3528-dw-mshc",
> + "rockchip,rk3288-dw-mshc";
> + reg = <0x0 0xffc10000 0x0 0x4000>;
> + clocks = <&cru HCLK_SDIO0>,
> + <&cru CCLK_SRC_SDIO0>,
> + <&cru SCLK_SDIO0_DRV>,
> + <&cru SCLK_SDIO0_SAMPLE>;
> + clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
> + fifo-depth = <0x100>;
> + interrupts = <GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>;
> + max-frequency = <150000000>;
> + pinctrl-names = "default";
> + pinctrl-0 = <&sdio0_bus4>, <&sdio0_clk>, <&sdio0_cmd>,
> + <&sdio0_det>, <&sdio0_pwren>;
> + resets = <&cru SRST_H_SDIO0>;
> + reset-names = "reset";
> + status = "disabled";
> + };
> +
> + sdio1: mmc@ffc20000 {
> + compatible = "rockchip,rk3528-dw-mshc",
> + "rockchip,rk3288-dw-mshc";
> + reg = <0x0 0xffc20000 0x0 0x4000>;
> + clocks = <&cru HCLK_SDIO1>,
> + <&cru CCLK_SRC_SDIO1>,
> + <&cru SCLK_SDIO1_DRV>,
> + <&cru SCLK_SDIO1_SAMPLE>;
> + clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
> + fifo-depth = <0x100>;
> + interrupts = <GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>;
> + max-frequency = <150000000>;
> + pinctrl-names = "default";
> + pinctrl-0 = <&sdio1_bus4>, <&sdio1_clk>, <&sdio1_cmd>,
> + <&sdio1_det>, <&sdio1_pwren>;
> + resets = <&cru SRST_H_SDIO1>;
> + reset-names = "reset";
> + status = "disabled";
> + };
> +
> + sdmmc: mmc@ffc30000 {
> + compatible = "rockchip,rk3528-dw-mshc",
> + "rockchip,rk3288-dw-mshc";
> + reg = <0x0 0xffc30000 0x0 0x4000>;
> + clocks = <&cru HCLK_SDMMC0>,
> + <&cru CCLK_SRC_SDMMC0>,
> + <&cru SCLK_SDMMC_DRV>,
> + <&cru SCLK_SDMMC_SAMPLE>;
> + clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
> + fifo-depth = <0x100>;
> + interrupts = <GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>;
> + max-frequency = <150000000>;
> + pinctrl-names = "default";
> + pinctrl-0 = <&sdmmc_bus4>, <&sdmmc_clk>, <&sdmmc_cmd>,
> + <&sdmmc_det>;
> + resets = <&cru SRST_H_SDMMC0>;
> + reset-names = "reset";
> + rockchip,default-sample-phase = <90>;
> status = "disabled";
> };
>
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH v2 7/8] arm64: dts: rockchip: Add SDMMC/SDIO controllers for RK3528
2025-03-07 23:22 ` Jonas Karlman
@ 2025-03-08 14:05 ` Yao Zi
0 siblings, 0 replies; 17+ messages in thread
From: Yao Zi @ 2025-03-08 14:05 UTC (permalink / raw)
To: Jonas Karlman
Cc: Ulf Hansson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Heiko Stuebner, Michael Turquette, Stephen Boyd, Shresth Prasad,
Cristian Ciocaltea, Detlev Casanova, Chukun Pan, linux-mmc,
devicetree, linux-arm-kernel, linux-rockchip, linux-kernel,
linux-clk
On Sat, Mar 08, 2025 at 12:22:48AM +0100, Jonas Karlman wrote:
> Hi Yao Zi,
>
> On 2025-03-05 20:46, Yao Zi wrote:
> > RK3528 features two SDIO controllers and one SD/MMC controller, describe
> > them in devicetree. Since their sample and drive clocks are located in
> > the VO and VPU GRFs, corresponding syscons are added to make these
> > clocks available.
> >
> > Signed-off-by: Yao Zi <ziyao@disroot.org>
> > ---
> > arch/arm64/boot/dts/rockchip/rk3528.dtsi | 70 ++++++++++++++++++++++++
> > 1 file changed, 70 insertions(+)
> >
> > diff --git a/arch/arm64/boot/dts/rockchip/rk3528.dtsi b/arch/arm64/boot/dts/rockchip/rk3528.dtsi
> > index d3e2a64ff2d5..363023314e9c 100644
> > --- a/arch/arm64/boot/dts/rockchip/rk3528.dtsi
> > +++ b/arch/arm64/boot/dts/rockchip/rk3528.dtsi
> > @@ -130,6 +130,16 @@ gic: interrupt-controller@fed01000 {
> > #interrupt-cells = <3>;
> > };
> >
> > + vpu_grf: syscon@ff340000 {
> > + compatible = "rockchip,rk3528-vpu-grf", "syscon";
> > + reg = <0x0 0xff340000 0x0 0x8000>;
> > + };
> > +
> > + vo_grf: syscon@ff360000 {
> > + compatible = "rockchip,rk3528-vo-grf", "syscon";
> > + reg = <0x0 0xff360000 0x0 0x10000>;
> > + };
> > +
> > cru: clock-controller@ff4a0000 {
> > compatible = "rockchip,rk3528-cru";
> > reg = <0x0 0xff4a0000 0x0 0x30000>;
> > @@ -274,6 +284,66 @@ saradc: adc@ffae0000 {
> > resets = <&cru SRST_P_SARADC>;
> > reset-names = "saradc-apb";
> > #io-channel-cells = <1>;
> > + };
>
> Look like this patch accidentally drops status = "disabled" from the
> adc@ffae0000 node.
It's a mistake during rebasing, I'll fix it in v3.
> Regards,
> Jonas
Thanks,
Yao Zi
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v2 8/8] arm64: dts: rockchip: Enable SD-card interface on Radxa E20C
2025-03-05 19:42 [PATCH v2 0/8] Support SD/SDIO controllers on RK3528 Yao Zi
` (6 preceding siblings ...)
2025-03-05 19:46 ` [PATCH v2 7/8] arm64: dts: rockchip: Add SDMMC/SDIO controllers for RK3528 Yao Zi
@ 2025-03-05 19:46 ` Yao Zi
2025-03-06 13:36 ` (subset) [PATCH v2 0/8] Support SD/SDIO controllers on RK3528 Heiko Stuebner
8 siblings, 0 replies; 17+ messages in thread
From: Yao Zi @ 2025-03-05 19:46 UTC (permalink / raw)
To: Ulf Hansson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Heiko Stuebner, Michael Turquette, Stephen Boyd, Shresth Prasad,
Cristian Ciocaltea, Detlev Casanova, Jonas Karlman, Chukun Pan
Cc: linux-mmc, devicetree, linux-arm-kernel, linux-rockchip,
linux-kernel, linux-clk, Yao Zi
SD-card is available on Radxa E20C board.
Signed-off-by: Yao Zi <ziyao@disroot.org>
---
.../boot/dts/rockchip/rk3528-radxa-e20c.dts | 34 +++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/arch/arm64/boot/dts/rockchip/rk3528-radxa-e20c.dts b/arch/arm64/boot/dts/rockchip/rk3528-radxa-e20c.dts
index 5346ef457c2a..a52a7924bb75 100644
--- a/arch/arm64/boot/dts/rockchip/rk3528-radxa-e20c.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3528-radxa-e20c.dts
@@ -15,6 +15,10 @@ / {
model = "Radxa E20C";
compatible = "radxa,e20c", "rockchip,rk3528";
+ aliases {
+ mmc1 = &sdmmc;
+ };
+
chosen {
stdout-path = "serial0:1500000n8";
};
@@ -104,6 +108,18 @@ vcc5v0_sys: regulator-5v0-vcc-sys {
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
};
+
+ vccio_sd: regulator-vccio-sd {
+ compatible = "regulator-gpio";
+ gpios = <&gpio4 RK_PB6 GPIO_ACTIVE_HIGH>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&sdmmc_vol_ctrl_h>;
+ regulator-name = "vccio_sd";
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <3300000>;
+ states = <1800000 0x0>, <3300000 0x1>;
+ vin-supply = <&vcc5v0_sys>;
+ };
};
&pinctrl {
@@ -126,6 +142,12 @@ wan_led_g: wan-led-g {
rockchip,pins = <4 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>;
};
};
+
+ sdmmc {
+ sdmmc_vol_ctrl_h: sdmmc-vol-ctrl-h {
+ rockchip,pins = <4 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>;
+ };
+ };
};
&saradc {
@@ -133,6 +155,18 @@ &saradc {
status = "okay";
};
+&sdmmc {
+ bus-width = <4>;
+ cap-mmc-highspeed;
+ cap-sd-highspeed;
+ disable-wp;
+ no-sdio;
+ sd-uhs-sdr104;
+ vmmc-supply = <&vcc_3v3>;
+ vqmmc-supply = <&vccio_sd>;
+ status = "okay";
+};
+
&uart0 {
pinctrl-names = "default";
pinctrl-0 = <&uart0m0_xfer>;
--
2.48.1
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: (subset) [PATCH v2 0/8] Support SD/SDIO controllers on RK3528
2025-03-05 19:42 [PATCH v2 0/8] Support SD/SDIO controllers on RK3528 Yao Zi
` (7 preceding siblings ...)
2025-03-05 19:46 ` [PATCH v2 8/8] arm64: dts: rockchip: Enable SD-card interface on Radxa E20C Yao Zi
@ 2025-03-06 13:36 ` Heiko Stuebner
8 siblings, 0 replies; 17+ messages in thread
From: Heiko Stuebner @ 2025-03-06 13:36 UTC (permalink / raw)
To: Ulf Hansson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Michael Turquette, Stephen Boyd, Shresth Prasad,
Cristian Ciocaltea, Detlev Casanova, Jonas Karlman, Chukun Pan,
Yao Zi
Cc: Heiko Stuebner, linux-mmc, devicetree, linux-arm-kernel,
linux-rockchip, linux-kernel, linux-clk
On Wed, 05 Mar 2025 19:42:09 +0000, Yao Zi wrote:
> RK3528 features two SDIO controllers and one SD/MMC controller. This
> series adds essential support for their tuning clocks, document the
> controller in dt-bindings and bring the SD/MMC one up on Radxa E20C
> board. Both HS and SDR104 mode are verified.
>
> This is based on v2 of the SARADC series[1]
>
> [...]
Applied, thanks!
[1/8] dt-bindings: soc: rockchip: Add RK3528 VO GRF syscon
commit: efc1bc1f36568a4297d20a691758b68c121cf982
[2/8] dt-bindings: soc: rockchip: Add RK3528 VPU GRF syscon
commit: 8f814d7c9f6cdffc1f5cc97637e12cd699ff9085
Best regards,
--
Heiko Stuebner <heiko@sntech.de>
^ permalink raw reply [flat|nested] 17+ messages in thread