All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] Add rockchip Saradc support
@ 2017-09-13 10:09 ` David Wu
  0 siblings, 0 replies; 45+ messages in thread
From: David Wu @ 2017-09-13 10:09 UTC (permalink / raw)
  To: sjg, philipp.tomsich
  Cc: huangtao, u-boot, zhangqing, linux-rockchip, p.marczak, David Wu,
	andy.yan, chenjh

The Saradc is used for adc keys and charging detect at uboot
loader. Except for the rk3036 and rk3228 Socs, the others
support the Saradc IP.

David Wu (8):
  adc: Add driver for Rockchip saradc
  configs: rockchip: Enable the ROCKCHIP_SARADC config
  clk: rockchip: Add rv1108 SARADC clock support
  clk: rockchip: Add SARADC clock support for rk3288
  clk: rockchip: Add rk3328 SRAADC clock support
  clk: rockchip: Add rk3368 SARADC clock support
  clk: rockchip: Add rk3399 SARADC clock support
  arm: dts: rv1108: Add saradc node at dtsi level

 arch/arm/dts/rv1108.dtsi                        |  11 ++
 arch/arm/include/asm/arch-rockchip/cru_rk3368.h |   5 +
 arch/arm/include/asm/arch-rockchip/cru_rv1108.h |   5 +
 configs/evb-rk3288_defconfig                    |   2 +
 configs/evb-rk3328_defconfig                    |   2 +
 configs/evb-rk3399_defconfig                    |   2 +
 configs/evb-rv1108_defconfig                    |   2 +
 configs/fennec-rk3288_defconfig                 |   2 +
 configs/firefly-rk3288_defconfig                |   2 +
 configs/firefly-rk3399_defconfig                |   2 +
 configs/lion-rk3368_defconfig                   |   2 +
 configs/miqi-rk3288_defconfig                   |   2 +
 configs/phycore-rk3288_defconfig                |   2 +
 configs/popmetal-rk3288_defconfig               |   2 +
 configs/puma-rk3399_defconfig                   |   2 +
 configs/sheep-rk3368_defconfig                  |   2 +
 configs/tinker-rk3288_defconfig                 |   2 +
 drivers/adc/Kconfig                             |   9 ++
 drivers/adc/Makefile                            |   1 +
 drivers/adc/rockchip-saradc.c                   | 188 ++++++++++++++++++++++++
 drivers/clk/rockchip/clk_rk3288.c               |  45 ++++++
 drivers/clk/rockchip/clk_rk3328.c               |  37 +++++
 drivers/clk/rockchip/clk_rk3368.c               |  31 ++++
 drivers/clk/rockchip/clk_rk3399.c               |  33 +++++
 drivers/clk/rockchip/clk_rv1108.c               |  35 +++++
 include/dt-bindings/clock/rv1108-cru.h          |   2 +
 26 files changed, 430 insertions(+)
 create mode 100644 drivers/adc/rockchip-saradc.c

-- 
2.7.4


_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

^ permalink raw reply	[flat|nested] 45+ messages in thread
* Re: [PATCH 4/8] clk: rockchip: Add Saradc clock support for rk3288
@ 2017-09-13 11:01 David.Wu
  0 siblings, 0 replies; 45+ messages in thread
From: David.Wu @ 2017-09-13 11:01 UTC (permalink / raw)
  To: Dr. Philipp Tomsich
  Cc: huangtao, u-boot, zhangqing, linux-rockchip, p.marczak, andy.yan, chenjh

[-- Attachment #1: Type: text/plain, Size: 2784 bytes --]

Spam detection software, running on the system "lists.denx.de",
has identified this incoming email as possible spam.  The original
message has been attached to this so you can view it or label
similar future email.  If you have any questions, see
@@CONTACT_ADDRESS@@ for details.

Content preview:  Hi Dr.Philipp 在 2017/9/13 18:24, Dr. Philipp Tomsich 写道:
   > >> On 13 Sep 2017, at 12:09, David Wu <david.wu@rock-chips.com> wrote:
  >> > > Please add a commit message. > >> Signed-off-by: David Wu <david.wu@rock-chips.com>
   > > Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
  > > See above and below for requested changes. > >> --- >> drivers/clk/rockchip/clk_rk3288.c
   | 45 +++++++++++++++++++++++++++++++++++++++ >> 1 file changed, 45 insertions(+)
   >> >> diff --git a/drivers/clk/rockchip/clk_rk3288.c b/drivers/clk/rockchip/clk_rk3288.c
   >> index 478195b..29652b0 100644 >> --- a/drivers/clk/rockchip/clk_rk3288.c
   >> +++ b/drivers/clk/rockchip/clk_rk3288.c >> @@ -111,6 +111,15 @@ enum {
   >> PERI_ACLK_DIV_SHIFT = 0, >> PERI_ACLK_DIV_MASK = 0x1f << PERI_ACLK_DIV_SHIFT,
   >> >> + /* >> + * CLKSEL24 >> + * saradc_div_con: >> + * clk_saradc=24MHz/(saradc_div_con+1)
   >> + */ >> + CLK_SARADC_DIV_CON_SHIFT = 8, >> + CLK_SARADC_DIV_CON_MASK =
   0xff << CLK_SARADC_DIV_CON_SHIFT, >> + CLK_SARADC_DIV_CON_WIDTH = 8, >> +
   >> SOCSTS_DPLL_LOCK = 1 << 5, >> SOCSTS_APLL_LOCK = 1 << 6, >> SOCSTS_CPLL_LOCK
   = 1 << 7, >> @@ -131,6 +140,11 @@ static const struct pll_div apll_init_cfg
   = PLL_DIVISORS(APLL_HZ, 1, 1); >> static const struct pll_div gpll_init_cfg
   = PLL_DIVISORS(GPLL_HZ, 2, 2); >> static const struct pll_div cpll_init_cfg
   = PLL_DIVISORS(CPLL_HZ, 1, 2); >> >> +static inline u32 extract_bits(u32
  val, unsigned width, unsigned shift) >> +{ >> + return (val >> shift) & ((1
   << width) - 1); >> +} > > Please reuse what’s already available in include/bitfield.h.
   > This also applies to all call-sites for extract_bits below: they should
   directly use the already existing function. [...] 

Content analysis details:   (5.6 points, 5.0 required)

 pts rule name              description
---- ---------------------- --------------------------------------------------
 0.6 RCVD_IN_SORBS_WEB      RBL: SORBS: sender is an abusable web server
                            [58.22.7.114 listed in dnsbl.sorbs.net]
 0.0 KHOP_BIG_TO_CC         Sent to 10+ recipients instaed of Bcc or a list
 2.6 RCVD_IN_SBL            RBL: Received via a relay in Spamhaus SBL
                            [211.157.147.132 listed in zen.spamhaus.org]
 2.4 RCVD_IN_MSPIKE_L5      RBL: Very bad reputation (-5)
                            [211.157.147.132 listed in bl.mailspike.net]
 0.0 RCVD_IN_MSPIKE_BL      Mailspike blacklisted



[-- Attachment #2: original message before SpamAssassin --]
[-- Type: message/rfc822, Size: 5416 bytes --]

From: "David.Wu" <david.wu@rock-chips.com>
To: "Dr. Philipp Tomsich" <philipp.tomsich@theobroma-systems.com>
Cc: sjg@chromium.org, p.marczak@samsung.com, huangtao@rock-chips.com, kever.yang@rock-chips.com, andy.yan@rock-chips.com, chenjh@rock-chips.com, heiko@sntech.de, zhangqing@rock-chips.com, linux-rockchip@lists.infradead.org, u-boot@lists.denx.de
Subject: Re: [PATCH 4/8] clk: rockchip: Add Saradc clock support for rk3288
Date: Wed, 13 Sep 2017 19:01:29 +0800
Message-ID: <84dd68d6-40f8-50dd-1f4e-b916d0c569d5@rock-chips.com>

Hi Dr.Philipp

在 2017/9/13 18:24, Dr. Philipp Tomsich 写道:
> 
>> On 13 Sep 2017, at 12:09, David Wu <david.wu@rock-chips.com> wrote:
>>
> 
> Please add a commit message.
> 
>> Signed-off-by: David Wu <david.wu@rock-chips.com>
> 
> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> 
> See above and below for requested changes.
> 
>> ---
>> drivers/clk/rockchip/clk_rk3288.c | 45 +++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 45 insertions(+)
>>
>> diff --git a/drivers/clk/rockchip/clk_rk3288.c b/drivers/clk/rockchip/clk_rk3288.c
>> index 478195b..29652b0 100644
>> --- a/drivers/clk/rockchip/clk_rk3288.c
>> +++ b/drivers/clk/rockchip/clk_rk3288.c
>> @@ -111,6 +111,15 @@ enum {
>> 	PERI_ACLK_DIV_SHIFT	= 0,
>> 	PERI_ACLK_DIV_MASK	= 0x1f << PERI_ACLK_DIV_SHIFT,
>>
>> +	/*
>> +	 * CLKSEL24
>> +	 * saradc_div_con:
>> +	 * clk_saradc=24MHz/(saradc_div_con+1)
>> +	 */
>> +	CLK_SARADC_DIV_CON_SHIFT	= 8,
>> +	CLK_SARADC_DIV_CON_MASK		= 0xff << CLK_SARADC_DIV_CON_SHIFT,
>> +	CLK_SARADC_DIV_CON_WIDTH	= 8,
>> +
>> 	SOCSTS_DPLL_LOCK	= 1 << 5,
>> 	SOCSTS_APLL_LOCK	= 1 << 6,
>> 	SOCSTS_CPLL_LOCK	= 1 << 7,
>> @@ -131,6 +140,11 @@ static const struct pll_div apll_init_cfg = PLL_DIVISORS(APLL_HZ, 1, 1);
>> static const struct pll_div gpll_init_cfg = PLL_DIVISORS(GPLL_HZ, 2, 2);
>> static const struct pll_div cpll_init_cfg = PLL_DIVISORS(CPLL_HZ, 1, 2);
>>
>> +static inline u32 extract_bits(u32 val, unsigned width, unsigned shift)
>> +{
>> +	return (val >> shift) & ((1 << width) - 1);
>> +}
> 
> Please reuse what’s already available in include/bitfield.h.
> This also applies to all call-sites for extract_bits below: they should directly use the already existing function.

Okay, i will use the bitfield_extract() instead of it.

> 
>> +
>> static int rkclk_set_pll(struct rk3288_cru *cru, enum rk_clk_id clk_id,
>> 			 const struct pll_div *div)
>> {
>> @@ -634,6 +648,31 @@ static ulong rockchip_spi_set_clk(struct rk3288_cru *cru, uint gclk_rate,
>> 	return rockchip_spi_get_clk(cru, gclk_rate, periph);
>> }
>>
>> +static ulong rockchip_saradc_get_clk(struct rk3288_cru *cru)
>> +{
>> +	u32 div, val;
>> +
>> +	val = readl(&cru->cru_clksel_con[24]);
>> +	div = extract_bits(val, CLK_SARADC_DIV_CON_WIDTH,
>> +			   CLK_SARADC_DIV_CON_SHIFT);
>> +
>> +	return DIV_TO_RATE(OSC_HZ, div);
>> +}
>> +
>> +static ulong rockchip_saradc_set_clk(struct rk3288_cru *cru, uint hz)
>> +{
>> +	int src_clk_div;
>> +
>> +	src_clk_div = DIV_ROUND_UP(OSC_HZ, hz) - 1;
>> +	assert(src_clk_div < 128);
>> +
>> +	rk_clrsetreg(&cru->cru_clksel_con[24],
>> +		     CLK_SARADC_DIV_CON_MASK,
>> +		     src_clk_div << CLK_SARADC_DIV_CON_SHIFT);
>> +
>> +	return rockchip_saradc_get_clk(cru);
>> +}
>> +
>> static ulong rk3288_clk_get_rate(struct clk *clk)
>> {
>> 	struct rk3288_clk_priv *priv = dev_get_priv(clk->dev);
>> @@ -666,6 +705,9 @@ static ulong rk3288_clk_get_rate(struct clk *clk)
>> 		return gclk_rate;
>> 	case PCLK_PWM:
>> 		return PD_BUS_PCLK_HZ;
>> +	case SCLK_SARADC:
>> +		new_rate = rockchip_saradc_get_clk(priv->cru);
>> +		break;
>> 	default:
>> 		return -ENOENT;
>> 	}
>> @@ -756,6 +798,9 @@ static ulong rk3288_clk_set_rate(struct clk *clk, ulong rate)
>> 		new_rate = rate;
>> 		break;
>> #endif
>> +	case SCLK_SARADC:
>> +		new_rate = rockchip_saradc_set_clk(priv->cru, rate);
>> +		break;
>> 	default:
>> 		return -ENOENT;
>> 	}
>> -- 
>> 2.7.4
>>
>>
> 
> 
> 
> 


[-- Attachment #3: Type: text/plain, Size: 127 bytes --]

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

^ permalink raw reply	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2017-09-14 14:55 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-13 10:09 [PATCH 0/8] Add rockchip Saradc support David Wu
2017-09-13 10:09 ` [U-Boot] " David Wu
     [not found] ` <1505297379-12638-1-git-send-email-david.wu-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2017-09-13 10:09   ` [PATCH 1/8] adc: Add driver for Rockchip Saradc David Wu
2017-09-13 10:09     ` [U-Boot] " David Wu
     [not found]     ` <1505297379-12638-2-git-send-email-david.wu-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2017-09-13 20:07       ` [U-Boot,1/8] " Philipp Tomsich
2017-09-13 20:07         ` [U-Boot] " Philipp Tomsich
2017-09-13 20:40     ` Philipp Tomsich
2017-09-13 20:40       ` [U-Boot] " Philipp Tomsich
2017-09-13 10:09   ` [PATCH 2/8] configs: rockchip: Enable the ROCKCHIP_SARADC config David Wu
2017-09-13 10:09     ` [U-Boot] " David Wu
2017-09-13 10:20     ` Dr. Philipp Tomsich
2017-09-13 10:20       ` [U-Boot] " Dr. Philipp Tomsich
2017-09-13 10:09   ` [PATCH 4/8] clk: rockchip: Add Saradc clock support for rk3288 David Wu
2017-09-13 10:09     ` [U-Boot] " David Wu
2017-09-13 10:24     ` Dr. Philipp Tomsich
2017-09-13 10:24       ` [U-Boot] " Dr. Philipp Tomsich
2017-09-13 10:26     ` Dr. Philipp Tomsich
2017-09-13 10:26       ` [U-Boot] " Dr. Philipp Tomsich
     [not found]     ` <1505297379-12638-5-git-send-email-david.wu-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2017-09-13 20:07       ` [U-Boot,4/8] " Philipp Tomsich
2017-09-13 20:07         ` [U-Boot] [U-Boot, 4/8] " Philipp Tomsich
2017-09-13 10:52   ` [PATCH 5/8] clk: rockchip: Add rk3328 Saradc clock support David Wu
2017-09-13 10:52     ` [U-Boot] " David Wu
     [not found]     ` <1505299969-13329-1-git-send-email-david.wu-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2017-09-13 20:07       ` [U-Boot,5/8] " Philipp Tomsich
2017-09-13 20:07         ` [U-Boot] [U-Boot, 5/8] " Philipp Tomsich
2017-09-13 20:44     ` Philipp Tomsich
2017-09-13 20:44       ` [U-Boot] " Philipp Tomsich
2017-09-13 10:09 ` [PATCH 3/8] clk: rockchip: Add rv1108 " David Wu
2017-09-13 10:09   ` [U-Boot] " David Wu
     [not found]   ` <1505297379-12638-4-git-send-email-david.wu-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2017-09-13 20:07     ` [U-Boot,3/8] " Philipp Tomsich
2017-09-13 20:07       ` [U-Boot] [U-Boot, 3/8] " Philipp Tomsich
2017-09-13 20:45   ` Philipp Tomsich
2017-09-13 20:45     ` [U-Boot] " Philipp Tomsich
2017-09-13 11:32 ` [U-Boot] [PATCH 6/8] clk: rockchip: Add rk3368 " David Wu
2017-09-13 20:07   ` [U-Boot] [U-Boot, " Philipp Tomsich
2017-09-13 20:41   ` Philipp Tomsich
2017-09-13 20:44     ` Dr. Philipp Tomsich
2017-09-14 11:17     ` David.Wu
2017-09-14 14:55       ` Dr. Philipp Tomsich
2017-09-13 11:33 ` [U-Boot] [PATCH 7/8] clk: rockchip: Add rk3399 " David Wu
2017-09-13 20:07   ` [U-Boot] [U-Boot, " Philipp Tomsich
2017-09-13 20:42   ` Philipp Tomsich
2017-09-13 11:35 ` [U-Boot] [PATCH 8/8] arm: dts: rv1108: Add Saradc node at dtsi level David Wu
2017-09-13 20:07   ` [U-Boot] [U-Boot, " Philipp Tomsich
2017-09-13 20:08   ` Philipp Tomsich
2017-09-13 11:01 [PATCH 4/8] clk: rockchip: Add Saradc clock support for rk3288 David.Wu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.