Skip to content

Commit 46721a1

Browse files
committed
dt-bindings: mtd: Create a file for raw NAND chip properties
In an effort to constrain as much as we can the existing binding, we want to add "unevaluatedProperties: false" in all the NAND chip descriptions part of NAND controller bindings. But in order to do that properly, we also need to reference a file which contains all the "allowed" properties. Right now this file is nand-chip.yaml but in practice raw NAND controllers may use additional properties in their NAND chip children node. These properties are listed under nand-controller.yaml, which makes the "unevaluatedProperties" checks fail while the description are valid. We need to move these NAND chip related properties into another file, because we do not want to pollute nand-chip.yaml which is also referenced by eg. SPI-NAND devices. Let's create a raw-nand-chip.yaml file to reference all the properties a raw NAND chip description can contain. The chain of inheritance becomes: nand-controller.yaml <- raw-nand-chip.yaml raw-nand-chip.yaml <- nand-chip.yaml spi-nand.yaml <- nand-chip.yaml Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/linux-mtd/20230619092916.3028470-3-miquel.raynal@bootlin.com
1 parent da78768 commit 46721a1

2 files changed

Lines changed: 104 additions & 83 deletions

File tree

Documentation/devicetree/bindings/mtd/nand-controller.yaml

Lines changed: 2 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,6 @@ description: |
1616
children nodes of the NAND controller. This representation should be
1717
enforced even for simple controllers supporting only one chip.
1818
19-
The ECC strength and ECC step size properties define the user
20-
desires in terms of correction capability of a controller. Together,
21-
they request the ECC engine to correct {strength} bit errors per
22-
{size} bytes.
23-
24-
The interpretation of these parameters is implementation-defined, so
25-
not all implementations must support all possible
26-
combinations. However, implementations are encouraged to further
27-
specify the value(s) they support.
28-
2919
properties:
3020
$nodename:
3121
pattern: "^nand-controller(@.*)?"
@@ -51,79 +41,8 @@ properties:
5141

5242
patternProperties:
5343
"^nand@[a-f0-9]$":
54-
$ref: nand-chip.yaml#
55-
56-
properties:
57-
reg:
58-
description:
59-
Contains the chip-select IDs.
60-
61-
nand-ecc-placement:
62-
description:
63-
Location of the ECC bytes. This location is unknown by default
64-
but can be explicitly set to "oob", if all ECC bytes are
65-
known to be stored in the OOB area, or "interleaved" if ECC
66-
bytes will be interleaved with regular data in the main area.
67-
$ref: /schemas/types.yaml#/definitions/string
68-
enum: [ oob, interleaved ]
69-
70-
nand-bus-width:
71-
description:
72-
Bus width to the NAND chip
73-
$ref: /schemas/types.yaml#/definitions/uint32
74-
enum: [8, 16]
75-
default: 8
76-
77-
nand-on-flash-bbt:
78-
description:
79-
With this property, the OS will search the device for a Bad
80-
Block Table (BBT). If not found, it will create one, reserve
81-
a few blocks at the end of the device to store it and update
82-
it as the device ages. Otherwise, the out-of-band area of a
83-
few pages of all the blocks will be scanned at boot time to
84-
find Bad Block Markers (BBM). These markers will help to
85-
build a volatile BBT in RAM.
86-
$ref: /schemas/types.yaml#/definitions/flag
87-
88-
nand-ecc-maximize:
89-
description:
90-
Whether or not the ECC strength should be maximized. The
91-
maximum ECC strength is both controller and chip
92-
dependent. The ECC engine has to select the ECC config
93-
providing the best strength and taking the OOB area size
94-
constraint into account. This is particularly useful when
95-
only the in-band area is used by the upper layers, and you
96-
want to make your NAND as reliable as possible.
97-
$ref: /schemas/types.yaml#/definitions/flag
98-
99-
nand-is-boot-medium:
100-
description:
101-
Whether or not the NAND chip is a boot medium. Drivers might
102-
use this information to select ECC algorithms supported by
103-
the boot ROM or similar restrictions.
104-
$ref: /schemas/types.yaml#/definitions/flag
105-
106-
nand-rb:
107-
description:
108-
Contains the native Ready/Busy IDs.
109-
$ref: /schemas/types.yaml#/definitions/uint32-array
110-
111-
rb-gpios:
112-
description:
113-
Contains one or more GPIO descriptor (the numper of descriptor
114-
depends on the number of R/B pins exposed by the flash) for the
115-
Ready/Busy pins. Active state refers to the NAND ready state and
116-
should be set to GPIOD_ACTIVE_HIGH unless the signal is inverted.
117-
118-
wp-gpios:
119-
description:
120-
Contains one GPIO descriptor for the Write Protect pin.
121-
Active state refers to the NAND Write Protect state and should be
122-
set to GPIOD_ACTIVE_LOW unless the signal is inverted.
123-
maxItems: 1
124-
125-
required:
126-
- reg
44+
type: object
45+
$ref: raw-nand-chip.yaml#
12746

12847
required:
12948
- "#address-cells"
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/mtd/raw-nand-chip.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Raw NAND Chip Common Properties
8+
9+
maintainers:
10+
- Miquel Raynal <miquel.raynal@bootlin.com>
11+
12+
allOf:
13+
- $ref: nand-chip.yaml#
14+
15+
description: |
16+
The ECC strength and ECC step size properties define the user
17+
desires in terms of correction capability of a controller. Together,
18+
they request the ECC engine to correct {strength} bit errors per
19+
{size} bytes for a particular raw NAND chip.
20+
21+
The interpretation of these parameters is implementation-defined, so
22+
not all implementations must support all possible
23+
combinations. However, implementations are encouraged to further
24+
specify the value(s) they support.
25+
26+
properties:
27+
$nodename:
28+
pattern: "^nand@[a-f0-9]$"
29+
30+
reg:
31+
description:
32+
Contains the chip-select IDs.
33+
34+
nand-ecc-placement:
35+
description:
36+
Location of the ECC bytes. This location is unknown by default
37+
but can be explicitly set to "oob", if all ECC bytes are
38+
known to be stored in the OOB area, or "interleaved" if ECC
39+
bytes will be interleaved with regular data in the main area.
40+
$ref: /schemas/types.yaml#/definitions/string
41+
enum: [ oob, interleaved ]
42+
43+
nand-bus-width:
44+
description:
45+
Bus width to the NAND chip
46+
$ref: /schemas/types.yaml#/definitions/uint32
47+
enum: [8, 16]
48+
default: 8
49+
50+
nand-on-flash-bbt:
51+
description:
52+
With this property, the OS will search the device for a Bad
53+
Block Table (BBT). If not found, it will create one, reserve
54+
a few blocks at the end of the device to store it and update
55+
it as the device ages. Otherwise, the out-of-band area of a
56+
few pages of all the blocks will be scanned at boot time to
57+
find Bad Block Markers (BBM). These markers will help to
58+
build a volatile BBT in RAM.
59+
$ref: /schemas/types.yaml#/definitions/flag
60+
61+
nand-ecc-maximize:
62+
description:
63+
Whether or not the ECC strength should be maximized. The
64+
maximum ECC strength is both controller and chip
65+
dependent. The ECC engine has to select the ECC config
66+
providing the best strength and taking the OOB area size
67+
constraint into account. This is particularly useful when
68+
only the in-band area is used by the upper layers, and you
69+
want to make your NAND as reliable as possible.
70+
$ref: /schemas/types.yaml#/definitions/flag
71+
72+
nand-is-boot-medium:
73+
description:
74+
Whether or not the NAND chip is a boot medium. Drivers might
75+
use this information to select ECC algorithms supported by
76+
the boot ROM or similar restrictions.
77+
$ref: /schemas/types.yaml#/definitions/flag
78+
79+
nand-rb:
80+
description:
81+
Contains the native Ready/Busy IDs.
82+
$ref: /schemas/types.yaml#/definitions/uint32-array
83+
84+
rb-gpios:
85+
description:
86+
Contains one or more GPIO descriptor (the numper of descriptor
87+
depends on the number of R/B pins exposed by the flash) for the
88+
Ready/Busy pins. Active state refers to the NAND ready state and
89+
should be set to GPIOD_ACTIVE_HIGH unless the signal is inverted.
90+
91+
wp-gpios:
92+
description:
93+
Contains one GPIO descriptor for the Write Protect pin.
94+
Active state refers to the NAND Write Protect state and should be
95+
set to GPIOD_ACTIVE_LOW unless the signal is inverted.
96+
maxItems: 1
97+
98+
required:
99+
- reg
100+
101+
# This is a generic file other binding inherit from and extend
102+
additionalProperties: true

0 commit comments

Comments
 (0)