mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alex Elder <elder@riscstar.com>
To: Yixun Lan <dlan@gentoo.org>
Cc: broonie@kernel.org, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, linux-spi@vger.kernel.org,
	devicetree@vger.kernel.org, paul.walmsley@sifive.com,
	palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr,
	p.zabel@pengutronix.de, spacemit@lists.linux.dev,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] spi: spacemit: introduce SpacemiT K1 SPI controller driver
Date: Thu, 18 Sep 2025 11:22:19 -0500	[thread overview]
Message-ID: <5a8364e4-3160-4459-9db4-c9d877ba8c6e@riscstar.com> (raw)
In-Reply-To: <20250918143928-GYB1274501@gentoo.org>

On 9/18/25 9:39 AM, Yixun Lan wrote:
>>>> +	ret = of_property_read_u32(np, "spi-max-frequency", &host->max_speed_hz);
>>>> +	if (ret < 0) {
>>>> +		if (ret != -EINVAL)
>>>> +			dev_warn(dev, "bad spi-max-frequency, using %u\n",
>>>> +				 K1_SPI_MAX_SPEED_HZ);
>>> the err msg does't really usefull..
>> You mean there should be no error message, or that it
>> should say something else?
>>
>>>> +		host->max_speed_hz = K1_SPI_MAX_SPEED_HZ;
>>>> +	}
>>> so in any case, there will be an assignment, I'd rather simplify it as
>>>
>>> 	if (of_property_read_u32(np, "spi-max-frequency", &host->max_speed_hz);
>>> 		host->max_speed_hz = K1_SPI_MAX_SPEED_HZ;
>> I add the warning so it's clear we're using something different
>> than is specified in the DT.
>>
> I personally do not really care about the msg as long as there is a known good value,
> but you could weigh this..
> 
> further I feel the warning message isn't accurate, if spi-max-frequency is
> "bad", why not let user fix it? does "bad" means invalid or overflow?

The reality is that this is a property in the DTB, so it can't
be "fixed" by the user.  It defines the *maximum* frequency
that this particular controller (on this board, or possibly
limited by what the SoC is capable of) will implement.

Stating that it's "bad" seems enough, given it normally can't
be changed--and we will use a sane default instead.

It might helpful to indicate what the bad value is, but that
complicates the code ("bad" could mean the property was
specified without a value too).

> I don't want to have bikeshedding on this, feel free to pick my suggestion
> or keep yours, there is no much real difference

I plan to keep the code as-is.

I don't actually know whether the limitation is on the SoC
or the board (or even whether it truly is the upper bound).
I'll ask SpacemiT about that.

The default value is expected to work on all platforms.  If
If it's specified at all, it should be done in the board
file (so it won't be in "k1.dtsi").

If I don't learn of specific constraints, I'll omit it in
the DTS file (it's currently unused).

However I *will* add some new code that verifies that the
value (if specified) is within the SoC-supported range,
which is 6.25 Kbps-51.2Mbps.

> thanks for your efforts to work on this

And thank you for your review feedback.

					-Alex>
> -- Yixun Lan (dlan)


  parent reply	other threads:[~2025-09-18 16:22 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-17 22:07 [PATCH 0/3] spi: support the SpacemiT K1 SPI controller Alex Elder
2025-09-17 22:07 ` [PATCH 1/3] dt-bindings: spi: add SpacemiT K1 SPI support Alex Elder
2025-09-17 23:15   ` Yixun Lan
2025-09-17 23:40     ` Alex Elder
2025-09-18  0:16       ` Yixun Lan
2025-09-18  2:59         ` Alex Elder
2025-09-18  7:43           ` Troy Mitchell
2025-09-18 12:00             ` Alex Elder
2025-09-18 19:57       ` Rob Herring
2025-09-18 20:02         ` Alex Elder
2025-10-06  8:10   ` Krzysztof Kozlowski
2025-09-17 22:07 ` [PATCH 2/3] spi: spacemit: introduce SpacemiT K1 SPI controller driver Alex Elder
2025-09-18  7:47   ` Troy Mitchell
2025-09-18 12:00     ` Alex Elder
2025-09-18 12:41   ` Yixun Lan
2025-09-18 13:45     ` Alex Elder
2025-09-18 14:39       ` Yixun Lan
2025-09-18 14:47         ` Alex Elder
2025-09-18 14:56           ` Yixun Lan
2025-09-18 15:44         ` Alex Elder
2025-09-18 15:58         ` Alex Elder
2025-09-18 16:22         ` Alex Elder [this message]
2025-09-17 22:07 ` [PATCH 3/3] riscv: dts: spacemit: define a SPI controller node Alex Elder
2025-09-18 13:32   ` Yixun Lan
2025-09-18 13:51     ` Alex Elder
2025-09-18 14:06       ` Yixun Lan
2025-09-18 14:20         ` Alex Elder
2025-09-18 15:04           ` Yixun Lan
2025-09-18 14:33     ` Yao Zi
2025-09-18 16:22       ` Alex Elder
2025-09-19 15:25         ` Alex Elder

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=5a8364e4-3160-4459-9db4-c9d877ba8c6e@riscstar.com \
    --to=elder@riscstar.com \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlan@gentoo.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=robh@kernel.org \
    --cc=spacemit@lists.linux.dev \
    /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

all inboxes | Powered by JetHome®