All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Junhui Liu" <junhui.liu@pigmoral.tech>
To: <wens@kernel.org>, "Junhui Liu" <junhui.liu@pigmoral.tech>
Cc: "Michael Turquette" <mturquette@baylibre.com>,
	"Stephen Boyd" <sboyd@kernel.org>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"Samuel Holland" <samuel@sholland.org>,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Maxime Ripard" <mripard@kernel.org>, <linux-clk@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-sunxi@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
	<linux-rtc@vger.kernel.org>, <devicetree@vger.kernel.org>
Subject: Re: [PATCH 4/7] clk: sunxi-ng: Extract common RTC CCU clock logic
Date: Sun, 25 Jan 2026 13:50:41 +0800	[thread overview]
Message-ID: <DFXFOHVB1GAV.3L3EL4FVWFWDC@pigmoral.tech> (raw)
In-Reply-To: <CAGb2v65aMMVu8W1PW+6NZM+YM72YFV9_FWVWtj6QHJ1CgetEsA@mail.gmail.com>

On Sun Jan 25, 2026 at 12:32 PM CST, Chen-Yu Tsai wrote:
> On Wed, Jan 21, 2026 at 7:04 PM Junhui Liu <junhui.liu@pigmoral.tech> wrote:
>>
>> Extract the IOSC and 32k clock logic from ccu-sun6i-rtc into a shared
>> module to simplify adding RTC CCU support for new SoCs. This is needed
>> because newer Allwinner SoCs introduce additional DCXO/HOSC logic that
>> prevents direct reuse of the existing driver.
>>
>> Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
>> ---
>>  drivers/clk/sunxi-ng/Makefile        |   3 +
>>  drivers/clk/sunxi-ng/ccu-sun6i-rtc.c | 152 +----------------------------------
>>  drivers/clk/sunxi-ng/ccu_rtc.c       | 136 +++++++++++++++++++++++++++++++
>>  drivers/clk/sunxi-ng/ccu_rtc.h       |  37 +++++++++
>>  4 files changed, 177 insertions(+), 151 deletions(-)
>>

[...]

>> +
>> +const struct clk_ops ccu_iosc_ops = {
>> +       .enable                 = ccu_iosc_enable,
>> +       .disable                = ccu_iosc_disable,
>> +       .is_enabled             = ccu_iosc_is_enabled,
>> +       .recalc_rate            = ccu_iosc_recalc_rate,
>> +       .recalc_accuracy        = ccu_iosc_recalc_accuracy,
>> +};
>
> You need to export the symbol.

Thanks, I will export them.

[...]

>> diff --git a/drivers/clk/sunxi-ng/ccu_rtc.h b/drivers/clk/sunxi-ng/ccu_rtc.h
>> new file mode 100644
>> index 000000000000..1c44c2206a25
>> --- /dev/null
>> +++ b/drivers/clk/sunxi-ng/ccu_rtc.h
>> @@ -0,0 +1,37 @@
>> +/* SPDX-License-Identifier: GPL-2.0-only */
>> +/*
>> + * Copyright (c) 2021 Samuel Holland <samuel@sholland.org>
>> + */
>> +
>> +#ifndef _CCU_RTC_H_
>> +#define _CCU_RTC_H_
>> +
>> +#define IOSC_ACCURACY                  300000000 /* 30% */
>> +#define IOSC_RATE                      16000000
>> +
>> +#define LOSC_RATE                      32768
>> +#define LOSC_RATE_SHIFT                        15
>> +
>> +#define LOSC_CTRL_REG                  0x0
>> +#define LOSC_CTRL_KEY                  0x16aa0000
>> +
>> +#define IOSC_32K_CLK_DIV_REG           0x8
>> +#define IOSC_32K_CLK_DIV               GENMASK(4, 0)
>> +#define IOSC_32K_PRE_DIV               32
>> +
>> +#define IOSC_CLK_CALI_REG              0xc
>> +#define IOSC_CLK_CALI_DIV_ONES         22
>> +#define IOSC_CLK_CALI_EN               BIT(1)
>> +#define IOSC_CLK_CALI_SRC_SEL          BIT(0)
>> +
>> +#define LOSC_OUT_GATING_REG            0x60
>> +
>> +#define DCXO_CTRL_REG                  0x160
>> +#define DCXO_CTRL_CLK16M_RC_EN         BIT(0)
>
> Please keep all internals in the .c file.

My original thought was to reuse these for the A733. But since doing
so is not appropriate, I will put them in the .c files separately.

>
> ChenYu
>

-- 
Best regards,
Junhui Liu



  reply	other threads:[~2026-01-25  5:51 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-21 10:59 [PATCH 0/7] rtc: sun6i: Add support for Allwinner A733 SoC Junhui Liu
2026-01-21 10:59 ` [PATCH 1/7] dt-bindings: rtc: sun6i: Add Allwinner A733 support Junhui Liu
2026-01-21 16:56   ` Rob Herring (Arm)
2026-03-28 12:37   ` Chen-Yu Tsai
2026-04-10  9:18     ` Junhui Liu
2026-01-21 10:59 ` [PATCH 2/7] rtc: sun6i: Bind internal CCU via auxiliary bus Junhui Liu
2026-01-22  2:18   ` kernel test robot
2026-01-21 10:59 ` [PATCH 3/7] clk: sunxi-ng: sun6i-rtc: Add feature bit for IOSC calibration Junhui Liu
2026-01-21 10:59 ` [PATCH 4/7] clk: sunxi-ng: Extract common RTC CCU clock logic Junhui Liu
2026-01-25  4:07   ` kernel test robot
2026-01-25  4:32   ` Chen-Yu Tsai
2026-01-25  5:50     ` Junhui Liu [this message]
2026-01-21 10:59 ` [PATCH 5/7] clk: sunxi-ng: mux: Add mux read-only clock operations Junhui Liu
2026-01-21 10:59 ` [PATCH 6/7] rtc: sun6i: Add support for A733 RTC Junhui Liu
2026-03-28 12:40   ` Chen-Yu Tsai
2026-01-21 10:59 ` [PATCH 7/7] clk: sunxi-ng: Add Allwinner A733 RTC CCU support Junhui Liu
2026-03-28 14:41   ` Chen-Yu Tsai
2026-04-10  9:49     ` Junhui Liu
2026-02-22 10:41 ` [PATCH 0/7] rtc: sun6i: Add support for Allwinner A733 SoC Jernej Škrabec
2026-02-25 12:02   ` Junhui Liu

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=DFXFOHVB1GAV.3L3EL4FVWFWDC@pigmoral.tech \
    --to=junhui.liu@pigmoral.tech \
    --cc=alexandre.belloni@bootlin.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=mripard@kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=robh@kernel.org \
    --cc=samuel@sholland.org \
    --cc=sboyd@kernel.org \
    --cc=wens@kernel.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 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.