[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <DFXFOHVB1GAV.3L3EL4FVWFWDC@pigmoral.tech>
Date: Sun, 25 Jan 2026 13:50:41 +0800
From: "Junhui Liu" <junhui.liu@...moral.tech>
To: <wens@...nel.org>, "Junhui Liu" <junhui.liu@...moral.tech>
Cc: "Michael Turquette" <mturquette@...libre.com>, "Stephen Boyd"
<sboyd@...nel.org>, "Jernej Skrabec" <jernej.skrabec@...il.com>, "Samuel
Holland" <samuel@...lland.org>, "Alexandre Belloni"
<alexandre.belloni@...tlin.com>, "Rob Herring" <robh@...nel.org>,
"Krzysztof Kozlowski" <krzk+dt@...nel.org>, "Conor Dooley"
<conor+dt@...nel.org>, "Maxime Ripard" <mripard@...nel.org>,
<linux-clk@...r.kernel.org>, <linux-arm-kernel@...ts.infradead.org>,
<linux-sunxi@...ts.linux.dev>, <linux-kernel@...r.kernel.org>,
<linux-rtc@...r.kernel.org>, <devicetree@...r.kernel.org>
Subject: Re: [PATCH 4/7] clk: sunxi-ng: Extract common RTC CCU clock logic
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@...moral.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@...moral.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@...lland.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
Powered by blists - more mailing lists