From: Heiko Stuebner <heiko@sntech.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 10/16] rockchip: rk3188: Add clock driver
Date: Sat, 18 Feb 2017 15:19:34 +0100 [thread overview]
Message-ID: <2833030.KiCRt674Zv@phil> (raw)
In-Reply-To: <CAPnjgZ3d5n1coqkrkCCOeuKNcLd=OmYJ8p=g_oHaWcLw=-j28g@mail.gmail.com>
Hi Simon,
Am Montag, 6. Februar 2017, 07:35:12 CET schrieb Simon Glass:
> On 3 February 2017 at 08:09, Heiko Stuebner <heiko@sntech.de> wrote:
> > Add a driver for setting up and modifying the various PLLs and peripheral
> > clocks on the RK3188.
> >
> > Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> > ---
> >
> > arch/arm/include/asm/arch-rockchip/cru_rk3188.h | 191 +++++++++
> > drivers/clk/rockchip/Makefile | 1 +
> > drivers/clk/rockchip/clk_rk3188.c | 523
> > ++++++++++++++++++++++++ 3 files changed, 715 insertions(+)
> > create mode 100644 arch/arm/include/asm/arch-rockchip/cru_rk3188.h
> > create mode 100644 drivers/clk/rockchip/clk_rk3188.c
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
>
> With one comment below.
>
> > diff --git a/arch/arm/include/asm/arch-rockchip/cru_rk3188.h
> > b/arch/arm/include/asm/arch-rockchip/cru_rk3188.h new file mode 100644
> > index 0000000000..74f0fedcc6
> > --- /dev/null
> > +++ b/arch/arm/include/asm/arch-rockchip/cru_rk3188.h
> > @@ -0,0 +1,191 @@
> > +/*
> > + * (C) Copyright 2016 Heiko Stuebner <heiko@sntech.de>
> > + *
> > + * SPDX-License-Identifier: GPL-2.0+
> > + */
> > +#ifndef _ASM_ARCH_CRU_RK3188_H
> > +#define _ASM_ARCH_CRU_RK3188_H
> > +
> > +#define OSC_HZ (24 * 1000 * 1000)
> > +
> > +#define APLL_HZ (1608 * 1000000)
> > +#define GPLL_HZ (594 * 1000000)
> > +#define CPLL_HZ (384 * 1000000)
> > +
> > +/* The SRAM is clocked off aclk_cpu, so we want to max it out for boot
> > speed */ +#define CPU_ACLK_HZ 297000000
> > +#define CPU_HCLK_HZ 148500000
> > +#define CPU_PCLK_HZ 74250000
> > +#define CPU_H2P_HZ 74250000
> > +
> > +#define PERI_ACLK_HZ 148500000
> > +#define PERI_HCLK_HZ 148500000
> > +#define PERI_PCLK_HZ 74250000
> > +
> > +/* Private data for the clock driver - used by rockchip_get_cru() */
> > +struct rk3188_clk_priv {
> > + struct rk3188_grf *grf;
> > + struct rk3188_cru *cru;
> > + ulong rate;
> > + bool has_bwadj;
> > +};
> > +
> > +struct rk3188_cru {
> > + struct rk3188_pll {
> > + u32 con0;
> > + u32 con1;
> > + u32 con2;
> > + u32 con3;
> > + } pll[4];
> > + u32 cru_mode_con;
> > + u32 cru_clksel_con[35];
> > + u32 cru_clkgate_con[10];
> > + u32 reserved1[2];
> > + u32 cru_glb_srst_fst_value;
> > + u32 cru_glb_srst_snd_value;
> > + u32 reserved2[2];
> > + u32 cru_softrst_con[9];
> > + u32 cru_misc_con;
> > + u32 reserved3[2];
> > + u32 cru_glb_cnt_th;
> > +};
> > +check_member(rk3188_cru, cru_glb_cnt_th, 0x0140);
> > +
> > +/* CRU_CLKSEL0_CON */
> > +enum {
> > + /* a9_core_div: core = core_src / (a9_core_div + 1) */
> > + A9_CORE_DIV_SHIFT = 9,
> > + A9_CORE_DIV_MASK = 0x1f,
>
> Can you define
>
> A9_CORE_DIV_MASK = 0x1f << A9_CORE_DIV_SHIFT
>
> and similarly for other masks. I got this wrong with rk3288, and I
> think shifting the mask makes the code easier in places.
I'd disagree here. We're using this scheme everywhere on Rockchip platforms.
For example please look at all the pinmux defines
GPIO3C1_SHIFT = 2,
GPIO3C1_MASK = 3,
GPIO3C1_GPIO = 0,
GPIO3C1_SDMMC1_DATA0,
GPIO3C1_RMII_TXD1,
GPIO3C1_RESERVED,
and numerous other places and I'd think mixing paradigms in one soc and
between all Rockchip socs would be somewhat unwise.
Heiko
next prev parent reply other threads:[~2017-02-18 14:19 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-03 16:09 [U-Boot] [PATCH v3 00/16] rk3188 uboot support Heiko Stuebner
2017-02-03 16:09 ` [U-Boot] [PATCH v3 01/16] dm: allow limiting pre-reloc markings to spl or tpl Heiko Stuebner
2017-02-06 15:34 ` Simon Glass
2017-02-17 0:36 ` Heiko Stübner
2017-02-22 3:59 ` Simon Glass
2017-02-03 16:09 ` [U-Boot] [PATCH v3 02/16] rockchip: move bootrom helper compilation to a hidden option Heiko Stuebner
2017-02-06 15:34 ` Simon Glass
2017-02-03 16:09 ` [U-Boot] [PATCH v3 03/16] rockchip: mkimage: Allow encoding of loader code in spl images Heiko Stuebner
2017-02-06 15:35 ` Simon Glass
2017-02-17 3:23 ` Kever Yang
2017-02-03 16:09 ` [U-Boot] [PATCH v3 04/16] rockchip: mkimage: Add support rk3188 serial Heiko Stuebner
2017-02-06 15:35 ` Simon Glass
2017-02-17 3:29 ` Kever Yang
2017-02-03 16:09 ` [U-Boot] [PATCH v3 05/16] rockchip: serial: Adapt rockchip of-platdata driver for rk3188 Heiko Stuebner
2017-02-06 15:35 ` Simon Glass
2017-02-03 16:09 ` [U-Boot] [PATCH v3 06/16] rockchip: rk3188: Add header files for PMU and GRF Heiko Stuebner
2017-02-03 16:09 ` [U-Boot] [PATCH v3 07/16] rockchip: rk3188: Add pinctrl driver Heiko Stuebner
2017-02-03 16:09 ` [U-Boot] [PATCH v3 08/16] rockchip: rk3188: Add sysreset driver Heiko Stuebner
2017-02-06 15:35 ` Simon Glass
2017-02-03 16:09 ` [U-Boot] [PATCH v3 09/16] rockchip: rk3188: Add rk3066/rk3188 clock bindings Heiko Stuebner
2017-02-03 16:09 ` [U-Boot] [PATCH v3 10/16] rockchip: rk3188: Add clock driver Heiko Stuebner
2017-02-06 15:35 ` Simon Glass
2017-02-18 14:19 ` Heiko Stuebner [this message]
2017-02-21 18:07 ` Simon Glass
2017-02-21 20:35 ` Simon Glass
2017-02-03 16:09 ` [U-Boot] [PATCH v3 11/16] rockchip: rk3188: Add core devicetree files Heiko Stuebner
2017-02-06 15:35 ` Simon Glass
2017-02-10 23:17 ` Heiko Stuebner
2017-02-03 16:09 ` [U-Boot] [PATCH v3 12/16] rockchip: rk3188: Add core support Heiko Stuebner
2017-02-06 15:35 ` Simon Glass
2017-02-03 16:09 ` [U-Boot] [PATCH v3 13/16] rockchip: rk3188: Add sdram driver Heiko Stuebner
2017-02-06 15:35 ` Simon Glass
2017-02-17 20:39 ` Heiko Stuebner
2017-02-17 20:44 ` Simon Glass
2017-02-03 16:09 ` [U-Boot] [PATCH v3 14/16] rockchip: rk3188: Add main, spl and tpl boards Heiko Stuebner
2017-02-06 15:35 ` Simon Glass
2017-02-11 0:47 ` Heiko Stuebner
2017-02-03 16:09 ` [U-Boot] [PATCH v3 15/16] rockchip: rk3188: Add Radxa Rock board Heiko Stuebner
2017-02-06 15:35 ` Simon Glass
2017-02-03 16:09 ` [U-Boot] [TEST-ONLY 16/16] Add a temporary script that can create a bootimage for rk3188 Heiko Stuebner
2017-02-06 15:35 ` Simon Glass
2017-02-16 20:43 ` [U-Boot] [PATCH v3 00/16] rk3188 uboot support Simon Glass
2017-02-17 0:41 ` Heiko Stübner
2017-02-17 20:11 ` Heiko Stuebner
2017-02-17 3:21 ` Kever Yang
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=2833030.KiCRt674Zv@phil \
--to=heiko@sntech.de \
--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