mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 10/20] i.MX: clk: Port imx_check_clocks() and imx_obtain_fixed_clock()
Date: Tue, 4 Oct 2016 08:49:23 +0200	[thread overview]
Message-ID: <20161004064923.txvdncnm57xwor5h@pengutronix.de> (raw)
In-Reply-To: <1475505657-898-11-git-send-email-andrew.smirnov@gmail.com>

On Mon, Oct 03, 2016 at 07:40:47AM -0700, Andrey Smirnov wrote:
> Port imx_check_clocks() and imx_obtain_fixed_clock() from Linux kernel.
> 
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
>  arch/arm/mach-imx/clk.h  |  4 ++++
>  drivers/clk/Makefile     |  1 +
>  drivers/clk/imx/Makefile |  1 +
>  drivers/clk/imx/clk.c    | 49 ++++++++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 55 insertions(+)
>  create mode 100644 drivers/clk/imx/Makefile
>  create mode 100644 drivers/clk/imx/clk.c
> 
> diff --git a/arch/arm/mach-imx/clk.h b/arch/arm/mach-imx/clk.h
> index 35e480f..f96e5d2 100644
> --- a/arch/arm/mach-imx/clk.h
> +++ b/arch/arm/mach-imx/clk.h
> @@ -109,4 +109,8 @@ static inline struct clk *imx_clk_busy_mux(const char *name, void __iomem *reg,
>  struct clk *imx_clk_gate_exclusive(const char *name, const char *parent,
>  		void __iomem *reg, u8 shift, u32 exclusive_mask);
>  
> +void imx_check_clocks(struct clk *clks[], unsigned int count);
> +struct clk * __init imx_obtain_fixed_clock(const char *name, unsigned long rate);
> +
> +
>  #endif /* __IMX_CLK_H */
> diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
> index 0fe8f1e..6dc82ea 100644
> --- a/drivers/clk/Makefile
> +++ b/drivers/clk/Makefile
> @@ -9,3 +9,4 @@ obj-$(CONFIG_ARCH_ROCKCHIP)	+= rockchip/
>  obj-$(CONFIG_ARCH_TEGRA)	+= tegra/
>  obj-$(CONFIG_CLK_SOCFPGA)	+= socfpga.o
>  obj-$(CONFIG_MACH_MIPS_ATH79)	+= clk-ar933x.o
> +obj-$(CONFIG_COMMON_CLK)	+= imx/
> diff --git a/drivers/clk/imx/Makefile b/drivers/clk/imx/Makefile
> new file mode 100644
> index 0000000..0303c0b
> --- /dev/null
> +++ b/drivers/clk/imx/Makefile
> @@ -0,0 +1 @@
> +obj-y += clk.o
> diff --git a/drivers/clk/imx/clk.c b/drivers/clk/imx/clk.c
> new file mode 100644
> index 0000000..0357048
> --- /dev/null
> +++ b/drivers/clk/imx/clk.c

We currently have the i.MX clock support in arch/arm/mach-imx/. This may
or may not be changed, but until it is, other i.MX clock support code
should go to arch/arm/mach-imx/ aswell.

> @@ -0,0 +1,49 @@
> +#include <common.h>
> +#include <init.h>
> +#include <driver.h>
> +#include <linux/clk.h>
> +#include <io.h>
> +#include <of.h>
> +#include <linux/clkdev.h>
> +#include <linux/err.h>
> +
> +#include "../../../arch/arm/mach-imx/clk.h"

#include <mach/clk.h>

> +
> +void __init imx_check_clocks(struct clk *clks[], unsigned int count)
> +{
> +	unsigned i;
> +
> +	for (i = 0; i < count; i++)
> +		if (IS_ERR(clks[i]))
> +			pr_err("i.MX clk %u: register failed with %ld\n",
> +			       i, PTR_ERR(clks[i]));
> +}
> +
> +static struct clk * __init imx_obtain_fixed_clock_from_dt(const char *name)
> +{
> +	struct of_phandle_args phandle;
> +	struct clk *clk = ERR_PTR(-ENODEV);
> +	char *path;
> +
> +	path = basprintf("/clocks/%s", name);
> +	if (!path)
> +		return ERR_PTR(-ENOMEM);
> +
> +	phandle.np = of_find_node_by_path(path);
> +	kfree(path);
> +
> +	if (phandle.np)
> +		clk = of_clk_get_from_provider(&phandle);
> +
> +	return clk;
> +}

Do we need this anyway? We already have clk providers for fixed-clock.
Hm, looking further, maybe a later patch explains.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2016-10-04  6:49 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-03 14:40 [PATCH 00/20] Vybrid support in Barebox Andrey Smirnov
2016-10-03 14:40 ` [PATCH 01/20] i.MX: Add primitive functions for VF610 family Andrey Smirnov
2016-10-03 14:40 ` [PATCH 02/20] i.MX: Add DEBUG_LL hooks for VF610 Andrey Smirnov
2016-10-04  6:24   ` Sascha Hauer
2016-10-04 13:27     ` Andrey Smirnov
2016-10-03 14:40 ` [PATCH 03/20] i.MX: scripts: Add "vf610" soc to imx-image Andrey Smirnov
2016-10-03 14:40 ` [PATCH 04/20] i.MX: Add support for VF610 Tower board Andrey Smirnov
2016-10-04  6:32   ` Sascha Hauer
2016-10-04 13:34     ` Andrey Smirnov
2016-10-07  7:56       ` Sascha Hauer
2016-10-03 14:40 ` [PATCH 05/20] i.MX: Add pinctrl driver for VF610 Andrey Smirnov
2016-10-03 14:40 ` [PATCH 06/20] clk: Port clock dependency resolution code Andrey Smirnov
2016-10-03 14:40 ` [PATCH 07/20] clk: Port of_clk_set_defautls() Andrey Smirnov
2016-10-04  6:38   ` Sascha Hauer
2016-10-04 13:36     ` Andrey Smirnov
2016-10-03 14:40 ` [PATCH 08/20] i.MX: clk: Port imx_clk_gate2_cgr() Andrey Smirnov
2016-10-03 14:40 ` [PATCH 09/20] i.MX: clk: Add IMX_PLLV3_USB_VF610 support Andrey Smirnov
2016-10-03 14:40 ` [PATCH 10/20] i.MX: clk: Port imx_check_clocks() and imx_obtain_fixed_clock() Andrey Smirnov
2016-10-04  6:49   ` Sascha Hauer [this message]
2016-10-04 13:43     ` Andrey Smirnov
2016-10-04 19:28       ` Sascha Hauer
2016-10-03 14:40 ` [PATCH 11/20] i.MX: Add VF610 clock tree initialization code Andrey Smirnov
2016-10-04  6:58   ` Sascha Hauer
2016-10-04 13:44     ` Andrey Smirnov
2016-10-03 14:40 ` [PATCH 12/20] vf610: Give enet_osc explicit "enet_ext" name Andrey Smirnov
2016-10-03 14:40 ` [PATCH 13/20] i.MX: Add 'lpuart' serial driver Andrey Smirnov
2016-10-04  7:13   ` Sascha Hauer
2016-10-04 13:56     ` Andrey Smirnov
2016-10-04 19:25       ` Sascha Hauer
2016-10-03 14:40 ` [PATCH 14/20] i.MX: i2c-imx: Add Vybrid support Andrey Smirnov
2016-10-04  7:20   ` Sascha Hauer
2016-10-04 13:57     ` Andrey Smirnov
2016-10-03 14:40 ` [PATCH 15/20] i.MX: esdhc: Do not rely on CPU type for quirks Andrey Smirnov
2016-10-03 14:40 ` [PATCH 16/20] i.MX: Kconfig: Enable OCOTP on Vybrid Andrey Smirnov
2016-10-03 14:40 ` [PATCH 17/20] i.MX: ocotp: Remove unused #define Andrey Smirnov
2016-10-03 14:40 ` [PATCH 18/20] i.MX: ocotp: Account for shadow memory gaps Andrey Smirnov
2016-10-03 14:40 ` [PATCH 19/20] i.MX: ocotp: Add Vybrid support Andrey Smirnov
2016-10-03 14:40 ` [PATCH 20/20] imx-esdhc: Request "per" clock explicitly Andrey Smirnov

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=20161004064923.txvdncnm57xwor5h@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=andrew.smirnov@gmail.com \
    --cc=barebox@lists.infradead.org \
    /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