mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Stefan Dösinger" <stefandoesinger@gmail.com>
To: linux-arm-kernel@lists.infradead.org,
	Navid Ghahremani <ghahramani.navid@gmail.com>
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	arnd@arndb.de, linux@armlinux.org.uk, robh@kernel.org,
	krzk@kernel.org, Navid Ghahremani <ghahramani.navid@gmail.com>
Subject: Re: [PATCH 06/24] dt-bindings: clock: Add ZTE ZX279128S CRM clocks and resets
Date: Sun, 11 Oct 2026 11:13:37 +0200	[thread overview]
Message-ID: <7axmtiEnS5SDBrUzy6e6jw@gmail.com> (raw)
In-Reply-To: <20261010130024.177503-7-ghahramani.navid@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4431 bytes --]

Hi Navid,

I don't have enough knowledge about about PCIe and the A9 l2cache to comment 
on the previous patches. For the clock ones I have a few points of hardware 
investigation and the actual implementation.

Am Samstag, 10. Oktober 2026, 14:59:44 Mitteleuropäische Sommerzeit schrieb 
Navid Ghahremani:

> +properties:
> +  compatible:
> +    oneOf:
> +      - items:
> +          - const: zte,zx279128s-topcrm
> +          - const: syscon
> +      - enum:
> +          - zte,zx279128s-lsp0crpm
> +          - zte,zx279128s-lsp1crpm

The advice I got for my zx297520v3 bindings was to write a separate binding 
for the clock controllers rather than try to write a one-size-fits-all one. So 
you'd have a zte,zx279128s-topcrm.yaml that has compatible zte,zx279128s-
topcrm, syscon and a separate lspcrpm.yaml (or maybe even one lsp0crpm and one 
lsp1crpm) that take the other compatible

> +  reg:
> +    maxItems: 1
> +
> +  clocks:
> +    minItems: 1
> +    maxItems: 5
> +
> +  clock-names:
> +    minItems: 1
> +    maxItems: 5

If you split the bindings the clocks becomes a fixed list in each, simplifying 
the if-then-that rules you have later.
 
> +required:
> +  - compatible
> +  - reg
> +  - clocks
> +  - clock-names
> +  - '#clock-cells'

Your topcrm should have the reboot node as a child. syscon-reboot's "regmap" 
property is deprecated and shouldn't be used for new bindings.

This will either mean adding the simple-mfd compatible to auto-probe the 
reboot child or writing a MFD driver that does that. Since you also have clock 
and reset functionality in there the MFD approach seems best, and it is what I 
ended up doing for my CRM controllers.

> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: zte,zx279128s-lsp0crpm
> +    then:
> +      properties:
> +        '#reset-cells': false

Are you sure there are no resets in lsp0crpm? Given what I know from my zx29 
board, it is likely that there *are* resets, but the ZTE kernel doesn't bother 
asserting/deasserting them and they come deasserted by the time U-Boot takes 
over. (So either they are deasserted after powerup or the boot rom deasserts 
them.

The way I discovered the rest controls on my board: I set all the registers in 
the LSP controller to 0 via a hack in arch/arm/kernel/head.S and looked at 
what broke. It turned out that there are some bits that need to be set to 1 
for the device to work that aren't mentioned at all in ZTE's code dump.

The follow-up check was to see what the impact of those bits was: Setting a 
pclk gate to 0 usually causes the mmio registers to read 0, 0xff, garbage or 
just hang (busybox's devmem is your friend). A reset bit, when asserted (set 
to 0) does the same. The difference is that when you re-enable a clock, the 
registers retain their old contents, whereas after deasserting a reset, the 
device lost previous state.

Since most devices have 2 reset bits YMMV. One of them might not do anything 
at all. Or one resets bus access properties while the other resets working 
state.

> +++ b/include/dt-bindings/clock/zte,zx279128s-crm.h
> @@ -0,0 +1,55 @@
> +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
> +/*
> + * Copyright (C) 2026 Navid Ghahremani <ghahramani.navid@gmail.com>
> + */
> +
> +#ifndef _DT_BINDINGS_CLOCK_ZTE_ZX279128S_CRM_H
> +#define _DT_BINDINGS_CLOCK_ZTE_ZX279128S_CRM_H
...
> + * Top CRM resets: (register offset / 4) * 32 + bit. The USB 3.0 controller
> + * has four in register 0x4c; what each one resets isn't known.
> + */
> +#define ZX279128S_TOP_RST_USB_B9	617
> +#define ZX279128S_TOP_RST_USB_B10	618
> +#define ZX279128S_TOP_RST_USB_B11	619
> +#define ZX279128S_TOP_RST_USB_B14	622

Please put the resets in their own reset header.

Using hardware locations (offset, bits) for the binding values is discouraged 
as far as I understand it. I saw a comment by Krzk on a different binding patch 
stating that. I'll try to find it.

It is better to give them logical values (0, 1, 2, ...) and have the reset 
driver map them to the actual hardware location. This also helps if you find 
out that you got a reset bit wrong. Since the bindings are considered ABI, 
changing them later is tricky - you don't want to have to do it because you 
identified a reset incorrectly.

Cheers,
Stefan

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 870 bytes --]

  reply	other threads:[~2026-10-11  9:13 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-10 12:59 [PATCH RFC 00/24] ARM: zte: Add support for Sanechips ZX279128S and ZTE ZXHN H3600 Navid Ghahremani
2026-10-10 12:59 ` [PATCH 01/24] dt-bindings: cache: l2c2x0: Describe ZTE device-read serialization Navid Ghahremani
2026-10-10 12:59 ` [PATCH 02/24] ARM: l2c: Serialize device reads with cache maintenance when requested Navid Ghahremani
2026-10-10 14:28   ` Arnd Bergmann
2026-10-10 21:41     ` Navid Ghahremani
2026-10-11  1:02     ` Navid Ghahremani
2026-10-10 12:59 ` [PATCH 03/24] wifi: mt76: Serialize MMIO reads with outer cache maintenance Navid Ghahremani
2026-10-10 12:59 ` [PATCH 04/24] dt-bindings: arm: Add ZTE ZX279128S platform descriptions Navid Ghahremani
2026-10-10 12:59 ` [PATCH 05/24] ARM: zte: Add ZX279128S platform and CPU hotplug support Navid Ghahremani
2026-10-10 14:13   ` Arnd Bergmann
2026-10-10 17:34     ` Stefan Dösinger
2026-10-10 21:26       ` Navid Ghahremani
2026-10-10 12:59 ` [PATCH 06/24] dt-bindings: clock: Add ZTE ZX279128S CRM clocks and resets Navid Ghahremani
2026-10-11  9:13   ` Stefan Dösinger [this message]
2026-10-10 12:59 ` [PATCH 07/24] clk: zte: Add ZX279128S CRM clock and reset driver Navid Ghahremani
2026-10-10 12:59 ` [PATCH 08/24] dt-bindings: gpio: Add ZTE ZX279128S GPIO controller Navid Ghahremani
2026-10-10 12:59 ` [PATCH 09/24] gpio: Add ZTE ZX279128S GPIO driver Navid Ghahremani
2026-10-10 12:59 ` [PATCH 10/24] dt-bindings: pinctrl: pinctrl-single: Add ZTE ZX279128S pin mux Navid Ghahremani
2026-10-10 12:59 ` [PATCH 11/24] dt-bindings: mfd: syscon: Add ZX279128S system controller Navid Ghahremani
2026-10-10 12:59 ` [PATCH 12/24] dt-bindings: PCI: Add ZTE ZX279128S host controller Navid Ghahremani
2026-10-10 12:59 ` [PATCH 13/24] PCI: dwc: Add ZTE ZX279128S host controller driver Navid Ghahremani
2026-10-10 12:59 ` [PATCH 14/24] dt-bindings: net: Add ZTE ZX279128S MDIO controller Navid Ghahremani
2026-10-10 12:59 ` [PATCH 15/24] net: mdio: " Navid Ghahremani
2026-10-10 12:59 ` [PATCH 16/24] net: phy: Add Sanechips ZX5201 PHY support Navid Ghahremani
2026-10-10 12:59 ` [PATCH 17/24] dt-bindings: net: Add ZTE ZX279128S Ethernet switch Navid Ghahremani
2026-10-10 12:59 ` [PATCH 18/24] net: ethernet: zte: Add ZX279128S Ethernet switch driver Navid Ghahremani
2026-10-10 12:59 ` [PATCH 19/24] dt-bindings: spi: Add ZTE ZX279128S SPI flash controller Navid Ghahremani
2026-10-10 12:59 ` [PATCH 20/24] " Navid Ghahremani
2026-10-10 12:59 ` [PATCH 21/24] dt-bindings: usb: Add ZTE ZX279128S DWC3 controller Navid Ghahremani
2026-10-10 13:00 ` [PATCH 22/24] usb: dwc3: generic-plat: Add ZTE ZX279128S Navid Ghahremani
2026-10-10 13:00 ` [PATCH 23/24] ARM: dts: zte: Add ZX279128S SoC description Navid Ghahremani
2026-10-10 13:00 ` [PATCH 24/24] ARM: dts: zte: Add ZTE ZXHN H3600 board Navid Ghahremani

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=7axmtiEnS5SDBrUzy6e6jw@gmail.com \
    --to=stefandoesinger@gmail.com \
    --cc=arnd@arndb.de \
    --cc=devicetree@vger.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@armlinux.org.uk \
    --cc=robh@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 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®