public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Johan Jonker <jbx6244@gmail.com>
To: Chris Morgan <macroalpha82@gmail.com>, linux-mtd@lists.infradead.org
Cc: linux-rockchip@lists.infradead.org, andy.yan@rock-chips.com,
	yifeng.zhao@rock-chips.com, sugar.zhang@rock-chips.com,
	tudor.ambarus@microchip.com, michael@walle.cc, p.yadav@ti.com,
	heiko@sntech.de, robh+dt@kernel.org, vigneshr@ti.com,
	richard@nod.at, miquel.raynal@bootlin.com,
	Chris Morgan <macromorgan@hotmail.com>
Subject: Re: [PATCH v2 2/4] spi: rockchip-sfc: Bindings for Rockchip serial flash controller
Date: Sat, 29 May 2021 10:45:35 +0200	[thread overview]
Message-ID: <d94ddb6c-116d-5119-a731-0b89925505d1@gmail.com> (raw)
In-Reply-To: <20210528170020.26219-3-macroalpha82@gmail.com>

Hi Chris,

Some comments. Have a look if it's useful.

Please try to order patches like:
(1) dt-binding - compatible addition
(2) driver patches
(3) devicetree node patches

On 5/28/21 7:00 PM, Chris Morgan wrote:
> From: Chris Morgan <macromorgan@hotmail.com>
> 
> Add binding document for the Rockchip serial flash controller.

... Serial Flash Controller (SFC)

binding, document is same meaning?

> New device specific parameter of rockchip,sfc-no-dma included in
> documentation.
> 
> Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
> ---
>  .../spi/rockchip,serialflash-controller.yaml  | 107 ++++++++++++++++++
>  1 file changed, 107 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml
> 
> diff --git a/Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml b/Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml
> new file mode 100644
> index 000000000000..eb073130e82a
> --- /dev/null

> +++ b/Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml
> @@ -0,0 +1,107 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/spi/rockchip,serialflash-controller.yaml#

rockchip-sfc.yaml is shorter,
but ask rob+dt or maintainer for correct name.
Documents seem to have the format:

(manufacturer), (SoC type)-(function).yaml

(manufacturer)-(function).yaml


> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +

> +title: Rockchip SoCs Serial FLASH Controller (SFC)

title: Rockchip Serial Flash Controller (SFC)

> +

> +maintainers:

> +  - Andy Yan <andy.yan@rock-chips.com>

This is the original author years ago, but did you ask him to be maintainer?

  - Heiko Stuebner <heiko@sntech.de>

Add someone who can respond in a short period of time and who knows the
hardware in case rob+dt wants to delete something.

> +
> +allOf:
> +  - $ref: spi-controller.yaml#
> +
> +properties:
> +  compatible:

> +    oneOf:
> +      - const: rockchip,px30-sfc
> +      - const: rockchip,rv1108-sfc
> +      - items:
> +        - const: rockchip,sfc

Compatible strings are supposed to be SoC orientated, so no generic ones
here.

"rockchip,sfc" can be found in the manufacturer tree:
px30.dtsi
rk1806.dtsi
rk1808.dtsi
rk3036.dtsi
rk312x.dtsi
rk3308.dtsi
rv1108.dtsi

Choose the first SoC in line with SFC and add that to your driver. All
SoCs with SFC compatible after that use a fallback string.

Example if rk3036 is first in line and has support in mainline:
    oneOf:
      - const: rockchip,rk3036-sfc
      - items:
          - enum:
              - rockchip,px30-sfc
              - rockchip,rk3308-sfc
              - rockchip,rv1108-sfc
          - const: rockchip,rk3036-sfc

Check indent with yamllint program.

> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  clocks:

> +    minItems: 2

Remove.
Already 2 items.

> +    items:
> +      - description: Module Clock
> +      - description: Bus Clock
> +
> +  clock-names:

> +    minItems: 2

Remove.
Already 2 items.

> +    items:

> +      - const: clk-sfc
> +      - const: clk-hsfc

      - const: clk
      - const: hclk

Ask Heiko for exact name.
The driver internal uses:

+	clk_disable_unprepare(sfc->clk);
+	clk_disable_unprepare(sfc->hclk);

> +
> +  power-domains:
> +    maxItems: 1
> +
> +  rockchip,sfc-no-dma:

===
  vendor,bool-property:
    description: Vendor specific properties must have a description. Boolean
      properties are one case where the json-schema 'type' keyword can
be used
      directly.
    type: boolean
===

> +    - descrption: Boolean value for disabling DMA

description:

without "-"

> +

> +patternProperties:

> +  "^spi-nor@[0-3]$":

  "^flash@[0-3]$":
Maybe restrict further to flash only?

> +    type: object
> +    properties:

> +
> +      compatible:
> +        oneOf:
> +          - const: jedec,spi-nor

Remove, use $ref to jedec,spi-nor.yaml.

===
      patternProperties:
        "^flash@[0-3]$":
          type: object

          $ref: "/schemas/mtd/jedec,spi-nor.yaml#"

          properties:
            reg:
              minimum: 0
              maximum: 3

          unevaluatedProperties: false
===

Could you try/test above example?

> +      reg:
> +        minimum: 0
> +        maximum: 3

This is a further restriction.
#define SFC_MAX_CHIPSELECT_NUM		4

> +
> +      spi-max-frequency:
> +        maxItems: 1
> +	  - description: Maximum frequency for SPI Flash

> +
> +      spi-rx-bus-width:
> +        maxItems: 1
> +          - description: RX Bus Width (1x, 2x, or 4x mode)
> +
> +      spi-tx-bus-width:
> +        maxItems: 1
> +          - description: TX Bus Width (1x, 2x, or 4x mode)

Already in spi-controller.yaml if nothing changed.

> +
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +  - clocks
> +  - clock-names
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/clock/px30-cru.h>
> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> +

> +sfc: spi@ff3a0000 {

Recheck example indent.

> +	compatible = "rockchip,px30-sfc","rockchip,sfc";

	compatible = "rockchip,px30-sfc", "rockchip,rk3036-sfc";

See comment above.

> +	reg = <0x0 0xff3a0000 0x0 0x4000>;
> +	interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>;
> +	clocks = <&cru SCLK_SFC>, <&cru HCLK_SFC>;
> +	clock-names = "sfc", "hsfc";

clock-names = "clk", "hclk";

> +	pinctrl-0 = <&sfc_clk &sfc_cs &sfc_bus2>;

	pinctrl-names = "default";

sort

> +	power-domains = <&power PX30_PD_MMC_NAND>;

	#address-cells = <1>;
	#size-cells = <0>;

Things with "#" below in the list.

> +

> +	nor_flash: spi-nor@0 {

	nor_flash: flash@0 {

> +		reg = <0>;

> +		compatible = "xtx,xt25f128b","jedec,spi-nor";

		compatible = "jedec,spi-nor";

> +		spi-rx-bus-width = <2>;
> +		spi-tx-bus-width = <2>;
> +		spi-max-frequency = <108000000>;

sort

> +	};
> +};
> +
> +...
> 

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  parent reply	other threads:[~2021-05-29  8:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-28 17:00 [PATCH v2 0/4] Add Rockchip SFC(serial flash controller) support Chris Morgan
2021-05-28 17:00 ` [PATCH v2 1/4] spi: rockchip-sfc: add rockchip serial flash controller driver Chris Morgan
2021-05-28 17:00 ` [PATCH v2 2/4] spi: rockchip-sfc: Bindings for Rockchip serial flash controller Chris Morgan
2021-05-28 18:48   ` Michael Walle
2021-05-28 20:01     ` Chris Morgan
2021-05-29  8:45   ` Johan Jonker [this message]
2021-05-31 17:18     ` Chris Morgan
2021-06-01  8:30       ` Heiko Stübner
2021-05-28 17:00 ` [PATCH v2 3/4] arm64: dts: rockchip: Add SFC to PX30 Chris Morgan
2021-05-28 17:00 ` [PATCH v2 4/4] arm64: dts: rockchip: Enable SFC for Odroid Go Advance Chris Morgan
2021-05-31 18:24   ` Pratyush Yadav
2021-05-28 18:49 ` [PATCH v2 0/4] Add Rockchip SFC(serial flash controller) support Michael Walle
2021-05-28 20:03   ` Chris Morgan

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=d94ddb6c-116d-5119-a731-0b89925505d1@gmail.com \
    --to=jbx6244@gmail.com \
    --cc=andy.yan@rock-chips.com \
    --cc=heiko@sntech.de \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=macroalpha82@gmail.com \
    --cc=macromorgan@hotmail.com \
    --cc=michael@walle.cc \
    --cc=miquel.raynal@bootlin.com \
    --cc=p.yadav@ti.com \
    --cc=richard@nod.at \
    --cc=robh+dt@kernel.org \
    --cc=sugar.zhang@rock-chips.com \
    --cc=tudor.ambarus@microchip.com \
    --cc=vigneshr@ti.com \
    --cc=yifeng.zhao@rock-chips.com \
    /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