All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] clk: at91: mark ddr clocks as critical
@ 2022-12-08 11:45 ` Claudiu Beznea
  0 siblings, 0 replies; 30+ messages in thread
From: Claudiu Beznea @ 2022-12-08 11:45 UTC (permalink / raw)
  To: mturquette, sboyd, nicolas.ferre, alexandre.belloni, krzysztof.kozlowski
  Cc: linux-kernel, linux-clk, linux-arm-kernel, Claudiu Beznea

Hi,

The series marks DDR clocks of AT91 SoCs as critical and remove the
atmel-sdramc.c driver as this does only clock request and enable and
don't prevent any of DDR clock consumers do DDR clocks.

Thank you,
Claudiu Beznea

Claudiu Beznea (3):
  clk: at91: mark ddr clocks as critical
  memory: atmel-sdramc: remove the driver
  clk: at91: do not compile dt-compat.c for sama7g5 and sam9x60

 drivers/clk/at91/Makefile         | 16 +++----
 drivers/clk/at91/at91rm9200.c     |  2 +-
 drivers/clk/at91/at91sam9260.c    |  2 +-
 drivers/clk/at91/at91sam9g45.c    | 10 +++-
 drivers/clk/at91/at91sam9n12.c    | 12 +++--
 drivers/clk/at91/at91sam9rl.c     |  2 +-
 drivers/clk/at91/at91sam9x5.c     | 17 +++++--
 drivers/clk/at91/clk-peripheral.c |  8 ++--
 drivers/clk/at91/clk-system.c     |  4 +-
 drivers/clk/at91/dt-compat.c      | 25 +++++++++-
 drivers/clk/at91/pmc.h            |  4 +-
 drivers/clk/at91/sam9x60.c        | 20 ++++++--
 drivers/clk/at91/sama5d2.c        | 22 +++++++--
 drivers/clk/at91/sama5d3.c        | 20 ++++++--
 drivers/clk/at91/sama5d4.c        | 22 +++++++--
 drivers/clk/at91/sama7g5.c        |  4 +-
 drivers/memory/Makefile           |  1 -
 drivers/memory/atmel-sdramc.c     | 76 -------------------------------
 18 files changed, 139 insertions(+), 128 deletions(-)
 delete mode 100644 drivers/memory/atmel-sdramc.c

-- 
2.34.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 0/3] clk: at91: mark ddr clocks as critical
@ 2022-12-08 11:45 ` Claudiu Beznea
  0 siblings, 0 replies; 30+ messages in thread
From: Claudiu Beznea @ 2022-12-08 11:45 UTC (permalink / raw)
  To: mturquette, sboyd, nicolas.ferre, alexandre.belloni, krzysztof.kozlowski
  Cc: linux-kernel, linux-clk, linux-arm-kernel, Claudiu Beznea

Hi,

The series marks DDR clocks of AT91 SoCs as critical and remove the
atmel-sdramc.c driver as this does only clock request and enable and
don't prevent any of DDR clock consumers do DDR clocks.

Thank you,
Claudiu Beznea

Claudiu Beznea (3):
  clk: at91: mark ddr clocks as critical
  memory: atmel-sdramc: remove the driver
  clk: at91: do not compile dt-compat.c for sama7g5 and sam9x60

 drivers/clk/at91/Makefile         | 16 +++----
 drivers/clk/at91/at91rm9200.c     |  2 +-
 drivers/clk/at91/at91sam9260.c    |  2 +-
 drivers/clk/at91/at91sam9g45.c    | 10 +++-
 drivers/clk/at91/at91sam9n12.c    | 12 +++--
 drivers/clk/at91/at91sam9rl.c     |  2 +-
 drivers/clk/at91/at91sam9x5.c     | 17 +++++--
 drivers/clk/at91/clk-peripheral.c |  8 ++--
 drivers/clk/at91/clk-system.c     |  4 +-
 drivers/clk/at91/dt-compat.c      | 25 +++++++++-
 drivers/clk/at91/pmc.h            |  4 +-
 drivers/clk/at91/sam9x60.c        | 20 ++++++--
 drivers/clk/at91/sama5d2.c        | 22 +++++++--
 drivers/clk/at91/sama5d3.c        | 20 ++++++--
 drivers/clk/at91/sama5d4.c        | 22 +++++++--
 drivers/clk/at91/sama7g5.c        |  4 +-
 drivers/memory/Makefile           |  1 -
 drivers/memory/atmel-sdramc.c     | 76 -------------------------------
 18 files changed, 139 insertions(+), 128 deletions(-)
 delete mode 100644 drivers/memory/atmel-sdramc.c

-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 1/3] clk: at91: mark ddr clocks as critical
  2022-12-08 11:45 ` Claudiu Beznea
@ 2022-12-08 11:45   ` Claudiu Beznea
  -1 siblings, 0 replies; 30+ messages in thread
From: Claudiu Beznea @ 2022-12-08 11:45 UTC (permalink / raw)
  To: mturquette, sboyd, nicolas.ferre, alexandre.belloni, krzysztof.kozlowski
  Cc: linux-kernel, linux-clk, linux-arm-kernel, Claudiu Beznea

Mark DDR clocks as critical for AT91 devices. These clocks are enabled
by bootloader when initializing DDR and needs to stay enabled. Up to
this patch the DDR clocks were requested from drivers/memory/atmel-sdramc.c
which does only clock request and enable. There is no need to have
a separate driver just for this, thus the atmel-sdramc.c will be deleted
in a subsequent patch.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 drivers/clk/at91/at91rm9200.c     |  2 +-
 drivers/clk/at91/at91sam9260.c    |  2 +-
 drivers/clk/at91/at91sam9g45.c    | 10 ++++++++--
 drivers/clk/at91/at91sam9n12.c    | 12 +++++++++---
 drivers/clk/at91/at91sam9rl.c     |  2 +-
 drivers/clk/at91/at91sam9x5.c     | 17 ++++++++++++-----
 drivers/clk/at91/clk-peripheral.c |  8 ++++----
 drivers/clk/at91/clk-system.c     |  4 ++--
 drivers/clk/at91/dt-compat.c      | 25 +++++++++++++++++++++++--
 drivers/clk/at91/pmc.h            |  4 ++--
 drivers/clk/at91/sam9x60.c        | 20 ++++++++++++++++----
 drivers/clk/at91/sama5d2.c        | 22 +++++++++++++++++-----
 drivers/clk/at91/sama5d3.c        | 20 ++++++++++++++++----
 drivers/clk/at91/sama5d4.c        | 22 +++++++++++++++++-----
 drivers/clk/at91/sama7g5.c        |  4 ++--
 15 files changed, 131 insertions(+), 43 deletions(-)

diff --git a/drivers/clk/at91/at91rm9200.c b/drivers/clk/at91/at91rm9200.c
index 16870943a13e..0b860126d589 100644
--- a/drivers/clk/at91/at91rm9200.c
+++ b/drivers/clk/at91/at91rm9200.c
@@ -183,7 +183,7 @@ static void __init at91rm9200_pmc_setup(struct device_node *np)
 	for (i = 0; i < ARRAY_SIZE(at91rm9200_systemck); i++) {
 		hw = at91_clk_register_system(regmap, at91rm9200_systemck[i].n,
 					      at91rm9200_systemck[i].p,
-					      at91rm9200_systemck[i].id);
+					      at91rm9200_systemck[i].id, 0);
 		if (IS_ERR(hw))
 			goto err_free;
 
diff --git a/drivers/clk/at91/at91sam9260.c b/drivers/clk/at91/at91sam9260.c
index 11550e50cd9f..b521f470428f 100644
--- a/drivers/clk/at91/at91sam9260.c
+++ b/drivers/clk/at91/at91sam9260.c
@@ -460,7 +460,7 @@ static void __init at91sam926x_pmc_setup(struct device_node *np,
 	for (i = 0; i < data->num_sck; i++) {
 		hw = at91_clk_register_system(regmap, data->sck[i].n,
 					      data->sck[i].p,
-					      data->sck[i].id);
+					      data->sck[i].id, 0);
 		if (IS_ERR(hw))
 			goto err_free;
 
diff --git a/drivers/clk/at91/at91sam9g45.c b/drivers/clk/at91/at91sam9g45.c
index 8c9344451f46..5099669ddcbd 100644
--- a/drivers/clk/at91/at91sam9g45.c
+++ b/drivers/clk/at91/at91sam9g45.c
@@ -40,9 +40,14 @@ static const struct clk_pll_characteristics plla_characteristics = {
 static const struct {
 	char *n;
 	char *p;
+	unsigned long flags;
 	u8 id;
 } at91sam9g45_systemck[] = {
-	{ .n = "ddrck", .p = "masterck_div", .id = 2 },
+	/*
+	 * ddrck feeds DDR controller and is enabled by bootloader thus we need
+	 * to keep it enabled in case there is no Linux consumer for it.
+	 */
+	{ .n = "ddrck", .p = "masterck_div", .id = 2, .flags = CLK_IS_CRITICAL },
 	{ .n = "uhpck", .p = "usbck",        .id = 6 },
 	{ .n = "pck0",  .p = "prog0",        .id = 8 },
 	{ .n = "pck1",  .p = "prog1",        .id = 9 },
@@ -198,7 +203,8 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np)
 	for (i = 0; i < ARRAY_SIZE(at91sam9g45_systemck); i++) {
 		hw = at91_clk_register_system(regmap, at91sam9g45_systemck[i].n,
 					      at91sam9g45_systemck[i].p,
-					      at91sam9g45_systemck[i].id);
+					      at91sam9g45_systemck[i].id,
+					      at91sam9g45_systemck[i].flags);
 		if (IS_ERR(hw))
 			goto err_free;
 
diff --git a/drivers/clk/at91/at91sam9n12.c b/drivers/clk/at91/at91sam9n12.c
index 0bb19400d199..08a10e12d08d 100644
--- a/drivers/clk/at91/at91sam9n12.c
+++ b/drivers/clk/at91/at91sam9n12.c
@@ -54,9 +54,14 @@ static const struct clk_pll_characteristics pllb_characteristics = {
 static const struct {
 	char *n;
 	char *p;
+	unsigned long flags;
 	u8 id;
 } at91sam9n12_systemck[] = {
-	{ .n = "ddrck", .p = "masterck_div", .id = 2 },
+	/*
+	 * ddrck feeds DDR controller and is enabled by bootloader thus we need
+	 * to keep it enabled in case there is no Linux consumer for it.
+	 */
+	{ .n = "ddrck", .p = "masterck_div", .id = 2, .flags = CLK_IS_CRITICAL },
 	{ .n = "lcdck", .p = "masterck_div", .id = 3 },
 	{ .n = "uhpck", .p = "usbck",        .id = 6 },
 	{ .n = "udpck", .p = "usbck",        .id = 7 },
@@ -223,7 +228,8 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np)
 	for (i = 0; i < ARRAY_SIZE(at91sam9n12_systemck); i++) {
 		hw = at91_clk_register_system(regmap, at91sam9n12_systemck[i].n,
 					      at91sam9n12_systemck[i].p,
-					      at91sam9n12_systemck[i].id);
+					      at91sam9n12_systemck[i].id,
+					      at91sam9n12_systemck[i].flags);
 		if (IS_ERR(hw))
 			goto err_free;
 
@@ -236,7 +242,7 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np)
 							 at91sam9n12_periphck[i].n,
 							 "masterck_div",
 							 at91sam9n12_periphck[i].id,
-							 &range, INT_MIN);
+							 &range, INT_MIN, 0);
 		if (IS_ERR(hw))
 			goto err_free;
 
diff --git a/drivers/clk/at91/at91sam9rl.c b/drivers/clk/at91/at91sam9rl.c
index b992137bab02..1a1b6b2bb0e3 100644
--- a/drivers/clk/at91/at91sam9rl.c
+++ b/drivers/clk/at91/at91sam9rl.c
@@ -160,7 +160,7 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np)
 	for (i = 0; i < ARRAY_SIZE(at91sam9rl_systemck); i++) {
 		hw = at91_clk_register_system(regmap, at91sam9rl_systemck[i].n,
 					      at91sam9rl_systemck[i].p,
-					      at91sam9rl_systemck[i].id);
+					      at91sam9rl_systemck[i].id, 0);
 		if (IS_ERR(hw))
 			goto err_free;
 
diff --git a/drivers/clk/at91/at91sam9x5.c b/drivers/clk/at91/at91sam9x5.c
index 3857db2e144b..13e589c95907 100644
--- a/drivers/clk/at91/at91sam9x5.c
+++ b/drivers/clk/at91/at91sam9x5.c
@@ -41,9 +41,14 @@ static const struct clk_pll_characteristics plla_characteristics = {
 static const struct {
 	char *n;
 	char *p;
+	unsigned long flags;
 	u8 id;
 } at91sam9x5_systemck[] = {
-	{ .n = "ddrck", .p = "masterck_div", .id = 2 },
+	/*
+	 * ddrck feeds DDR controller and is enabled by bootloader thus we need
+	 * to keep it enabled in case there is no Linux consumer for it.
+	 */
+	{ .n = "ddrck", .p = "masterck_div", .id = 2, .flags = CLK_IS_CRITICAL },
 	{ .n = "smdck", .p = "smdclk",   .id = 4 },
 	{ .n = "uhpck", .p = "usbck",    .id = 6 },
 	{ .n = "udpck", .p = "usbck",    .id = 7 },
@@ -248,7 +253,8 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
 	for (i = 0; i < ARRAY_SIZE(at91sam9x5_systemck); i++) {
 		hw = at91_clk_register_system(regmap, at91sam9x5_systemck[i].n,
 					      at91sam9x5_systemck[i].p,
-					      at91sam9x5_systemck[i].id);
+					      at91sam9x5_systemck[i].id,
+					      at91sam9x5_systemck[i].flags);
 		if (IS_ERR(hw))
 			goto err_free;
 
@@ -256,7 +262,8 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
 	}
 
 	if (has_lcdck) {
-		hw = at91_clk_register_system(regmap, "lcdck", "masterck_div", 3);
+		hw = at91_clk_register_system(regmap, "lcdck", "masterck_div",
+					      3, 0);
 		if (IS_ERR(hw))
 			goto err_free;
 
@@ -269,7 +276,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
 							 at91sam9x5_periphck[i].n,
 							 "masterck_div",
 							 at91sam9x5_periphck[i].id,
-							 &range, INT_MIN);
+							 &range, INT_MIN, 0);
 		if (IS_ERR(hw))
 			goto err_free;
 
@@ -282,7 +289,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
 							 extra_pcks[i].n,
 							 "masterck_div",
 							 extra_pcks[i].id,
-							 &range, INT_MIN);
+							 &range, INT_MIN, 0);
 		if (IS_ERR(hw))
 			goto err_free;
 
diff --git a/drivers/clk/at91/clk-peripheral.c b/drivers/clk/at91/clk-peripheral.c
index 5104d4025484..93ea685e27f6 100644
--- a/drivers/clk/at91/clk-peripheral.c
+++ b/drivers/clk/at91/clk-peripheral.c
@@ -445,7 +445,7 @@ at91_clk_register_sam9x5_peripheral(struct regmap *regmap, spinlock_t *lock,
 				    const struct clk_pcr_layout *layout,
 				    const char *name, const char *parent_name,
 				    u32 id, const struct clk_range *range,
-				    int chg_pid)
+				    int chg_pid, unsigned long flags)
 {
 	struct clk_sam9x5_peripheral *periph;
 	struct clk_init_data init;
@@ -462,12 +462,12 @@ at91_clk_register_sam9x5_peripheral(struct regmap *regmap, spinlock_t *lock,
 	init.name = name;
 	init.parent_names = &parent_name;
 	init.num_parents = 1;
+	init.flags = flags;
 	if (chg_pid < 0) {
-		init.flags = 0;
 		init.ops = &sam9x5_peripheral_ops;
 	} else {
-		init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE |
-			     CLK_SET_RATE_PARENT;
+		init.flags |= CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE |
+			      CLK_SET_RATE_PARENT;
 		init.ops = &sam9x5_peripheral_chg_ops;
 	}
 
diff --git a/drivers/clk/at91/clk-system.c b/drivers/clk/at91/clk-system.c
index 80720fd1a9cf..10193650429e 100644
--- a/drivers/clk/at91/clk-system.c
+++ b/drivers/clk/at91/clk-system.c
@@ -105,7 +105,7 @@ static const struct clk_ops system_ops = {
 
 struct clk_hw * __init
 at91_clk_register_system(struct regmap *regmap, const char *name,
-			 const char *parent_name, u8 id)
+			 const char *parent_name, u8 id, unsigned long flags)
 {
 	struct clk_system *sys;
 	struct clk_hw *hw;
@@ -123,7 +123,7 @@ at91_clk_register_system(struct regmap *regmap, const char *name,
 	init.ops = &system_ops;
 	init.parent_names = &parent_name;
 	init.num_parents = 1;
-	init.flags = CLK_SET_RATE_PARENT;
+	init.flags = CLK_SET_RATE_PARENT | flags;
 
 	sys->id = id;
 	sys->hw.init = &init;
diff --git a/drivers/clk/at91/dt-compat.c b/drivers/clk/at91/dt-compat.c
index 85a964cb2d89..97f67e23ef80 100644
--- a/drivers/clk/at91/dt-compat.c
+++ b/drivers/clk/at91/dt-compat.c
@@ -493,18 +493,28 @@ of_at91_clk_periph_setup(struct device_node *np, u8 type)
 							  parent_name, id);
 		} else {
 			struct clk_range range = CLK_RANGE(0, 0);
+			unsigned long flags = 0;
 
 			of_at91_get_clk_range(periphclknp,
 					      "atmel,clk-output-range",
 					      &range);
 
+			/*
+			 * mpddr_clk feed DDR controller and is enabled by
+			 * bootloader thus we need to keep it enabled in case
+			 * there is no Linux consumer for it.
+			 */
+			if (!strcmp(periphclknp->name, "mpddr_clk"))
+				flags = CLK_IS_CRITICAL;
+
 			hw = at91_clk_register_sam9x5_peripheral(regmap,
 								 &pmc_pcr_lock,
 								 &dt_pcr_layout,
 								 name,
 								 parent_name,
 								 id, &range,
-								 INT_MIN);
+								 INT_MIN,
+								 flags);
 		}
 
 		if (IS_ERR(hw))
@@ -879,6 +889,8 @@ static void __init of_at91rm9200_clk_sys_setup(struct device_node *np)
 		return;
 
 	for_each_child_of_node(np, sysclknp) {
+		unsigned long flags = 0;
+
 		if (of_property_read_u32(sysclknp, "reg", &id))
 			continue;
 
@@ -887,7 +899,16 @@ static void __init of_at91rm9200_clk_sys_setup(struct device_node *np)
 
 		parent_name = of_clk_get_parent_name(sysclknp, 0);
 
-		hw = at91_clk_register_system(regmap, name, parent_name, id);
+		/*
+		 * ddrck feeds DDR controller and is enabled by bootloader thus
+		 * we need to keep it enabled in case there is no Linux consumer
+		 * for it.
+		 */
+		if (!strcmp(sysclknp->name, "ddrck"))
+			flags = CLK_IS_CRITICAL;
+
+		hw = at91_clk_register_system(regmap, name, parent_name, id,
+					      flags);
 		if (IS_ERR(hw))
 			continue;
 
diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h
index efe4975bddc3..1b3ca7dd9b57 100644
--- a/drivers/clk/at91/pmc.h
+++ b/drivers/clk/at91/pmc.h
@@ -199,7 +199,7 @@ at91_clk_register_sam9x5_peripheral(struct regmap *regmap, spinlock_t *lock,
 				    const struct clk_pcr_layout *layout,
 				    const char *name, const char *parent_name,
 				    u32 id, const struct clk_range *range,
-				    int chg_pid);
+				    int chg_pid, unsigned long flags);
 
 struct clk_hw * __init
 at91_clk_register_pll(struct regmap *regmap, const char *name,
@@ -242,7 +242,7 @@ at91sam9x5_clk_register_smd(struct regmap *regmap, const char *name,
 
 struct clk_hw * __init
 at91_clk_register_system(struct regmap *regmap, const char *name,
-			 const char *parent_name, u8 id);
+			 const char *parent_name, u8 id, unsigned long flags);
 
 struct clk_hw * __init
 at91sam9x5_clk_register_usb(struct regmap *regmap, const char *name,
diff --git a/drivers/clk/at91/sam9x60.c b/drivers/clk/at91/sam9x60.c
index 9ea4ce501bad..ac070db58195 100644
--- a/drivers/clk/at91/sam9x60.c
+++ b/drivers/clk/at91/sam9x60.c
@@ -75,9 +75,14 @@ static const struct clk_pcr_layout sam9x60_pcr_layout = {
 static const struct {
 	char *n;
 	char *p;
+	unsigned long flags;
 	u8 id;
 } sam9x60_systemck[] = {
-	{ .n = "ddrck",  .p = "masterck_div", .id = 2 },
+	/*
+	 * ddrck feeds DDR controller and is enabled by bootloader thus we need
+	 * to keep it enabled in case there is no Linux consumer for it.
+	 */
+	{ .n = "ddrck",  .p = "masterck_div", .id = 2, .flags = CLK_IS_CRITICAL },
 	{ .n = "uhpck",  .p = "usbck",    .id = 6 },
 	{ .n = "pck0",   .p = "prog0",    .id = 8 },
 	{ .n = "pck1",   .p = "prog1",    .id = 9 },
@@ -86,6 +91,7 @@ static const struct {
 
 static const struct {
 	char *n;
+	unsigned long flags;
 	u8 id;
 } sam9x60_periphck[] = {
 	{ .n = "pioA_clk",   .id = 2, },
@@ -132,7 +138,11 @@ static const struct {
 	{ .n = "pioD_clk",   .id = 44, },
 	{ .n = "tcb1_clk",   .id = 45, },
 	{ .n = "dbgu_clk",   .id = 47, },
-	{ .n = "mpddr_clk",  .id = 49, },
+	/*
+	 * mpddr_clk feeds DDR controller and is enabled by bootloader thus we
+	 * need to keep it enabled in case there is no Linux consumer for it.
+	 */
+	{ .n = "mpddr_clk",  .id = 49, .flags = CLK_IS_CRITICAL },
 };
 
 static const struct {
@@ -315,7 +325,8 @@ static void __init sam9x60_pmc_setup(struct device_node *np)
 	for (i = 0; i < ARRAY_SIZE(sam9x60_systemck); i++) {
 		hw = at91_clk_register_system(regmap, sam9x60_systemck[i].n,
 					      sam9x60_systemck[i].p,
-					      sam9x60_systemck[i].id);
+					      sam9x60_systemck[i].id,
+					      sam9x60_systemck[i].flags);
 		if (IS_ERR(hw))
 			goto err_free;
 
@@ -328,7 +339,8 @@ static void __init sam9x60_pmc_setup(struct device_node *np)
 							 sam9x60_periphck[i].n,
 							 "masterck_div",
 							 sam9x60_periphck[i].id,
-							 &range, INT_MIN);
+							 &range, INT_MIN,
+							 sam9x60_periphck[i].flags);
 		if (IS_ERR(hw))
 			goto err_free;
 
diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c
index 84156dc52bff..c0e3e1a4bbf3 100644
--- a/drivers/clk/at91/sama5d2.c
+++ b/drivers/clk/at91/sama5d2.c
@@ -40,9 +40,14 @@ static const struct clk_pcr_layout sama5d2_pcr_layout = {
 static const struct {
 	char *n;
 	char *p;
+	unsigned long flags;
 	u8 id;
 } sama5d2_systemck[] = {
-	{ .n = "ddrck", .p = "masterck_div", .id = 2 },
+	/*
+	 * ddrck feeds DDR controller and is enabled by bootloader thus we need
+	 * to keep it enabled in case there is no Linux consumer for it.
+	 */
+	{ .n = "ddrck", .p = "masterck_div", .id = 2, .flags = CLK_IS_CRITICAL },
 	{ .n = "lcdck", .p = "masterck_div", .id = 3 },
 	{ .n = "uhpck", .p = "usbck",        .id = 6 },
 	{ .n = "udpck", .p = "usbck",        .id = 7 },
@@ -97,6 +102,7 @@ static const struct {
 
 static const struct {
 	char *n;
+	unsigned long flags;
 	u8 id;
 } sama5d2_periphck[] = {
 	{ .n = "dma0_clk",    .id = 6, },
@@ -104,7 +110,11 @@ static const struct {
 	{ .n = "aes_clk",     .id = 9, },
 	{ .n = "aesb_clk",    .id = 10, },
 	{ .n = "sha_clk",     .id = 12, },
-	{ .n = "mpddr_clk",   .id = 13, },
+	/*
+	 * mpddr_clk feeds DDR controller and is enabled by bootloader thus we
+	 * need to keep it enabled in case there is no Linux consumer for it.
+	 */
+	{ .n = "mpddr_clk",   .id = 13, .flags = CLK_IS_CRITICAL },
 	{ .n = "matrix0_clk", .id = 15, },
 	{ .n = "sdmmc0_hclk", .id = 31, },
 	{ .n = "sdmmc1_hclk", .id = 32, },
@@ -302,7 +312,8 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
 	for (i = 0; i < ARRAY_SIZE(sama5d2_systemck); i++) {
 		hw = at91_clk_register_system(regmap, sama5d2_systemck[i].n,
 					      sama5d2_systemck[i].p,
-					      sama5d2_systemck[i].id);
+					      sama5d2_systemck[i].id,
+					      sama5d2_systemck[i].flags);
 		if (IS_ERR(hw))
 			goto err_free;
 
@@ -315,7 +326,8 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
 							 sama5d2_periphck[i].n,
 							 "masterck_div",
 							 sama5d2_periphck[i].id,
-							 &range, INT_MIN);
+							 &range, INT_MIN,
+							 sama5d2_periphck[i].flags);
 		if (IS_ERR(hw))
 			goto err_free;
 
@@ -329,7 +341,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
 							 "h32mxck",
 							 sama5d2_periph32ck[i].id,
 							 &sama5d2_periph32ck[i].r,
-							 INT_MIN);
+							 INT_MIN, 0);
 		if (IS_ERR(hw))
 			goto err_free;
 
diff --git a/drivers/clk/at91/sama5d3.c b/drivers/clk/at91/sama5d3.c
index 7e93c6edf305..ad6068b884de 100644
--- a/drivers/clk/at91/sama5d3.c
+++ b/drivers/clk/at91/sama5d3.c
@@ -40,9 +40,14 @@ static const struct clk_pcr_layout sama5d3_pcr_layout = {
 static const struct {
 	char *n;
 	char *p;
+	unsigned long flags;
 	u8 id;
 } sama5d3_systemck[] = {
-	{ .n = "ddrck", .p = "masterck_div", .id = 2 },
+	/*
+	 * ddrck feeds DDR controller and is enabled by bootloader thus we need
+	 * to keep it enabled in case there is no Linux consumer for it.
+	 */
+	{ .n = "ddrck", .p = "masterck_div", .id = 2, .flags = CLK_IS_CRITICAL },
 	{ .n = "lcdck", .p = "masterck_div", .id = 3 },
 	{ .n = "smdck", .p = "smdclk",       .id = 4 },
 	{ .n = "uhpck", .p = "usbck",        .id = 6 },
@@ -56,6 +61,7 @@ static const struct {
 	char *n;
 	u8 id;
 	struct clk_range r;
+	unsigned long flags;
 } sama5d3_periphck[] = {
 	{ .n = "dbgu_clk", .id = 2, },
 	{ .n = "hsmc_clk", .id = 5, },
@@ -99,7 +105,11 @@ static const struct {
 	{ .n = "tdes_clk", .id = 44, },
 	{ .n = "trng_clk", .id = 45, },
 	{ .n = "fuse_clk", .id = 48, },
-	{ .n = "mpddr_clk", .id = 49, },
+	/*
+	 * mpddr_clk feeds DDR controller and is enabled by bootloader thus we
+	 * need to keep it enabled in case there is no Linux consumer for it.
+	 */
+	{ .n = "mpddr_clk", .id = 49, .flags = CLK_IS_CRITICAL },
 };
 
 static void __init sama5d3_pmc_setup(struct device_node *np)
@@ -222,7 +232,8 @@ static void __init sama5d3_pmc_setup(struct device_node *np)
 	for (i = 0; i < ARRAY_SIZE(sama5d3_systemck); i++) {
 		hw = at91_clk_register_system(regmap, sama5d3_systemck[i].n,
 					      sama5d3_systemck[i].p,
-					      sama5d3_systemck[i].id);
+					      sama5d3_systemck[i].id,
+					      sama5d3_systemck[i].flags);
 		if (IS_ERR(hw))
 			goto err_free;
 
@@ -236,7 +247,8 @@ static void __init sama5d3_pmc_setup(struct device_node *np)
 							 "masterck_div",
 							 sama5d3_periphck[i].id,
 							 &sama5d3_periphck[i].r,
-							 INT_MIN);
+							 INT_MIN,
+							 sama5d3_periphck[i].flags);
 		if (IS_ERR(hw))
 			goto err_free;
 
diff --git a/drivers/clk/at91/sama5d4.c b/drivers/clk/at91/sama5d4.c
index 1a14a9bce308..e876ec971a39 100644
--- a/drivers/clk/at91/sama5d4.c
+++ b/drivers/clk/at91/sama5d4.c
@@ -39,9 +39,14 @@ static const struct clk_pcr_layout sama5d4_pcr_layout = {
 static const struct {
 	char *n;
 	char *p;
+	unsigned long flags;
 	u8 id;
 } sama5d4_systemck[] = {
-	{ .n = "ddrck", .p = "masterck_div", .id = 2 },
+	/*
+	 * ddrck feeds DDR controller and is enabled by bootloader thus we need
+	 * to keep it enabled in case there is no Linux consumer for it.
+	 */
+	{ .n = "ddrck", .p = "masterck_div", .id = 2, .flags = CLK_IS_CRITICAL },
 	{ .n = "lcdck", .p = "masterck_div", .id = 3 },
 	{ .n = "smdck", .p = "smdclk",       .id = 4 },
 	{ .n = "uhpck", .p = "usbck",        .id = 6 },
@@ -103,12 +108,17 @@ static const struct {
 
 static const struct {
 	char *n;
+	unsigned long flags;
 	u8 id;
 } sama5d4_periphck[] = {
 	{ .n = "dma0_clk", .id = 8 },
 	{ .n = "cpkcc_clk", .id = 10 },
 	{ .n = "aesb_clk", .id = 13 },
-	{ .n = "mpddr_clk", .id = 16 },
+	/*
+	 * mpddr_clk feeds DDR controller and is enabled by bootloader thus we
+	 * need to keep it enabled in case there is no Linux consumer for it.
+	 */
+	{ .n = "mpddr_clk", .id = 16, .flags = CLK_IS_CRITICAL },
 	{ .n = "matrix0_clk", .id = 18 },
 	{ .n = "vdec_clk", .id = 19 },
 	{ .n = "dma1_clk", .id = 50 },
@@ -245,7 +255,8 @@ static void __init sama5d4_pmc_setup(struct device_node *np)
 	for (i = 0; i < ARRAY_SIZE(sama5d4_systemck); i++) {
 		hw = at91_clk_register_system(regmap, sama5d4_systemck[i].n,
 					      sama5d4_systemck[i].p,
-					      sama5d4_systemck[i].id);
+					      sama5d4_systemck[i].id,
+					      sama5d4_systemck[i].flags);
 		if (IS_ERR(hw))
 			goto err_free;
 
@@ -258,7 +269,8 @@ static void __init sama5d4_pmc_setup(struct device_node *np)
 							 sama5d4_periphck[i].n,
 							 "masterck_div",
 							 sama5d4_periphck[i].id,
-							 &range, INT_MIN);
+							 &range, INT_MIN,
+							 sama5d4_periphck[i].flags);
 		if (IS_ERR(hw))
 			goto err_free;
 
@@ -271,7 +283,7 @@ static void __init sama5d4_pmc_setup(struct device_node *np)
 							 sama5d4_periph32ck[i].n,
 							 "h32mxck",
 							 sama5d4_periph32ck[i].id,
-							 &range, INT_MIN);
+							 &range, INT_MIN, 0);
 		if (IS_ERR(hw))
 			goto err_free;
 
diff --git a/drivers/clk/at91/sama7g5.c b/drivers/clk/at91/sama7g5.c
index 9a213ba9e58b..f135b662f1ff 100644
--- a/drivers/clk/at91/sama7g5.c
+++ b/drivers/clk/at91/sama7g5.c
@@ -1068,7 +1068,7 @@ static void __init sama7g5_pmc_setup(struct device_node *np)
 	for (i = 0; i < ARRAY_SIZE(sama7g5_systemck); i++) {
 		hw = at91_clk_register_system(regmap, sama7g5_systemck[i].n,
 					      sama7g5_systemck[i].p,
-					      sama7g5_systemck[i].id);
+					      sama7g5_systemck[i].id, 0);
 		if (IS_ERR(hw))
 			goto err_free;
 
@@ -1083,7 +1083,7 @@ static void __init sama7g5_pmc_setup(struct device_node *np)
 						sama7g5_periphck[i].id,
 						&sama7g5_periphck[i].r,
 						sama7g5_periphck[i].chgp ? 0 :
-						INT_MIN);
+						INT_MIN, 0);
 		if (IS_ERR(hw))
 			goto err_free;
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 1/3] clk: at91: mark ddr clocks as critical
@ 2022-12-08 11:45   ` Claudiu Beznea
  0 siblings, 0 replies; 30+ messages in thread
From: Claudiu Beznea @ 2022-12-08 11:45 UTC (permalink / raw)
  To: mturquette, sboyd, nicolas.ferre, alexandre.belloni, krzysztof.kozlowski
  Cc: linux-kernel, linux-clk, linux-arm-kernel, Claudiu Beznea

Mark DDR clocks as critical for AT91 devices. These clocks are enabled
by bootloader when initializing DDR and needs to stay enabled. Up to
this patch the DDR clocks were requested from drivers/memory/atmel-sdramc.c
which does only clock request and enable. There is no need to have
a separate driver just for this, thus the atmel-sdramc.c will be deleted
in a subsequent patch.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 drivers/clk/at91/at91rm9200.c     |  2 +-
 drivers/clk/at91/at91sam9260.c    |  2 +-
 drivers/clk/at91/at91sam9g45.c    | 10 ++++++++--
 drivers/clk/at91/at91sam9n12.c    | 12 +++++++++---
 drivers/clk/at91/at91sam9rl.c     |  2 +-
 drivers/clk/at91/at91sam9x5.c     | 17 ++++++++++++-----
 drivers/clk/at91/clk-peripheral.c |  8 ++++----
 drivers/clk/at91/clk-system.c     |  4 ++--
 drivers/clk/at91/dt-compat.c      | 25 +++++++++++++++++++++++--
 drivers/clk/at91/pmc.h            |  4 ++--
 drivers/clk/at91/sam9x60.c        | 20 ++++++++++++++++----
 drivers/clk/at91/sama5d2.c        | 22 +++++++++++++++++-----
 drivers/clk/at91/sama5d3.c        | 20 ++++++++++++++++----
 drivers/clk/at91/sama5d4.c        | 22 +++++++++++++++++-----
 drivers/clk/at91/sama7g5.c        |  4 ++--
 15 files changed, 131 insertions(+), 43 deletions(-)

diff --git a/drivers/clk/at91/at91rm9200.c b/drivers/clk/at91/at91rm9200.c
index 16870943a13e..0b860126d589 100644
--- a/drivers/clk/at91/at91rm9200.c
+++ b/drivers/clk/at91/at91rm9200.c
@@ -183,7 +183,7 @@ static void __init at91rm9200_pmc_setup(struct device_node *np)
 	for (i = 0; i < ARRAY_SIZE(at91rm9200_systemck); i++) {
 		hw = at91_clk_register_system(regmap, at91rm9200_systemck[i].n,
 					      at91rm9200_systemck[i].p,
-					      at91rm9200_systemck[i].id);
+					      at91rm9200_systemck[i].id, 0);
 		if (IS_ERR(hw))
 			goto err_free;
 
diff --git a/drivers/clk/at91/at91sam9260.c b/drivers/clk/at91/at91sam9260.c
index 11550e50cd9f..b521f470428f 100644
--- a/drivers/clk/at91/at91sam9260.c
+++ b/drivers/clk/at91/at91sam9260.c
@@ -460,7 +460,7 @@ static void __init at91sam926x_pmc_setup(struct device_node *np,
 	for (i = 0; i < data->num_sck; i++) {
 		hw = at91_clk_register_system(regmap, data->sck[i].n,
 					      data->sck[i].p,
-					      data->sck[i].id);
+					      data->sck[i].id, 0);
 		if (IS_ERR(hw))
 			goto err_free;
 
diff --git a/drivers/clk/at91/at91sam9g45.c b/drivers/clk/at91/at91sam9g45.c
index 8c9344451f46..5099669ddcbd 100644
--- a/drivers/clk/at91/at91sam9g45.c
+++ b/drivers/clk/at91/at91sam9g45.c
@@ -40,9 +40,14 @@ static const struct clk_pll_characteristics plla_characteristics = {
 static const struct {
 	char *n;
 	char *p;
+	unsigned long flags;
 	u8 id;
 } at91sam9g45_systemck[] = {
-	{ .n = "ddrck", .p = "masterck_div", .id = 2 },
+	/*
+	 * ddrck feeds DDR controller and is enabled by bootloader thus we need
+	 * to keep it enabled in case there is no Linux consumer for it.
+	 */
+	{ .n = "ddrck", .p = "masterck_div", .id = 2, .flags = CLK_IS_CRITICAL },
 	{ .n = "uhpck", .p = "usbck",        .id = 6 },
 	{ .n = "pck0",  .p = "prog0",        .id = 8 },
 	{ .n = "pck1",  .p = "prog1",        .id = 9 },
@@ -198,7 +203,8 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np)
 	for (i = 0; i < ARRAY_SIZE(at91sam9g45_systemck); i++) {
 		hw = at91_clk_register_system(regmap, at91sam9g45_systemck[i].n,
 					      at91sam9g45_systemck[i].p,
-					      at91sam9g45_systemck[i].id);
+					      at91sam9g45_systemck[i].id,
+					      at91sam9g45_systemck[i].flags);
 		if (IS_ERR(hw))
 			goto err_free;
 
diff --git a/drivers/clk/at91/at91sam9n12.c b/drivers/clk/at91/at91sam9n12.c
index 0bb19400d199..08a10e12d08d 100644
--- a/drivers/clk/at91/at91sam9n12.c
+++ b/drivers/clk/at91/at91sam9n12.c
@@ -54,9 +54,14 @@ static const struct clk_pll_characteristics pllb_characteristics = {
 static const struct {
 	char *n;
 	char *p;
+	unsigned long flags;
 	u8 id;
 } at91sam9n12_systemck[] = {
-	{ .n = "ddrck", .p = "masterck_div", .id = 2 },
+	/*
+	 * ddrck feeds DDR controller and is enabled by bootloader thus we need
+	 * to keep it enabled in case there is no Linux consumer for it.
+	 */
+	{ .n = "ddrck", .p = "masterck_div", .id = 2, .flags = CLK_IS_CRITICAL },
 	{ .n = "lcdck", .p = "masterck_div", .id = 3 },
 	{ .n = "uhpck", .p = "usbck",        .id = 6 },
 	{ .n = "udpck", .p = "usbck",        .id = 7 },
@@ -223,7 +228,8 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np)
 	for (i = 0; i < ARRAY_SIZE(at91sam9n12_systemck); i++) {
 		hw = at91_clk_register_system(regmap, at91sam9n12_systemck[i].n,
 					      at91sam9n12_systemck[i].p,
-					      at91sam9n12_systemck[i].id);
+					      at91sam9n12_systemck[i].id,
+					      at91sam9n12_systemck[i].flags);
 		if (IS_ERR(hw))
 			goto err_free;
 
@@ -236,7 +242,7 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np)
 							 at91sam9n12_periphck[i].n,
 							 "masterck_div",
 							 at91sam9n12_periphck[i].id,
-							 &range, INT_MIN);
+							 &range, INT_MIN, 0);
 		if (IS_ERR(hw))
 			goto err_free;
 
diff --git a/drivers/clk/at91/at91sam9rl.c b/drivers/clk/at91/at91sam9rl.c
index b992137bab02..1a1b6b2bb0e3 100644
--- a/drivers/clk/at91/at91sam9rl.c
+++ b/drivers/clk/at91/at91sam9rl.c
@@ -160,7 +160,7 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np)
 	for (i = 0; i < ARRAY_SIZE(at91sam9rl_systemck); i++) {
 		hw = at91_clk_register_system(regmap, at91sam9rl_systemck[i].n,
 					      at91sam9rl_systemck[i].p,
-					      at91sam9rl_systemck[i].id);
+					      at91sam9rl_systemck[i].id, 0);
 		if (IS_ERR(hw))
 			goto err_free;
 
diff --git a/drivers/clk/at91/at91sam9x5.c b/drivers/clk/at91/at91sam9x5.c
index 3857db2e144b..13e589c95907 100644
--- a/drivers/clk/at91/at91sam9x5.c
+++ b/drivers/clk/at91/at91sam9x5.c
@@ -41,9 +41,14 @@ static const struct clk_pll_characteristics plla_characteristics = {
 static const struct {
 	char *n;
 	char *p;
+	unsigned long flags;
 	u8 id;
 } at91sam9x5_systemck[] = {
-	{ .n = "ddrck", .p = "masterck_div", .id = 2 },
+	/*
+	 * ddrck feeds DDR controller and is enabled by bootloader thus we need
+	 * to keep it enabled in case there is no Linux consumer for it.
+	 */
+	{ .n = "ddrck", .p = "masterck_div", .id = 2, .flags = CLK_IS_CRITICAL },
 	{ .n = "smdck", .p = "smdclk",   .id = 4 },
 	{ .n = "uhpck", .p = "usbck",    .id = 6 },
 	{ .n = "udpck", .p = "usbck",    .id = 7 },
@@ -248,7 +253,8 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
 	for (i = 0; i < ARRAY_SIZE(at91sam9x5_systemck); i++) {
 		hw = at91_clk_register_system(regmap, at91sam9x5_systemck[i].n,
 					      at91sam9x5_systemck[i].p,
-					      at91sam9x5_systemck[i].id);
+					      at91sam9x5_systemck[i].id,
+					      at91sam9x5_systemck[i].flags);
 		if (IS_ERR(hw))
 			goto err_free;
 
@@ -256,7 +262,8 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
 	}
 
 	if (has_lcdck) {
-		hw = at91_clk_register_system(regmap, "lcdck", "masterck_div", 3);
+		hw = at91_clk_register_system(regmap, "lcdck", "masterck_div",
+					      3, 0);
 		if (IS_ERR(hw))
 			goto err_free;
 
@@ -269,7 +276,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
 							 at91sam9x5_periphck[i].n,
 							 "masterck_div",
 							 at91sam9x5_periphck[i].id,
-							 &range, INT_MIN);
+							 &range, INT_MIN, 0);
 		if (IS_ERR(hw))
 			goto err_free;
 
@@ -282,7 +289,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
 							 extra_pcks[i].n,
 							 "masterck_div",
 							 extra_pcks[i].id,
-							 &range, INT_MIN);
+							 &range, INT_MIN, 0);
 		if (IS_ERR(hw))
 			goto err_free;
 
diff --git a/drivers/clk/at91/clk-peripheral.c b/drivers/clk/at91/clk-peripheral.c
index 5104d4025484..93ea685e27f6 100644
--- a/drivers/clk/at91/clk-peripheral.c
+++ b/drivers/clk/at91/clk-peripheral.c
@@ -445,7 +445,7 @@ at91_clk_register_sam9x5_peripheral(struct regmap *regmap, spinlock_t *lock,
 				    const struct clk_pcr_layout *layout,
 				    const char *name, const char *parent_name,
 				    u32 id, const struct clk_range *range,
-				    int chg_pid)
+				    int chg_pid, unsigned long flags)
 {
 	struct clk_sam9x5_peripheral *periph;
 	struct clk_init_data init;
@@ -462,12 +462,12 @@ at91_clk_register_sam9x5_peripheral(struct regmap *regmap, spinlock_t *lock,
 	init.name = name;
 	init.parent_names = &parent_name;
 	init.num_parents = 1;
+	init.flags = flags;
 	if (chg_pid < 0) {
-		init.flags = 0;
 		init.ops = &sam9x5_peripheral_ops;
 	} else {
-		init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE |
-			     CLK_SET_RATE_PARENT;
+		init.flags |= CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE |
+			      CLK_SET_RATE_PARENT;
 		init.ops = &sam9x5_peripheral_chg_ops;
 	}
 
diff --git a/drivers/clk/at91/clk-system.c b/drivers/clk/at91/clk-system.c
index 80720fd1a9cf..10193650429e 100644
--- a/drivers/clk/at91/clk-system.c
+++ b/drivers/clk/at91/clk-system.c
@@ -105,7 +105,7 @@ static const struct clk_ops system_ops = {
 
 struct clk_hw * __init
 at91_clk_register_system(struct regmap *regmap, const char *name,
-			 const char *parent_name, u8 id)
+			 const char *parent_name, u8 id, unsigned long flags)
 {
 	struct clk_system *sys;
 	struct clk_hw *hw;
@@ -123,7 +123,7 @@ at91_clk_register_system(struct regmap *regmap, const char *name,
 	init.ops = &system_ops;
 	init.parent_names = &parent_name;
 	init.num_parents = 1;
-	init.flags = CLK_SET_RATE_PARENT;
+	init.flags = CLK_SET_RATE_PARENT | flags;
 
 	sys->id = id;
 	sys->hw.init = &init;
diff --git a/drivers/clk/at91/dt-compat.c b/drivers/clk/at91/dt-compat.c
index 85a964cb2d89..97f67e23ef80 100644
--- a/drivers/clk/at91/dt-compat.c
+++ b/drivers/clk/at91/dt-compat.c
@@ -493,18 +493,28 @@ of_at91_clk_periph_setup(struct device_node *np, u8 type)
 							  parent_name, id);
 		} else {
 			struct clk_range range = CLK_RANGE(0, 0);
+			unsigned long flags = 0;
 
 			of_at91_get_clk_range(periphclknp,
 					      "atmel,clk-output-range",
 					      &range);
 
+			/*
+			 * mpddr_clk feed DDR controller and is enabled by
+			 * bootloader thus we need to keep it enabled in case
+			 * there is no Linux consumer for it.
+			 */
+			if (!strcmp(periphclknp->name, "mpddr_clk"))
+				flags = CLK_IS_CRITICAL;
+
 			hw = at91_clk_register_sam9x5_peripheral(regmap,
 								 &pmc_pcr_lock,
 								 &dt_pcr_layout,
 								 name,
 								 parent_name,
 								 id, &range,
-								 INT_MIN);
+								 INT_MIN,
+								 flags);
 		}
 
 		if (IS_ERR(hw))
@@ -879,6 +889,8 @@ static void __init of_at91rm9200_clk_sys_setup(struct device_node *np)
 		return;
 
 	for_each_child_of_node(np, sysclknp) {
+		unsigned long flags = 0;
+
 		if (of_property_read_u32(sysclknp, "reg", &id))
 			continue;
 
@@ -887,7 +899,16 @@ static void __init of_at91rm9200_clk_sys_setup(struct device_node *np)
 
 		parent_name = of_clk_get_parent_name(sysclknp, 0);
 
-		hw = at91_clk_register_system(regmap, name, parent_name, id);
+		/*
+		 * ddrck feeds DDR controller and is enabled by bootloader thus
+		 * we need to keep it enabled in case there is no Linux consumer
+		 * for it.
+		 */
+		if (!strcmp(sysclknp->name, "ddrck"))
+			flags = CLK_IS_CRITICAL;
+
+		hw = at91_clk_register_system(regmap, name, parent_name, id,
+					      flags);
 		if (IS_ERR(hw))
 			continue;
 
diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h
index efe4975bddc3..1b3ca7dd9b57 100644
--- a/drivers/clk/at91/pmc.h
+++ b/drivers/clk/at91/pmc.h
@@ -199,7 +199,7 @@ at91_clk_register_sam9x5_peripheral(struct regmap *regmap, spinlock_t *lock,
 				    const struct clk_pcr_layout *layout,
 				    const char *name, const char *parent_name,
 				    u32 id, const struct clk_range *range,
-				    int chg_pid);
+				    int chg_pid, unsigned long flags);
 
 struct clk_hw * __init
 at91_clk_register_pll(struct regmap *regmap, const char *name,
@@ -242,7 +242,7 @@ at91sam9x5_clk_register_smd(struct regmap *regmap, const char *name,
 
 struct clk_hw * __init
 at91_clk_register_system(struct regmap *regmap, const char *name,
-			 const char *parent_name, u8 id);
+			 const char *parent_name, u8 id, unsigned long flags);
 
 struct clk_hw * __init
 at91sam9x5_clk_register_usb(struct regmap *regmap, const char *name,
diff --git a/drivers/clk/at91/sam9x60.c b/drivers/clk/at91/sam9x60.c
index 9ea4ce501bad..ac070db58195 100644
--- a/drivers/clk/at91/sam9x60.c
+++ b/drivers/clk/at91/sam9x60.c
@@ -75,9 +75,14 @@ static const struct clk_pcr_layout sam9x60_pcr_layout = {
 static const struct {
 	char *n;
 	char *p;
+	unsigned long flags;
 	u8 id;
 } sam9x60_systemck[] = {
-	{ .n = "ddrck",  .p = "masterck_div", .id = 2 },
+	/*
+	 * ddrck feeds DDR controller and is enabled by bootloader thus we need
+	 * to keep it enabled in case there is no Linux consumer for it.
+	 */
+	{ .n = "ddrck",  .p = "masterck_div", .id = 2, .flags = CLK_IS_CRITICAL },
 	{ .n = "uhpck",  .p = "usbck",    .id = 6 },
 	{ .n = "pck0",   .p = "prog0",    .id = 8 },
 	{ .n = "pck1",   .p = "prog1",    .id = 9 },
@@ -86,6 +91,7 @@ static const struct {
 
 static const struct {
 	char *n;
+	unsigned long flags;
 	u8 id;
 } sam9x60_periphck[] = {
 	{ .n = "pioA_clk",   .id = 2, },
@@ -132,7 +138,11 @@ static const struct {
 	{ .n = "pioD_clk",   .id = 44, },
 	{ .n = "tcb1_clk",   .id = 45, },
 	{ .n = "dbgu_clk",   .id = 47, },
-	{ .n = "mpddr_clk",  .id = 49, },
+	/*
+	 * mpddr_clk feeds DDR controller and is enabled by bootloader thus we
+	 * need to keep it enabled in case there is no Linux consumer for it.
+	 */
+	{ .n = "mpddr_clk",  .id = 49, .flags = CLK_IS_CRITICAL },
 };
 
 static const struct {
@@ -315,7 +325,8 @@ static void __init sam9x60_pmc_setup(struct device_node *np)
 	for (i = 0; i < ARRAY_SIZE(sam9x60_systemck); i++) {
 		hw = at91_clk_register_system(regmap, sam9x60_systemck[i].n,
 					      sam9x60_systemck[i].p,
-					      sam9x60_systemck[i].id);
+					      sam9x60_systemck[i].id,
+					      sam9x60_systemck[i].flags);
 		if (IS_ERR(hw))
 			goto err_free;
 
@@ -328,7 +339,8 @@ static void __init sam9x60_pmc_setup(struct device_node *np)
 							 sam9x60_periphck[i].n,
 							 "masterck_div",
 							 sam9x60_periphck[i].id,
-							 &range, INT_MIN);
+							 &range, INT_MIN,
+							 sam9x60_periphck[i].flags);
 		if (IS_ERR(hw))
 			goto err_free;
 
diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c
index 84156dc52bff..c0e3e1a4bbf3 100644
--- a/drivers/clk/at91/sama5d2.c
+++ b/drivers/clk/at91/sama5d2.c
@@ -40,9 +40,14 @@ static const struct clk_pcr_layout sama5d2_pcr_layout = {
 static const struct {
 	char *n;
 	char *p;
+	unsigned long flags;
 	u8 id;
 } sama5d2_systemck[] = {
-	{ .n = "ddrck", .p = "masterck_div", .id = 2 },
+	/*
+	 * ddrck feeds DDR controller and is enabled by bootloader thus we need
+	 * to keep it enabled in case there is no Linux consumer for it.
+	 */
+	{ .n = "ddrck", .p = "masterck_div", .id = 2, .flags = CLK_IS_CRITICAL },
 	{ .n = "lcdck", .p = "masterck_div", .id = 3 },
 	{ .n = "uhpck", .p = "usbck",        .id = 6 },
 	{ .n = "udpck", .p = "usbck",        .id = 7 },
@@ -97,6 +102,7 @@ static const struct {
 
 static const struct {
 	char *n;
+	unsigned long flags;
 	u8 id;
 } sama5d2_periphck[] = {
 	{ .n = "dma0_clk",    .id = 6, },
@@ -104,7 +110,11 @@ static const struct {
 	{ .n = "aes_clk",     .id = 9, },
 	{ .n = "aesb_clk",    .id = 10, },
 	{ .n = "sha_clk",     .id = 12, },
-	{ .n = "mpddr_clk",   .id = 13, },
+	/*
+	 * mpddr_clk feeds DDR controller and is enabled by bootloader thus we
+	 * need to keep it enabled in case there is no Linux consumer for it.
+	 */
+	{ .n = "mpddr_clk",   .id = 13, .flags = CLK_IS_CRITICAL },
 	{ .n = "matrix0_clk", .id = 15, },
 	{ .n = "sdmmc0_hclk", .id = 31, },
 	{ .n = "sdmmc1_hclk", .id = 32, },
@@ -302,7 +312,8 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
 	for (i = 0; i < ARRAY_SIZE(sama5d2_systemck); i++) {
 		hw = at91_clk_register_system(regmap, sama5d2_systemck[i].n,
 					      sama5d2_systemck[i].p,
-					      sama5d2_systemck[i].id);
+					      sama5d2_systemck[i].id,
+					      sama5d2_systemck[i].flags);
 		if (IS_ERR(hw))
 			goto err_free;
 
@@ -315,7 +326,8 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
 							 sama5d2_periphck[i].n,
 							 "masterck_div",
 							 sama5d2_periphck[i].id,
-							 &range, INT_MIN);
+							 &range, INT_MIN,
+							 sama5d2_periphck[i].flags);
 		if (IS_ERR(hw))
 			goto err_free;
 
@@ -329,7 +341,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
 							 "h32mxck",
 							 sama5d2_periph32ck[i].id,
 							 &sama5d2_periph32ck[i].r,
-							 INT_MIN);
+							 INT_MIN, 0);
 		if (IS_ERR(hw))
 			goto err_free;
 
diff --git a/drivers/clk/at91/sama5d3.c b/drivers/clk/at91/sama5d3.c
index 7e93c6edf305..ad6068b884de 100644
--- a/drivers/clk/at91/sama5d3.c
+++ b/drivers/clk/at91/sama5d3.c
@@ -40,9 +40,14 @@ static const struct clk_pcr_layout sama5d3_pcr_layout = {
 static const struct {
 	char *n;
 	char *p;
+	unsigned long flags;
 	u8 id;
 } sama5d3_systemck[] = {
-	{ .n = "ddrck", .p = "masterck_div", .id = 2 },
+	/*
+	 * ddrck feeds DDR controller and is enabled by bootloader thus we need
+	 * to keep it enabled in case there is no Linux consumer for it.
+	 */
+	{ .n = "ddrck", .p = "masterck_div", .id = 2, .flags = CLK_IS_CRITICAL },
 	{ .n = "lcdck", .p = "masterck_div", .id = 3 },
 	{ .n = "smdck", .p = "smdclk",       .id = 4 },
 	{ .n = "uhpck", .p = "usbck",        .id = 6 },
@@ -56,6 +61,7 @@ static const struct {
 	char *n;
 	u8 id;
 	struct clk_range r;
+	unsigned long flags;
 } sama5d3_periphck[] = {
 	{ .n = "dbgu_clk", .id = 2, },
 	{ .n = "hsmc_clk", .id = 5, },
@@ -99,7 +105,11 @@ static const struct {
 	{ .n = "tdes_clk", .id = 44, },
 	{ .n = "trng_clk", .id = 45, },
 	{ .n = "fuse_clk", .id = 48, },
-	{ .n = "mpddr_clk", .id = 49, },
+	/*
+	 * mpddr_clk feeds DDR controller and is enabled by bootloader thus we
+	 * need to keep it enabled in case there is no Linux consumer for it.
+	 */
+	{ .n = "mpddr_clk", .id = 49, .flags = CLK_IS_CRITICAL },
 };
 
 static void __init sama5d3_pmc_setup(struct device_node *np)
@@ -222,7 +232,8 @@ static void __init sama5d3_pmc_setup(struct device_node *np)
 	for (i = 0; i < ARRAY_SIZE(sama5d3_systemck); i++) {
 		hw = at91_clk_register_system(regmap, sama5d3_systemck[i].n,
 					      sama5d3_systemck[i].p,
-					      sama5d3_systemck[i].id);
+					      sama5d3_systemck[i].id,
+					      sama5d3_systemck[i].flags);
 		if (IS_ERR(hw))
 			goto err_free;
 
@@ -236,7 +247,8 @@ static void __init sama5d3_pmc_setup(struct device_node *np)
 							 "masterck_div",
 							 sama5d3_periphck[i].id,
 							 &sama5d3_periphck[i].r,
-							 INT_MIN);
+							 INT_MIN,
+							 sama5d3_periphck[i].flags);
 		if (IS_ERR(hw))
 			goto err_free;
 
diff --git a/drivers/clk/at91/sama5d4.c b/drivers/clk/at91/sama5d4.c
index 1a14a9bce308..e876ec971a39 100644
--- a/drivers/clk/at91/sama5d4.c
+++ b/drivers/clk/at91/sama5d4.c
@@ -39,9 +39,14 @@ static const struct clk_pcr_layout sama5d4_pcr_layout = {
 static const struct {
 	char *n;
 	char *p;
+	unsigned long flags;
 	u8 id;
 } sama5d4_systemck[] = {
-	{ .n = "ddrck", .p = "masterck_div", .id = 2 },
+	/*
+	 * ddrck feeds DDR controller and is enabled by bootloader thus we need
+	 * to keep it enabled in case there is no Linux consumer for it.
+	 */
+	{ .n = "ddrck", .p = "masterck_div", .id = 2, .flags = CLK_IS_CRITICAL },
 	{ .n = "lcdck", .p = "masterck_div", .id = 3 },
 	{ .n = "smdck", .p = "smdclk",       .id = 4 },
 	{ .n = "uhpck", .p = "usbck",        .id = 6 },
@@ -103,12 +108,17 @@ static const struct {
 
 static const struct {
 	char *n;
+	unsigned long flags;
 	u8 id;
 } sama5d4_periphck[] = {
 	{ .n = "dma0_clk", .id = 8 },
 	{ .n = "cpkcc_clk", .id = 10 },
 	{ .n = "aesb_clk", .id = 13 },
-	{ .n = "mpddr_clk", .id = 16 },
+	/*
+	 * mpddr_clk feeds DDR controller and is enabled by bootloader thus we
+	 * need to keep it enabled in case there is no Linux consumer for it.
+	 */
+	{ .n = "mpddr_clk", .id = 16, .flags = CLK_IS_CRITICAL },
 	{ .n = "matrix0_clk", .id = 18 },
 	{ .n = "vdec_clk", .id = 19 },
 	{ .n = "dma1_clk", .id = 50 },
@@ -245,7 +255,8 @@ static void __init sama5d4_pmc_setup(struct device_node *np)
 	for (i = 0; i < ARRAY_SIZE(sama5d4_systemck); i++) {
 		hw = at91_clk_register_system(regmap, sama5d4_systemck[i].n,
 					      sama5d4_systemck[i].p,
-					      sama5d4_systemck[i].id);
+					      sama5d4_systemck[i].id,
+					      sama5d4_systemck[i].flags);
 		if (IS_ERR(hw))
 			goto err_free;
 
@@ -258,7 +269,8 @@ static void __init sama5d4_pmc_setup(struct device_node *np)
 							 sama5d4_periphck[i].n,
 							 "masterck_div",
 							 sama5d4_periphck[i].id,
-							 &range, INT_MIN);
+							 &range, INT_MIN,
+							 sama5d4_periphck[i].flags);
 		if (IS_ERR(hw))
 			goto err_free;
 
@@ -271,7 +283,7 @@ static void __init sama5d4_pmc_setup(struct device_node *np)
 							 sama5d4_periph32ck[i].n,
 							 "h32mxck",
 							 sama5d4_periph32ck[i].id,
-							 &range, INT_MIN);
+							 &range, INT_MIN, 0);
 		if (IS_ERR(hw))
 			goto err_free;
 
diff --git a/drivers/clk/at91/sama7g5.c b/drivers/clk/at91/sama7g5.c
index 9a213ba9e58b..f135b662f1ff 100644
--- a/drivers/clk/at91/sama7g5.c
+++ b/drivers/clk/at91/sama7g5.c
@@ -1068,7 +1068,7 @@ static void __init sama7g5_pmc_setup(struct device_node *np)
 	for (i = 0; i < ARRAY_SIZE(sama7g5_systemck); i++) {
 		hw = at91_clk_register_system(regmap, sama7g5_systemck[i].n,
 					      sama7g5_systemck[i].p,
-					      sama7g5_systemck[i].id);
+					      sama7g5_systemck[i].id, 0);
 		if (IS_ERR(hw))
 			goto err_free;
 
@@ -1083,7 +1083,7 @@ static void __init sama7g5_pmc_setup(struct device_node *np)
 						sama7g5_periphck[i].id,
 						&sama7g5_periphck[i].r,
 						sama7g5_periphck[i].chgp ? 0 :
-						INT_MIN);
+						INT_MIN, 0);
 		if (IS_ERR(hw))
 			goto err_free;
 
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 2/3] memory: atmel-sdramc: remove the driver
  2022-12-08 11:45 ` Claudiu Beznea
@ 2022-12-08 11:45   ` Claudiu Beznea
  -1 siblings, 0 replies; 30+ messages in thread
From: Claudiu Beznea @ 2022-12-08 11:45 UTC (permalink / raw)
  To: mturquette, sboyd, nicolas.ferre, alexandre.belloni, krzysztof.kozlowski
  Cc: linux-kernel, linux-clk, linux-arm-kernel, Claudiu Beznea

Driver does only clock request + enable for DDR clocks. DDR clocks are
enabled by bootloader and need to stay that way in Linux. To avoid having
these clocks disabled by clock subsystem in case there are no Linux
consumers for them the clocks were marked as critical in clock drivers.
With this, there is no need to have a separate driver that only does
clock request + enable.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 drivers/memory/Makefile       |  1 -
 drivers/memory/atmel-sdramc.c | 76 -----------------------------------
 2 files changed, 77 deletions(-)
 delete mode 100644 drivers/memory/atmel-sdramc.c

diff --git a/drivers/memory/Makefile b/drivers/memory/Makefile
index e148f636c082..d1836be010ec 100644
--- a/drivers/memory/Makefile
+++ b/drivers/memory/Makefile
@@ -8,7 +8,6 @@ ifeq ($(CONFIG_DDR),y)
 obj-$(CONFIG_OF)		+= of_memory.o
 endif
 obj-$(CONFIG_ARM_PL172_MPMC)	+= pl172.o
-obj-$(CONFIG_ATMEL_SDRAMC)	+= atmel-sdramc.o
 obj-$(CONFIG_ATMEL_EBI)		+= atmel-ebi.o
 obj-$(CONFIG_BRCMSTB_DPFE)	+= brcmstb_dpfe.o
 obj-$(CONFIG_BRCMSTB_MEMC)	+= brcmstb_memc.o
diff --git a/drivers/memory/atmel-sdramc.c b/drivers/memory/atmel-sdramc.c
deleted file mode 100644
index 9c49d00c2a96..000000000000
--- a/drivers/memory/atmel-sdramc.c
+++ /dev/null
@@ -1,76 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Atmel (Multi-port DDR-)SDRAM Controller driver
- *
- * Author: Alexandre Belloni <alexandre.belloni@free-electrons.com>
- *
- * Copyright (C) 2014 Atmel
- */
-
-#include <linux/clk.h>
-#include <linux/err.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/of_platform.h>
-#include <linux/platform_device.h>
-
-struct at91_ramc_caps {
-	bool has_ddrck;
-	bool has_mpddr_clk;
-};
-
-static const struct at91_ramc_caps at91rm9200_caps = { };
-
-static const struct at91_ramc_caps at91sam9g45_caps = {
-	.has_ddrck = 1,
-	.has_mpddr_clk = 0,
-};
-
-static const struct at91_ramc_caps sama5d3_caps = {
-	.has_ddrck = 1,
-	.has_mpddr_clk = 1,
-};
-
-static const struct of_device_id atmel_ramc_of_match[] = {
-	{ .compatible = "atmel,at91rm9200-sdramc", .data = &at91rm9200_caps, },
-	{ .compatible = "atmel,at91sam9260-sdramc", .data = &at91rm9200_caps, },
-	{ .compatible = "atmel,at91sam9g45-ddramc", .data = &at91sam9g45_caps, },
-	{ .compatible = "atmel,sama5d3-ddramc", .data = &sama5d3_caps, },
-	{},
-};
-
-static int atmel_ramc_probe(struct platform_device *pdev)
-{
-	const struct at91_ramc_caps *caps;
-	struct clk *clk;
-
-	caps = of_device_get_match_data(&pdev->dev);
-
-	if (caps->has_ddrck) {
-		clk = devm_clk_get(&pdev->dev, "ddrck");
-		if (IS_ERR(clk))
-			return PTR_ERR(clk);
-		clk_prepare_enable(clk);
-	}
-
-	if (caps->has_mpddr_clk) {
-		clk = devm_clk_get(&pdev->dev, "mpddr");
-		if (IS_ERR(clk)) {
-			pr_err("AT91 RAMC: couldn't get mpddr clock\n");
-			return PTR_ERR(clk);
-		}
-		clk_prepare_enable(clk);
-	}
-
-	return 0;
-}
-
-static struct platform_driver atmel_ramc_driver = {
-	.probe		= atmel_ramc_probe,
-	.driver		= {
-		.name	= "atmel-ramc",
-		.of_match_table = atmel_ramc_of_match,
-	},
-};
-
-builtin_platform_driver(atmel_ramc_driver);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 2/3] memory: atmel-sdramc: remove the driver
@ 2022-12-08 11:45   ` Claudiu Beznea
  0 siblings, 0 replies; 30+ messages in thread
From: Claudiu Beznea @ 2022-12-08 11:45 UTC (permalink / raw)
  To: mturquette, sboyd, nicolas.ferre, alexandre.belloni, krzysztof.kozlowski
  Cc: linux-kernel, linux-clk, linux-arm-kernel, Claudiu Beznea

Driver does only clock request + enable for DDR clocks. DDR clocks are
enabled by bootloader and need to stay that way in Linux. To avoid having
these clocks disabled by clock subsystem in case there are no Linux
consumers for them the clocks were marked as critical in clock drivers.
With this, there is no need to have a separate driver that only does
clock request + enable.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 drivers/memory/Makefile       |  1 -
 drivers/memory/atmel-sdramc.c | 76 -----------------------------------
 2 files changed, 77 deletions(-)
 delete mode 100644 drivers/memory/atmel-sdramc.c

diff --git a/drivers/memory/Makefile b/drivers/memory/Makefile
index e148f636c082..d1836be010ec 100644
--- a/drivers/memory/Makefile
+++ b/drivers/memory/Makefile
@@ -8,7 +8,6 @@ ifeq ($(CONFIG_DDR),y)
 obj-$(CONFIG_OF)		+= of_memory.o
 endif
 obj-$(CONFIG_ARM_PL172_MPMC)	+= pl172.o
-obj-$(CONFIG_ATMEL_SDRAMC)	+= atmel-sdramc.o
 obj-$(CONFIG_ATMEL_EBI)		+= atmel-ebi.o
 obj-$(CONFIG_BRCMSTB_DPFE)	+= brcmstb_dpfe.o
 obj-$(CONFIG_BRCMSTB_MEMC)	+= brcmstb_memc.o
diff --git a/drivers/memory/atmel-sdramc.c b/drivers/memory/atmel-sdramc.c
deleted file mode 100644
index 9c49d00c2a96..000000000000
--- a/drivers/memory/atmel-sdramc.c
+++ /dev/null
@@ -1,76 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Atmel (Multi-port DDR-)SDRAM Controller driver
- *
- * Author: Alexandre Belloni <alexandre.belloni@free-electrons.com>
- *
- * Copyright (C) 2014 Atmel
- */
-
-#include <linux/clk.h>
-#include <linux/err.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/of_platform.h>
-#include <linux/platform_device.h>
-
-struct at91_ramc_caps {
-	bool has_ddrck;
-	bool has_mpddr_clk;
-};
-
-static const struct at91_ramc_caps at91rm9200_caps = { };
-
-static const struct at91_ramc_caps at91sam9g45_caps = {
-	.has_ddrck = 1,
-	.has_mpddr_clk = 0,
-};
-
-static const struct at91_ramc_caps sama5d3_caps = {
-	.has_ddrck = 1,
-	.has_mpddr_clk = 1,
-};
-
-static const struct of_device_id atmel_ramc_of_match[] = {
-	{ .compatible = "atmel,at91rm9200-sdramc", .data = &at91rm9200_caps, },
-	{ .compatible = "atmel,at91sam9260-sdramc", .data = &at91rm9200_caps, },
-	{ .compatible = "atmel,at91sam9g45-ddramc", .data = &at91sam9g45_caps, },
-	{ .compatible = "atmel,sama5d3-ddramc", .data = &sama5d3_caps, },
-	{},
-};
-
-static int atmel_ramc_probe(struct platform_device *pdev)
-{
-	const struct at91_ramc_caps *caps;
-	struct clk *clk;
-
-	caps = of_device_get_match_data(&pdev->dev);
-
-	if (caps->has_ddrck) {
-		clk = devm_clk_get(&pdev->dev, "ddrck");
-		if (IS_ERR(clk))
-			return PTR_ERR(clk);
-		clk_prepare_enable(clk);
-	}
-
-	if (caps->has_mpddr_clk) {
-		clk = devm_clk_get(&pdev->dev, "mpddr");
-		if (IS_ERR(clk)) {
-			pr_err("AT91 RAMC: couldn't get mpddr clock\n");
-			return PTR_ERR(clk);
-		}
-		clk_prepare_enable(clk);
-	}
-
-	return 0;
-}
-
-static struct platform_driver atmel_ramc_driver = {
-	.probe		= atmel_ramc_probe,
-	.driver		= {
-		.name	= "atmel-ramc",
-		.of_match_table = atmel_ramc_of_match,
-	},
-};
-
-builtin_platform_driver(atmel_ramc_driver);
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 3/3] clk: at91: do not compile dt-compat.c for sama7g5 and sam9x60
  2022-12-08 11:45 ` Claudiu Beznea
@ 2022-12-08 11:45   ` Claudiu Beznea
  -1 siblings, 0 replies; 30+ messages in thread
From: Claudiu Beznea @ 2022-12-08 11:45 UTC (permalink / raw)
  To: mturquette, sboyd, nicolas.ferre, alexandre.belloni, krzysztof.kozlowski
  Cc: linux-kernel, linux-clk, linux-arm-kernel, Claudiu Beznea

There is no need to have dt-compat.c compiled for SAMA7G5 and SAM9X60
as there is no in kernel device tree that could use it. Thus avoid
compiling dt-compat.c for them.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 drivers/clk/at91/Makefile | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/at91/Makefile b/drivers/clk/at91/Makefile
index 79301e1c1c36..89061b85e7d2 100644
--- a/drivers/clk/at91/Makefile
+++ b/drivers/clk/at91/Makefile
@@ -3,7 +3,7 @@
 # Makefile for at91 specific clk
 #
 
-obj-y += pmc.o sckc.o dt-compat.o
+obj-y += pmc.o sckc.o
 obj-y += clk-slow.o clk-main.o clk-pll.o clk-plldiv.o clk-master.o
 obj-y += clk-system.o clk-peripheral.o clk-programmable.o
 
@@ -15,12 +15,12 @@ obj-$(CONFIG_HAVE_AT91_H32MX)		+= clk-h32mx.o
 obj-$(CONFIG_HAVE_AT91_GENERATED_CLK)	+= clk-generated.o
 obj-$(CONFIG_HAVE_AT91_I2S_MUX_CLK)	+= clk-i2s-mux.o
 obj-$(CONFIG_HAVE_AT91_SAM9X60_PLL)	+= clk-sam9x60-pll.o
-obj-$(CONFIG_SOC_AT91RM9200) += at91rm9200.o
-obj-$(CONFIG_SOC_AT91SAM9) += at91sam9260.o at91sam9rl.o at91sam9x5.o
-obj-$(CONFIG_SOC_AT91SAM9) += at91sam9g45.o
-obj-$(CONFIG_SOC_AT91SAM9) += at91sam9n12.o at91sam9x5.o
+obj-$(CONFIG_SOC_AT91RM9200) += at91rm9200.o dt-compat.o
+obj-$(CONFIG_SOC_AT91SAM9) += at91sam9260.o at91sam9rl.o at91sam9x5.o dt-compat.o
+obj-$(CONFIG_SOC_AT91SAM9) += at91sam9g45.o dt-compat.o
+obj-$(CONFIG_SOC_AT91SAM9) += at91sam9n12.o at91sam9x5.o dt-compat.o
 obj-$(CONFIG_SOC_SAM9X60) += sam9x60.o
-obj-$(CONFIG_SOC_SAMA5D3) += sama5d3.o
-obj-$(CONFIG_SOC_SAMA5D4) += sama5d4.o
-obj-$(CONFIG_SOC_SAMA5D2) += sama5d2.o
+obj-$(CONFIG_SOC_SAMA5D3) += sama5d3.o dt-compat.o
+obj-$(CONFIG_SOC_SAMA5D4) += sama5d4.o dt-compat.o
+obj-$(CONFIG_SOC_SAMA5D2) += sama5d2.o dt-compat.o
 obj-$(CONFIG_SOC_SAMA7G5) += sama7g5.o
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 3/3] clk: at91: do not compile dt-compat.c for sama7g5 and sam9x60
@ 2022-12-08 11:45   ` Claudiu Beznea
  0 siblings, 0 replies; 30+ messages in thread
From: Claudiu Beznea @ 2022-12-08 11:45 UTC (permalink / raw)
  To: mturquette, sboyd, nicolas.ferre, alexandre.belloni, krzysztof.kozlowski
  Cc: linux-kernel, linux-clk, linux-arm-kernel, Claudiu Beznea

There is no need to have dt-compat.c compiled for SAMA7G5 and SAM9X60
as there is no in kernel device tree that could use it. Thus avoid
compiling dt-compat.c for them.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 drivers/clk/at91/Makefile | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/at91/Makefile b/drivers/clk/at91/Makefile
index 79301e1c1c36..89061b85e7d2 100644
--- a/drivers/clk/at91/Makefile
+++ b/drivers/clk/at91/Makefile
@@ -3,7 +3,7 @@
 # Makefile for at91 specific clk
 #
 
-obj-y += pmc.o sckc.o dt-compat.o
+obj-y += pmc.o sckc.o
 obj-y += clk-slow.o clk-main.o clk-pll.o clk-plldiv.o clk-master.o
 obj-y += clk-system.o clk-peripheral.o clk-programmable.o
 
@@ -15,12 +15,12 @@ obj-$(CONFIG_HAVE_AT91_H32MX)		+= clk-h32mx.o
 obj-$(CONFIG_HAVE_AT91_GENERATED_CLK)	+= clk-generated.o
 obj-$(CONFIG_HAVE_AT91_I2S_MUX_CLK)	+= clk-i2s-mux.o
 obj-$(CONFIG_HAVE_AT91_SAM9X60_PLL)	+= clk-sam9x60-pll.o
-obj-$(CONFIG_SOC_AT91RM9200) += at91rm9200.o
-obj-$(CONFIG_SOC_AT91SAM9) += at91sam9260.o at91sam9rl.o at91sam9x5.o
-obj-$(CONFIG_SOC_AT91SAM9) += at91sam9g45.o
-obj-$(CONFIG_SOC_AT91SAM9) += at91sam9n12.o at91sam9x5.o
+obj-$(CONFIG_SOC_AT91RM9200) += at91rm9200.o dt-compat.o
+obj-$(CONFIG_SOC_AT91SAM9) += at91sam9260.o at91sam9rl.o at91sam9x5.o dt-compat.o
+obj-$(CONFIG_SOC_AT91SAM9) += at91sam9g45.o dt-compat.o
+obj-$(CONFIG_SOC_AT91SAM9) += at91sam9n12.o at91sam9x5.o dt-compat.o
 obj-$(CONFIG_SOC_SAM9X60) += sam9x60.o
-obj-$(CONFIG_SOC_SAMA5D3) += sama5d3.o
-obj-$(CONFIG_SOC_SAMA5D4) += sama5d4.o
-obj-$(CONFIG_SOC_SAMA5D2) += sama5d2.o
+obj-$(CONFIG_SOC_SAMA5D3) += sama5d3.o dt-compat.o
+obj-$(CONFIG_SOC_SAMA5D4) += sama5d4.o dt-compat.o
+obj-$(CONFIG_SOC_SAMA5D2) += sama5d2.o dt-compat.o
 obj-$(CONFIG_SOC_SAMA7G5) += sama7g5.o
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* Re: [PATCH 3/3] clk: at91: do not compile dt-compat.c for sama7g5 and sam9x60
  2022-12-08 11:45   ` Claudiu Beznea
@ 2022-12-08 14:39     ` Alexandre Belloni
  -1 siblings, 0 replies; 30+ messages in thread
From: Alexandre Belloni @ 2022-12-08 14:39 UTC (permalink / raw)
  To: Claudiu Beznea
  Cc: mturquette, sboyd, nicolas.ferre, krzysztof.kozlowski,
	linux-kernel, linux-clk, linux-arm-kernel

On 08/12/2022 13:45:15+0200, Claudiu Beznea wrote:
> There is no need to have dt-compat.c compiled for SAMA7G5 and SAM9X60
> as there is no in kernel device tree that could use it. Thus avoid
> compiling dt-compat.c for them.
> 

Isn't it time to drop dt-compat.c? I was going to send a patch after 6.1
is released

> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
> ---
>  drivers/clk/at91/Makefile | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/clk/at91/Makefile b/drivers/clk/at91/Makefile
> index 79301e1c1c36..89061b85e7d2 100644
> --- a/drivers/clk/at91/Makefile
> +++ b/drivers/clk/at91/Makefile
> @@ -3,7 +3,7 @@
>  # Makefile for at91 specific clk
>  #
>  
> -obj-y += pmc.o sckc.o dt-compat.o
> +obj-y += pmc.o sckc.o
>  obj-y += clk-slow.o clk-main.o clk-pll.o clk-plldiv.o clk-master.o
>  obj-y += clk-system.o clk-peripheral.o clk-programmable.o
>  
> @@ -15,12 +15,12 @@ obj-$(CONFIG_HAVE_AT91_H32MX)		+= clk-h32mx.o
>  obj-$(CONFIG_HAVE_AT91_GENERATED_CLK)	+= clk-generated.o
>  obj-$(CONFIG_HAVE_AT91_I2S_MUX_CLK)	+= clk-i2s-mux.o
>  obj-$(CONFIG_HAVE_AT91_SAM9X60_PLL)	+= clk-sam9x60-pll.o
> -obj-$(CONFIG_SOC_AT91RM9200) += at91rm9200.o
> -obj-$(CONFIG_SOC_AT91SAM9) += at91sam9260.o at91sam9rl.o at91sam9x5.o
> -obj-$(CONFIG_SOC_AT91SAM9) += at91sam9g45.o
> -obj-$(CONFIG_SOC_AT91SAM9) += at91sam9n12.o at91sam9x5.o
> +obj-$(CONFIG_SOC_AT91RM9200) += at91rm9200.o dt-compat.o
> +obj-$(CONFIG_SOC_AT91SAM9) += at91sam9260.o at91sam9rl.o at91sam9x5.o dt-compat.o
> +obj-$(CONFIG_SOC_AT91SAM9) += at91sam9g45.o dt-compat.o
> +obj-$(CONFIG_SOC_AT91SAM9) += at91sam9n12.o at91sam9x5.o dt-compat.o
>  obj-$(CONFIG_SOC_SAM9X60) += sam9x60.o
> -obj-$(CONFIG_SOC_SAMA5D3) += sama5d3.o
> -obj-$(CONFIG_SOC_SAMA5D4) += sama5d4.o
> -obj-$(CONFIG_SOC_SAMA5D2) += sama5d2.o
> +obj-$(CONFIG_SOC_SAMA5D3) += sama5d3.o dt-compat.o
> +obj-$(CONFIG_SOC_SAMA5D4) += sama5d4.o dt-compat.o
> +obj-$(CONFIG_SOC_SAMA5D2) += sama5d2.o dt-compat.o
>  obj-$(CONFIG_SOC_SAMA7G5) += sama7g5.o
> -- 
> 2.34.1
> 

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 3/3] clk: at91: do not compile dt-compat.c for sama7g5 and sam9x60
@ 2022-12-08 14:39     ` Alexandre Belloni
  0 siblings, 0 replies; 30+ messages in thread
From: Alexandre Belloni @ 2022-12-08 14:39 UTC (permalink / raw)
  To: Claudiu Beznea
  Cc: sboyd, mturquette, linux-kernel, krzysztof.kozlowski, linux-clk,
	linux-arm-kernel

On 08/12/2022 13:45:15+0200, Claudiu Beznea wrote:
> There is no need to have dt-compat.c compiled for SAMA7G5 and SAM9X60
> as there is no in kernel device tree that could use it. Thus avoid
> compiling dt-compat.c for them.
> 

Isn't it time to drop dt-compat.c? I was going to send a patch after 6.1
is released

> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
> ---
>  drivers/clk/at91/Makefile | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/clk/at91/Makefile b/drivers/clk/at91/Makefile
> index 79301e1c1c36..89061b85e7d2 100644
> --- a/drivers/clk/at91/Makefile
> +++ b/drivers/clk/at91/Makefile
> @@ -3,7 +3,7 @@
>  # Makefile for at91 specific clk
>  #
>  
> -obj-y += pmc.o sckc.o dt-compat.o
> +obj-y += pmc.o sckc.o
>  obj-y += clk-slow.o clk-main.o clk-pll.o clk-plldiv.o clk-master.o
>  obj-y += clk-system.o clk-peripheral.o clk-programmable.o
>  
> @@ -15,12 +15,12 @@ obj-$(CONFIG_HAVE_AT91_H32MX)		+= clk-h32mx.o
>  obj-$(CONFIG_HAVE_AT91_GENERATED_CLK)	+= clk-generated.o
>  obj-$(CONFIG_HAVE_AT91_I2S_MUX_CLK)	+= clk-i2s-mux.o
>  obj-$(CONFIG_HAVE_AT91_SAM9X60_PLL)	+= clk-sam9x60-pll.o
> -obj-$(CONFIG_SOC_AT91RM9200) += at91rm9200.o
> -obj-$(CONFIG_SOC_AT91SAM9) += at91sam9260.o at91sam9rl.o at91sam9x5.o
> -obj-$(CONFIG_SOC_AT91SAM9) += at91sam9g45.o
> -obj-$(CONFIG_SOC_AT91SAM9) += at91sam9n12.o at91sam9x5.o
> +obj-$(CONFIG_SOC_AT91RM9200) += at91rm9200.o dt-compat.o
> +obj-$(CONFIG_SOC_AT91SAM9) += at91sam9260.o at91sam9rl.o at91sam9x5.o dt-compat.o
> +obj-$(CONFIG_SOC_AT91SAM9) += at91sam9g45.o dt-compat.o
> +obj-$(CONFIG_SOC_AT91SAM9) += at91sam9n12.o at91sam9x5.o dt-compat.o
>  obj-$(CONFIG_SOC_SAM9X60) += sam9x60.o
> -obj-$(CONFIG_SOC_SAMA5D3) += sama5d3.o
> -obj-$(CONFIG_SOC_SAMA5D4) += sama5d4.o
> -obj-$(CONFIG_SOC_SAMA5D2) += sama5d2.o
> +obj-$(CONFIG_SOC_SAMA5D3) += sama5d3.o dt-compat.o
> +obj-$(CONFIG_SOC_SAMA5D4) += sama5d4.o dt-compat.o
> +obj-$(CONFIG_SOC_SAMA5D2) += sama5d2.o dt-compat.o
>  obj-$(CONFIG_SOC_SAMA7G5) += sama7g5.o
> -- 
> 2.34.1
> 

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 3/3] clk: at91: do not compile dt-compat.c for sama7g5 and sam9x60
  2022-12-08 14:39     ` Alexandre Belloni
@ 2022-12-08 15:17       ` Claudiu.Beznea
  -1 siblings, 0 replies; 30+ messages in thread
From: Claudiu.Beznea @ 2022-12-08 15:17 UTC (permalink / raw)
  To: alexandre.belloni
  Cc: sboyd, mturquette, linux-kernel, krzysztof.kozlowski, linux-clk,
	linux-arm-kernel

On 08.12.2022 16:39, Alexandre Belloni wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On 08/12/2022 13:45:15+0200, Claudiu Beznea wrote:
>> There is no need to have dt-compat.c compiled for SAMA7G5 and SAM9X60
>> as there is no in kernel device tree that could use it. Thus avoid
>> compiling dt-compat.c for them.
>>
> 
> Isn't it time to drop dt-compat.c? 

My assumption was that we need to guarantee that old device trees will
still work with newer kernels. Should we guarantee this only for a limited
period of time?

> I was going to send a patch after 6.1
> is released
> 
>> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
>> ---
>>  drivers/clk/at91/Makefile | 16 ++++++++--------
>>  1 file changed, 8 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/clk/at91/Makefile b/drivers/clk/at91/Makefile
>> index 79301e1c1c36..89061b85e7d2 100644
>> --- a/drivers/clk/at91/Makefile
>> +++ b/drivers/clk/at91/Makefile
>> @@ -3,7 +3,7 @@
>>  # Makefile for at91 specific clk
>>  #
>>
>> -obj-y += pmc.o sckc.o dt-compat.o
>> +obj-y += pmc.o sckc.o
>>  obj-y += clk-slow.o clk-main.o clk-pll.o clk-plldiv.o clk-master.o
>>  obj-y += clk-system.o clk-peripheral.o clk-programmable.o
>>
>> @@ -15,12 +15,12 @@ obj-$(CONFIG_HAVE_AT91_H32MX)             += clk-h32mx.o
>>  obj-$(CONFIG_HAVE_AT91_GENERATED_CLK)        += clk-generated.o
>>  obj-$(CONFIG_HAVE_AT91_I2S_MUX_CLK)  += clk-i2s-mux.o
>>  obj-$(CONFIG_HAVE_AT91_SAM9X60_PLL)  += clk-sam9x60-pll.o
>> -obj-$(CONFIG_SOC_AT91RM9200) += at91rm9200.o
>> -obj-$(CONFIG_SOC_AT91SAM9) += at91sam9260.o at91sam9rl.o at91sam9x5.o
>> -obj-$(CONFIG_SOC_AT91SAM9) += at91sam9g45.o
>> -obj-$(CONFIG_SOC_AT91SAM9) += at91sam9n12.o at91sam9x5.o
>> +obj-$(CONFIG_SOC_AT91RM9200) += at91rm9200.o dt-compat.o
>> +obj-$(CONFIG_SOC_AT91SAM9) += at91sam9260.o at91sam9rl.o at91sam9x5.o dt-compat.o
>> +obj-$(CONFIG_SOC_AT91SAM9) += at91sam9g45.o dt-compat.o
>> +obj-$(CONFIG_SOC_AT91SAM9) += at91sam9n12.o at91sam9x5.o dt-compat.o
>>  obj-$(CONFIG_SOC_SAM9X60) += sam9x60.o
>> -obj-$(CONFIG_SOC_SAMA5D3) += sama5d3.o
>> -obj-$(CONFIG_SOC_SAMA5D4) += sama5d4.o
>> -obj-$(CONFIG_SOC_SAMA5D2) += sama5d2.o
>> +obj-$(CONFIG_SOC_SAMA5D3) += sama5d3.o dt-compat.o
>> +obj-$(CONFIG_SOC_SAMA5D4) += sama5d4.o dt-compat.o
>> +obj-$(CONFIG_SOC_SAMA5D2) += sama5d2.o dt-compat.o
>>  obj-$(CONFIG_SOC_SAMA7G5) += sama7g5.o
>> --
>> 2.34.1
>>
> 
> --
> Alexandre Belloni, co-owner and COO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 3/3] clk: at91: do not compile dt-compat.c for sama7g5 and sam9x60
@ 2022-12-08 15:17       ` Claudiu.Beznea
  0 siblings, 0 replies; 30+ messages in thread
From: Claudiu.Beznea @ 2022-12-08 15:17 UTC (permalink / raw)
  To: alexandre.belloni
  Cc: mturquette, sboyd, Nicolas.Ferre, krzysztof.kozlowski,
	linux-kernel, linux-clk, linux-arm-kernel

On 08.12.2022 16:39, Alexandre Belloni wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On 08/12/2022 13:45:15+0200, Claudiu Beznea wrote:
>> There is no need to have dt-compat.c compiled for SAMA7G5 and SAM9X60
>> as there is no in kernel device tree that could use it. Thus avoid
>> compiling dt-compat.c for them.
>>
> 
> Isn't it time to drop dt-compat.c? 

My assumption was that we need to guarantee that old device trees will
still work with newer kernels. Should we guarantee this only for a limited
period of time?

> I was going to send a patch after 6.1
> is released
> 
>> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
>> ---
>>  drivers/clk/at91/Makefile | 16 ++++++++--------
>>  1 file changed, 8 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/clk/at91/Makefile b/drivers/clk/at91/Makefile
>> index 79301e1c1c36..89061b85e7d2 100644
>> --- a/drivers/clk/at91/Makefile
>> +++ b/drivers/clk/at91/Makefile
>> @@ -3,7 +3,7 @@
>>  # Makefile for at91 specific clk
>>  #
>>
>> -obj-y += pmc.o sckc.o dt-compat.o
>> +obj-y += pmc.o sckc.o
>>  obj-y += clk-slow.o clk-main.o clk-pll.o clk-plldiv.o clk-master.o
>>  obj-y += clk-system.o clk-peripheral.o clk-programmable.o
>>
>> @@ -15,12 +15,12 @@ obj-$(CONFIG_HAVE_AT91_H32MX)             += clk-h32mx.o
>>  obj-$(CONFIG_HAVE_AT91_GENERATED_CLK)        += clk-generated.o
>>  obj-$(CONFIG_HAVE_AT91_I2S_MUX_CLK)  += clk-i2s-mux.o
>>  obj-$(CONFIG_HAVE_AT91_SAM9X60_PLL)  += clk-sam9x60-pll.o
>> -obj-$(CONFIG_SOC_AT91RM9200) += at91rm9200.o
>> -obj-$(CONFIG_SOC_AT91SAM9) += at91sam9260.o at91sam9rl.o at91sam9x5.o
>> -obj-$(CONFIG_SOC_AT91SAM9) += at91sam9g45.o
>> -obj-$(CONFIG_SOC_AT91SAM9) += at91sam9n12.o at91sam9x5.o
>> +obj-$(CONFIG_SOC_AT91RM9200) += at91rm9200.o dt-compat.o
>> +obj-$(CONFIG_SOC_AT91SAM9) += at91sam9260.o at91sam9rl.o at91sam9x5.o dt-compat.o
>> +obj-$(CONFIG_SOC_AT91SAM9) += at91sam9g45.o dt-compat.o
>> +obj-$(CONFIG_SOC_AT91SAM9) += at91sam9n12.o at91sam9x5.o dt-compat.o
>>  obj-$(CONFIG_SOC_SAM9X60) += sam9x60.o
>> -obj-$(CONFIG_SOC_SAMA5D3) += sama5d3.o
>> -obj-$(CONFIG_SOC_SAMA5D4) += sama5d4.o
>> -obj-$(CONFIG_SOC_SAMA5D2) += sama5d2.o
>> +obj-$(CONFIG_SOC_SAMA5D3) += sama5d3.o dt-compat.o
>> +obj-$(CONFIG_SOC_SAMA5D4) += sama5d4.o dt-compat.o
>> +obj-$(CONFIG_SOC_SAMA5D2) += sama5d2.o dt-compat.o
>>  obj-$(CONFIG_SOC_SAMA7G5) += sama7g5.o
>> --
>> 2.34.1
>>
> 
> --
> Alexandre Belloni, co-owner and COO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 2/3] memory: atmel-sdramc: remove the driver
  2022-12-08 11:45   ` Claudiu Beznea
@ 2023-01-03 10:00     ` Claudiu.Beznea
  -1 siblings, 0 replies; 30+ messages in thread
From: Claudiu.Beznea @ 2023-01-03 10:00 UTC (permalink / raw)
  To: mturquette, sboyd, Nicolas.Ferre, alexandre.belloni, krzysztof.kozlowski
  Cc: linux-kernel, linux-clk, linux-arm-kernel

Hi, Krzysztof,

On 08.12.2022 13:45, Claudiu Beznea wrote:
> Driver does only clock request + enable for DDR clocks. DDR clocks are
> enabled by bootloader and need to stay that way in Linux. To avoid having
> these clocks disabled by clock subsystem in case there are no Linux
> consumers for them the clocks were marked as critical in clock drivers.
> With this, there is no need to have a separate driver that only does
> clock request + enable.
> 
> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>

As this patch depends on patch 1/3 from this series, can I have your ack
for it to take it though clock tree?

Thank you,
Claudiu

> ---
>  drivers/memory/Makefile       |  1 -
>  drivers/memory/atmel-sdramc.c | 76 -----------------------------------
>  2 files changed, 77 deletions(-)
>  delete mode 100644 drivers/memory/atmel-sdramc.c
> 
> diff --git a/drivers/memory/Makefile b/drivers/memory/Makefile
> index e148f636c082..d1836be010ec 100644
> --- a/drivers/memory/Makefile
> +++ b/drivers/memory/Makefile
> @@ -8,7 +8,6 @@ ifeq ($(CONFIG_DDR),y)
>  obj-$(CONFIG_OF)		+= of_memory.o
>  endif
>  obj-$(CONFIG_ARM_PL172_MPMC)	+= pl172.o
> -obj-$(CONFIG_ATMEL_SDRAMC)	+= atmel-sdramc.o
>  obj-$(CONFIG_ATMEL_EBI)		+= atmel-ebi.o
>  obj-$(CONFIG_BRCMSTB_DPFE)	+= brcmstb_dpfe.o
>  obj-$(CONFIG_BRCMSTB_MEMC)	+= brcmstb_memc.o
> diff --git a/drivers/memory/atmel-sdramc.c b/drivers/memory/atmel-sdramc.c
> deleted file mode 100644
> index 9c49d00c2a96..000000000000
> --- a/drivers/memory/atmel-sdramc.c
> +++ /dev/null
> @@ -1,76 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-only
> -/*
> - * Atmel (Multi-port DDR-)SDRAM Controller driver
> - *
> - * Author: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> - *
> - * Copyright (C) 2014 Atmel
> - */
> -
> -#include <linux/clk.h>
> -#include <linux/err.h>
> -#include <linux/kernel.h>
> -#include <linux/init.h>
> -#include <linux/of_platform.h>
> -#include <linux/platform_device.h>
> -
> -struct at91_ramc_caps {
> -	bool has_ddrck;
> -	bool has_mpddr_clk;
> -};
> -
> -static const struct at91_ramc_caps at91rm9200_caps = { };
> -
> -static const struct at91_ramc_caps at91sam9g45_caps = {
> -	.has_ddrck = 1,
> -	.has_mpddr_clk = 0,
> -};
> -
> -static const struct at91_ramc_caps sama5d3_caps = {
> -	.has_ddrck = 1,
> -	.has_mpddr_clk = 1,
> -};
> -
> -static const struct of_device_id atmel_ramc_of_match[] = {
> -	{ .compatible = "atmel,at91rm9200-sdramc", .data = &at91rm9200_caps, },
> -	{ .compatible = "atmel,at91sam9260-sdramc", .data = &at91rm9200_caps, },
> -	{ .compatible = "atmel,at91sam9g45-ddramc", .data = &at91sam9g45_caps, },
> -	{ .compatible = "atmel,sama5d3-ddramc", .data = &sama5d3_caps, },
> -	{},
> -};
> -
> -static int atmel_ramc_probe(struct platform_device *pdev)
> -{
> -	const struct at91_ramc_caps *caps;
> -	struct clk *clk;
> -
> -	caps = of_device_get_match_data(&pdev->dev);
> -
> -	if (caps->has_ddrck) {
> -		clk = devm_clk_get(&pdev->dev, "ddrck");
> -		if (IS_ERR(clk))
> -			return PTR_ERR(clk);
> -		clk_prepare_enable(clk);
> -	}
> -
> -	if (caps->has_mpddr_clk) {
> -		clk = devm_clk_get(&pdev->dev, "mpddr");
> -		if (IS_ERR(clk)) {
> -			pr_err("AT91 RAMC: couldn't get mpddr clock\n");
> -			return PTR_ERR(clk);
> -		}
> -		clk_prepare_enable(clk);
> -	}
> -
> -	return 0;
> -}
> -
> -static struct platform_driver atmel_ramc_driver = {
> -	.probe		= atmel_ramc_probe,
> -	.driver		= {
> -		.name	= "atmel-ramc",
> -		.of_match_table = atmel_ramc_of_match,
> -	},
> -};
> -
> -builtin_platform_driver(atmel_ramc_driver);


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 2/3] memory: atmel-sdramc: remove the driver
@ 2023-01-03 10:00     ` Claudiu.Beznea
  0 siblings, 0 replies; 30+ messages in thread
From: Claudiu.Beznea @ 2023-01-03 10:00 UTC (permalink / raw)
  To: mturquette, sboyd, Nicolas.Ferre, alexandre.belloni, krzysztof.kozlowski
  Cc: linux-kernel, linux-clk, linux-arm-kernel

Hi, Krzysztof,

On 08.12.2022 13:45, Claudiu Beznea wrote:
> Driver does only clock request + enable for DDR clocks. DDR clocks are
> enabled by bootloader and need to stay that way in Linux. To avoid having
> these clocks disabled by clock subsystem in case there are no Linux
> consumers for them the clocks were marked as critical in clock drivers.
> With this, there is no need to have a separate driver that only does
> clock request + enable.
> 
> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>

As this patch depends on patch 1/3 from this series, can I have your ack
for it to take it though clock tree?

Thank you,
Claudiu

> ---
>  drivers/memory/Makefile       |  1 -
>  drivers/memory/atmel-sdramc.c | 76 -----------------------------------
>  2 files changed, 77 deletions(-)
>  delete mode 100644 drivers/memory/atmel-sdramc.c
> 
> diff --git a/drivers/memory/Makefile b/drivers/memory/Makefile
> index e148f636c082..d1836be010ec 100644
> --- a/drivers/memory/Makefile
> +++ b/drivers/memory/Makefile
> @@ -8,7 +8,6 @@ ifeq ($(CONFIG_DDR),y)
>  obj-$(CONFIG_OF)		+= of_memory.o
>  endif
>  obj-$(CONFIG_ARM_PL172_MPMC)	+= pl172.o
> -obj-$(CONFIG_ATMEL_SDRAMC)	+= atmel-sdramc.o
>  obj-$(CONFIG_ATMEL_EBI)		+= atmel-ebi.o
>  obj-$(CONFIG_BRCMSTB_DPFE)	+= brcmstb_dpfe.o
>  obj-$(CONFIG_BRCMSTB_MEMC)	+= brcmstb_memc.o
> diff --git a/drivers/memory/atmel-sdramc.c b/drivers/memory/atmel-sdramc.c
> deleted file mode 100644
> index 9c49d00c2a96..000000000000
> --- a/drivers/memory/atmel-sdramc.c
> +++ /dev/null
> @@ -1,76 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-only
> -/*
> - * Atmel (Multi-port DDR-)SDRAM Controller driver
> - *
> - * Author: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> - *
> - * Copyright (C) 2014 Atmel
> - */
> -
> -#include <linux/clk.h>
> -#include <linux/err.h>
> -#include <linux/kernel.h>
> -#include <linux/init.h>
> -#include <linux/of_platform.h>
> -#include <linux/platform_device.h>
> -
> -struct at91_ramc_caps {
> -	bool has_ddrck;
> -	bool has_mpddr_clk;
> -};
> -
> -static const struct at91_ramc_caps at91rm9200_caps = { };
> -
> -static const struct at91_ramc_caps at91sam9g45_caps = {
> -	.has_ddrck = 1,
> -	.has_mpddr_clk = 0,
> -};
> -
> -static const struct at91_ramc_caps sama5d3_caps = {
> -	.has_ddrck = 1,
> -	.has_mpddr_clk = 1,
> -};
> -
> -static const struct of_device_id atmel_ramc_of_match[] = {
> -	{ .compatible = "atmel,at91rm9200-sdramc", .data = &at91rm9200_caps, },
> -	{ .compatible = "atmel,at91sam9260-sdramc", .data = &at91rm9200_caps, },
> -	{ .compatible = "atmel,at91sam9g45-ddramc", .data = &at91sam9g45_caps, },
> -	{ .compatible = "atmel,sama5d3-ddramc", .data = &sama5d3_caps, },
> -	{},
> -};
> -
> -static int atmel_ramc_probe(struct platform_device *pdev)
> -{
> -	const struct at91_ramc_caps *caps;
> -	struct clk *clk;
> -
> -	caps = of_device_get_match_data(&pdev->dev);
> -
> -	if (caps->has_ddrck) {
> -		clk = devm_clk_get(&pdev->dev, "ddrck");
> -		if (IS_ERR(clk))
> -			return PTR_ERR(clk);
> -		clk_prepare_enable(clk);
> -	}
> -
> -	if (caps->has_mpddr_clk) {
> -		clk = devm_clk_get(&pdev->dev, "mpddr");
> -		if (IS_ERR(clk)) {
> -			pr_err("AT91 RAMC: couldn't get mpddr clock\n");
> -			return PTR_ERR(clk);
> -		}
> -		clk_prepare_enable(clk);
> -	}
> -
> -	return 0;
> -}
> -
> -static struct platform_driver atmel_ramc_driver = {
> -	.probe		= atmel_ramc_probe,
> -	.driver		= {
> -		.name	= "atmel-ramc",
> -		.of_match_table = atmel_ramc_of_match,
> -	},
> -};
> -
> -builtin_platform_driver(atmel_ramc_driver);

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 2/3] memory: atmel-sdramc: remove the driver
  2023-01-03 10:00     ` Claudiu.Beznea
@ 2023-01-03 10:06       ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 30+ messages in thread
From: Krzysztof Kozlowski @ 2023-01-03 10:06 UTC (permalink / raw)
  To: Claudiu.Beznea, mturquette, sboyd, Nicolas.Ferre, alexandre.belloni
  Cc: linux-kernel, linux-clk, linux-arm-kernel

On 03/01/2023 11:00, Claudiu.Beznea@microchip.com wrote:
> Hi, Krzysztof,
> 
> On 08.12.2022 13:45, Claudiu Beznea wrote:
>> Driver does only clock request + enable for DDR clocks. DDR clocks are
>> enabled by bootloader and need to stay that way in Linux. To avoid having
>> these clocks disabled by clock subsystem in case there are no Linux
>> consumers for them the clocks were marked as critical in clock drivers.
>> With this, there is no need to have a separate driver that only does
>> clock request + enable.
>>
>> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
> 
> As this patch depends on patch 1/3 from this series, can I have your ack
> for it to take it though clock tree?

Uh, why does it depend? I understood the changset is bisectable and
removal of unneeded driver will happen later. Otherwise it is not
bisectable...

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 2/3] memory: atmel-sdramc: remove the driver
@ 2023-01-03 10:06       ` Krzysztof Kozlowski
  0 siblings, 0 replies; 30+ messages in thread
From: Krzysztof Kozlowski @ 2023-01-03 10:06 UTC (permalink / raw)
  To: Claudiu.Beznea, mturquette, sboyd, Nicolas.Ferre, alexandre.belloni
  Cc: linux-kernel, linux-clk, linux-arm-kernel

On 03/01/2023 11:00, Claudiu.Beznea@microchip.com wrote:
> Hi, Krzysztof,
> 
> On 08.12.2022 13:45, Claudiu Beznea wrote:
>> Driver does only clock request + enable for DDR clocks. DDR clocks are
>> enabled by bootloader and need to stay that way in Linux. To avoid having
>> these clocks disabled by clock subsystem in case there are no Linux
>> consumers for them the clocks were marked as critical in clock drivers.
>> With this, there is no need to have a separate driver that only does
>> clock request + enable.
>>
>> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
> 
> As this patch depends on patch 1/3 from this series, can I have your ack
> for it to take it though clock tree?

Uh, why does it depend? I understood the changset is bisectable and
removal of unneeded driver will happen later. Otherwise it is not
bisectable...

Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 2/3] memory: atmel-sdramc: remove the driver
  2023-01-03 10:06       ` Krzysztof Kozlowski
@ 2023-01-03 11:18         ` Claudiu.Beznea
  -1 siblings, 0 replies; 30+ messages in thread
From: Claudiu.Beznea @ 2023-01-03 11:18 UTC (permalink / raw)
  To: krzysztof.kozlowski, mturquette, sboyd, Nicolas.Ferre, alexandre.belloni
  Cc: linux-kernel, linux-clk, linux-arm-kernel

On 03.01.2023 12:06, Krzysztof Kozlowski wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On 03/01/2023 11:00, Claudiu.Beznea@microchip.com wrote:
>> Hi, Krzysztof,
>>
>> On 08.12.2022 13:45, Claudiu Beznea wrote:
>>> Driver does only clock request + enable for DDR clocks. DDR clocks are
>>> enabled by bootloader and need to stay that way in Linux. To avoid having
>>> these clocks disabled by clock subsystem in case there are no Linux
>>> consumers for them the clocks were marked as critical in clock drivers.
>>> With this, there is no need to have a separate driver that only does
>>> clock request + enable.
>>>
>>> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
>>
>> As this patch depends on patch 1/3 from this series, can I have your ack
>> for it to take it though clock tree?
> 
> Uh, why does it depend? I understood the changset is bisectable and
> removal of unneeded driver will happen later. Otherwise it is not
> bisectable...

AT91 devices will fail to boot if this patch is applied and 1/3 is not
there. This is because clock framework will disable DDR clocks because
there will be no consumer for them.

> 
> Best regards,
> Krzysztof
> 


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 2/3] memory: atmel-sdramc: remove the driver
@ 2023-01-03 11:18         ` Claudiu.Beznea
  0 siblings, 0 replies; 30+ messages in thread
From: Claudiu.Beznea @ 2023-01-03 11:18 UTC (permalink / raw)
  To: krzysztof.kozlowski, mturquette, sboyd, Nicolas.Ferre, alexandre.belloni
  Cc: linux-kernel, linux-clk, linux-arm-kernel

On 03.01.2023 12:06, Krzysztof Kozlowski wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On 03/01/2023 11:00, Claudiu.Beznea@microchip.com wrote:
>> Hi, Krzysztof,
>>
>> On 08.12.2022 13:45, Claudiu Beznea wrote:
>>> Driver does only clock request + enable for DDR clocks. DDR clocks are
>>> enabled by bootloader and need to stay that way in Linux. To avoid having
>>> these clocks disabled by clock subsystem in case there are no Linux
>>> consumers for them the clocks were marked as critical in clock drivers.
>>> With this, there is no need to have a separate driver that only does
>>> clock request + enable.
>>>
>>> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
>>
>> As this patch depends on patch 1/3 from this series, can I have your ack
>> for it to take it though clock tree?
> 
> Uh, why does it depend? I understood the changset is bisectable and
> removal of unneeded driver will happen later. Otherwise it is not
> bisectable...

AT91 devices will fail to boot if this patch is applied and 1/3 is not
there. This is because clock framework will disable DDR clocks because
there will be no consumer for them.

> 
> Best regards,
> Krzysztof
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 2/3] memory: atmel-sdramc: remove the driver
  2023-01-03 11:18         ` Claudiu.Beznea
@ 2023-01-03 12:00           ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 30+ messages in thread
From: Krzysztof Kozlowski @ 2023-01-03 12:00 UTC (permalink / raw)
  To: Claudiu.Beznea, mturquette, sboyd, Nicolas.Ferre, alexandre.belloni
  Cc: linux-kernel, linux-clk, linux-arm-kernel

On 03/01/2023 12:18, Claudiu.Beznea@microchip.com wrote:
> On 03.01.2023 12:06, Krzysztof Kozlowski wrote:
>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>
>> On 03/01/2023 11:00, Claudiu.Beznea@microchip.com wrote:
>>> Hi, Krzysztof,
>>>
>>> On 08.12.2022 13:45, Claudiu Beznea wrote:
>>>> Driver does only clock request + enable for DDR clocks. DDR clocks are
>>>> enabled by bootloader and need to stay that way in Linux. To avoid having
>>>> these clocks disabled by clock subsystem in case there are no Linux
>>>> consumers for them the clocks were marked as critical in clock drivers.
>>>> With this, there is no need to have a separate driver that only does
>>>> clock request + enable.
>>>>
>>>> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
>>>
>>> As this patch depends on patch 1/3 from this series, can I have your ack
>>> for it to take it though clock tree?
>>
>> Uh, why does it depend? I understood the changset is bisectable and
>> removal of unneeded driver will happen later. Otherwise it is not
>> bisectable...
> 
> AT91 devices will fail to boot if this patch is applied and 1/3 is not
> there. This is because clock framework will disable DDR clocks because
> there will be no consumer for them.

This I understand, but why do you need this patch to be able to apply
1/3? This is problem of bisectability. Not the other way.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 2/3] memory: atmel-sdramc: remove the driver
@ 2023-01-03 12:00           ` Krzysztof Kozlowski
  0 siblings, 0 replies; 30+ messages in thread
From: Krzysztof Kozlowski @ 2023-01-03 12:00 UTC (permalink / raw)
  To: Claudiu.Beznea, mturquette, sboyd, Nicolas.Ferre, alexandre.belloni
  Cc: linux-kernel, linux-clk, linux-arm-kernel

On 03/01/2023 12:18, Claudiu.Beznea@microchip.com wrote:
> On 03.01.2023 12:06, Krzysztof Kozlowski wrote:
>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>
>> On 03/01/2023 11:00, Claudiu.Beznea@microchip.com wrote:
>>> Hi, Krzysztof,
>>>
>>> On 08.12.2022 13:45, Claudiu Beznea wrote:
>>>> Driver does only clock request + enable for DDR clocks. DDR clocks are
>>>> enabled by bootloader and need to stay that way in Linux. To avoid having
>>>> these clocks disabled by clock subsystem in case there are no Linux
>>>> consumers for them the clocks were marked as critical in clock drivers.
>>>> With this, there is no need to have a separate driver that only does
>>>> clock request + enable.
>>>>
>>>> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
>>>
>>> As this patch depends on patch 1/3 from this series, can I have your ack
>>> for it to take it though clock tree?
>>
>> Uh, why does it depend? I understood the changset is bisectable and
>> removal of unneeded driver will happen later. Otherwise it is not
>> bisectable...
> 
> AT91 devices will fail to boot if this patch is applied and 1/3 is not
> there. This is because clock framework will disable DDR clocks because
> there will be no consumer for them.

This I understand, but why do you need this patch to be able to apply
1/3? This is problem of bisectability. Not the other way.

Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 2/3] memory: atmel-sdramc: remove the driver
  2023-01-03 12:00           ` Krzysztof Kozlowski
@ 2023-01-03 12:45             ` Claudiu.Beznea
  -1 siblings, 0 replies; 30+ messages in thread
From: Claudiu.Beznea @ 2023-01-03 12:45 UTC (permalink / raw)
  To: krzysztof.kozlowski, mturquette, sboyd, Nicolas.Ferre, alexandre.belloni
  Cc: linux-kernel, linux-clk, linux-arm-kernel

On 03.01.2023 14:00, Krzysztof Kozlowski wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On 03/01/2023 12:18, Claudiu.Beznea@microchip.com wrote:
>> On 03.01.2023 12:06, Krzysztof Kozlowski wrote:
>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>
>>> On 03/01/2023 11:00, Claudiu.Beznea@microchip.com wrote:
>>>> Hi, Krzysztof,
>>>>
>>>> On 08.12.2022 13:45, Claudiu Beznea wrote:
>>>>> Driver does only clock request + enable for DDR clocks. DDR clocks are
>>>>> enabled by bootloader and need to stay that way in Linux. To avoid having
>>>>> these clocks disabled by clock subsystem in case there are no Linux
>>>>> consumers for them the clocks were marked as critical in clock drivers.
>>>>> With this, there is no need to have a separate driver that only does
>>>>> clock request + enable.
>>>>>
>>>>> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
>>>>
>>>> As this patch depends on patch 1/3 from this series, can I have your ack
>>>> for it to take it though clock tree?
>>>
>>> Uh, why does it depend? I understood the changset is bisectable and
>>> removal of unneeded driver will happen later. Otherwise it is not
>>> bisectable...
>>
>> AT91 devices will fail to boot if this patch is applied and 1/3 is not
>> there. This is because clock framework will disable DDR clocks because
>> there will be no consumer for them.
> 
> This I understand, but why do you need this patch to be able to apply
> 1/3? 

To avoid having AT91 devices failing to boot in case your tree (containing
this patch) is merged  first.

> This is problem of bisectability. Not the other way.
> 
> Best regards,
> Krzysztof
> 


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 2/3] memory: atmel-sdramc: remove the driver
@ 2023-01-03 12:45             ` Claudiu.Beznea
  0 siblings, 0 replies; 30+ messages in thread
From: Claudiu.Beznea @ 2023-01-03 12:45 UTC (permalink / raw)
  To: krzysztof.kozlowski, mturquette, sboyd, Nicolas.Ferre, alexandre.belloni
  Cc: linux-kernel, linux-clk, linux-arm-kernel

On 03.01.2023 14:00, Krzysztof Kozlowski wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On 03/01/2023 12:18, Claudiu.Beznea@microchip.com wrote:
>> On 03.01.2023 12:06, Krzysztof Kozlowski wrote:
>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>
>>> On 03/01/2023 11:00, Claudiu.Beznea@microchip.com wrote:
>>>> Hi, Krzysztof,
>>>>
>>>> On 08.12.2022 13:45, Claudiu Beznea wrote:
>>>>> Driver does only clock request + enable for DDR clocks. DDR clocks are
>>>>> enabled by bootloader and need to stay that way in Linux. To avoid having
>>>>> these clocks disabled by clock subsystem in case there are no Linux
>>>>> consumers for them the clocks were marked as critical in clock drivers.
>>>>> With this, there is no need to have a separate driver that only does
>>>>> clock request + enable.
>>>>>
>>>>> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
>>>>
>>>> As this patch depends on patch 1/3 from this series, can I have your ack
>>>> for it to take it though clock tree?
>>>
>>> Uh, why does it depend? I understood the changset is bisectable and
>>> removal of unneeded driver will happen later. Otherwise it is not
>>> bisectable...
>>
>> AT91 devices will fail to boot if this patch is applied and 1/3 is not
>> there. This is because clock framework will disable DDR clocks because
>> there will be no consumer for them.
> 
> This I understand, but why do you need this patch to be able to apply
> 1/3? 

To avoid having AT91 devices failing to boot in case your tree (containing
this patch) is merged  first.

> This is problem of bisectability. Not the other way.
> 
> Best regards,
> Krzysztof
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 2/3] memory: atmel-sdramc: remove the driver
  2023-01-03 12:45             ` Claudiu.Beznea
@ 2023-01-03 13:17               ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 30+ messages in thread
From: Krzysztof Kozlowski @ 2023-01-03 13:17 UTC (permalink / raw)
  To: Claudiu.Beznea, mturquette, sboyd, Nicolas.Ferre, alexandre.belloni
  Cc: linux-kernel, linux-clk, linux-arm-kernel

On 03/01/2023 13:45, Claudiu.Beznea@microchip.com wrote:

>>>> Uh, why does it depend? I understood the changset is bisectable and
>>>> removal of unneeded driver will happen later. Otherwise it is not
>>>> bisectable...
>>>
>>> AT91 devices will fail to boot if this patch is applied and 1/3 is not
>>> there. This is because clock framework will disable DDR clocks because
>>> there will be no consumer for them.
>>
>> This I understand, but why do you need this patch to be able to apply
>> 1/3? 
> 
> To avoid having AT91 devices failing to boot in case your tree (containing
> this patch) is merged  first.

But this patch is not going to be merged first. It will wait one more
cycle, so the dependency is there.

If you need to make it in one cycle for some reason, then I would need
stable tag with the clock patch.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 2/3] memory: atmel-sdramc: remove the driver
@ 2023-01-03 13:17               ` Krzysztof Kozlowski
  0 siblings, 0 replies; 30+ messages in thread
From: Krzysztof Kozlowski @ 2023-01-03 13:17 UTC (permalink / raw)
  To: Claudiu.Beznea, mturquette, sboyd, Nicolas.Ferre, alexandre.belloni
  Cc: linux-kernel, linux-clk, linux-arm-kernel

On 03/01/2023 13:45, Claudiu.Beznea@microchip.com wrote:

>>>> Uh, why does it depend? I understood the changset is bisectable and
>>>> removal of unneeded driver will happen later. Otherwise it is not
>>>> bisectable...
>>>
>>> AT91 devices will fail to boot if this patch is applied and 1/3 is not
>>> there. This is because clock framework will disable DDR clocks because
>>> there will be no consumer for them.
>>
>> This I understand, but why do you need this patch to be able to apply
>> 1/3? 
> 
> To avoid having AT91 devices failing to boot in case your tree (containing
> this patch) is merged  first.

But this patch is not going to be merged first. It will wait one more
cycle, so the dependency is there.

If you need to make it in one cycle for some reason, then I would need
stable tag with the clock patch.

Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 2/3] memory: atmel-sdramc: remove the driver
  2023-01-03 13:17               ` Krzysztof Kozlowski
@ 2023-01-03 14:29                 ` Claudiu.Beznea
  -1 siblings, 0 replies; 30+ messages in thread
From: Claudiu.Beznea @ 2023-01-03 14:29 UTC (permalink / raw)
  To: krzysztof.kozlowski, mturquette, sboyd, Nicolas.Ferre, alexandre.belloni
  Cc: linux-kernel, linux-clk, linux-arm-kernel

On 03.01.2023 15:17, Krzysztof Kozlowski wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On 03/01/2023 13:45, Claudiu.Beznea@microchip.com wrote:
> 
>>>>> Uh, why does it depend? I understood the changset is bisectable and
>>>>> removal of unneeded driver will happen later. Otherwise it is not
>>>>> bisectable...
>>>>
>>>> AT91 devices will fail to boot if this patch is applied and 1/3 is not
>>>> there. This is because clock framework will disable DDR clocks because
>>>> there will be no consumer for them.
>>>
>>> This I understand, but why do you need this patch to be able to apply
>>> 1/3?
>>
>> To avoid having AT91 devices failing to boot in case your tree (containing
>> this patch) is merged  first.
> 
> But this patch is not going to be merged first. It will wait one more
> cycle, so the dependency is there.

OK. All good this way.

Thank you,
Claudiu

> 
> If you need to make it in one cycle for some reason, then I would need
> stable tag with the clock patch.
> 
> Best regards,
> Krzysztof
> 


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 2/3] memory: atmel-sdramc: remove the driver
@ 2023-01-03 14:29                 ` Claudiu.Beznea
  0 siblings, 0 replies; 30+ messages in thread
From: Claudiu.Beznea @ 2023-01-03 14:29 UTC (permalink / raw)
  To: krzysztof.kozlowski, mturquette, sboyd, Nicolas.Ferre, alexandre.belloni
  Cc: linux-kernel, linux-clk, linux-arm-kernel

On 03.01.2023 15:17, Krzysztof Kozlowski wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On 03/01/2023 13:45, Claudiu.Beznea@microchip.com wrote:
> 
>>>>> Uh, why does it depend? I understood the changset is bisectable and
>>>>> removal of unneeded driver will happen later. Otherwise it is not
>>>>> bisectable...
>>>>
>>>> AT91 devices will fail to boot if this patch is applied and 1/3 is not
>>>> there. This is because clock framework will disable DDR clocks because
>>>> there will be no consumer for them.
>>>
>>> This I understand, but why do you need this patch to be able to apply
>>> 1/3?
>>
>> To avoid having AT91 devices failing to boot in case your tree (containing
>> this patch) is merged  first.
> 
> But this patch is not going to be merged first. It will wait one more
> cycle, so the dependency is there.

OK. All good this way.

Thank you,
Claudiu

> 
> If you need to make it in one cycle for some reason, then I would need
> stable tag with the clock patch.
> 
> Best regards,
> Krzysztof
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/3] clk: at91: mark ddr clocks as critical
  2022-12-08 11:45   ` Claudiu Beznea
@ 2023-01-12 10:28     ` Claudiu.Beznea
  -1 siblings, 0 replies; 30+ messages in thread
From: Claudiu.Beznea @ 2023-01-12 10:28 UTC (permalink / raw)
  To: mturquette, sboyd, Nicolas.Ferre, alexandre.belloni, krzysztof.kozlowski
  Cc: linux-kernel, linux-clk, linux-arm-kernel

On 08.12.2022 13:45, Claudiu Beznea wrote:
> Mark DDR clocks as critical for AT91 devices. These clocks are enabled
> by bootloader when initializing DDR and needs to stay enabled. Up to
> this patch the DDR clocks were requested from drivers/memory/atmel-sdramc.c
> which does only clock request and enable. There is no need to have
> a separate driver just for this, thus the atmel-sdramc.c will be deleted
> in a subsequent patch.
> 
> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>

Applied to clk-microchip, thanks!

> ---
>  drivers/clk/at91/at91rm9200.c     |  2 +-
>  drivers/clk/at91/at91sam9260.c    |  2 +-
>  drivers/clk/at91/at91sam9g45.c    | 10 ++++++++--
>  drivers/clk/at91/at91sam9n12.c    | 12 +++++++++---
>  drivers/clk/at91/at91sam9rl.c     |  2 +-
>  drivers/clk/at91/at91sam9x5.c     | 17 ++++++++++++-----
>  drivers/clk/at91/clk-peripheral.c |  8 ++++----
>  drivers/clk/at91/clk-system.c     |  4 ++--
>  drivers/clk/at91/dt-compat.c      | 25 +++++++++++++++++++++++--
>  drivers/clk/at91/pmc.h            |  4 ++--
>  drivers/clk/at91/sam9x60.c        | 20 ++++++++++++++++----
>  drivers/clk/at91/sama5d2.c        | 22 +++++++++++++++++-----
>  drivers/clk/at91/sama5d3.c        | 20 ++++++++++++++++----
>  drivers/clk/at91/sama5d4.c        | 22 +++++++++++++++++-----
>  drivers/clk/at91/sama7g5.c        |  4 ++--
>  15 files changed, 131 insertions(+), 43 deletions(-)
> 
> diff --git a/drivers/clk/at91/at91rm9200.c b/drivers/clk/at91/at91rm9200.c
> index 16870943a13e..0b860126d589 100644
> --- a/drivers/clk/at91/at91rm9200.c
> +++ b/drivers/clk/at91/at91rm9200.c
> @@ -183,7 +183,7 @@ static void __init at91rm9200_pmc_setup(struct device_node *np)
>  	for (i = 0; i < ARRAY_SIZE(at91rm9200_systemck); i++) {
>  		hw = at91_clk_register_system(regmap, at91rm9200_systemck[i].n,
>  					      at91rm9200_systemck[i].p,
> -					      at91rm9200_systemck[i].id);
> +					      at91rm9200_systemck[i].id, 0);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> diff --git a/drivers/clk/at91/at91sam9260.c b/drivers/clk/at91/at91sam9260.c
> index 11550e50cd9f..b521f470428f 100644
> --- a/drivers/clk/at91/at91sam9260.c
> +++ b/drivers/clk/at91/at91sam9260.c
> @@ -460,7 +460,7 @@ static void __init at91sam926x_pmc_setup(struct device_node *np,
>  	for (i = 0; i < data->num_sck; i++) {
>  		hw = at91_clk_register_system(regmap, data->sck[i].n,
>  					      data->sck[i].p,
> -					      data->sck[i].id);
> +					      data->sck[i].id, 0);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> diff --git a/drivers/clk/at91/at91sam9g45.c b/drivers/clk/at91/at91sam9g45.c
> index 8c9344451f46..5099669ddcbd 100644
> --- a/drivers/clk/at91/at91sam9g45.c
> +++ b/drivers/clk/at91/at91sam9g45.c
> @@ -40,9 +40,14 @@ static const struct clk_pll_characteristics plla_characteristics = {
>  static const struct {
>  	char *n;
>  	char *p;
> +	unsigned long flags;
>  	u8 id;
>  } at91sam9g45_systemck[] = {
> -	{ .n = "ddrck", .p = "masterck_div", .id = 2 },
> +	/*
> +	 * ddrck feeds DDR controller and is enabled by bootloader thus we need
> +	 * to keep it enabled in case there is no Linux consumer for it.
> +	 */
> +	{ .n = "ddrck", .p = "masterck_div", .id = 2, .flags = CLK_IS_CRITICAL },
>  	{ .n = "uhpck", .p = "usbck",        .id = 6 },
>  	{ .n = "pck0",  .p = "prog0",        .id = 8 },
>  	{ .n = "pck1",  .p = "prog1",        .id = 9 },
> @@ -198,7 +203,8 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np)
>  	for (i = 0; i < ARRAY_SIZE(at91sam9g45_systemck); i++) {
>  		hw = at91_clk_register_system(regmap, at91sam9g45_systemck[i].n,
>  					      at91sam9g45_systemck[i].p,
> -					      at91sam9g45_systemck[i].id);
> +					      at91sam9g45_systemck[i].id,
> +					      at91sam9g45_systemck[i].flags);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> diff --git a/drivers/clk/at91/at91sam9n12.c b/drivers/clk/at91/at91sam9n12.c
> index 0bb19400d199..08a10e12d08d 100644
> --- a/drivers/clk/at91/at91sam9n12.c
> +++ b/drivers/clk/at91/at91sam9n12.c
> @@ -54,9 +54,14 @@ static const struct clk_pll_characteristics pllb_characteristics = {
>  static const struct {
>  	char *n;
>  	char *p;
> +	unsigned long flags;
>  	u8 id;
>  } at91sam9n12_systemck[] = {
> -	{ .n = "ddrck", .p = "masterck_div", .id = 2 },
> +	/*
> +	 * ddrck feeds DDR controller and is enabled by bootloader thus we need
> +	 * to keep it enabled in case there is no Linux consumer for it.
> +	 */
> +	{ .n = "ddrck", .p = "masterck_div", .id = 2, .flags = CLK_IS_CRITICAL },
>  	{ .n = "lcdck", .p = "masterck_div", .id = 3 },
>  	{ .n = "uhpck", .p = "usbck",        .id = 6 },
>  	{ .n = "udpck", .p = "usbck",        .id = 7 },
> @@ -223,7 +228,8 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np)
>  	for (i = 0; i < ARRAY_SIZE(at91sam9n12_systemck); i++) {
>  		hw = at91_clk_register_system(regmap, at91sam9n12_systemck[i].n,
>  					      at91sam9n12_systemck[i].p,
> -					      at91sam9n12_systemck[i].id);
> +					      at91sam9n12_systemck[i].id,
> +					      at91sam9n12_systemck[i].flags);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> @@ -236,7 +242,7 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np)
>  							 at91sam9n12_periphck[i].n,
>  							 "masterck_div",
>  							 at91sam9n12_periphck[i].id,
> -							 &range, INT_MIN);
> +							 &range, INT_MIN, 0);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> diff --git a/drivers/clk/at91/at91sam9rl.c b/drivers/clk/at91/at91sam9rl.c
> index b992137bab02..1a1b6b2bb0e3 100644
> --- a/drivers/clk/at91/at91sam9rl.c
> +++ b/drivers/clk/at91/at91sam9rl.c
> @@ -160,7 +160,7 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np)
>  	for (i = 0; i < ARRAY_SIZE(at91sam9rl_systemck); i++) {
>  		hw = at91_clk_register_system(regmap, at91sam9rl_systemck[i].n,
>  					      at91sam9rl_systemck[i].p,
> -					      at91sam9rl_systemck[i].id);
> +					      at91sam9rl_systemck[i].id, 0);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> diff --git a/drivers/clk/at91/at91sam9x5.c b/drivers/clk/at91/at91sam9x5.c
> index 3857db2e144b..13e589c95907 100644
> --- a/drivers/clk/at91/at91sam9x5.c
> +++ b/drivers/clk/at91/at91sam9x5.c
> @@ -41,9 +41,14 @@ static const struct clk_pll_characteristics plla_characteristics = {
>  static const struct {
>  	char *n;
>  	char *p;
> +	unsigned long flags;
>  	u8 id;
>  } at91sam9x5_systemck[] = {
> -	{ .n = "ddrck", .p = "masterck_div", .id = 2 },
> +	/*
> +	 * ddrck feeds DDR controller and is enabled by bootloader thus we need
> +	 * to keep it enabled in case there is no Linux consumer for it.
> +	 */
> +	{ .n = "ddrck", .p = "masterck_div", .id = 2, .flags = CLK_IS_CRITICAL },
>  	{ .n = "smdck", .p = "smdclk",   .id = 4 },
>  	{ .n = "uhpck", .p = "usbck",    .id = 6 },
>  	{ .n = "udpck", .p = "usbck",    .id = 7 },
> @@ -248,7 +253,8 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
>  	for (i = 0; i < ARRAY_SIZE(at91sam9x5_systemck); i++) {
>  		hw = at91_clk_register_system(regmap, at91sam9x5_systemck[i].n,
>  					      at91sam9x5_systemck[i].p,
> -					      at91sam9x5_systemck[i].id);
> +					      at91sam9x5_systemck[i].id,
> +					      at91sam9x5_systemck[i].flags);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> @@ -256,7 +262,8 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
>  	}
>  
>  	if (has_lcdck) {
> -		hw = at91_clk_register_system(regmap, "lcdck", "masterck_div", 3);
> +		hw = at91_clk_register_system(regmap, "lcdck", "masterck_div",
> +					      3, 0);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> @@ -269,7 +276,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
>  							 at91sam9x5_periphck[i].n,
>  							 "masterck_div",
>  							 at91sam9x5_periphck[i].id,
> -							 &range, INT_MIN);
> +							 &range, INT_MIN, 0);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> @@ -282,7 +289,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
>  							 extra_pcks[i].n,
>  							 "masterck_div",
>  							 extra_pcks[i].id,
> -							 &range, INT_MIN);
> +							 &range, INT_MIN, 0);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> diff --git a/drivers/clk/at91/clk-peripheral.c b/drivers/clk/at91/clk-peripheral.c
> index 5104d4025484..93ea685e27f6 100644
> --- a/drivers/clk/at91/clk-peripheral.c
> +++ b/drivers/clk/at91/clk-peripheral.c
> @@ -445,7 +445,7 @@ at91_clk_register_sam9x5_peripheral(struct regmap *regmap, spinlock_t *lock,
>  				    const struct clk_pcr_layout *layout,
>  				    const char *name, const char *parent_name,
>  				    u32 id, const struct clk_range *range,
> -				    int chg_pid)
> +				    int chg_pid, unsigned long flags)
>  {
>  	struct clk_sam9x5_peripheral *periph;
>  	struct clk_init_data init;
> @@ -462,12 +462,12 @@ at91_clk_register_sam9x5_peripheral(struct regmap *regmap, spinlock_t *lock,
>  	init.name = name;
>  	init.parent_names = &parent_name;
>  	init.num_parents = 1;
> +	init.flags = flags;
>  	if (chg_pid < 0) {
> -		init.flags = 0;
>  		init.ops = &sam9x5_peripheral_ops;
>  	} else {
> -		init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE |
> -			     CLK_SET_RATE_PARENT;
> +		init.flags |= CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE |
> +			      CLK_SET_RATE_PARENT;
>  		init.ops = &sam9x5_peripheral_chg_ops;
>  	}
>  
> diff --git a/drivers/clk/at91/clk-system.c b/drivers/clk/at91/clk-system.c
> index 80720fd1a9cf..10193650429e 100644
> --- a/drivers/clk/at91/clk-system.c
> +++ b/drivers/clk/at91/clk-system.c
> @@ -105,7 +105,7 @@ static const struct clk_ops system_ops = {
>  
>  struct clk_hw * __init
>  at91_clk_register_system(struct regmap *regmap, const char *name,
> -			 const char *parent_name, u8 id)
> +			 const char *parent_name, u8 id, unsigned long flags)
>  {
>  	struct clk_system *sys;
>  	struct clk_hw *hw;
> @@ -123,7 +123,7 @@ at91_clk_register_system(struct regmap *regmap, const char *name,
>  	init.ops = &system_ops;
>  	init.parent_names = &parent_name;
>  	init.num_parents = 1;
> -	init.flags = CLK_SET_RATE_PARENT;
> +	init.flags = CLK_SET_RATE_PARENT | flags;
>  
>  	sys->id = id;
>  	sys->hw.init = &init;
> diff --git a/drivers/clk/at91/dt-compat.c b/drivers/clk/at91/dt-compat.c
> index 85a964cb2d89..97f67e23ef80 100644
> --- a/drivers/clk/at91/dt-compat.c
> +++ b/drivers/clk/at91/dt-compat.c
> @@ -493,18 +493,28 @@ of_at91_clk_periph_setup(struct device_node *np, u8 type)
>  							  parent_name, id);
>  		} else {
>  			struct clk_range range = CLK_RANGE(0, 0);
> +			unsigned long flags = 0;
>  
>  			of_at91_get_clk_range(periphclknp,
>  					      "atmel,clk-output-range",
>  					      &range);
>  
> +			/*
> +			 * mpddr_clk feed DDR controller and is enabled by
> +			 * bootloader thus we need to keep it enabled in case
> +			 * there is no Linux consumer for it.
> +			 */
> +			if (!strcmp(periphclknp->name, "mpddr_clk"))
> +				flags = CLK_IS_CRITICAL;
> +
>  			hw = at91_clk_register_sam9x5_peripheral(regmap,
>  								 &pmc_pcr_lock,
>  								 &dt_pcr_layout,
>  								 name,
>  								 parent_name,
>  								 id, &range,
> -								 INT_MIN);
> +								 INT_MIN,
> +								 flags);
>  		}
>  
>  		if (IS_ERR(hw))
> @@ -879,6 +889,8 @@ static void __init of_at91rm9200_clk_sys_setup(struct device_node *np)
>  		return;
>  
>  	for_each_child_of_node(np, sysclknp) {
> +		unsigned long flags = 0;
> +
>  		if (of_property_read_u32(sysclknp, "reg", &id))
>  			continue;
>  
> @@ -887,7 +899,16 @@ static void __init of_at91rm9200_clk_sys_setup(struct device_node *np)
>  
>  		parent_name = of_clk_get_parent_name(sysclknp, 0);
>  
> -		hw = at91_clk_register_system(regmap, name, parent_name, id);
> +		/*
> +		 * ddrck feeds DDR controller and is enabled by bootloader thus
> +		 * we need to keep it enabled in case there is no Linux consumer
> +		 * for it.
> +		 */
> +		if (!strcmp(sysclknp->name, "ddrck"))
> +			flags = CLK_IS_CRITICAL;
> +
> +		hw = at91_clk_register_system(regmap, name, parent_name, id,
> +					      flags);
>  		if (IS_ERR(hw))
>  			continue;
>  
> diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h
> index efe4975bddc3..1b3ca7dd9b57 100644
> --- a/drivers/clk/at91/pmc.h
> +++ b/drivers/clk/at91/pmc.h
> @@ -199,7 +199,7 @@ at91_clk_register_sam9x5_peripheral(struct regmap *regmap, spinlock_t *lock,
>  				    const struct clk_pcr_layout *layout,
>  				    const char *name, const char *parent_name,
>  				    u32 id, const struct clk_range *range,
> -				    int chg_pid);
> +				    int chg_pid, unsigned long flags);
>  
>  struct clk_hw * __init
>  at91_clk_register_pll(struct regmap *regmap, const char *name,
> @@ -242,7 +242,7 @@ at91sam9x5_clk_register_smd(struct regmap *regmap, const char *name,
>  
>  struct clk_hw * __init
>  at91_clk_register_system(struct regmap *regmap, const char *name,
> -			 const char *parent_name, u8 id);
> +			 const char *parent_name, u8 id, unsigned long flags);
>  
>  struct clk_hw * __init
>  at91sam9x5_clk_register_usb(struct regmap *regmap, const char *name,
> diff --git a/drivers/clk/at91/sam9x60.c b/drivers/clk/at91/sam9x60.c
> index 9ea4ce501bad..ac070db58195 100644
> --- a/drivers/clk/at91/sam9x60.c
> +++ b/drivers/clk/at91/sam9x60.c
> @@ -75,9 +75,14 @@ static const struct clk_pcr_layout sam9x60_pcr_layout = {
>  static const struct {
>  	char *n;
>  	char *p;
> +	unsigned long flags;
>  	u8 id;
>  } sam9x60_systemck[] = {
> -	{ .n = "ddrck",  .p = "masterck_div", .id = 2 },
> +	/*
> +	 * ddrck feeds DDR controller and is enabled by bootloader thus we need
> +	 * to keep it enabled in case there is no Linux consumer for it.
> +	 */
> +	{ .n = "ddrck",  .p = "masterck_div", .id = 2, .flags = CLK_IS_CRITICAL },
>  	{ .n = "uhpck",  .p = "usbck",    .id = 6 },
>  	{ .n = "pck0",   .p = "prog0",    .id = 8 },
>  	{ .n = "pck1",   .p = "prog1",    .id = 9 },
> @@ -86,6 +91,7 @@ static const struct {
>  
>  static const struct {
>  	char *n;
> +	unsigned long flags;
>  	u8 id;
>  } sam9x60_periphck[] = {
>  	{ .n = "pioA_clk",   .id = 2, },
> @@ -132,7 +138,11 @@ static const struct {
>  	{ .n = "pioD_clk",   .id = 44, },
>  	{ .n = "tcb1_clk",   .id = 45, },
>  	{ .n = "dbgu_clk",   .id = 47, },
> -	{ .n = "mpddr_clk",  .id = 49, },
> +	/*
> +	 * mpddr_clk feeds DDR controller and is enabled by bootloader thus we
> +	 * need to keep it enabled in case there is no Linux consumer for it.
> +	 */
> +	{ .n = "mpddr_clk",  .id = 49, .flags = CLK_IS_CRITICAL },
>  };
>  
>  static const struct {
> @@ -315,7 +325,8 @@ static void __init sam9x60_pmc_setup(struct device_node *np)
>  	for (i = 0; i < ARRAY_SIZE(sam9x60_systemck); i++) {
>  		hw = at91_clk_register_system(regmap, sam9x60_systemck[i].n,
>  					      sam9x60_systemck[i].p,
> -					      sam9x60_systemck[i].id);
> +					      sam9x60_systemck[i].id,
> +					      sam9x60_systemck[i].flags);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> @@ -328,7 +339,8 @@ static void __init sam9x60_pmc_setup(struct device_node *np)
>  							 sam9x60_periphck[i].n,
>  							 "masterck_div",
>  							 sam9x60_periphck[i].id,
> -							 &range, INT_MIN);
> +							 &range, INT_MIN,
> +							 sam9x60_periphck[i].flags);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c
> index 84156dc52bff..c0e3e1a4bbf3 100644
> --- a/drivers/clk/at91/sama5d2.c
> +++ b/drivers/clk/at91/sama5d2.c
> @@ -40,9 +40,14 @@ static const struct clk_pcr_layout sama5d2_pcr_layout = {
>  static const struct {
>  	char *n;
>  	char *p;
> +	unsigned long flags;
>  	u8 id;
>  } sama5d2_systemck[] = {
> -	{ .n = "ddrck", .p = "masterck_div", .id = 2 },
> +	/*
> +	 * ddrck feeds DDR controller and is enabled by bootloader thus we need
> +	 * to keep it enabled in case there is no Linux consumer for it.
> +	 */
> +	{ .n = "ddrck", .p = "masterck_div", .id = 2, .flags = CLK_IS_CRITICAL },
>  	{ .n = "lcdck", .p = "masterck_div", .id = 3 },
>  	{ .n = "uhpck", .p = "usbck",        .id = 6 },
>  	{ .n = "udpck", .p = "usbck",        .id = 7 },
> @@ -97,6 +102,7 @@ static const struct {
>  
>  static const struct {
>  	char *n;
> +	unsigned long flags;
>  	u8 id;
>  } sama5d2_periphck[] = {
>  	{ .n = "dma0_clk",    .id = 6, },
> @@ -104,7 +110,11 @@ static const struct {
>  	{ .n = "aes_clk",     .id = 9, },
>  	{ .n = "aesb_clk",    .id = 10, },
>  	{ .n = "sha_clk",     .id = 12, },
> -	{ .n = "mpddr_clk",   .id = 13, },
> +	/*
> +	 * mpddr_clk feeds DDR controller and is enabled by bootloader thus we
> +	 * need to keep it enabled in case there is no Linux consumer for it.
> +	 */
> +	{ .n = "mpddr_clk",   .id = 13, .flags = CLK_IS_CRITICAL },
>  	{ .n = "matrix0_clk", .id = 15, },
>  	{ .n = "sdmmc0_hclk", .id = 31, },
>  	{ .n = "sdmmc1_hclk", .id = 32, },
> @@ -302,7 +312,8 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
>  	for (i = 0; i < ARRAY_SIZE(sama5d2_systemck); i++) {
>  		hw = at91_clk_register_system(regmap, sama5d2_systemck[i].n,
>  					      sama5d2_systemck[i].p,
> -					      sama5d2_systemck[i].id);
> +					      sama5d2_systemck[i].id,
> +					      sama5d2_systemck[i].flags);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> @@ -315,7 +326,8 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
>  							 sama5d2_periphck[i].n,
>  							 "masterck_div",
>  							 sama5d2_periphck[i].id,
> -							 &range, INT_MIN);
> +							 &range, INT_MIN,
> +							 sama5d2_periphck[i].flags);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> @@ -329,7 +341,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
>  							 "h32mxck",
>  							 sama5d2_periph32ck[i].id,
>  							 &sama5d2_periph32ck[i].r,
> -							 INT_MIN);
> +							 INT_MIN, 0);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> diff --git a/drivers/clk/at91/sama5d3.c b/drivers/clk/at91/sama5d3.c
> index 7e93c6edf305..ad6068b884de 100644
> --- a/drivers/clk/at91/sama5d3.c
> +++ b/drivers/clk/at91/sama5d3.c
> @@ -40,9 +40,14 @@ static const struct clk_pcr_layout sama5d3_pcr_layout = {
>  static const struct {
>  	char *n;
>  	char *p;
> +	unsigned long flags;
>  	u8 id;
>  } sama5d3_systemck[] = {
> -	{ .n = "ddrck", .p = "masterck_div", .id = 2 },
> +	/*
> +	 * ddrck feeds DDR controller and is enabled by bootloader thus we need
> +	 * to keep it enabled in case there is no Linux consumer for it.
> +	 */
> +	{ .n = "ddrck", .p = "masterck_div", .id = 2, .flags = CLK_IS_CRITICAL },
>  	{ .n = "lcdck", .p = "masterck_div", .id = 3 },
>  	{ .n = "smdck", .p = "smdclk",       .id = 4 },
>  	{ .n = "uhpck", .p = "usbck",        .id = 6 },
> @@ -56,6 +61,7 @@ static const struct {
>  	char *n;
>  	u8 id;
>  	struct clk_range r;
> +	unsigned long flags;
>  } sama5d3_periphck[] = {
>  	{ .n = "dbgu_clk", .id = 2, },
>  	{ .n = "hsmc_clk", .id = 5, },
> @@ -99,7 +105,11 @@ static const struct {
>  	{ .n = "tdes_clk", .id = 44, },
>  	{ .n = "trng_clk", .id = 45, },
>  	{ .n = "fuse_clk", .id = 48, },
> -	{ .n = "mpddr_clk", .id = 49, },
> +	/*
> +	 * mpddr_clk feeds DDR controller and is enabled by bootloader thus we
> +	 * need to keep it enabled in case there is no Linux consumer for it.
> +	 */
> +	{ .n = "mpddr_clk", .id = 49, .flags = CLK_IS_CRITICAL },
>  };
>  
>  static void __init sama5d3_pmc_setup(struct device_node *np)
> @@ -222,7 +232,8 @@ static void __init sama5d3_pmc_setup(struct device_node *np)
>  	for (i = 0; i < ARRAY_SIZE(sama5d3_systemck); i++) {
>  		hw = at91_clk_register_system(regmap, sama5d3_systemck[i].n,
>  					      sama5d3_systemck[i].p,
> -					      sama5d3_systemck[i].id);
> +					      sama5d3_systemck[i].id,
> +					      sama5d3_systemck[i].flags);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> @@ -236,7 +247,8 @@ static void __init sama5d3_pmc_setup(struct device_node *np)
>  							 "masterck_div",
>  							 sama5d3_periphck[i].id,
>  							 &sama5d3_periphck[i].r,
> -							 INT_MIN);
> +							 INT_MIN,
> +							 sama5d3_periphck[i].flags);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> diff --git a/drivers/clk/at91/sama5d4.c b/drivers/clk/at91/sama5d4.c
> index 1a14a9bce308..e876ec971a39 100644
> --- a/drivers/clk/at91/sama5d4.c
> +++ b/drivers/clk/at91/sama5d4.c
> @@ -39,9 +39,14 @@ static const struct clk_pcr_layout sama5d4_pcr_layout = {
>  static const struct {
>  	char *n;
>  	char *p;
> +	unsigned long flags;
>  	u8 id;
>  } sama5d4_systemck[] = {
> -	{ .n = "ddrck", .p = "masterck_div", .id = 2 },
> +	/*
> +	 * ddrck feeds DDR controller and is enabled by bootloader thus we need
> +	 * to keep it enabled in case there is no Linux consumer for it.
> +	 */
> +	{ .n = "ddrck", .p = "masterck_div", .id = 2, .flags = CLK_IS_CRITICAL },
>  	{ .n = "lcdck", .p = "masterck_div", .id = 3 },
>  	{ .n = "smdck", .p = "smdclk",       .id = 4 },
>  	{ .n = "uhpck", .p = "usbck",        .id = 6 },
> @@ -103,12 +108,17 @@ static const struct {
>  
>  static const struct {
>  	char *n;
> +	unsigned long flags;
>  	u8 id;
>  } sama5d4_periphck[] = {
>  	{ .n = "dma0_clk", .id = 8 },
>  	{ .n = "cpkcc_clk", .id = 10 },
>  	{ .n = "aesb_clk", .id = 13 },
> -	{ .n = "mpddr_clk", .id = 16 },
> +	/*
> +	 * mpddr_clk feeds DDR controller and is enabled by bootloader thus we
> +	 * need to keep it enabled in case there is no Linux consumer for it.
> +	 */
> +	{ .n = "mpddr_clk", .id = 16, .flags = CLK_IS_CRITICAL },
>  	{ .n = "matrix0_clk", .id = 18 },
>  	{ .n = "vdec_clk", .id = 19 },
>  	{ .n = "dma1_clk", .id = 50 },
> @@ -245,7 +255,8 @@ static void __init sama5d4_pmc_setup(struct device_node *np)
>  	for (i = 0; i < ARRAY_SIZE(sama5d4_systemck); i++) {
>  		hw = at91_clk_register_system(regmap, sama5d4_systemck[i].n,
>  					      sama5d4_systemck[i].p,
> -					      sama5d4_systemck[i].id);
> +					      sama5d4_systemck[i].id,
> +					      sama5d4_systemck[i].flags);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> @@ -258,7 +269,8 @@ static void __init sama5d4_pmc_setup(struct device_node *np)
>  							 sama5d4_periphck[i].n,
>  							 "masterck_div",
>  							 sama5d4_periphck[i].id,
> -							 &range, INT_MIN);
> +							 &range, INT_MIN,
> +							 sama5d4_periphck[i].flags);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> @@ -271,7 +283,7 @@ static void __init sama5d4_pmc_setup(struct device_node *np)
>  							 sama5d4_periph32ck[i].n,
>  							 "h32mxck",
>  							 sama5d4_periph32ck[i].id,
> -							 &range, INT_MIN);
> +							 &range, INT_MIN, 0);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> diff --git a/drivers/clk/at91/sama7g5.c b/drivers/clk/at91/sama7g5.c
> index 9a213ba9e58b..f135b662f1ff 100644
> --- a/drivers/clk/at91/sama7g5.c
> +++ b/drivers/clk/at91/sama7g5.c
> @@ -1068,7 +1068,7 @@ static void __init sama7g5_pmc_setup(struct device_node *np)
>  	for (i = 0; i < ARRAY_SIZE(sama7g5_systemck); i++) {
>  		hw = at91_clk_register_system(regmap, sama7g5_systemck[i].n,
>  					      sama7g5_systemck[i].p,
> -					      sama7g5_systemck[i].id);
> +					      sama7g5_systemck[i].id, 0);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> @@ -1083,7 +1083,7 @@ static void __init sama7g5_pmc_setup(struct device_node *np)
>  						sama7g5_periphck[i].id,
>  						&sama7g5_periphck[i].r,
>  						sama7g5_periphck[i].chgp ? 0 :
> -						INT_MIN);
> +						INT_MIN, 0);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/3] clk: at91: mark ddr clocks as critical
@ 2023-01-12 10:28     ` Claudiu.Beznea
  0 siblings, 0 replies; 30+ messages in thread
From: Claudiu.Beznea @ 2023-01-12 10:28 UTC (permalink / raw)
  To: mturquette, sboyd, Nicolas.Ferre, alexandre.belloni, krzysztof.kozlowski
  Cc: linux-kernel, linux-clk, linux-arm-kernel

On 08.12.2022 13:45, Claudiu Beznea wrote:
> Mark DDR clocks as critical for AT91 devices. These clocks are enabled
> by bootloader when initializing DDR and needs to stay enabled. Up to
> this patch the DDR clocks were requested from drivers/memory/atmel-sdramc.c
> which does only clock request and enable. There is no need to have
> a separate driver just for this, thus the atmel-sdramc.c will be deleted
> in a subsequent patch.
> 
> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>

Applied to clk-microchip, thanks!

> ---
>  drivers/clk/at91/at91rm9200.c     |  2 +-
>  drivers/clk/at91/at91sam9260.c    |  2 +-
>  drivers/clk/at91/at91sam9g45.c    | 10 ++++++++--
>  drivers/clk/at91/at91sam9n12.c    | 12 +++++++++---
>  drivers/clk/at91/at91sam9rl.c     |  2 +-
>  drivers/clk/at91/at91sam9x5.c     | 17 ++++++++++++-----
>  drivers/clk/at91/clk-peripheral.c |  8 ++++----
>  drivers/clk/at91/clk-system.c     |  4 ++--
>  drivers/clk/at91/dt-compat.c      | 25 +++++++++++++++++++++++--
>  drivers/clk/at91/pmc.h            |  4 ++--
>  drivers/clk/at91/sam9x60.c        | 20 ++++++++++++++++----
>  drivers/clk/at91/sama5d2.c        | 22 +++++++++++++++++-----
>  drivers/clk/at91/sama5d3.c        | 20 ++++++++++++++++----
>  drivers/clk/at91/sama5d4.c        | 22 +++++++++++++++++-----
>  drivers/clk/at91/sama7g5.c        |  4 ++--
>  15 files changed, 131 insertions(+), 43 deletions(-)
> 
> diff --git a/drivers/clk/at91/at91rm9200.c b/drivers/clk/at91/at91rm9200.c
> index 16870943a13e..0b860126d589 100644
> --- a/drivers/clk/at91/at91rm9200.c
> +++ b/drivers/clk/at91/at91rm9200.c
> @@ -183,7 +183,7 @@ static void __init at91rm9200_pmc_setup(struct device_node *np)
>  	for (i = 0; i < ARRAY_SIZE(at91rm9200_systemck); i++) {
>  		hw = at91_clk_register_system(regmap, at91rm9200_systemck[i].n,
>  					      at91rm9200_systemck[i].p,
> -					      at91rm9200_systemck[i].id);
> +					      at91rm9200_systemck[i].id, 0);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> diff --git a/drivers/clk/at91/at91sam9260.c b/drivers/clk/at91/at91sam9260.c
> index 11550e50cd9f..b521f470428f 100644
> --- a/drivers/clk/at91/at91sam9260.c
> +++ b/drivers/clk/at91/at91sam9260.c
> @@ -460,7 +460,7 @@ static void __init at91sam926x_pmc_setup(struct device_node *np,
>  	for (i = 0; i < data->num_sck; i++) {
>  		hw = at91_clk_register_system(regmap, data->sck[i].n,
>  					      data->sck[i].p,
> -					      data->sck[i].id);
> +					      data->sck[i].id, 0);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> diff --git a/drivers/clk/at91/at91sam9g45.c b/drivers/clk/at91/at91sam9g45.c
> index 8c9344451f46..5099669ddcbd 100644
> --- a/drivers/clk/at91/at91sam9g45.c
> +++ b/drivers/clk/at91/at91sam9g45.c
> @@ -40,9 +40,14 @@ static const struct clk_pll_characteristics plla_characteristics = {
>  static const struct {
>  	char *n;
>  	char *p;
> +	unsigned long flags;
>  	u8 id;
>  } at91sam9g45_systemck[] = {
> -	{ .n = "ddrck", .p = "masterck_div", .id = 2 },
> +	/*
> +	 * ddrck feeds DDR controller and is enabled by bootloader thus we need
> +	 * to keep it enabled in case there is no Linux consumer for it.
> +	 */
> +	{ .n = "ddrck", .p = "masterck_div", .id = 2, .flags = CLK_IS_CRITICAL },
>  	{ .n = "uhpck", .p = "usbck",        .id = 6 },
>  	{ .n = "pck0",  .p = "prog0",        .id = 8 },
>  	{ .n = "pck1",  .p = "prog1",        .id = 9 },
> @@ -198,7 +203,8 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np)
>  	for (i = 0; i < ARRAY_SIZE(at91sam9g45_systemck); i++) {
>  		hw = at91_clk_register_system(regmap, at91sam9g45_systemck[i].n,
>  					      at91sam9g45_systemck[i].p,
> -					      at91sam9g45_systemck[i].id);
> +					      at91sam9g45_systemck[i].id,
> +					      at91sam9g45_systemck[i].flags);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> diff --git a/drivers/clk/at91/at91sam9n12.c b/drivers/clk/at91/at91sam9n12.c
> index 0bb19400d199..08a10e12d08d 100644
> --- a/drivers/clk/at91/at91sam9n12.c
> +++ b/drivers/clk/at91/at91sam9n12.c
> @@ -54,9 +54,14 @@ static const struct clk_pll_characteristics pllb_characteristics = {
>  static const struct {
>  	char *n;
>  	char *p;
> +	unsigned long flags;
>  	u8 id;
>  } at91sam9n12_systemck[] = {
> -	{ .n = "ddrck", .p = "masterck_div", .id = 2 },
> +	/*
> +	 * ddrck feeds DDR controller and is enabled by bootloader thus we need
> +	 * to keep it enabled in case there is no Linux consumer for it.
> +	 */
> +	{ .n = "ddrck", .p = "masterck_div", .id = 2, .flags = CLK_IS_CRITICAL },
>  	{ .n = "lcdck", .p = "masterck_div", .id = 3 },
>  	{ .n = "uhpck", .p = "usbck",        .id = 6 },
>  	{ .n = "udpck", .p = "usbck",        .id = 7 },
> @@ -223,7 +228,8 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np)
>  	for (i = 0; i < ARRAY_SIZE(at91sam9n12_systemck); i++) {
>  		hw = at91_clk_register_system(regmap, at91sam9n12_systemck[i].n,
>  					      at91sam9n12_systemck[i].p,
> -					      at91sam9n12_systemck[i].id);
> +					      at91sam9n12_systemck[i].id,
> +					      at91sam9n12_systemck[i].flags);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> @@ -236,7 +242,7 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np)
>  							 at91sam9n12_periphck[i].n,
>  							 "masterck_div",
>  							 at91sam9n12_periphck[i].id,
> -							 &range, INT_MIN);
> +							 &range, INT_MIN, 0);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> diff --git a/drivers/clk/at91/at91sam9rl.c b/drivers/clk/at91/at91sam9rl.c
> index b992137bab02..1a1b6b2bb0e3 100644
> --- a/drivers/clk/at91/at91sam9rl.c
> +++ b/drivers/clk/at91/at91sam9rl.c
> @@ -160,7 +160,7 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np)
>  	for (i = 0; i < ARRAY_SIZE(at91sam9rl_systemck); i++) {
>  		hw = at91_clk_register_system(regmap, at91sam9rl_systemck[i].n,
>  					      at91sam9rl_systemck[i].p,
> -					      at91sam9rl_systemck[i].id);
> +					      at91sam9rl_systemck[i].id, 0);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> diff --git a/drivers/clk/at91/at91sam9x5.c b/drivers/clk/at91/at91sam9x5.c
> index 3857db2e144b..13e589c95907 100644
> --- a/drivers/clk/at91/at91sam9x5.c
> +++ b/drivers/clk/at91/at91sam9x5.c
> @@ -41,9 +41,14 @@ static const struct clk_pll_characteristics plla_characteristics = {
>  static const struct {
>  	char *n;
>  	char *p;
> +	unsigned long flags;
>  	u8 id;
>  } at91sam9x5_systemck[] = {
> -	{ .n = "ddrck", .p = "masterck_div", .id = 2 },
> +	/*
> +	 * ddrck feeds DDR controller and is enabled by bootloader thus we need
> +	 * to keep it enabled in case there is no Linux consumer for it.
> +	 */
> +	{ .n = "ddrck", .p = "masterck_div", .id = 2, .flags = CLK_IS_CRITICAL },
>  	{ .n = "smdck", .p = "smdclk",   .id = 4 },
>  	{ .n = "uhpck", .p = "usbck",    .id = 6 },
>  	{ .n = "udpck", .p = "usbck",    .id = 7 },
> @@ -248,7 +253,8 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
>  	for (i = 0; i < ARRAY_SIZE(at91sam9x5_systemck); i++) {
>  		hw = at91_clk_register_system(regmap, at91sam9x5_systemck[i].n,
>  					      at91sam9x5_systemck[i].p,
> -					      at91sam9x5_systemck[i].id);
> +					      at91sam9x5_systemck[i].id,
> +					      at91sam9x5_systemck[i].flags);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> @@ -256,7 +262,8 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
>  	}
>  
>  	if (has_lcdck) {
> -		hw = at91_clk_register_system(regmap, "lcdck", "masterck_div", 3);
> +		hw = at91_clk_register_system(regmap, "lcdck", "masterck_div",
> +					      3, 0);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> @@ -269,7 +276,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
>  							 at91sam9x5_periphck[i].n,
>  							 "masterck_div",
>  							 at91sam9x5_periphck[i].id,
> -							 &range, INT_MIN);
> +							 &range, INT_MIN, 0);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> @@ -282,7 +289,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
>  							 extra_pcks[i].n,
>  							 "masterck_div",
>  							 extra_pcks[i].id,
> -							 &range, INT_MIN);
> +							 &range, INT_MIN, 0);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> diff --git a/drivers/clk/at91/clk-peripheral.c b/drivers/clk/at91/clk-peripheral.c
> index 5104d4025484..93ea685e27f6 100644
> --- a/drivers/clk/at91/clk-peripheral.c
> +++ b/drivers/clk/at91/clk-peripheral.c
> @@ -445,7 +445,7 @@ at91_clk_register_sam9x5_peripheral(struct regmap *regmap, spinlock_t *lock,
>  				    const struct clk_pcr_layout *layout,
>  				    const char *name, const char *parent_name,
>  				    u32 id, const struct clk_range *range,
> -				    int chg_pid)
> +				    int chg_pid, unsigned long flags)
>  {
>  	struct clk_sam9x5_peripheral *periph;
>  	struct clk_init_data init;
> @@ -462,12 +462,12 @@ at91_clk_register_sam9x5_peripheral(struct regmap *regmap, spinlock_t *lock,
>  	init.name = name;
>  	init.parent_names = &parent_name;
>  	init.num_parents = 1;
> +	init.flags = flags;
>  	if (chg_pid < 0) {
> -		init.flags = 0;
>  		init.ops = &sam9x5_peripheral_ops;
>  	} else {
> -		init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE |
> -			     CLK_SET_RATE_PARENT;
> +		init.flags |= CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE |
> +			      CLK_SET_RATE_PARENT;
>  		init.ops = &sam9x5_peripheral_chg_ops;
>  	}
>  
> diff --git a/drivers/clk/at91/clk-system.c b/drivers/clk/at91/clk-system.c
> index 80720fd1a9cf..10193650429e 100644
> --- a/drivers/clk/at91/clk-system.c
> +++ b/drivers/clk/at91/clk-system.c
> @@ -105,7 +105,7 @@ static const struct clk_ops system_ops = {
>  
>  struct clk_hw * __init
>  at91_clk_register_system(struct regmap *regmap, const char *name,
> -			 const char *parent_name, u8 id)
> +			 const char *parent_name, u8 id, unsigned long flags)
>  {
>  	struct clk_system *sys;
>  	struct clk_hw *hw;
> @@ -123,7 +123,7 @@ at91_clk_register_system(struct regmap *regmap, const char *name,
>  	init.ops = &system_ops;
>  	init.parent_names = &parent_name;
>  	init.num_parents = 1;
> -	init.flags = CLK_SET_RATE_PARENT;
> +	init.flags = CLK_SET_RATE_PARENT | flags;
>  
>  	sys->id = id;
>  	sys->hw.init = &init;
> diff --git a/drivers/clk/at91/dt-compat.c b/drivers/clk/at91/dt-compat.c
> index 85a964cb2d89..97f67e23ef80 100644
> --- a/drivers/clk/at91/dt-compat.c
> +++ b/drivers/clk/at91/dt-compat.c
> @@ -493,18 +493,28 @@ of_at91_clk_periph_setup(struct device_node *np, u8 type)
>  							  parent_name, id);
>  		} else {
>  			struct clk_range range = CLK_RANGE(0, 0);
> +			unsigned long flags = 0;
>  
>  			of_at91_get_clk_range(periphclknp,
>  					      "atmel,clk-output-range",
>  					      &range);
>  
> +			/*
> +			 * mpddr_clk feed DDR controller and is enabled by
> +			 * bootloader thus we need to keep it enabled in case
> +			 * there is no Linux consumer for it.
> +			 */
> +			if (!strcmp(periphclknp->name, "mpddr_clk"))
> +				flags = CLK_IS_CRITICAL;
> +
>  			hw = at91_clk_register_sam9x5_peripheral(regmap,
>  								 &pmc_pcr_lock,
>  								 &dt_pcr_layout,
>  								 name,
>  								 parent_name,
>  								 id, &range,
> -								 INT_MIN);
> +								 INT_MIN,
> +								 flags);
>  		}
>  
>  		if (IS_ERR(hw))
> @@ -879,6 +889,8 @@ static void __init of_at91rm9200_clk_sys_setup(struct device_node *np)
>  		return;
>  
>  	for_each_child_of_node(np, sysclknp) {
> +		unsigned long flags = 0;
> +
>  		if (of_property_read_u32(sysclknp, "reg", &id))
>  			continue;
>  
> @@ -887,7 +899,16 @@ static void __init of_at91rm9200_clk_sys_setup(struct device_node *np)
>  
>  		parent_name = of_clk_get_parent_name(sysclknp, 0);
>  
> -		hw = at91_clk_register_system(regmap, name, parent_name, id);
> +		/*
> +		 * ddrck feeds DDR controller and is enabled by bootloader thus
> +		 * we need to keep it enabled in case there is no Linux consumer
> +		 * for it.
> +		 */
> +		if (!strcmp(sysclknp->name, "ddrck"))
> +			flags = CLK_IS_CRITICAL;
> +
> +		hw = at91_clk_register_system(regmap, name, parent_name, id,
> +					      flags);
>  		if (IS_ERR(hw))
>  			continue;
>  
> diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h
> index efe4975bddc3..1b3ca7dd9b57 100644
> --- a/drivers/clk/at91/pmc.h
> +++ b/drivers/clk/at91/pmc.h
> @@ -199,7 +199,7 @@ at91_clk_register_sam9x5_peripheral(struct regmap *regmap, spinlock_t *lock,
>  				    const struct clk_pcr_layout *layout,
>  				    const char *name, const char *parent_name,
>  				    u32 id, const struct clk_range *range,
> -				    int chg_pid);
> +				    int chg_pid, unsigned long flags);
>  
>  struct clk_hw * __init
>  at91_clk_register_pll(struct regmap *regmap, const char *name,
> @@ -242,7 +242,7 @@ at91sam9x5_clk_register_smd(struct regmap *regmap, const char *name,
>  
>  struct clk_hw * __init
>  at91_clk_register_system(struct regmap *regmap, const char *name,
> -			 const char *parent_name, u8 id);
> +			 const char *parent_name, u8 id, unsigned long flags);
>  
>  struct clk_hw * __init
>  at91sam9x5_clk_register_usb(struct regmap *regmap, const char *name,
> diff --git a/drivers/clk/at91/sam9x60.c b/drivers/clk/at91/sam9x60.c
> index 9ea4ce501bad..ac070db58195 100644
> --- a/drivers/clk/at91/sam9x60.c
> +++ b/drivers/clk/at91/sam9x60.c
> @@ -75,9 +75,14 @@ static const struct clk_pcr_layout sam9x60_pcr_layout = {
>  static const struct {
>  	char *n;
>  	char *p;
> +	unsigned long flags;
>  	u8 id;
>  } sam9x60_systemck[] = {
> -	{ .n = "ddrck",  .p = "masterck_div", .id = 2 },
> +	/*
> +	 * ddrck feeds DDR controller and is enabled by bootloader thus we need
> +	 * to keep it enabled in case there is no Linux consumer for it.
> +	 */
> +	{ .n = "ddrck",  .p = "masterck_div", .id = 2, .flags = CLK_IS_CRITICAL },
>  	{ .n = "uhpck",  .p = "usbck",    .id = 6 },
>  	{ .n = "pck0",   .p = "prog0",    .id = 8 },
>  	{ .n = "pck1",   .p = "prog1",    .id = 9 },
> @@ -86,6 +91,7 @@ static const struct {
>  
>  static const struct {
>  	char *n;
> +	unsigned long flags;
>  	u8 id;
>  } sam9x60_periphck[] = {
>  	{ .n = "pioA_clk",   .id = 2, },
> @@ -132,7 +138,11 @@ static const struct {
>  	{ .n = "pioD_clk",   .id = 44, },
>  	{ .n = "tcb1_clk",   .id = 45, },
>  	{ .n = "dbgu_clk",   .id = 47, },
> -	{ .n = "mpddr_clk",  .id = 49, },
> +	/*
> +	 * mpddr_clk feeds DDR controller and is enabled by bootloader thus we
> +	 * need to keep it enabled in case there is no Linux consumer for it.
> +	 */
> +	{ .n = "mpddr_clk",  .id = 49, .flags = CLK_IS_CRITICAL },
>  };
>  
>  static const struct {
> @@ -315,7 +325,8 @@ static void __init sam9x60_pmc_setup(struct device_node *np)
>  	for (i = 0; i < ARRAY_SIZE(sam9x60_systemck); i++) {
>  		hw = at91_clk_register_system(regmap, sam9x60_systemck[i].n,
>  					      sam9x60_systemck[i].p,
> -					      sam9x60_systemck[i].id);
> +					      sam9x60_systemck[i].id,
> +					      sam9x60_systemck[i].flags);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> @@ -328,7 +339,8 @@ static void __init sam9x60_pmc_setup(struct device_node *np)
>  							 sam9x60_periphck[i].n,
>  							 "masterck_div",
>  							 sam9x60_periphck[i].id,
> -							 &range, INT_MIN);
> +							 &range, INT_MIN,
> +							 sam9x60_periphck[i].flags);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c
> index 84156dc52bff..c0e3e1a4bbf3 100644
> --- a/drivers/clk/at91/sama5d2.c
> +++ b/drivers/clk/at91/sama5d2.c
> @@ -40,9 +40,14 @@ static const struct clk_pcr_layout sama5d2_pcr_layout = {
>  static const struct {
>  	char *n;
>  	char *p;
> +	unsigned long flags;
>  	u8 id;
>  } sama5d2_systemck[] = {
> -	{ .n = "ddrck", .p = "masterck_div", .id = 2 },
> +	/*
> +	 * ddrck feeds DDR controller and is enabled by bootloader thus we need
> +	 * to keep it enabled in case there is no Linux consumer for it.
> +	 */
> +	{ .n = "ddrck", .p = "masterck_div", .id = 2, .flags = CLK_IS_CRITICAL },
>  	{ .n = "lcdck", .p = "masterck_div", .id = 3 },
>  	{ .n = "uhpck", .p = "usbck",        .id = 6 },
>  	{ .n = "udpck", .p = "usbck",        .id = 7 },
> @@ -97,6 +102,7 @@ static const struct {
>  
>  static const struct {
>  	char *n;
> +	unsigned long flags;
>  	u8 id;
>  } sama5d2_periphck[] = {
>  	{ .n = "dma0_clk",    .id = 6, },
> @@ -104,7 +110,11 @@ static const struct {
>  	{ .n = "aes_clk",     .id = 9, },
>  	{ .n = "aesb_clk",    .id = 10, },
>  	{ .n = "sha_clk",     .id = 12, },
> -	{ .n = "mpddr_clk",   .id = 13, },
> +	/*
> +	 * mpddr_clk feeds DDR controller and is enabled by bootloader thus we
> +	 * need to keep it enabled in case there is no Linux consumer for it.
> +	 */
> +	{ .n = "mpddr_clk",   .id = 13, .flags = CLK_IS_CRITICAL },
>  	{ .n = "matrix0_clk", .id = 15, },
>  	{ .n = "sdmmc0_hclk", .id = 31, },
>  	{ .n = "sdmmc1_hclk", .id = 32, },
> @@ -302,7 +312,8 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
>  	for (i = 0; i < ARRAY_SIZE(sama5d2_systemck); i++) {
>  		hw = at91_clk_register_system(regmap, sama5d2_systemck[i].n,
>  					      sama5d2_systemck[i].p,
> -					      sama5d2_systemck[i].id);
> +					      sama5d2_systemck[i].id,
> +					      sama5d2_systemck[i].flags);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> @@ -315,7 +326,8 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
>  							 sama5d2_periphck[i].n,
>  							 "masterck_div",
>  							 sama5d2_periphck[i].id,
> -							 &range, INT_MIN);
> +							 &range, INT_MIN,
> +							 sama5d2_periphck[i].flags);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> @@ -329,7 +341,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
>  							 "h32mxck",
>  							 sama5d2_periph32ck[i].id,
>  							 &sama5d2_periph32ck[i].r,
> -							 INT_MIN);
> +							 INT_MIN, 0);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> diff --git a/drivers/clk/at91/sama5d3.c b/drivers/clk/at91/sama5d3.c
> index 7e93c6edf305..ad6068b884de 100644
> --- a/drivers/clk/at91/sama5d3.c
> +++ b/drivers/clk/at91/sama5d3.c
> @@ -40,9 +40,14 @@ static const struct clk_pcr_layout sama5d3_pcr_layout = {
>  static const struct {
>  	char *n;
>  	char *p;
> +	unsigned long flags;
>  	u8 id;
>  } sama5d3_systemck[] = {
> -	{ .n = "ddrck", .p = "masterck_div", .id = 2 },
> +	/*
> +	 * ddrck feeds DDR controller and is enabled by bootloader thus we need
> +	 * to keep it enabled in case there is no Linux consumer for it.
> +	 */
> +	{ .n = "ddrck", .p = "masterck_div", .id = 2, .flags = CLK_IS_CRITICAL },
>  	{ .n = "lcdck", .p = "masterck_div", .id = 3 },
>  	{ .n = "smdck", .p = "smdclk",       .id = 4 },
>  	{ .n = "uhpck", .p = "usbck",        .id = 6 },
> @@ -56,6 +61,7 @@ static const struct {
>  	char *n;
>  	u8 id;
>  	struct clk_range r;
> +	unsigned long flags;
>  } sama5d3_periphck[] = {
>  	{ .n = "dbgu_clk", .id = 2, },
>  	{ .n = "hsmc_clk", .id = 5, },
> @@ -99,7 +105,11 @@ static const struct {
>  	{ .n = "tdes_clk", .id = 44, },
>  	{ .n = "trng_clk", .id = 45, },
>  	{ .n = "fuse_clk", .id = 48, },
> -	{ .n = "mpddr_clk", .id = 49, },
> +	/*
> +	 * mpddr_clk feeds DDR controller and is enabled by bootloader thus we
> +	 * need to keep it enabled in case there is no Linux consumer for it.
> +	 */
> +	{ .n = "mpddr_clk", .id = 49, .flags = CLK_IS_CRITICAL },
>  };
>  
>  static void __init sama5d3_pmc_setup(struct device_node *np)
> @@ -222,7 +232,8 @@ static void __init sama5d3_pmc_setup(struct device_node *np)
>  	for (i = 0; i < ARRAY_SIZE(sama5d3_systemck); i++) {
>  		hw = at91_clk_register_system(regmap, sama5d3_systemck[i].n,
>  					      sama5d3_systemck[i].p,
> -					      sama5d3_systemck[i].id);
> +					      sama5d3_systemck[i].id,
> +					      sama5d3_systemck[i].flags);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> @@ -236,7 +247,8 @@ static void __init sama5d3_pmc_setup(struct device_node *np)
>  							 "masterck_div",
>  							 sama5d3_periphck[i].id,
>  							 &sama5d3_periphck[i].r,
> -							 INT_MIN);
> +							 INT_MIN,
> +							 sama5d3_periphck[i].flags);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> diff --git a/drivers/clk/at91/sama5d4.c b/drivers/clk/at91/sama5d4.c
> index 1a14a9bce308..e876ec971a39 100644
> --- a/drivers/clk/at91/sama5d4.c
> +++ b/drivers/clk/at91/sama5d4.c
> @@ -39,9 +39,14 @@ static const struct clk_pcr_layout sama5d4_pcr_layout = {
>  static const struct {
>  	char *n;
>  	char *p;
> +	unsigned long flags;
>  	u8 id;
>  } sama5d4_systemck[] = {
> -	{ .n = "ddrck", .p = "masterck_div", .id = 2 },
> +	/*
> +	 * ddrck feeds DDR controller and is enabled by bootloader thus we need
> +	 * to keep it enabled in case there is no Linux consumer for it.
> +	 */
> +	{ .n = "ddrck", .p = "masterck_div", .id = 2, .flags = CLK_IS_CRITICAL },
>  	{ .n = "lcdck", .p = "masterck_div", .id = 3 },
>  	{ .n = "smdck", .p = "smdclk",       .id = 4 },
>  	{ .n = "uhpck", .p = "usbck",        .id = 6 },
> @@ -103,12 +108,17 @@ static const struct {
>  
>  static const struct {
>  	char *n;
> +	unsigned long flags;
>  	u8 id;
>  } sama5d4_periphck[] = {
>  	{ .n = "dma0_clk", .id = 8 },
>  	{ .n = "cpkcc_clk", .id = 10 },
>  	{ .n = "aesb_clk", .id = 13 },
> -	{ .n = "mpddr_clk", .id = 16 },
> +	/*
> +	 * mpddr_clk feeds DDR controller and is enabled by bootloader thus we
> +	 * need to keep it enabled in case there is no Linux consumer for it.
> +	 */
> +	{ .n = "mpddr_clk", .id = 16, .flags = CLK_IS_CRITICAL },
>  	{ .n = "matrix0_clk", .id = 18 },
>  	{ .n = "vdec_clk", .id = 19 },
>  	{ .n = "dma1_clk", .id = 50 },
> @@ -245,7 +255,8 @@ static void __init sama5d4_pmc_setup(struct device_node *np)
>  	for (i = 0; i < ARRAY_SIZE(sama5d4_systemck); i++) {
>  		hw = at91_clk_register_system(regmap, sama5d4_systemck[i].n,
>  					      sama5d4_systemck[i].p,
> -					      sama5d4_systemck[i].id);
> +					      sama5d4_systemck[i].id,
> +					      sama5d4_systemck[i].flags);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> @@ -258,7 +269,8 @@ static void __init sama5d4_pmc_setup(struct device_node *np)
>  							 sama5d4_periphck[i].n,
>  							 "masterck_div",
>  							 sama5d4_periphck[i].id,
> -							 &range, INT_MIN);
> +							 &range, INT_MIN,
> +							 sama5d4_periphck[i].flags);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> @@ -271,7 +283,7 @@ static void __init sama5d4_pmc_setup(struct device_node *np)
>  							 sama5d4_periph32ck[i].n,
>  							 "h32mxck",
>  							 sama5d4_periph32ck[i].id,
> -							 &range, INT_MIN);
> +							 &range, INT_MIN, 0);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> diff --git a/drivers/clk/at91/sama7g5.c b/drivers/clk/at91/sama7g5.c
> index 9a213ba9e58b..f135b662f1ff 100644
> --- a/drivers/clk/at91/sama7g5.c
> +++ b/drivers/clk/at91/sama7g5.c
> @@ -1068,7 +1068,7 @@ static void __init sama7g5_pmc_setup(struct device_node *np)
>  	for (i = 0; i < ARRAY_SIZE(sama7g5_systemck); i++) {
>  		hw = at91_clk_register_system(regmap, sama7g5_systemck[i].n,
>  					      sama7g5_systemck[i].p,
> -					      sama7g5_systemck[i].id);
> +					      sama7g5_systemck[i].id, 0);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  
> @@ -1083,7 +1083,7 @@ static void __init sama7g5_pmc_setup(struct device_node *np)
>  						sama7g5_periphck[i].id,
>  						&sama7g5_periphck[i].r,
>  						sama7g5_periphck[i].chgp ? 0 :
> -						INT_MIN);
> +						INT_MIN, 0);
>  		if (IS_ERR(hw))
>  			goto err_free;
>  


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 3/3] clk: at91: do not compile dt-compat.c for sama7g5 and sam9x60
  2022-12-08 11:45   ` Claudiu Beznea
@ 2023-01-12 10:28     ` Claudiu.Beznea
  -1 siblings, 0 replies; 30+ messages in thread
From: Claudiu.Beznea @ 2023-01-12 10:28 UTC (permalink / raw)
  To: mturquette, sboyd, Nicolas.Ferre, alexandre.belloni, krzysztof.kozlowski
  Cc: linux-kernel, linux-clk, linux-arm-kernel

On 08.12.2022 13:45, Claudiu Beznea wrote:
> There is no need to have dt-compat.c compiled for SAMA7G5 and SAM9X60
> as there is no in kernel device tree that could use it. Thus avoid
> compiling dt-compat.c for them.
> 
> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>

Applied to clk-microchip, thanks!

> ---
>  drivers/clk/at91/Makefile | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/clk/at91/Makefile b/drivers/clk/at91/Makefile
> index 79301e1c1c36..89061b85e7d2 100644
> --- a/drivers/clk/at91/Makefile
> +++ b/drivers/clk/at91/Makefile
> @@ -3,7 +3,7 @@
>  # Makefile for at91 specific clk
>  #
>  
> -obj-y += pmc.o sckc.o dt-compat.o
> +obj-y += pmc.o sckc.o
>  obj-y += clk-slow.o clk-main.o clk-pll.o clk-plldiv.o clk-master.o
>  obj-y += clk-system.o clk-peripheral.o clk-programmable.o
>  
> @@ -15,12 +15,12 @@ obj-$(CONFIG_HAVE_AT91_H32MX)		+= clk-h32mx.o
>  obj-$(CONFIG_HAVE_AT91_GENERATED_CLK)	+= clk-generated.o
>  obj-$(CONFIG_HAVE_AT91_I2S_MUX_CLK)	+= clk-i2s-mux.o
>  obj-$(CONFIG_HAVE_AT91_SAM9X60_PLL)	+= clk-sam9x60-pll.o
> -obj-$(CONFIG_SOC_AT91RM9200) += at91rm9200.o
> -obj-$(CONFIG_SOC_AT91SAM9) += at91sam9260.o at91sam9rl.o at91sam9x5.o
> -obj-$(CONFIG_SOC_AT91SAM9) += at91sam9g45.o
> -obj-$(CONFIG_SOC_AT91SAM9) += at91sam9n12.o at91sam9x5.o
> +obj-$(CONFIG_SOC_AT91RM9200) += at91rm9200.o dt-compat.o
> +obj-$(CONFIG_SOC_AT91SAM9) += at91sam9260.o at91sam9rl.o at91sam9x5.o dt-compat.o
> +obj-$(CONFIG_SOC_AT91SAM9) += at91sam9g45.o dt-compat.o
> +obj-$(CONFIG_SOC_AT91SAM9) += at91sam9n12.o at91sam9x5.o dt-compat.o
>  obj-$(CONFIG_SOC_SAM9X60) += sam9x60.o
> -obj-$(CONFIG_SOC_SAMA5D3) += sama5d3.o
> -obj-$(CONFIG_SOC_SAMA5D4) += sama5d4.o
> -obj-$(CONFIG_SOC_SAMA5D2) += sama5d2.o
> +obj-$(CONFIG_SOC_SAMA5D3) += sama5d3.o dt-compat.o
> +obj-$(CONFIG_SOC_SAMA5D4) += sama5d4.o dt-compat.o
> +obj-$(CONFIG_SOC_SAMA5D2) += sama5d2.o dt-compat.o
>  obj-$(CONFIG_SOC_SAMA7G5) += sama7g5.o

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 3/3] clk: at91: do not compile dt-compat.c for sama7g5 and sam9x60
@ 2023-01-12 10:28     ` Claudiu.Beznea
  0 siblings, 0 replies; 30+ messages in thread
From: Claudiu.Beznea @ 2023-01-12 10:28 UTC (permalink / raw)
  To: mturquette, sboyd, Nicolas.Ferre, alexandre.belloni, krzysztof.kozlowski
  Cc: linux-kernel, linux-clk, linux-arm-kernel

On 08.12.2022 13:45, Claudiu Beznea wrote:
> There is no need to have dt-compat.c compiled for SAMA7G5 and SAM9X60
> as there is no in kernel device tree that could use it. Thus avoid
> compiling dt-compat.c for them.
> 
> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>

Applied to clk-microchip, thanks!

> ---
>  drivers/clk/at91/Makefile | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/clk/at91/Makefile b/drivers/clk/at91/Makefile
> index 79301e1c1c36..89061b85e7d2 100644
> --- a/drivers/clk/at91/Makefile
> +++ b/drivers/clk/at91/Makefile
> @@ -3,7 +3,7 @@
>  # Makefile for at91 specific clk
>  #
>  
> -obj-y += pmc.o sckc.o dt-compat.o
> +obj-y += pmc.o sckc.o
>  obj-y += clk-slow.o clk-main.o clk-pll.o clk-plldiv.o clk-master.o
>  obj-y += clk-system.o clk-peripheral.o clk-programmable.o
>  
> @@ -15,12 +15,12 @@ obj-$(CONFIG_HAVE_AT91_H32MX)		+= clk-h32mx.o
>  obj-$(CONFIG_HAVE_AT91_GENERATED_CLK)	+= clk-generated.o
>  obj-$(CONFIG_HAVE_AT91_I2S_MUX_CLK)	+= clk-i2s-mux.o
>  obj-$(CONFIG_HAVE_AT91_SAM9X60_PLL)	+= clk-sam9x60-pll.o
> -obj-$(CONFIG_SOC_AT91RM9200) += at91rm9200.o
> -obj-$(CONFIG_SOC_AT91SAM9) += at91sam9260.o at91sam9rl.o at91sam9x5.o
> -obj-$(CONFIG_SOC_AT91SAM9) += at91sam9g45.o
> -obj-$(CONFIG_SOC_AT91SAM9) += at91sam9n12.o at91sam9x5.o
> +obj-$(CONFIG_SOC_AT91RM9200) += at91rm9200.o dt-compat.o
> +obj-$(CONFIG_SOC_AT91SAM9) += at91sam9260.o at91sam9rl.o at91sam9x5.o dt-compat.o
> +obj-$(CONFIG_SOC_AT91SAM9) += at91sam9g45.o dt-compat.o
> +obj-$(CONFIG_SOC_AT91SAM9) += at91sam9n12.o at91sam9x5.o dt-compat.o
>  obj-$(CONFIG_SOC_SAM9X60) += sam9x60.o
> -obj-$(CONFIG_SOC_SAMA5D3) += sama5d3.o
> -obj-$(CONFIG_SOC_SAMA5D4) += sama5d4.o
> -obj-$(CONFIG_SOC_SAMA5D2) += sama5d2.o
> +obj-$(CONFIG_SOC_SAMA5D3) += sama5d3.o dt-compat.o
> +obj-$(CONFIG_SOC_SAMA5D4) += sama5d4.o dt-compat.o
> +obj-$(CONFIG_SOC_SAMA5D2) += sama5d2.o dt-compat.o
>  obj-$(CONFIG_SOC_SAMA7G5) += sama7g5.o


^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2023-01-12 10:34 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-08 11:45 [PATCH 0/3] clk: at91: mark ddr clocks as critical Claudiu Beznea
2022-12-08 11:45 ` Claudiu Beznea
2022-12-08 11:45 ` [PATCH 1/3] " Claudiu Beznea
2022-12-08 11:45   ` Claudiu Beznea
2023-01-12 10:28   ` Claudiu.Beznea
2023-01-12 10:28     ` Claudiu.Beznea
2022-12-08 11:45 ` [PATCH 2/3] memory: atmel-sdramc: remove the driver Claudiu Beznea
2022-12-08 11:45   ` Claudiu Beznea
2023-01-03 10:00   ` Claudiu.Beznea
2023-01-03 10:00     ` Claudiu.Beznea
2023-01-03 10:06     ` Krzysztof Kozlowski
2023-01-03 10:06       ` Krzysztof Kozlowski
2023-01-03 11:18       ` Claudiu.Beznea
2023-01-03 11:18         ` Claudiu.Beznea
2023-01-03 12:00         ` Krzysztof Kozlowski
2023-01-03 12:00           ` Krzysztof Kozlowski
2023-01-03 12:45           ` Claudiu.Beznea
2023-01-03 12:45             ` Claudiu.Beznea
2023-01-03 13:17             ` Krzysztof Kozlowski
2023-01-03 13:17               ` Krzysztof Kozlowski
2023-01-03 14:29               ` Claudiu.Beznea
2023-01-03 14:29                 ` Claudiu.Beznea
2022-12-08 11:45 ` [PATCH 3/3] clk: at91: do not compile dt-compat.c for sama7g5 and sam9x60 Claudiu Beznea
2022-12-08 11:45   ` Claudiu Beznea
2022-12-08 14:39   ` Alexandre Belloni
2022-12-08 14:39     ` Alexandre Belloni
2022-12-08 15:17     ` Claudiu.Beznea
2022-12-08 15:17       ` Claudiu.Beznea
2023-01-12 10:28   ` Claudiu.Beznea
2023-01-12 10:28     ` Claudiu.Beznea

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.