From: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2] DW SPI: Get clock value from Device Tree
Date: Tue, 17 Oct 2017 13:32:43 +0000 [thread overview]
Message-ID: <1508247162.2676.13.camel@synopsys.com> (raw)
In-Reply-To: <CAD6G_RQJxBdgyZsSEdfTQL0bZ6qyaKHHrLasxOTDrFhdoaCDMQ@mail.gmail.com>
Hi Jagan,
On Mon, 2017-10-16 at 22:37 +0530, Jagan Teki wrote:
> On Fri, Oct 13, 2017 at 8:48 PM, Eugeniy Paltsev
> <Eugeniy.Paltsev@synopsys.com> wrote:
> > Add option to set spi controller clock frequency via device tree
> > using standard clock bindings.
> > Old way of setting spi controller clock frequency (via implementation
> > of 'cm_get_spi_controller_clk_hz' function in platform specific code)
> > remains supported for backward compatibility.
> >
> > Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
> > ---
> > Changes v1->v2:
> > * disable clock if we can't get the rate.
> > * get rid of cm_get_spi_controller_clk_hz weak declaration.
> >
> > drivers/spi/designware_spi.c | 65 +++++++++++++++++++++++++++++++++++++++++++-
> > 1 file changed, 64 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/spi/designware_spi.c b/drivers/spi/designware_spi.c
> > index 5aa507b..9eb5b1c 100644
> > --- a/drivers/spi/designware_spi.c
> > +++ b/drivers/spi/designware_spi.c
> > @@ -11,6 +11,7 @@
> > */
> >
> > #include <common.h>
> > +#include <clk.h>
> > #include <dm.h>
> > #include <errno.h>
> > #include <malloc.h>
> > @@ -18,7 +19,10 @@
> > #include <fdtdec.h>
> > #include <linux/compat.h>
> > #include <asm/io.h>
> > +/* Only SOCFPGA_GEN5 and SOCFPGA_ARRIA10 uses their clock_manager functions */
> > +#if defined(CONFIG_TARGET_SOCFPGA_GEN5) || defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
> > #include <asm/arch/clock_manager.h>
> > +#endif
>
> How hard it is to make others to use clock manager? do you have any list?
clock_manager.h is an old (and non-generic) way to deal with different clocks.
For example in SOCFPGA_GEN5 and SOCFPGA_ARRIA10 clock_manager.h provides
cm_get_spi_controller_clk_hz function to deal with spi controller clock.
But today we have another, linux-like alternative: to bind clocks via device tree
and manipulate with clocks via generic functions provided by clk.h
In this patch I added option to get clock via device tree using standard bindings
and restrict clock_manager.h functions usage only to targets which still use it,
so new targets can simply bind clock via device tree and they do not need to
implement/define something in clock_manager.h
So we don't need to make others to use clock manager :)
> thanks!
--
Eugeniy Paltsev
next prev parent reply other threads:[~2017-10-17 13:32 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-13 15:18 [U-Boot] [PATCH v2] DW SPI: Get clock value from Device Tree Eugeniy Paltsev
2017-10-16 17:07 ` Jagan Teki
2017-10-17 13:32 ` Eugeniy Paltsev [this message]
2017-10-17 14:57 ` Alexey Brodkin
2017-10-17 15:02 ` Jagan Teki
2017-10-19 15:36 ` Eugeniy Paltsev
2017-10-19 15:51 ` Marek Vasut
2017-10-19 18:20 ` Dinh Nguyen
2017-10-23 11:43 ` Eugeniy Paltsev
2017-10-24 6:08 ` Marek Vasut
2017-10-24 9:52 ` Jagan Teki
2017-10-25 6:50 ` Marek Vasut
2017-10-27 13:54 ` Eugeniy Paltsev
2017-10-28 11:39 ` Marek Vasut
2017-10-30 6:04 ` Jagan Teki
2017-10-30 10:54 ` Marek Vasut
2017-10-30 11:36 ` Jagan Teki
2017-10-30 11:42 ` Marek Vasut
2017-10-31 8:27 ` Jagan Teki
2017-10-31 9:33 ` Marek Vasut
2017-10-17 15:03 ` Marek Vasut
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1508247162.2676.13.camel@synopsys.com \
--to=eugeniy.paltsev@synopsys.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox