Skip to contentSkip to conversation

mmc: Add LiteSDCard mmc driver

PATCH Superseded Gabriel Somlo 4 participants 9 messages Dec 8, 2021 – Dec 25, 2021

Subsystems (4)

v3 of 14 Superseded Latest is v14 →

lore
Share & tools
lore
#0 lore raw

v3 cover mmc: Add LiteSDCard mmc driver

Add support for the LiteX SD-Card device, LiteSDCard.

LiteSDCard is a simple SD-Card interface available as part of the LiteX environment, used with various RISC-V and other FPGA based SoCs.

New in v3:

MAINTAINERS:

- picked up acked-by Joel
- added listing for liteeth driver
- added Joel as additional co-maintainer (thanks!)

Doc/dt/bindings/mmc/litex,mmc.yaml:

- picked up r/b Geert Uytterhoeven <[email protected]> in DT bindings document (please let me know if that was premature, and happy to take further review if needed :)
- add dedicated DT property for source clock frequency

drivers/mmc/host/litex_mmc.c:

- fixed function signature (no line split), and naming (litex_mmc_*)
- more informative MODULE_AUTHOR() entries
- also added matching "Copyright" entries in file header
- fixed description in Kconfig
- fixed DT documentation
- removed magic constants
- removed litex_map_status(), have sdcard_wait_done() return *real* error codes directly instead.
- streamlined litex_mmc_reponse_len()
- call litex_mmc_set_bus_width() only once, and ensure it returns correct error code(s)
- use readx_poll_timeout() -- more concise -- instead of read_poll_timeout()
- use dev_err() in litex_mmc_send_cmd() (instead of pr_err())
- litex_mmc_setclk() will update host->clock before returning
- separate irq initialization into its own function, litex_mmc_irq_init()
- document rationale for f_min, f_max
- use dmam_alloc_coherent(), which simplifies cleanup significantly
- large if (data) { ... } block in litex_mmc_request() left as-is, there are too many variables shared with the rest of the parent function body to easily separate (e.g., len, transfer, direct). If this is indeed a blocker, I can take another shot at refactoring it in a future revision!
- bump dma_set_mask_and_coherent() to 64-bits on suitable architectures
- clock source picked up from dedicated DT clock reference property
- remove gpio card-detect logic (needs testing and a dt binding example before being eligible for upstream inclusion)

Quoted 9 lines

New in v2:
- reword info message in litex_set_clk()
- streamline code in litex_map_status()
- fix typos in Kconfig (thanks Randy Dunlap <[email protected]>)
- improvements suggested by Stafford Horne <[email protected]>
- allow COMPILE_TEST in Kconfig
- use read_poll_timeout() when waiting for cmd/data/DMA xfer completion
- include interrupt.h (thanks kernel test robot <[email protected]>)

Gabriel Somlo (3):
MAINTAINERS: co-maintain LiteX platform
dt-bindings: mmc: Add bindings for LiteSDCard
mmc: Add driver for LiteX's LiteSDCard interface

 .../devicetree/bindings/mmc/litex,mmc.yaml    |  72 ++
 MAINTAINERS                                   |   9 +-
 drivers/mmc/host/Kconfig                      |   9 +
 drivers/mmc/host/Makefile                     |   1 +
 drivers/mmc/host/litex_mmc.c                  | 644 ++++++++++++++++++
 5 files changed, 733 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mmc/litex,mmc.yaml
 create mode 100644 drivers/mmc/host/litex_mmc.c
Signature · 1 line
2.31.1
#1 lore raw

PATCH v3 1/3 MAINTAINERS: co-maintain LiteX platform

Add the litex_mmc (LiteSDCard) and LiteETH drivers to the list of files maintained under LiteX.

Add Gabriel Somlo and Joel Stanley as maintainers; Joel authored the LiteETH driver, and Gabriel is currently curating the LiteX out-of-tree device drivers as they are tested and prepared for upstream submission, having also co-authored a number of them.

---

New in v3:
- picked up acked-by Joel
- added listing for liteeth driver
- added Joel as additional co-maintainer (thanks!)

 MAINTAINERS | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
MAINTAINERS +7 -2
index 43007f2d29e0..477d993f70df 100644
@@ -11012,12 +11012,17 @@ F:	lib/list-test.c
 LITEX PLATFORM
 M:	Karol Gugala <[email protected]>
 M:	Mateusz Holenko <[email protected]>
+M:	Gabriel Somlo <[email protected]>
+M:	Joel Stanley <[email protected]>
 S:	Maintained
 F:	Documentation/devicetree/bindings/*/litex,*.yaml
 F:	arch/openrisc/boot/dts/or1klitex.dts
-F:	drivers/soc/litex/litex_soc_ctrl.c
-F:	drivers/tty/serial/liteuart.c
 F:	include/linux/litex.h
+F:	drivers/tty/serial/liteuart.c
+F:	drivers/soc/litex/*
+F:	drivers/net/ethernet/litex/*
+F:	drivers/mmc/host/litex_mmc.c
+N:	litex
 
 LIVE PATCHING
 M:	Josh Poimboeuf <[email protected]>
Signature · 1 line
2.31.1
#2 lore raw

PATCH v3 2/3 dt-bindings: mmc: Add bindings for LiteSDCard

In reply to Gabriel Somlo

LiteSDCard is a small footprint, configurable SDCard core for FPGA based system on chips.

---

New in v3:
- picked up r/b Geert Uytterhoeven <[email protected]> in DT bindings document (please let me know if that was premature, and happy to take further review if needed :)
- add dedicated DT property for source clock frequency

 .../devicetree/bindings/mmc/litex,mmc.yaml    | 72 +++++++++++++++++++
 1 file changed, 72 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/litex,mmc.yaml
Documentation/devicetree/bindings/mmc/litex,mmc.yaml new file +72 -0
new file mode 100644
index 000000000000..9b8d4ec30375
@@ -0,0 +1,72 @@
+# SPDX-License-Identifier: GPL-2.0-or-later OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mmc/litex,mmc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: LiteX LiteSDCard device
+
+maintainers:
+  - Gabriel Somlo <[email protected]>
+
+description: |
+  LiteSDCard is a small footprint, configurable SDCard core for FPGA based
+  system on chips.
+
+  The hardware source is Open Source and can be found on at
+  https://github.com/enjoy-digital/litesdcard/.
+
+allOf:
+  - $ref: mmc-controller.yaml#
+
+properties:
+  compatible:
+    const: litex,mmc
+
+  reg:
+    items:
+      - description: PHY registers
+      - description: CORE registers
+      - description: DMA Reader buffer
+      - description: DMA Writer buffer
+      - description: IRQ registers (optional)
+    minItems: 4
+    maxItems: 5
+
+  reg-names:
+    items:
+      - const: phy
+      - const: core
+      - const: reader
+      - const: writer
+      - const: irq (optional)
+    minItems: 4
+    maxItems: 5
+
+  clocks:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - clocks
+
+additionalProperties: false
+
+examples:
+  - |
+    mmc: mmc@12005000 {
+        compatible = "litex,mmc";
+        reg = <0x12005000 0x100>,
+              <0x12003800 0x100>,
+              <0x12003000 0x100>,
+              <0x12004800 0x100>,
+              <0x12004000 0x100>;
+        reg-names = "phy", "core", "reader", "writer", "irq";
+        clocks = <&reference_clk>;
+        interrupts = <4>;
+    };
Signature · 1 line
2.31.1
#7 lore raw

PATCH v3 3/3 mmc: Add driver for LiteX's LiteSDCard interface

In reply to Gabriel Somlo

LiteX (https://github.com/enjoy-digital/litex) is a SoC framework that targets FPGAs. LiteSDCard is a small footprint, configurable SDCard core commonly used in LiteX designs.

The driver was first written in May 2020 and has been maintained cooperatively by the LiteX community. Thanks to all contributors!

Cc Mateusz Holenko <[email protected]>
Cc Karol Gugala <[email protected]>
Cc Joel Stanley <[email protected]>
Cc Stafford Horne <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc David Abdurachmanov <[email protected]>
Cc Florent Kermarrec <[email protected]>

---

New in v3:
- fixed function signature (no line split), and naming (litex_mmc_*)
- more informative MODULE_AUTHOR() entries
- also added matching "Copyright" entries in file header
- fixed description and dependencies in Kconfig
- removed magic constants
- removed litex_map_status(), have sdcard_wait_done() return *real* error codes directly instead.
- streamlined litex_mmc_reponse_len()
- call litex_mmc_set_bus_width() only once, and ensure it returns correct error code(s)
- use readx_poll_timeout() -- more concise -- instead of read_poll_timeout()
- use dev_err() in litex_mmc_send_cmd() (instead of pr_err())
- litex_mmc_setclk() will update host->clock before returning
- separate irq initialization into its own function, litex_mmc_irq_init()
- document rationale for f_min, f_max
- use dmam_alloc_coherent(), which simplifies cleanup significantly
- bump dma_set_mask_and_coherent() to 64-bits on suitable architectures
- clock source picked up from dedicated DT clock reference property
- remove gpio card-detect logic (needs testing and a dt binding example before being eligible for upstream inclusion)
- large if (data) { ... } block in litex_mmc_request() left as-is, there are too many variables shared with the rest of the parent function body to easily separate (e.g., len, transfer, direct). If this is indeed a blocker, I can take another shot at refactoring it in a future revision!

 drivers/mmc/host/Kconfig     |   9 +
 drivers/mmc/host/Makefile    |   1 +
 drivers/mmc/host/litex_mmc.c | 644 +++++++++++++++++++++++++++++++++++
 3 files changed, 654 insertions(+)
 create mode 100644 drivers/mmc/host/litex_mmc.c
drivers/mmc/host/Kconfig +9 -0
index 5af8494c31b5..c1b66d06d1c9 100644
@@ -1093,3 +1093,12 @@ config MMC_OWL
 
 config MMC_SDHCI_EXTERNAL_DMA
 	bool
+
+config MMC_LITEX
+	tristate "LiteX MMC Host Controller support"
+	depends on OF
+	depends on PPC_MICROWATT || LITEX || COMPILE_TEST
+	help
+	  This selects support for the MMC Host Controller found in LiteX SoCs.
+
+	  If unsure, say N.
drivers/mmc/host/Makefile +1 -0
index ea36d379bd3c..4e4ceb32c4b4 100644
@@ -101,6 +101,7 @@ obj-$(CONFIG_MMC_CQHCI)			+= cqhci.o
 cqhci-y					+= cqhci-core.o
 cqhci-$(CONFIG_MMC_CRYPTO)		+= cqhci-crypto.o
 obj-$(CONFIG_MMC_HSQ)			+= mmc_hsq.o
+obj-$(CONFIG_MMC_LITEX)			+= litex_mmc.o
 
 ifeq ($(CONFIG_CB710_DEBUG),y)
 	CFLAGS-cb710-mmc	+= -DDEBUG
drivers/mmc/host/litex_mmc.c new file +644 -0

644 lines not on this page · raw message

Signature · 1 line
2.31.1
maintainer
#3 lore raw

Re: [PATCH v3 2/3] dt-bindings: mmc: Add bindings for LiteSDCard

In reply to Gabriel Somlo
Quoted 13 lines · Gabriel Somlo

LiteSDCard is a small footprint, configurable SDCard core for FPGA based system on chips.

---

New in v3:
- picked up r/b Geert Uytterhoeven <[email protected]> in DT bindings document (please let me know if that was premature, and happy to take further review if needed :)
- add dedicated DT property for source clock frequency

Quoted 4 lines
 .../devicetree/bindings/mmc/litex,mmc.yaml    | 72 +++++++++++++++++++
 1 file changed, 72 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/litex,mmc.yaml

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/mmc/litex,mmc.yaml: properties:reg-names:items: 'oneOf' conditional failed, one must be fixed:

	[{'const': 'phy'}, {'const': 'core'}, {'const': 'reader'}, {'const': 'writer'}, {'const': 'irq (optional)'}] is not of type 'object'
	'irq (optional)' does not match '^[a-zA-Z0-9,.\\-_ #+/]+$'
	from schema $id: http://devicetree.org/meta-schemas/string-array.yaml#

/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/mmc/litex,mmc.yaml: properties:reg: {'items': [{'description': 'PHY registers'}, {'description': 'CORE registers'}, {'description': 'DMA Reader buffer'}, {'description': 'DMA Writer buffer'}, {'description': 'IRQ registers (optional)'}], 'minItems': 4, 'maxItems': 5} should not be valid under {'required': ['maxItems']}
hint: "maxItems" is not needed with an "items" list
from schema $id: http://devicetree.org/meta-schemas/items.yaml#
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/mmc/litex,mmc.yaml: properties:reg-names: {'items': [{'const': 'phy'}, {'const': 'core'}, {'const': 'reader'}, {'const': 'writer'}, {'const': 'irq (optional)'}], 'minItems': 4, 'maxItems': 5} should not be valid under {'required': ['maxItems']}
hint: "maxItems" is not needed with an "items" list
from schema $id: http://devicetree.org/meta-schemas/items.yaml#
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/mmc/litex,mmc.yaml: ignoring, error in schema: properties: reg-names: items
warning: no schema found in file: ./Documentation/devicetree/bindings/mmc/litex,mmc.yaml
Documentation/devicetree/bindings/mmc/litex,mmc.example.dt.yaml:0:0: /example-0/mmc@12005000: failed to match any schema with compatible: ['litex,mmc']

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/1565210

This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit.

#4 lore raw

Re: [PATCH v3 2/3] dt-bindings: mmc: Add bindings for LiteSDCard

Quoted 47 lines · Rob Herring
Quoted 13 lines · Gabriel Somlo

LiteSDCard is a small footprint, configurable SDCard core for FPGA based system on chips.

---

New in v3:
- picked up r/b Geert Uytterhoeven <[email protected]> in DT bindings document (please let me know if that was premature, and happy to take further review if needed :)
- add dedicated DT property for source clock frequency

Quoted 4 lines
 .../devicetree/bindings/mmc/litex,mmc.yaml    | 72 +++++++++++++++++++
 1 file changed, 72 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/litex,mmc.yaml

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/mmc/litex,mmc.yaml: properties:reg-names:items: 'oneOf' conditional failed, one must be fixed:

	[{'const': 'phy'}, {'const': 'core'}, {'const': 'reader'}, {'const': 'writer'}, {'const': 'irq (optional)'}] is not of type 'object'
	'irq (optional)' does not match '^[a-zA-Z0-9,.\\-_ #+/]+$'
	from schema $id: http://devicetree.org/meta-schemas/string-array.yaml#

/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/mmc/litex,mmc.yaml: properties:reg: {'items': [{'description': 'PHY registers'}, {'description': 'CORE registers'}, {'description': 'DMA Reader buffer'}, {'description': 'DMA Writer buffer'}, {'description': 'IRQ registers (optional)'}], 'minItems': 4, 'maxItems': 5} should not be valid under {'required': ['maxItems']}
hint: "maxItems" is not needed with an "items" list
from schema $id: http://devicetree.org/meta-schemas/items.yaml#
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/mmc/litex,mmc.yaml: properties:reg-names: {'items': [{'const': 'phy'}, {'const': 'core'}, {'const': 'reader'}, {'const': 'writer'}, {'const': 'irq (optional)'}], 'minItems': 4, 'maxItems': 5} should not be valid under {'required': ['maxItems']}
hint: "maxItems" is not needed with an "items" list
from schema $id: http://devicetree.org/meta-schemas/items.yaml#
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/mmc/litex,mmc.yaml: ignoring, error in schema: properties: reg-names: items
warning: no schema found in file: ./Documentation/devicetree/bindings/mmc/litex,mmc.yaml
Documentation/devicetree/bindings/mmc/litex,mmc.example.dt.yaml:0:0: /example-0/mmc@12005000: failed to match any schema with compatible: ['litex,mmc']

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/1565210

This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.

Quoted 8 lines

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit.

Thanks!

I made the following changes:

Documentation/devicetree/bindings/mmc/litex,mmc.yaml +4 -4
@@ -29,9 +29,8 @@ properties:
       - description: CORE registers
       - description: DMA Reader buffer
       - description: DMA Writer buffer
-      - description: IRQ registers (optional)
+      - description: IRQ registers
     minItems: 4
-    maxItems: 5
 
   reg-names:
     items:
@@ -39,12 +38,13 @@ properties:
       - const: core
       - const: reader
       - const: writer
-      - const: irq (optional)
+      - const: irq
     minItems: 4
-    maxItems: 5
 
   clocks:
     maxItems: 1
+    description:
+      Handle to reference clock.
 
   interrupts:
     maxItems: 1

... which took care of the bulk of the error messages reported. However, I'm still getting the one below, whether or not I leave the maxItems 1 line there under clocks:

$ make ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu-  dt_binding_check
  LINT    Documentation/devicetree/bindings
  CHKDT   Documentation/devicetree/bindings/processed-schema-examples.json
/home/somlo/linux/Documentation/devicetree/bindings/clock/litex,clock.yaml: properties:clock-output-names: {'description': 'List of strings of clock output signal names indexed by the first cell in the clock specifier.', 'minItems': 1, 'maxItems': 7, 'items': [{'const': 'CLKOUT0'}, {'const': 'CLKOUT1'}, {'const': 'CLKOUT2'}, {'const': 'CLKOUT3'}, {'const': 'CLKOUT4'}, {'const': 'CLKOUT5'}, {'const': 'CLKOUT6'}]} should not be valid under {'required': ['maxItems']}
	hint: "maxItems" is not needed with an "items" list
	from schema $id: http://devicetree.org/meta-schemas/items.yaml#
  SCHEMA  Documentation/devicetree/bindings/processed-schema-examples.json
/home/somlo/linux/Documentation/devicetree/bindings/clock/litex,clock.yaml: ignoring, error in schema: properties: clock-output-names
warning: no schema found in file: ./Documentation/devicetree/bindings/clock/litex,clock.yaml
  DTEX    Documentation/devicetree/bindings/mmc/litex,mmc.example.dts
  DTEX    Documentation/devicetree/bindings/media/renesas,imr.example.dts
  ...

It appears as though make dt_binding_check is trying to read from Documentation/devicetree/bindings/clock/litex,clock.yaml, which does not exist. The clock reference I'm talking about could be *any* clock elsewhere in the dts!

This wasn't part of the originally reported errors, not sure why I'm seeing it now. Also, not sure what (if anything) I still need to do about it, any advice much appreciated!

Thanks,
--Gabriel

#5 lore raw

Re: [PATCH v3 2/3] dt-bindings: mmc: Add bindings for LiteSDCard

Hi Gabriel,

Quoted 4 lines · Gabriel L. Somlo

... which took care of the bulk of the error messages reported. However, I'm still getting the one below, whether or not I leave the maxItems 1 line there under clocks:

Quoted 12 lines
$ make ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu-  dt_binding_check
  LINT    Documentation/devicetree/bindings
  CHKDT   Documentation/devicetree/bindings/processed-schema-examples.json
/home/somlo/linux/Documentation/devicetree/bindings/clock/litex,clock.yaml: properties:clock-output-names: {'description': 'List of strings of clock output signal names indexed by the first cell in the clock specifier.', 'minItems': 1, 'maxItems': 7, 'items': [{'const': 'CLKOUT0'}, {'const': 'CLKOUT1'}, {'const': 'CLKOUT2'}, {'const': 'CLKOUT3'}, {'const': 'CLKOUT4'}, {'const': 'CLKOUT5'}, {'const': 'CLKOUT6'}]} should not be valid under {'required': ['maxItems']}
        hint: "maxItems" is not needed with an "items" list
        from schema $id: http://devicetree.org/meta-schemas/items.yaml#
  SCHEMA  Documentation/devicetree/bindings/processed-schema-examples.json
/home/somlo/linux/Documentation/devicetree/bindings/clock/litex,clock.yaml: ignoring, error in schema: properties: clock-output-names
warning: no schema found in file: ./Documentation/devicetree/bindings/clock/litex,clock.yaml
  DTEX    Documentation/devicetree/bindings/mmc/litex,mmc.example.dts
  DTEX    Documentation/devicetree/bindings/media/renesas,imr.example.dts
  ...
Documentation/devicetree/bindings/clock/litex,clock.yaml +0 -1
@@ -45,7 +45,6 @@ properties:
       List of strings of clock output signal names indexed
       by the first cell in the clock specifier.
     minItems: 1
-    maxItems: 7
     items:
       - const: CLKOUT0
       - const: CLKOUT1

I have that in my local tree, but hadn't sent it to you yet, because litex,clock definitely need more work.

Quoted 3 lines

It appears as though make dt_binding_check is trying to read from Documentation/devicetree/bindings/clock/litex,clock.yaml, which does not exist. The clock reference I'm talking about could be *any*

Oh, it does exist in your tree ;-)
To check the examples, it has to apply all other binding files that might apply, hence some checks are always run.

You can avoid some (but not all) such checks by adding

DT_SCHEMA_FILES=Documentation/devicetree/bindings/path/to/binding.yaml

Quoted 5 lines

clock elsewhere in the dts!

This wasn't part of the originally reported errors, not sure why I'm seeing it now. Also, not sure what (if anything) I still need to do about it, any advice much appreciated!

Of course, as Rob doesn't have that file in his tree.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#6 lore raw

Re: [PATCH v3 2/3] dt-bindings: mmc: Add bindings for LiteSDCard

Quoted 46 lines · Geert Uytterhoeven

Hi Gabriel,

Quoted 16 lines · Gabriel L. Somlo

... which took care of the bulk of the error messages reported. However, I'm still getting the one below, whether or not I leave the maxItems 1 line there under clocks:

$ make ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu-  dt_binding_check
  LINT    Documentation/devicetree/bindings
  CHKDT   Documentation/devicetree/bindings/processed-schema-examples.json
/home/somlo/linux/Documentation/devicetree/bindings/clock/litex,clock.yaml: properties:clock-output-names: {'description': 'List of strings of clock output signal names indexed by the first cell in the clock specifier.', 'minItems': 1, 'maxItems': 7, 'items': [{'const': 'CLKOUT0'}, {'const': 'CLKOUT1'}, {'const': 'CLKOUT2'}, {'const': 'CLKOUT3'}, {'const': 'CLKOUT4'}, {'const': 'CLKOUT5'}, {'const': 'CLKOUT6'}]} should not be valid under {'required': ['maxItems']}
        hint: "maxItems" is not needed with an "items" list
        from schema $id: http://devicetree.org/meta-schemas/items.yaml#
  SCHEMA  Documentation/devicetree/bindings/processed-schema-examples.json
/home/somlo/linux/Documentation/devicetree/bindings/clock/litex,clock.yaml: ignoring, error in schema: properties: clock-output-names
warning: no schema found in file: ./Documentation/devicetree/bindings/clock/litex,clock.yaml
  DTEX    Documentation/devicetree/bindings/mmc/litex,mmc.example.dts
  DTEX    Documentation/devicetree/bindings/media/renesas,imr.example.dts
  ...
Documentation/devicetree/bindings/clock/litex,clock.yaml +0 -1
@@ -45,7 +45,6 @@ properties:
       List of strings of clock output signal names indexed
       by the first cell in the clock specifier.
     minItems: 1
-    maxItems: 7
     items:
       - const: CLKOUT0
       - const: CLKOUT1

I have that in my local tree, but hadn't sent it to you yet, because litex,clock definitely need more work.

Quoted 3 lines

It appears as though make dt_binding_check is trying to read from Documentation/devicetree/bindings/clock/litex,clock.yaml, which does not exist. The clock reference I'm talking about could be *any*

Oh, it does exist in your tree ;-)
To check the examples, it has to apply all other binding files that might apply, hence some checks are always run.

You can avoid some (but not all) such checks by adding

DT_SCHEMA_FILES=Documentation/devicetree/bindings/path/to/binding.yaml

Quoted 7 lines
Quoted 5 lines

clock elsewhere in the dts!

This wasn't part of the originally reported errors, not sure why I'm seeing it now. Also, not sure what (if anything) I still need to do about it, any advice much appreciated!

Of course, as Rob doesn't have that file in his tree.

Oh, I'm working on the litex-rebase branch, which does have the litex,clock file. Running the check on the Linus master with litex_mmc v4 on top now passes the check without any errors or warnings. I'll incorporate the fixes pointed out by Rob when I publish v4.

Sorry for the misunderstanding, thanks Geert for pointing out the source of my confusion -- I think all's well now on the dt-bindings front w.r.t. litex_mmc... :)

Cheers,
--Gabriel

#8 lore raw

Re: [PATCH v3 3/3] mmc: Add driver for LiteX's LiteSDCard interface

In reply to Gabriel Somlo
Quoted 4 lines · Gabriel Somlo

LiteX (https://github.com/enjoy-digital/litex) is a SoC framework that targets FPGAs. LiteSDCard is a small footprint, configurable SDCard core commonly used in LiteX designs.

...

drivers/mmc/host/litex_mmc.c line 462

Quoted 7 lines
drivers/mmc/host/litex_mmc.c new file +7 -0
+       int ret;
+
+       host->irq = platform_get_irq_optional(host->dev, 0);
+       if (host->irq <= 0) {
+               dev_warn(dev, "Failed to get IRQ, using polling\n");
+               goto use_polling;
+       }

This is wrong. It missed the deferred probe, for example.

The best approach is

ret = platform_get_irq_optional(...);
if (ret < 0 && ret != -ENXIO)
return ret;
if (ret > 0)
...we got it...

It will allow the future API fix of platform_get_irq_optional() to be really optional.

--
With Best Regards,
Andy Shevchenko