@@ -8,6 +8,7 @@
#include <linux/clk-provider.h>
#include <linux/device.h>
#include <linux/init.h>
+#include <linux/io.h>
#include <linux/kernel.h>
#include <dt-bindings/clock/r9a07g044-cpg.h>
@@ -271,7 +272,28 @@ static const unsigned int r9a07g044_crit_mod_clks[] __initconst = {
MOD_CLK_BASE + R9A07G044_DMAC_ACLK,
};
+#define CPG_WDTRST_SEL 0xb14
+#define CPG_WDTRST_SEL_WDTRSTSEL(n) BIT(n)
+
+#define CPG_WDTRST_SEL_WDTRST (CPG_WDTRST_SEL_WDTRSTSEL(0) | \
+ CPG_WDTRST_SEL_WDTRSTSEL(1) | \
+ CPG_WDTRST_SEL_WDTRSTSEL(2))
+
+int r9a07g044_wdt_rst_setect(void __iomem *base)
+{
+ writel((CPG_WDTRST_SEL_WDTRST << 16) | CPG_WDTRST_SEL_WDTRST,
+ base + CPG_WDTRST_SEL);
+
+ return 0;
+}
+
+static const struct rzg2l_cpg_soc_operations r9a07g044_cpg_ops = {
+ .wdt_rst_setect = r9a07g044_wdt_rst_setect,
+};
+
const struct rzg2l_cpg_info r9a07g044_cpg_info = {
+ .ops = &r9a07g044_cpg_ops,
+
/* Core Clocks */
.core_clks = r9a07g044_core_clks,
.num_core_clks = ARRAY_SIZE(r9a07g044_core_clks),
@@ -932,6 +932,12 @@ static int __init rzg2l_cpg_probe(struct platform_device *pdev)
if (error)
return error;
+ if (info->ops && info->ops->wdt_rst_setect) {
+ error = info->ops->wdt_rst_setect(priv->base);
+ if (error)
+ return error;
+ }
+
return 0;
}
@@ -156,9 +156,20 @@ struct rzg2l_reset {
.bit = (_bit) \
}
+/**
+ * struct rzg2l_cpg_soc_operations - SoC-specific CPG Operations
+ *
+ * @wdt_rst_setect: WDT reset selection
+ */
+struct rzg2l_cpg_soc_operations {
+ int (*wdt_rst_setect)(void __iomem *base); /* Platform specific WDT reset selection */
+};
+
/**
* struct rzg2l_cpg_info - SoC-specific CPG Description
*
+ * @ops: SoC-specific CPG Operations
+ *
* @core_clks: Array of Core Clock definitions
* @num_core_clks: Number of entries in core_clks[]
* @last_dt_core_clk: ID of the last Core Clock exported to DT
@@ -176,6 +187,9 @@ struct rzg2l_reset {
* @num_crit_mod_clks: Number of entries in crit_mod_clks[]
*/
struct rzg2l_cpg_info {
+ /* CPG Operations */
+ const struct rzg2l_cpg_soc_operations *ops;
+
/* Core Clocks */
const struct cpg_core_clk *core_clks;
unsigned int num_core_clks;
This patch adds support for watchdog reset selection. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> --- drivers/clk/renesas/r9a07g044-cpg.c | 22 ++++++++++++++++++++++ drivers/clk/renesas/rzg2l-cpg.c | 6 ++++++ drivers/clk/renesas/rzg2l-cpg.h | 14 ++++++++++++++ 3 files changed, 42 insertions(+)