diff mbox series

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

Message ID 1592745008-17196-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 Shrikant Kadam June 21, 2020, 1:10 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>
Reviewed-by: Pragnesh Patel <Pragnesh.patel@sifive.com>
---
 drivers/clk/sifive/fu540-prci.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

Comments

Rick Chen June 22, 2020, 1:53 a.m. UTC | #1
Hi Sagar,

> From: Sagar Shrikant Kadam [mailto:sagar.kadam@sifive.com]
> Sent: Sunday, June 21, 2020 9:10 PM
> To: u-boot@lists.denx.de
> Cc: Rick Jian-Zhi Chen(陳建志); lukma@denx.de; bmeng.cn@gmail.com; jagan@amarulasolutions.com; pragnesh.patel@sifive.com; anup.patel@wdc.com; sjg@chromium.org; seanga2@gmail.com; Sagar Shrikant Kadam
> Subject: [PATCH v4 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>
> Reviewed-by: Pragnesh Patel <Pragnesh.patel@sifive.com>
> ---

This v4 series still have some conflicts with master.
Please check about it.

Applying: fu540: prci: add request and free clock handlers
Applying: riscv: dts: hifive-unleashed-a00: add cpu aliases
Applying: riscv: cpu: fixes to display proper CPU features
error: patch failed: drivers/cpu/riscv_cpu.c:38
error: drivers/cpu/riscv_cpu.c: patch does not apply
Patch failed at 0003 riscv: cpu: fixes to display proper CPU features

Thanks,
Rick

>  drivers/clk/sifive/fu540-prci.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>
> diff --git a/drivers/clk/sifive/fu540-prci.c b/drivers/clk/sifive/fu540-prci.c index fe6e0d4..9a9ff6b 100644
> --- a/drivers/clk/sifive/fu540-prci.c
> +++ b/drivers/clk/sifive/fu540-prci.c
> @@ -686,6 +686,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_enable(struct clk *clk)  {
>         struct __prci_clock *pc;
> @@ -755,6 +774,8 @@ static struct clk_ops sifive_fu540_prci_ops = {
>         .get_rate = sifive_fu540_prci_get_rate,
>         .enable = sifive_fu540_prci_enable,
>         .disable = sifive_fu540_prci_disable,
> +       .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 Shrikant Kadam June 22, 2020, 4:46 a.m. UTC | #2
Hello Rick,

> -----Original Message-----
> From: Rick Chen <rickchen36@gmail.com>
> Sent: Monday, June 22, 2020 7:24 AM
> To: Sagar Kadam <sagar.kadam@sifive.com>
> Cc: U-Boot Mailing List <u-boot@lists.denx.de>; Lukasz Majewski
> <lukma@denx.de>; Bin Meng <bmeng.cn@gmail.com>; Jagan Teki
> <jagan@amarulasolutions.com>; Pragnesh Patel
> <pragnesh.patel@sifive.com>; Anup Patel <anup.patel@wdc.com>; Simon
> Glass <sjg@chromium.org>; Sean Anderson <seanga2@gmail.com>; rick
> <rick@andestech.com>; Alan Kao <alankao@andestech.com>;
> ycliang@andestech.com
> Subject: Re: [PATCH v4 1/4] fu540: prci: add request and free clock handlers
> 
> [External Email] Do not click links or attachments unless you recognize the
> sender and know the content is safe
> 
> Hi Sagar,
> 
> > From: Sagar Shrikant Kadam [mailto:sagar.kadam@sifive.com]
> > Sent: Sunday, June 21, 2020 9:10 PM
> > To: u-boot@lists.denx.de
> > Cc: Rick Jian-Zhi Chen(陳建志); lukma@denx.de; bmeng.cn@gmail.com;
> > jagan@amarulasolutions.com; pragnesh.patel@sifive.com;
> > anup.patel@wdc.com; sjg@chromium.org; seanga2@gmail.com; Sagar
> > Shrikant Kadam
> > Subject: [PATCH v4 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>
> > Reviewed-by: Pragnesh Patel <Pragnesh.patel@sifive.com>
> > ---
> 
> This v4 series still have some conflicts with master.
> Please check about it.
> 
> Applying: fu540: prci: add request and free clock handlers
> Applying: riscv: dts: hifive-unleashed-a00: add cpu aliases
> Applying: riscv: cpu: fixes to display proper CPU features
> error: patch failed: drivers/cpu/riscv_cpu.c:38
> error: drivers/cpu/riscv_cpu.c: patch does not apply Patch failed at 0003
> riscv: cpu: fixes to display proper CPU features
> 

Thanks for trying this out
This series is dependent on following two patches [1] 
and [2] below which are part of "Add Sipeed Maix support." series
[1] https://patchwork.ozlabs.org/patch/1295345
[2] https://patchwork.ozlabs.org/patch/1295346
and I also mentioned in cover-letter. Sorry If I missed to add some 
additional information there.

The dependent are added like 
-u-boot master [commit 2b8692bac1e8]. 
-Patches [1] + [2].
-This series.

I guess the PR for the series was sent earlier followed with some discussion 
https://www.mail-archive.com/u-boot@lists.denx.de/msg370739.html
and I think this series was deferred in that PR.
Please let me know if you have some suggestions here?

Thanks & BR,
Sagar Kadam

> Thanks,
> Rick
> 
> >  drivers/clk/sifive/fu540-prci.c | 21 +++++++++++++++++++++
> >  1 file changed, 21 insertions(+)
> >
> > diff --git a/drivers/clk/sifive/fu540-prci.c
> > b/drivers/clk/sifive/fu540-prci.c index fe6e0d4..9a9ff6b 100644
> > --- a/drivers/clk/sifive/fu540-prci.c
> > +++ b/drivers/clk/sifive/fu540-prci.c
> > @@ -686,6 +686,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_enable(struct clk *clk)  {
> >         struct __prci_clock *pc;
> > @@ -755,6 +774,8 @@ static struct clk_ops sifive_fu540_prci_ops = {
> >         .get_rate = sifive_fu540_prci_get_rate,
> >         .enable = sifive_fu540_prci_enable,
> >         .disable = sifive_fu540_prci_disable,
> > +       .request  = sifive_fu540_prci_clk_request,
> > +       .rfree    = sifive_fu540_prci_clk_free,
> >  };
> >
> >  static const struct udevice_id sifive_fu540_prci_ids[] = {
> > --
> > 2.7.4
> >
Bin Meng June 24, 2020, 1:20 a.m. UTC | #3
Hi Sagar,

On Sun, Jun 21, 2020 at 9:10 PM Sagar Shrikant Kadam
<sagar.kadam@sifive.com> wrote:
>
> 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>
> Reviewed-by: Pragnesh Patel <Pragnesh.patel@sifive.com>
> ---
>  drivers/clk/sifive/fu540-prci.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>
> diff --git a/drivers/clk/sifive/fu540-prci.c b/drivers/clk/sifive/fu540-prci.c
> index fe6e0d4..9a9ff6b 100644
> --- a/drivers/clk/sifive/fu540-prci.c
> +++ b/drivers/clk/sifive/fu540-prci.c
> @@ -686,6 +686,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;
> +}

It seems these 2 routines do not actually do anything? Is this for
debugging purposes?

Regards,
Bin
Rick Chen June 24, 2020, 1:35 a.m. UTC | #4
Hi Sagar

>
> Hello Rick,
>
> > -----Original Message-----
> > From: Rick Chen <rickchen36@gmail.com>
> > Sent: Monday, June 22, 2020 7:24 AM
> > To: Sagar Kadam <sagar.kadam@sifive.com>
> > Cc: U-Boot Mailing List <u-boot@lists.denx.de>; Lukasz Majewski
> > <lukma@denx.de>; Bin Meng <bmeng.cn@gmail.com>; Jagan Teki
> > <jagan@amarulasolutions.com>; Pragnesh Patel
> > <pragnesh.patel@sifive.com>; Anup Patel <anup.patel@wdc.com>; Simon
> > Glass <sjg@chromium.org>; Sean Anderson <seanga2@gmail.com>; rick
> > <rick@andestech.com>; Alan Kao <alankao@andestech.com>;
> > ycliang@andestech.com
> > Subject: Re: [PATCH v4 1/4] fu540: prci: add request and free clock handlers
> >
> > [External Email] Do not click links or attachments unless you recognize the
> > sender and know the content is safe
> >
> > Hi Sagar,
> >
> > > From: Sagar Shrikant Kadam [mailto:sagar.kadam@sifive.com]
> > > Sent: Sunday, June 21, 2020 9:10 PM
> > > To: u-boot@lists.denx.de
> > > Cc: Rick Jian-Zhi Chen(陳建志); lukma@denx.de; bmeng.cn@gmail.com;
> > > jagan@amarulasolutions.com; pragnesh.patel@sifive.com;
> > > anup.patel@wdc.com; sjg@chromium.org; seanga2@gmail.com; Sagar
> > > Shrikant Kadam
> > > Subject: [PATCH v4 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>
> > > Reviewed-by: Pragnesh Patel <Pragnesh.patel@sifive.com>
> > > ---
> >
> > This v4 series still have some conflicts with master.
> > Please check about it.
> >
> > Applying: fu540: prci: add request and free clock handlers
> > Applying: riscv: dts: hifive-unleashed-a00: add cpu aliases
> > Applying: riscv: cpu: fixes to display proper CPU features
> > error: patch failed: drivers/cpu/riscv_cpu.c:38
> > error: drivers/cpu/riscv_cpu.c: patch does not apply Patch failed at 0003
> > riscv: cpu: fixes to display proper CPU features
> >
>
> Thanks for trying this out
> This series is dependent on following two patches [1]
> and [2] below which are part of "Add Sipeed Maix support." series
> [1] https://patchwork.ozlabs.org/patch/1295345
> [2] https://patchwork.ozlabs.org/patch/1295346
> and I also mentioned in cover-letter. Sorry If I missed to add some
> additional information there.
>
> The dependent are added like
> -u-boot master [commit 2b8692bac1e8].
> -Patches [1] + [2].
> -This series.

According to this dependency I will apply yours in -next behind of Sean's

Thanks,
Rick

>
> I guess the PR for the series was sent earlier followed with some discussion
> https://www.mail-archive.com/u-boot@lists.denx.de/msg370739.html
> and I think this series was deferred in that PR.
> Please let me know if you have some suggestions here?
>
> Thanks & BR,
> Sagar Kadam
>
> > Thanks,
> > Rick
> >
> > >  drivers/clk/sifive/fu540-prci.c | 21 +++++++++++++++++++++
> > >  1 file changed, 21 insertions(+)
> > >
> > > diff --git a/drivers/clk/sifive/fu540-prci.c
> > > b/drivers/clk/sifive/fu540-prci.c index fe6e0d4..9a9ff6b 100644
> > > --- a/drivers/clk/sifive/fu540-prci.c
> > > +++ b/drivers/clk/sifive/fu540-prci.c
> > > @@ -686,6 +686,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_enable(struct clk *clk)  {
> > >         struct __prci_clock *pc;
> > > @@ -755,6 +774,8 @@ static struct clk_ops sifive_fu540_prci_ops = {
> > >         .get_rate = sifive_fu540_prci_get_rate,
> > >         .enable = sifive_fu540_prci_enable,
> > >         .disable = sifive_fu540_prci_disable,
> > > +       .request  = sifive_fu540_prci_clk_request,
> > > +       .rfree    = sifive_fu540_prci_clk_free,
> > >  };
> > >
> > >  static const struct udevice_id sifive_fu540_prci_ids[] = {
> > > --
> > > 2.7.4
> > >
Bin Meng June 24, 2020, 1:38 a.m. UTC | #5
Hi Rick,

On Wed, Jun 24, 2020 at 9:36 AM Rick Chen <rickchen36@gmail.com> wrote:
>
> Hi Sagar
>
> >
> > Hello Rick,
> >
> > > -----Original Message-----
> > > From: Rick Chen <rickchen36@gmail.com>
> > > Sent: Monday, June 22, 2020 7:24 AM
> > > To: Sagar Kadam <sagar.kadam@sifive.com>
> > > Cc: U-Boot Mailing List <u-boot@lists.denx.de>; Lukasz Majewski
> > > <lukma@denx.de>; Bin Meng <bmeng.cn@gmail.com>; Jagan Teki
> > > <jagan@amarulasolutions.com>; Pragnesh Patel
> > > <pragnesh.patel@sifive.com>; Anup Patel <anup.patel@wdc.com>; Simon
> > > Glass <sjg@chromium.org>; Sean Anderson <seanga2@gmail.com>; rick
> > > <rick@andestech.com>; Alan Kao <alankao@andestech.com>;
> > > ycliang@andestech.com
> > > Subject: Re: [PATCH v4 1/4] fu540: prci: add request and free clock handlers
> > >
> > > [External Email] Do not click links or attachments unless you recognize the
> > > sender and know the content is safe
> > >
> > > Hi Sagar,
> > >
> > > > From: Sagar Shrikant Kadam [mailto:sagar.kadam@sifive.com]
> > > > Sent: Sunday, June 21, 2020 9:10 PM
> > > > To: u-boot@lists.denx.de
> > > > Cc: Rick Jian-Zhi Chen(陳建志); lukma@denx.de; bmeng.cn@gmail.com;
> > > > jagan@amarulasolutions.com; pragnesh.patel@sifive.com;
> > > > anup.patel@wdc.com; sjg@chromium.org; seanga2@gmail.com; Sagar
> > > > Shrikant Kadam
> > > > Subject: [PATCH v4 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>
> > > > Reviewed-by: Pragnesh Patel <Pragnesh.patel@sifive.com>
> > > > ---
> > >
> > > This v4 series still have some conflicts with master.
> > > Please check about it.
> > >
> > > Applying: fu540: prci: add request and free clock handlers
> > > Applying: riscv: dts: hifive-unleashed-a00: add cpu aliases
> > > Applying: riscv: cpu: fixes to display proper CPU features
> > > error: patch failed: drivers/cpu/riscv_cpu.c:38
> > > error: drivers/cpu/riscv_cpu.c: patch does not apply Patch failed at 0003
> > > riscv: cpu: fixes to display proper CPU features
> > >
> >
> > Thanks for trying this out
> > This series is dependent on following two patches [1]
> > and [2] below which are part of "Add Sipeed Maix support." series
> > [1] https://patchwork.ozlabs.org/patch/1295345
> > [2] https://patchwork.ozlabs.org/patch/1295346
> > and I also mentioned in cover-letter. Sorry If I missed to add some
> > additional information there.
> >
> > The dependent are added like
> > -u-boot master [commit 2b8692bac1e8].
> > -Patches [1] + [2].
> > -This series.
>
> According to this dependency I will apply yours in -next behind of Sean's

I just sent comments to this series, please hold on.

Regards,
Bin
Rick Chen June 24, 2020, 1:46 a.m. UTC | #6
Hi Bin

> Hi Rick,
>
> On Wed, Jun 24, 2020 at 9:36 AM Rick Chen <rickchen36@gmail.com> wrote:
> >
> > Hi Sagar
> >
> > >
> > > Hello Rick,
> > >
> > > > -----Original Message-----
> > > > From: Rick Chen <rickchen36@gmail.com>
> > > > Sent: Monday, June 22, 2020 7:24 AM
> > > > To: Sagar Kadam <sagar.kadam@sifive.com>
> > > > Cc: U-Boot Mailing List <u-boot@lists.denx.de>; Lukasz Majewski
> > > > <lukma@denx.de>; Bin Meng <bmeng.cn@gmail.com>; Jagan Teki
> > > > <jagan@amarulasolutions.com>; Pragnesh Patel
> > > > <pragnesh.patel@sifive.com>; Anup Patel <anup.patel@wdc.com>; Simon
> > > > Glass <sjg@chromium.org>; Sean Anderson <seanga2@gmail.com>; rick
> > > > <rick@andestech.com>; Alan Kao <alankao@andestech.com>;
> > > > ycliang@andestech.com
> > > > Subject: Re: [PATCH v4 1/4] fu540: prci: add request and free clock handlers
> > > >
> > > > [External Email] Do not click links or attachments unless you recognize the
> > > > sender and know the content is safe
> > > >
> > > > Hi Sagar,
> > > >
> > > > > From: Sagar Shrikant Kadam [mailto:sagar.kadam@sifive.com]
> > > > > Sent: Sunday, June 21, 2020 9:10 PM
> > > > > To: u-boot@lists.denx.de
> > > > > Cc: Rick Jian-Zhi Chen(陳建志); lukma@denx.de; bmeng.cn@gmail.com;
> > > > > jagan@amarulasolutions.com; pragnesh.patel@sifive.com;
> > > > > anup.patel@wdc.com; sjg@chromium.org; seanga2@gmail.com; Sagar
> > > > > Shrikant Kadam
> > > > > Subject: [PATCH v4 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>
> > > > > Reviewed-by: Pragnesh Patel <Pragnesh.patel@sifive.com>
> > > > > ---
> > > >
> > > > This v4 series still have some conflicts with master.
> > > > Please check about it.
> > > >
> > > > Applying: fu540: prci: add request and free clock handlers
> > > > Applying: riscv: dts: hifive-unleashed-a00: add cpu aliases
> > > > Applying: riscv: cpu: fixes to display proper CPU features
> > > > error: patch failed: drivers/cpu/riscv_cpu.c:38
> > > > error: drivers/cpu/riscv_cpu.c: patch does not apply Patch failed at 0003
> > > > riscv: cpu: fixes to display proper CPU features
> > > >
> > >
> > > Thanks for trying this out
> > > This series is dependent on following two patches [1]
> > > and [2] below which are part of "Add Sipeed Maix support." series
> > > [1] https://patchwork.ozlabs.org/patch/1295345
> > > [2] https://patchwork.ozlabs.org/patch/1295346
> > > and I also mentioned in cover-letter. Sorry If I missed to add some
> > > additional information there.
> > >
> > > The dependent are added like
> > > -u-boot master [commit 2b8692bac1e8].
> > > -Patches [1] + [2].
> > > -This series.
> >
> > According to this dependency I will apply yours in -next behind of Sean's
>
> I just sent comments to this series, please hold on.

OK.

Thanks,
Rick

>
> Regards,
> Bin
Sagar Shrikant Kadam June 24, 2020, 9:51 a.m. UTC | #7
Hi Rick,

> -----Original Message-----
> From: Rick Chen <rickchen36@gmail.com>
> Sent: Wednesday, June 24, 2020 7:16 AM
> To: Bin Meng <bmeng.cn@gmail.com>
> Cc: Sagar Kadam <sagar.kadam@sifive.com>; U-Boot Mailing List <u-
> boot@lists.denx.de>; Lukasz Majewski <lukma@denx.de>; Jagan Teki
> <jagan@amarulasolutions.com>; Pragnesh Patel
> <pragnesh.patel@sifive.com>; Anup Patel <anup.patel@wdc.com>; Simon
> Glass <sjg@chromium.org>; Sean Anderson <seanga2@gmail.com>; rick
> <rick@andestech.com>; Alan Kao <alankao@andestech.com>;
> ycliang@andestech.com
> Subject: Re: [PATCH v4 1/4] fu540: prci: add request and free clock handlers
> 
> [External Email] Do not click links or attachments unless you recognize the
> sender and know the content is safe
> 
> Hi Bin
> 
> > Hi Rick,
> >
> > On Wed, Jun 24, 2020 at 9:36 AM Rick Chen <rickchen36@gmail.com>
> wrote:
> > >
> > > Hi Sagar
> > >
> > > >
> > > > Hello Rick,
> > > >
> > > > > -----Original Message-----
> > > > > From: Rick Chen <rickchen36@gmail.com>
> > > > > Sent: Monday, June 22, 2020 7:24 AM
> > > > > To: Sagar Kadam <sagar.kadam@sifive.com>
> > > > > Cc: U-Boot Mailing List <u-boot@lists.denx.de>; Lukasz Majewski
> > > > > <lukma@denx.de>; Bin Meng <bmeng.cn@gmail.com>; Jagan Teki
> > > > > <jagan@amarulasolutions.com>; Pragnesh Patel
> > > > > <pragnesh.patel@sifive.com>; Anup Patel <anup.patel@wdc.com>;
> > > > > Simon Glass <sjg@chromium.org>; Sean Anderson
> > > > > <seanga2@gmail.com>; rick <rick@andestech.com>; Alan Kao
> > > > > <alankao@andestech.com>; ycliang@andestech.com
> > > > > Subject: Re: [PATCH v4 1/4] fu540: prci: add request and free
> > > > > clock handlers
> > > > >
> > > > > [External Email] Do not click links or attachments unless you
> > > > > recognize the sender and know the content is safe
> > > > >
> > > > > Hi Sagar,
> > > > >
> > > > > > From: Sagar Shrikant Kadam [mailto:sagar.kadam@sifive.com]
> > > > > > Sent: Sunday, June 21, 2020 9:10 PM
> > > > > > To: u-boot@lists.denx.de
> > > > > > Cc: Rick Jian-Zhi Chen(陳建志); lukma@denx.de;
> > > > > > bmeng.cn@gmail.com; jagan@amarulasolutions.com;
> > > > > > pragnesh.patel@sifive.com; anup.patel@wdc.com;
> > > > > > sjg@chromium.org; seanga2@gmail.com; Sagar Shrikant Kadam
> > > > > > Subject: [PATCH v4 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>
> > > > > > Reviewed-by: Pragnesh Patel <Pragnesh.patel@sifive.com>
> > > > > > ---
> > > > >
> > > > > This v4 series still have some conflicts with master.
> > > > > Please check about it.
> > > > >
> > > > > Applying: fu540: prci: add request and free clock handlers
> > > > > Applying: riscv: dts: hifive-unleashed-a00: add cpu aliases
> > > > > Applying: riscv: cpu: fixes to display proper CPU features
> > > > > error: patch failed: drivers/cpu/riscv_cpu.c:38
> > > > > error: drivers/cpu/riscv_cpu.c: patch does not apply Patch
> > > > > failed at 0003
> > > > > riscv: cpu: fixes to display proper CPU features
> > > > >
> > > >
> > > > Thanks for trying this out
> > > > This series is dependent on following two patches [1] and [2]
> > > > below which are part of "Add Sipeed Maix support." series [1]
> > > > https://patchwork.ozlabs.org/patch/1295345
> > > > [2] https://patchwork.ozlabs.org/patch/1295346
> > > > and I also mentioned in cover-letter. Sorry If I missed to add
> > > > some additional information there.
> > > >
> > > > The dependent are added like
> > > > -u-boot master [commit 2b8692bac1e8].
> > > > -Patches [1] + [2].
> > > > -This series.
> > >
> > > According to this dependency I will apply yours in -next behind of
> > > Sean's
> >
> > I just sent comments to this series, please hold on.
> 
> OK.
> 

Thanks for holding on.
Yes, Bin has sent few comments. I will submit V5 for this.

Thanks & BR,
Sagar

> Thanks,
> Rick
> 
> >
> > Regards,
> > Bin
Sagar Shrikant Kadam June 24, 2020, 10:58 a.m. UTC | #8
Hi Bin,

> -----Original Message-----
> From: Bin Meng <bmeng.cn@gmail.com>
> Sent: Wednesday, June 24, 2020 6:50 AM
> To: Sagar Kadam <sagar.kadam@sifive.com>
> Cc: U-Boot Mailing List <u-boot@lists.denx.de>; Rick Chen
> <rick@andestech.com>; Lukasz Majewski <lukma@denx.de>; Jagan Teki
> <jagan@amarulasolutions.com>; Pragnesh Patel
> <pragnesh.patel@sifive.com>; Anup Patel <anup.patel@wdc.com>; Simon
> Glass <sjg@chromium.org>; Sean Anderson <seanga2@gmail.com>
> Subject: Re: [PATCH v4 1/4] fu540: prci: add request and free clock handlers
> 
> [External Email] Do not click links or attachments unless you recognize the
> sender and know the content is safe
> 
> Hi Sagar,
> 
> On Sun, Jun 21, 2020 at 9:10 PM Sagar Shrikant Kadam
> <sagar.kadam@sifive.com> wrote:
> >
> > 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>
> > Reviewed-by: Pragnesh Patel <Pragnesh.patel@sifive.com>
> > ---
> >  drivers/clk/sifive/fu540-prci.c | 21 +++++++++++++++++++++
> >  1 file changed, 21 insertions(+)
> >
> > diff --git a/drivers/clk/sifive/fu540-prci.c
> > b/drivers/clk/sifive/fu540-prci.c index fe6e0d4..9a9ff6b 100644
> > --- a/drivers/clk/sifive/fu540-prci.c
> > +++ b/drivers/clk/sifive/fu540-prci.c
> > @@ -686,6 +686,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;
> > +}
> 
> It seems these 2 routines do not actually do anything? Is this for debugging
> purposes?
> 
The sifive_fu540_prci_clk_request will check if the clock requested is valid or not.
While the sifive_fu540_prci_clk_free function is just for debug.
Is it ok if I retain these in V5 or you have some other thought here.

Thanks & BR,
Sagar

> Regards,
> Bin
Bin Meng June 24, 2020, 11:21 p.m. UTC | #9
Hi Sagar,

On Wed, Jun 24, 2020 at 6:58 PM Sagar Kadam <sagar.kadam@sifive.com> wrote:
>
> Hi Bin,
>
> > -----Original Message-----
> > From: Bin Meng <bmeng.cn@gmail.com>
> > Sent: Wednesday, June 24, 2020 6:50 AM
> > To: Sagar Kadam <sagar.kadam@sifive.com>
> > Cc: U-Boot Mailing List <u-boot@lists.denx.de>; Rick Chen
> > <rick@andestech.com>; Lukasz Majewski <lukma@denx.de>; Jagan Teki
> > <jagan@amarulasolutions.com>; Pragnesh Patel
> > <pragnesh.patel@sifive.com>; Anup Patel <anup.patel@wdc.com>; Simon
> > Glass <sjg@chromium.org>; Sean Anderson <seanga2@gmail.com>
> > Subject: Re: [PATCH v4 1/4] fu540: prci: add request and free clock handlers
> >
> > [External Email] Do not click links or attachments unless you recognize the
> > sender and know the content is safe
> >
> > Hi Sagar,
> >
> > On Sun, Jun 21, 2020 at 9:10 PM Sagar Shrikant Kadam
> > <sagar.kadam@sifive.com> wrote:
> > >
> > > 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>
> > > Reviewed-by: Pragnesh Patel <Pragnesh.patel@sifive.com>
> > > ---
> > >  drivers/clk/sifive/fu540-prci.c | 21 +++++++++++++++++++++
> > >  1 file changed, 21 insertions(+)
> > >
> > > diff --git a/drivers/clk/sifive/fu540-prci.c
> > > b/drivers/clk/sifive/fu540-prci.c index fe6e0d4..9a9ff6b 100644
> > > --- a/drivers/clk/sifive/fu540-prci.c
> > > +++ b/drivers/clk/sifive/fu540-prci.c
> > > @@ -686,6 +686,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;
> > > +}
> >
> > It seems these 2 routines do not actually do anything? Is this for debugging
> > purposes?
> >
> The sifive_fu540_prci_clk_request will check if the clock requested is valid or not.
> While the sifive_fu540_prci_clk_free function is just for debug.
> Is it ok if I retain these in V5 or you have some other thought here.
>

OK, but I suspect the parameter check in
sifive_fu540_prci_clk_request() is not necessary too as currently the
codes work well.

Regards,
Bin
Sagar Shrikant Kadam June 25, 2020, 4:46 a.m. UTC | #10
Hi Bin,

> -----Original Message-----
> From: Bin Meng <bmeng.cn@gmail.com>
> Sent: Thursday, June 25, 2020 4:51 AM
> To: Sagar Kadam <sagar.kadam@sifive.com>
> Cc: U-Boot Mailing List <u-boot@lists.denx.de>; Rick Chen
> <rick@andestech.com>; Lukasz Majewski <lukma@denx.de>; Jagan Teki
> <jagan@amarulasolutions.com>; Pragnesh Patel
> <pragnesh.patel@sifive.com>; Anup Patel <anup.patel@wdc.com>; Simon
> Glass <sjg@chromium.org>; Sean Anderson <seanga2@gmail.com>
> Subject: Re: [PATCH v4 1/4] fu540: prci: add request and free clock handlers
> 
> [External Email] Do not click links or attachments unless you recognize the
> sender and know the content is safe
> 
> Hi Sagar,
> 
> On Wed, Jun 24, 2020 at 6:58 PM Sagar Kadam <sagar.kadam@sifive.com>
> wrote:
> >
> > Hi Bin,
> >
> > > -----Original Message-----
> > > From: Bin Meng <bmeng.cn@gmail.com>
> > > Sent: Wednesday, June 24, 2020 6:50 AM
> > > To: Sagar Kadam <sagar.kadam@sifive.com>
> > > Cc: U-Boot Mailing List <u-boot@lists.denx.de>; Rick Chen
> > > <rick@andestech.com>; Lukasz Majewski <lukma@denx.de>; Jagan Teki
> > > <jagan@amarulasolutions.com>; Pragnesh Patel
> > > <pragnesh.patel@sifive.com>; Anup Patel <anup.patel@wdc.com>;
> Simon
> > > Glass <sjg@chromium.org>; Sean Anderson <seanga2@gmail.com>
> > > Subject: Re: [PATCH v4 1/4] fu540: prci: add request and free clock
> handlers
> > >
> > > [External Email] Do not click links or attachments unless you recognize
> the
> > > sender and know the content is safe
> > >
> > > Hi Sagar,
> > >
> > > On Sun, Jun 21, 2020 at 9:10 PM Sagar Shrikant Kadam
> > > <sagar.kadam@sifive.com> wrote:
> > > >
> > > > 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>
> > > > Reviewed-by: Pragnesh Patel <Pragnesh.patel@sifive.com>
> > > > ---
> > > >  drivers/clk/sifive/fu540-prci.c | 21 +++++++++++++++++++++
> > > >  1 file changed, 21 insertions(+)
> > > >
> > > > diff --git a/drivers/clk/sifive/fu540-prci.c
> > > > b/drivers/clk/sifive/fu540-prci.c index fe6e0d4..9a9ff6b 100644
> > > > --- a/drivers/clk/sifive/fu540-prci.c
> > > > +++ b/drivers/clk/sifive/fu540-prci.c
> > > > @@ -686,6 +686,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;
> > > > +}
> > >
> > > It seems these 2 routines do not actually do anything? Is this for
> debugging
> > > purposes?
> > >
> > The sifive_fu540_prci_clk_request will check if the clock requested is valid
> or not.
> > While the sifive_fu540_prci_clk_free function is just for debug.
> > Is it ok if I retain these in V5 or you have some other thought here.
> >
> 
> OK, but I suspect the parameter check in
> sifive_fu540_prci_clk_request() is not necessary too as currently the
> codes work well.
> 

Ok. In that case I will than drop the check in sifive_fu540_prci_clk_request()
and just keep the debug info.

Thanks & BR,
Sagar

> Regards,
> Bin
Sagar Shrikant Kadam June 25, 2020, 5:41 a.m. UTC | #11
Hi Bin,

> -----Original Message-----
> From: Sagar Kadam
> Sent: Thursday, June 25, 2020 10:17 AM
> To: Bin Meng <bmeng.cn@gmail.com>
> Cc: U-Boot Mailing List <u-boot@lists.denx.de>; Rick Chen
> <rick@andestech.com>; Lukasz Majewski <lukma@denx.de>; Jagan Teki
> <jagan@amarulasolutions.com>; Pragnesh Patel
> <pragnesh.patel@sifive.com>; Anup Patel <anup.patel@wdc.com>; Simon
> Glass <sjg@chromium.org>; Sean Anderson <seanga2@gmail.com>
> Subject: RE: [PATCH v4 1/4] fu540: prci: add request and free clock handlers
> 
> Hi Bin,
> 
> > -----Original Message-----
> > From: Bin Meng <bmeng.cn@gmail.com>
> > Sent: Thursday, June 25, 2020 4:51 AM
> > To: Sagar Kadam <sagar.kadam@sifive.com>
> > Cc: U-Boot Mailing List <u-boot@lists.denx.de>; Rick Chen
> > <rick@andestech.com>; Lukasz Majewski <lukma@denx.de>; Jagan Teki
> > <jagan@amarulasolutions.com>; Pragnesh Patel
> > <pragnesh.patel@sifive.com>; Anup Patel <anup.patel@wdc.com>; Simon
> > Glass <sjg@chromium.org>; Sean Anderson <seanga2@gmail.com>
> > Subject: Re: [PATCH v4 1/4] fu540: prci: add request and free clock
> > handlers
> >
> > [External Email] Do not click links or attachments unless you
> > recognize the sender and know the content is safe
> >
> > Hi Sagar,
> >
> > On Wed, Jun 24, 2020 at 6:58 PM Sagar Kadam <sagar.kadam@sifive.com>
> > wrote:
> > >
> > > Hi Bin,
> > >
> > > > -----Original Message-----
> > > > From: Bin Meng <bmeng.cn@gmail.com>
> > > > Sent: Wednesday, June 24, 2020 6:50 AM
> > > > To: Sagar Kadam <sagar.kadam@sifive.com>
> > > > Cc: U-Boot Mailing List <u-boot@lists.denx.de>; Rick Chen
> > > > <rick@andestech.com>; Lukasz Majewski <lukma@denx.de>; Jagan
> Teki
> > > > <jagan@amarulasolutions.com>; Pragnesh Patel
> > > > <pragnesh.patel@sifive.com>; Anup Patel <anup.patel@wdc.com>;
> > Simon
> > > > Glass <sjg@chromium.org>; Sean Anderson <seanga2@gmail.com>
> > > > Subject: Re: [PATCH v4 1/4] fu540: prci: add request and free
> > > > clock
> > handlers
> > > >
> > > > [External Email] Do not click links or attachments unless you
> > > > recognize
> > the
> > > > sender and know the content is safe
> > > >
> > > > Hi Sagar,
> > > >
> > > > On Sun, Jun 21, 2020 at 9:10 PM Sagar Shrikant Kadam
> > > > <sagar.kadam@sifive.com> wrote:
> > > > >
> > > > > 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>
> > > > > Reviewed-by: Pragnesh Patel <Pragnesh.patel@sifive.com>
> > > > > ---
> > > > >  drivers/clk/sifive/fu540-prci.c | 21 +++++++++++++++++++++
> > > > >  1 file changed, 21 insertions(+)
> > > > >
> > > > > diff --git a/drivers/clk/sifive/fu540-prci.c
> > > > > b/drivers/clk/sifive/fu540-prci.c index fe6e0d4..9a9ff6b 100644
> > > > > --- a/drivers/clk/sifive/fu540-prci.c
> > > > > +++ b/drivers/clk/sifive/fu540-prci.c
> > > > > @@ -686,6 +686,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;
> > > > > +}
> > > >
> > > > It seems these 2 routines do not actually do anything? Is this for
> > debugging
> > > > purposes?
> > > >
> > > The sifive_fu540_prci_clk_request will check if the clock requested
> > > is valid
> > or not.
> > > While the sifive_fu540_prci_clk_free function is just for debug.
> > > Is it ok if I retain these in V5 or you have some other thought here.
> > >
> >
> > OK, but I suspect the parameter check in
> > sifive_fu540_prci_clk_request() is not necessary too as currently the
> > codes work well.
> >
> 
> Ok. In that case I will than drop the check in sifive_fu540_prci_clk_request()
> and just keep the debug info.
> 
> Thanks & BR,
> Sagar
> 
Missed to add:
I had referred to other reference driver's and thought of keeping it.
So I'll drop this patch in V5 as it is not much value addition here.
Sorry for the confusion

Thanks & BR,
Sagar 

> > Regards,
> > Bin
diff mbox series

Patch

diff --git a/drivers/clk/sifive/fu540-prci.c b/drivers/clk/sifive/fu540-prci.c
index fe6e0d4..9a9ff6b 100644
--- a/drivers/clk/sifive/fu540-prci.c
+++ b/drivers/clk/sifive/fu540-prci.c
@@ -686,6 +686,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_enable(struct clk *clk)
 {
 	struct __prci_clock *pc;
@@ -755,6 +774,8 @@  static struct clk_ops sifive_fu540_prci_ops = {
 	.get_rate = sifive_fu540_prci_get_rate,
 	.enable = sifive_fu540_prci_enable,
 	.disable = sifive_fu540_prci_disable,
+	.request  = sifive_fu540_prci_clk_request,
+	.rfree	  = sifive_fu540_prci_clk_free,
 };
 
 static const struct udevice_id sifive_fu540_prci_ids[] = {