From: "Stefan Dösinger" <stefandoesinger@gmail.com>
To: linux-arm-kernel@lists.infradead.org,
Navid Ghahremani <ghahramani.navid@gmail.com>
Cc: arnd@arndb.de, krzk@kernel.org,
Navid Ghahremani <ghahramani.navid@gmail.com>,
Mark Brown <broonie@kernel.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org
Subject: Re: [PATCH v2 20/24] spi: zx: Add ZTE ZX family SPI flash controller driver
Date: Mon, 19 Oct 2026 14:15:30 +0200 [thread overview]
Message-ID: <jjb8MyAPSXaXqHtedDkkwQ@gmail.com> (raw)
In-Reply-To: <20261014072109.1759502-21-ghahramani.navid@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2145 bytes --]
Hi Navid,
I had some time to review the changes you made to my SPI driver.
I'll grab the code style changes, they seem in line with kernel guidelines. Of
course it'll only live in my gitlab repo for the time being.
Am Mittwoch, 14. Oktober 2026, 09:21:00 Mitteleuropäische Sommerzeit schrieb
Navid Ghahremani:
> +static int zx_qspi_set_speed(struct zx_qspi *qspi, unsigned int max_hz)
> +{
> + unsigned long rate;
> + long rounded;
> + int ret;
> +
> + if (!max_hz)
> + return -EINVAL;
> + if (qspi->speed_hz == max_hz)
> + return 0;
> +
> + rounded = clk_round_rate(qspi->wclk, max_hz);
> + if (rounded < 0)
> + return rounded;
> + if (!rounded || rounded > max_hz)
> + return -EINVAL;
> +
> + ret = clk_set_rate(qspi->wclk, rounded);
> + if (ret)
> + return ret;
> + rate = clk_get_rate(qspi->wclk);
> + if (!rate || rate > max_hz)
> + return -EINVAL;
> + qspi->speed_hz = rate;
> +
> + return 0;
> +}
I think the idea of op->max_freq is that it is the SPI bus clock, not the
controller clock. Existing drivers aren't quite consistent on it though (or
there's HW without a divider register). spi-ma35d1-qspi.c for example sets the
controller's clock divider rather than the clock.
So IOW, this function should primarily configure ZX_QSPI_TIMING_REG. If the
target clock can't be achieved with the controller input clock (e.g. divider
is larger than ZX_QSPI_TIMING_REG supports or clock rate is lower than
requested SPI speed), then a change to the wclk is in order.
> + ctrl->min_speed_hz = clk_round_rate(qspi->wclk, 1);
> + ctrl->max_speed_hz = 50000000;
This looks wrong - the max speed is probably the highest possible wclk rate,
the lowest speed the lowest possible wclk rate divided by the highest possible
divider.
> + /* Ensure proper data sampling point */
> + reg = readl_relaxed(qspi->io_base + ZX_QSPI_TIMING_REG);
> + if (!FIELD_GET(GENMASK(17, 16), reg)) {
> + reg |= FIELD_PREP(GENMASK(17, 16), 1);
> + writel_relaxed(reg, qspi->io_base + ZX_QSPI_TIMING_REG);
> + }
I don't know what this is doing. Can you elaborate?
Cheers,
Stefan
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 870 bytes --]
next prev parent reply other threads:[~2026-10-19 19:00 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20261014072109.1759502-1-ghahramani.navid@gmail.com>
2026-10-14 7:20 ` [PATCH v2 01/24] MAINTAINERS: Consolidate ARM/ZTE ZX SOC SUPPORT with Stefan Doesinger Navid Ghahremani
2026-10-14 20:11 ` Stefan Dösinger
2026-10-14 7:20 ` [PATCH v2 02/24] dt-bindings: arm: Add ZTE ZX279128S platform descriptions Navid Ghahremani
2026-10-14 7:20 ` [PATCH v2 03/24] ARM: zte: Add ZX279128S platform and CPU hotplug support Navid Ghahremani
2026-10-14 7:20 ` [PATCH v2 04/24] dt-bindings: clock: Add ZTE ZX279128S CRM clock bindings Navid Ghahremani
2026-10-14 21:48 ` Stefan Dösinger
2026-10-15 9:25 ` Krzysztof Kozlowski
2026-10-15 9:26 ` Krzysztof Kozlowski
2026-10-14 7:20 ` [PATCH v2 05/24] dt-bindings: reset: Add ZTE ZX279128S reset controller bindings Navid Ghahremani
2026-10-15 9:27 ` Krzysztof Kozlowski
2026-10-14 7:20 ` [PATCH v2 06/24] clk: zte: Add ZX279128S CRM clock and reset driver Navid Ghahremani
2026-10-14 13:21 ` Philipp Zabel
2026-10-14 19:39 ` Stefan Dösinger
2026-10-14 7:20 ` [PATCH v2 07/24] dt-bindings: gpio: Add ZTE ZX279128S GPIO controller Navid Ghahremani
2026-10-14 7:20 ` [PATCH v2 08/24] gpio: Add ZTE ZX279128S GPIO driver Navid Ghahremani
2026-10-14 21:11 ` Stefan Dösinger
2026-10-15 12:25 ` Bartosz Golaszewski
2026-10-14 7:20 ` [PATCH v2 09/24] dt-bindings: pinctrl: pinctrl-single: Add ZTE ZX279128S pin mux Navid Ghahremani
2026-10-17 16:20 ` Krzysztof Kozlowski
2026-10-14 7:20 ` [PATCH v2 10/24] dt-bindings: phy: Add ZTE ZX279128S PCIe PHY binding Navid Ghahremani
2026-10-15 9:29 ` Krzysztof Kozlowski
2026-10-14 7:20 ` [PATCH v2 11/24] phy: zte: Add ZTE ZX279128S PCIe PHY driver Navid Ghahremani
2026-10-14 7:20 ` [PATCH v2 12/24] dt-bindings: PCI: Add ZTE ZX279128S host controller Navid Ghahremani
2026-10-14 7:20 ` [PATCH v2 13/24] PCI: dwc: Add ZTE ZX279128S host controller driver Navid Ghahremani
2026-10-14 13:19 ` Bjorn Helgaas
2026-10-14 21:06 ` Stefan Dösinger
2026-10-14 7:20 ` [PATCH v2 14/24] dt-bindings: net: Add ZTE ZX279128S MDIO controller Navid Ghahremani
2026-10-14 7:20 ` [PATCH v2 15/24] net: mdio: " Navid Ghahremani
2026-10-14 12:13 ` Andrew Lunn
2026-10-14 7:20 ` [PATCH v2 16/24] net: phy: Add Sanechips ZX5201 PHY support Navid Ghahremani
2026-10-14 12:37 ` Andrew Lunn
2026-10-14 7:20 ` [PATCH v2 17/24] dt-bindings: net: Add ZTE ZX279128S Ethernet switch Navid Ghahremani
2026-10-14 7:20 ` [PATCH v2 18/24] net: ethernet: zte: Add ZX279128S Ethernet switch driver Navid Ghahremani
2026-10-14 7:20 ` [PATCH v2 19/24] dt-bindings: spi: Add ZTE ZX family SPI flash controller binding Navid Ghahremani
2026-10-14 20:33 ` Stefan Dösinger
2026-10-15 9:35 ` Krzysztof Kozlowski
2026-10-15 9:36 ` Krzysztof Kozlowski
2026-10-14 7:21 ` [PATCH v2 20/24] spi: zx: Add ZTE ZX family SPI flash controller driver Navid Ghahremani
2026-10-14 19:28 ` Stefan Dösinger
2026-10-15 9:34 ` Krzysztof Kozlowski
2026-10-15 14:29 ` kernel test robot
2026-10-19 12:15 ` Stefan Dösinger [this message]
2026-10-14 7:21 ` [PATCH v2 21/24] dt-bindings: usb: Add ZTE ZX279128S DWC3 controller Navid Ghahremani
2026-10-14 7:21 ` [PATCH v2 22/24] usb: dwc3: generic-plat: Add ZTE ZX279128S Navid Ghahremani
2026-10-14 7:21 ` [PATCH v2 23/24] ARM: dts: zte: Add ZX279128S SoC description Navid Ghahremani
2026-10-14 7:21 ` [PATCH v2 24/24] ARM: dts: zte: Add ZTE ZXHN H3600 board Navid Ghahremani
2026-10-14 12:52 ` Andrew Lunn
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=jjb8MyAPSXaXqHtedDkkwQ@gmail.com \
--to=stefandoesinger@gmail.com \
--cc=arnd@arndb.de \
--cc=broonie@kernel.org \
--cc=ghahramani.navid@gmail.com \
--cc=krzk@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
/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®