diff mbox series

[v2,1/4] fu540: prci: add request and free clock handlers

Message ID 1590512951-1045-2-git-send-email-sagar.kadam@sifive.com
State Superseded
Delegated to: Andes
Headers show
Series update clock handler and proper cpu features | expand

Commit Message

Sagar Kadam May 26, 2020, 5:09 p.m. UTC
Add clk_request handler to check if a valid clock is requested,
Here clk_free handler is added for debug purpose which will display
details of clock passed to clk_free.

Signed-off-by: Sagar Shrikant Kadam <sagar.kadam@sifive.com>
---
 drivers/clk/sifive/fu540-prci.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

Comments

Pragnesh Patel May 27, 2020, 2:11 p.m. UTC | #1
>-----Original Message-----
>From: Sagar Kadam <sagar.kadam@sifive.com>
>Sent: 26 May 2020 22:39
>To: u-boot@lists.denx.de; rick@andestech.com; lukma@denx.de
>Cc: jagan@amarulasolutions.com; bmeng.cn@gmail.com; Pragnesh Patel
><pragnesh.patel@sifive.com>; seanga2@gmail.com; Sagar Kadam
><sagar.kadam@sifive.com>
>Subject: [PATCH v2 1/4] fu540: prci: add request and free clock handlers
>
>Add clk_request handler to check if a valid clock is requested, Here clk_free
>handler is added for debug purpose which will display details of clock passed
>to clk_free.
>
>Signed-off-by: Sagar Shrikant Kadam <sagar.kadam@sifive.com>
>---
> drivers/clk/sifive/fu540-prci.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>

Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>

>diff --git a/drivers/clk/sifive/fu540-prci.c b/drivers/clk/sifive/fu540-prci.c
>index 67e21b6..bf50ea2 100644
>--- a/drivers/clk/sifive/fu540-prci.c
>+++ b/drivers/clk/sifive/fu540-prci.c
>@@ -581,6 +581,25 @@ static ulong sifive_fu540_prci_set_rate(struct clk *clk,
>ulong rate)
> 	return rate;
> }
>
>+static int sifive_fu540_prci_clk_request(struct clk *clk) {
>+	debug("%s(clk=%p) (dev=%p, id=%lu)\n", __func__, clk, clk->dev,
>+	      clk->id);
>+
>+	if (clk->id >= ARRAY_SIZE(__prci_init_clocks))
>+		return -EINVAL;
>+
>+	return 0;
>+}
>+
>+static int sifive_fu540_prci_clk_free(struct clk *clk) {
>+	debug("%s(clk=%p) (dev=%p, id=%lu)\n", __func__, clk, clk->dev,
>+	      clk->id);
>+
>+	return 0;
>+}
>+
> static int sifive_fu540_prci_probe(struct udevice *dev)  {
> 	int i, err;
>@@ -612,6 +631,8 @@ static int sifive_fu540_prci_probe(struct udevice *dev)
>static struct clk_ops sifive_fu540_prci_ops = {
> 	.set_rate = sifive_fu540_prci_set_rate,
> 	.get_rate = sifive_fu540_prci_get_rate,
>+	.request  = sifive_fu540_prci_clk_request,
>+	.rfree	  = sifive_fu540_prci_clk_free,
> };
>
> static const struct udevice_id sifive_fu540_prci_ids[] = {
>--
>2.7.4
Sagar Kadam May 28, 2020, 8:51 a.m. UTC | #2
Hi Pragnesh,

> -----Original Message-----
> From: Pragnesh Patel <pragnesh.patel@sifive.com>
> Sent: Wednesday, May 27, 2020 7:41 PM
> To: Sagar Kadam <sagar.kadam@sifive.com>; u-boot@lists.denx.de;
> rick@andestech.com; lukma@denx.de
> Cc: jagan@amarulasolutions.com; bmeng.cn@gmail.com;
> seanga2@gmail.com
> Subject: RE: [PATCH v2 1/4] fu540: prci: add request and free clock handlers
> 
> >-----Original Message-----
> >From: Sagar Kadam <sagar.kadam@sifive.com>
> >Sent: 26 May 2020 22:39
> >To: u-boot@lists.denx.de; rick@andestech.com; lukma@denx.de
> >Cc: jagan@amarulasolutions.com; bmeng.cn@gmail.com; Pragnesh Patel
> ><pragnesh.patel@sifive.com>; seanga2@gmail.com; Sagar Kadam
> ><sagar.kadam@sifive.com>
> >Subject: [PATCH v2 1/4] fu540: prci: add request and free clock
> >handlers
> >
> >Add clk_request handler to check if a valid clock is requested, Here
> >clk_free handler is added for debug purpose which will display details
> >of clock passed to clk_free.
> >
> >Signed-off-by: Sagar Shrikant Kadam <sagar.kadam@sifive.com>
> >---
> > drivers/clk/sifive/fu540-prci.c | 21 +++++++++++++++++++++
> > 1 file changed, 21 insertions(+)
> >
> 
> Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
>

Thanks for the review.

BR,
Sagar
> >diff --git a/drivers/clk/sifive/fu540-prci.c
> >b/drivers/clk/sifive/fu540-prci.c index 67e21b6..bf50ea2 100644
> >--- a/drivers/clk/sifive/fu540-prci.c
> >+++ b/drivers/clk/sifive/fu540-prci.c
> >@@ -581,6 +581,25 @@ static ulong sifive_fu540_prci_set_rate(struct clk
> >*clk, ulong rate)
> > 	return rate;
> > }
> >
> >+static int sifive_fu540_prci_clk_request(struct clk *clk) {
> >+	debug("%s(clk=%p) (dev=%p, id=%lu)\n", __func__, clk, clk->dev,
> >+	      clk->id);
> >+
> >+	if (clk->id >= ARRAY_SIZE(__prci_init_clocks))
> >+		return -EINVAL;
> >+
> >+	return 0;
> >+}
> >+
> >+static int sifive_fu540_prci_clk_free(struct clk *clk) {
> >+	debug("%s(clk=%p) (dev=%p, id=%lu)\n", __func__, clk, clk->dev,
> >+	      clk->id);
> >+
> >+	return 0;
> >+}
> >+
> > static int sifive_fu540_prci_probe(struct udevice *dev)  {
> > 	int i, err;
> >@@ -612,6 +631,8 @@ static int sifive_fu540_prci_probe(struct udevice
> >*dev) static struct clk_ops sifive_fu540_prci_ops = {
> > 	.set_rate = sifive_fu540_prci_set_rate,
> > 	.get_rate = sifive_fu540_prci_get_rate,
> >+	.request  = sifive_fu540_prci_clk_request,
> >+	.rfree	  = sifive_fu540_prci_clk_free,
> > };
> >
> > static const struct udevice_id sifive_fu540_prci_ids[] = {
> >--
> >2.7.4
diff mbox series

Patch

diff --git a/drivers/clk/sifive/fu540-prci.c b/drivers/clk/sifive/fu540-prci.c
index 67e21b6..bf50ea2 100644
--- a/drivers/clk/sifive/fu540-prci.c
+++ b/drivers/clk/sifive/fu540-prci.c
@@ -581,6 +581,25 @@  static ulong sifive_fu540_prci_set_rate(struct clk *clk, ulong rate)
 	return rate;
 }
 
+static int sifive_fu540_prci_clk_request(struct clk *clk)
+{
+	debug("%s(clk=%p) (dev=%p, id=%lu)\n", __func__, clk, clk->dev,
+	      clk->id);
+
+	if (clk->id >= ARRAY_SIZE(__prci_init_clocks))
+		return -EINVAL;
+
+	return 0;
+}
+
+static int sifive_fu540_prci_clk_free(struct clk *clk)
+{
+	debug("%s(clk=%p) (dev=%p, id=%lu)\n", __func__, clk, clk->dev,
+	      clk->id);
+
+	return 0;
+}
+
 static int sifive_fu540_prci_probe(struct udevice *dev)
 {
 	int i, err;
@@ -612,6 +631,8 @@  static int sifive_fu540_prci_probe(struct udevice *dev)
 static struct clk_ops sifive_fu540_prci_ops = {
 	.set_rate = sifive_fu540_prci_set_rate,
 	.get_rate = sifive_fu540_prci_get_rate,
+	.request  = sifive_fu540_prci_clk_request,
+	.rfree	  = sifive_fu540_prci_clk_free,
 };
 
 static const struct udevice_id sifive_fu540_prci_ids[] = {