mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Jules Maselbas" <jmaselbas@zdiv.net>
To: "Ahmad Fatoum" <a.fatoum@pengutronix.de>, <barebox@lists.infradead.org>
Subject: Re: [PATCH v2 2/6] clk: Add clock driver for sun50i-a64
Date: Thu, 16 Jan 2025 15:20:33 +0100	[thread overview]
Message-ID: <D73KB4PN5LPG.1CIQYZNKG3U5J@zdiv.net> (raw)
In-Reply-To: <801d9231-2563-405e-bcbf-a0ae8d38857e@pengutronix.de>

Hi,
On Tue Jan 14, 2025 at 9:38 AM CET, Ahmad Fatoum wrote:
> Hi,
>
> On 07.01.25 15:37, Jules Maselbas wrote:
>> Adds a "one-size fit all" clock driver to be used for complex
>> "composite" clock, composed of: a gate, a mux and severals dividers.
>> This clk driver could be used to make SoC specific drivers easier
>> to port from linux sources, but this is not the case yet.
>
> Just curious: Here you say tha this driver can make porting kernel
> drivers easier, but at the end you say this one-size fits all is
> barebox-specific?

Yes it is barebox specific.
The linux drivers (clk/sunxi-ng) use SUNXI_CCU_* macros to define clks,
such macros could be reimplemented using the one-size fits all driver.
I think i'll try to do this for the H6 SoC.

>> The pll-cpux is set to 816MHz and pll-periph0-2x is set to 1.2GHz.
>> 
>> Signed-off-by: Jules Maselbas <jmaselbas@zdiv.net>
>
> Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
>
> As I read through the code, some nitpicks below, but nothing critical.
thanks

>> ---
>
>> +#define MHZ (1000UL * 1000UL)
>
> There is linux/units.h with HZ_PER_MHZ.
>
>> +static struct clk_div_table div_apb1[] = {
>> +	{ .val = 0, .div = 2 },
>> +	{ .val = 1, .div = 2 },
>> +	{ .val = 2, .div = 4 },
>> +	{ .val = 3, .div = 8 },
>> +	{ /* Sentinel */ },
>
> If comma is removed, it's less likely to add a member after it by mistake.
ack

>
>> +static void sun50i_a64_resets_init(void __iomem *regs)
>> +{
>> +	u32 rst;
>> +
>> +	rst = 0 |
>> +		/* RST_USB_PHY0 */ BIT(0) |
>> +		/* RST_USB_PHY1 */ BIT(1) |
>> +		/* RST_USB_HSIC */ BIT(2);
>
> Why not name this ${REG}_RST_USB_PHY0 and so on instead of the comments?
Not really worth the effort i think. This file is already too much different from
its Linux source. This is barebox specific.

>> +static inline void nop_delay(u32 cnt)
>> +{
>> +	while (cnt--)
>> +		barrier();
>
> While we use GCC by default, first clang support was recently added and
> clang is known to do optimizations that would reorder cnt over a memory
> clobber if cnt is held in a register. Better make cnt volatile here.
ok

>
>> +}
>> +
>> +/* a "one size fit all" clk for barebox */
>
> Cheers,
> Ahmad




  reply	other threads:[~2025-01-16 14:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-07 14:37 [PATCH v2 0/6] Initial support for Allwinner A64 SoC Jules Maselbas
2025-01-07 14:37 ` [PATCH v2 1/6] clk: divider: add error code propagation Jules Maselbas
2025-01-08 14:20   ` Ahmad Fatoum
2025-01-07 14:37 ` [PATCH v2 2/6] clk: Add clock driver for sun50i-a64 Jules Maselbas
2025-01-14  8:38   ` Ahmad Fatoum
2025-01-16 14:20     ` Jules Maselbas [this message]
2025-01-07 14:37 ` [PATCH v2 3/6] pinctrl: Add sun50i-a64 pinctrl driver Jules Maselbas
2025-01-14  8:39   ` Ahmad Fatoum
2025-01-16 14:28     ` Jules Maselbas
2025-01-07 14:37 ` [PATCH v2 4/6] mci: Add sunxi-mmc driver Jules Maselbas
2025-01-14  8:38   ` Ahmad Fatoum
2025-01-07 14:37 ` [PATCH v2 5/6] ARM: sunxi: Introduce mach-sunxi Jules Maselbas
2025-01-14  5:49   ` Sascha Hauer
2025-01-14  8:38   ` Ahmad Fatoum
2025-01-07 14:37 ` [PATCH v2 6/6] Documentation: sunxi: Add some documentation Jules Maselbas
2025-01-14  8:39   ` Ahmad Fatoum
2025-01-16 14:37     ` Jules Maselbas

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=D73KB4PN5LPG.1CIQYZNKG3U5J@zdiv.net \
    --to=jmaselbas@zdiv.net \
    --cc=a.fatoum@pengutronix.de \
    --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