[RFC,05/11] dt-bindings: soc: realtek: rtd1195-chip: Extend reg property
diff mbox series

Message ID 20191103013645.9856-6-afaerber@suse.de
State RFC
Headers show
Series
  • ARM: Realtek RTD1195/RTD1295 SoC info
Related show

Checks

Context Check Description
robh/dt-meta-schema success
robh/checkpatch success

Commit Message

Andreas Färber Nov. 3, 2019, 1:36 a.m. UTC
Allow to optionally specify a second register to identify the chip.
Whether needed and which register to specify depends on the family;
RTD1295 family will want the CHIP_INFO1 register.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 A SoC specific binding would defeat the purpose of the generic Linux driver;
 is it possible to check the root node's compatible in an if: expression
 to prohibit using more than one reg on "realtek,rtd1195"?
 
 .../devicetree/bindings/soc/realtek/realtek,rtd1195-chip.yaml  | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Rob Herring Nov. 6, 2019, 4:46 a.m. UTC | #1
On Sun, Nov 03, 2019 at 02:36:39AM +0100, Andreas Färber wrote:
> Allow to optionally specify a second register to identify the chip.
> Whether needed and which register to specify depends on the family;
> RTD1295 family will want the CHIP_INFO1 register.
> 
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> ---
>  A SoC specific binding would defeat the purpose of the generic Linux driver;

Why? You can map any number of compatibles to a generic driver.

>  is it possible to check the root node's compatible in an if: expression
>  to prohibit using more than one reg on "realtek,rtd1195"?

The "rule" is different programming model, different compatible string 
for the block. But this looks simple enough, I don't really care.

>  
>  .../devicetree/bindings/soc/realtek/realtek,rtd1195-chip.yaml  | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/soc/realtek/realtek,rtd1195-chip.yaml b/Documentation/devicetree/bindings/soc/realtek/realtek,rtd1195-chip.yaml
> index 565ad2419553..e431cf559b66 100644
> --- a/Documentation/devicetree/bindings/soc/realtek/realtek,rtd1195-chip.yaml
> +++ b/Documentation/devicetree/bindings/soc/realtek/realtek,rtd1195-chip.yaml
> @@ -11,13 +11,15 @@ maintainers:
>  
>  description: |
>    The Realtek SoCs have some registers to identify the chip and revision.
> +  To identify the exact model within a family, further registers are needed.
>  
>  properties:
>    compatible:
>      const: "realtek,rtd1195-chip"
>  
>    reg:
> -    maxItems: 1
> +    minItems: 1
> +    maxItems: 2
>  
>  required:
>    - compatible
> @@ -29,4 +31,10 @@ examples:
>          compatible = "realtek,rtd1195-chip";
>          reg = <0x1801a200 0x8>;
>      };
> +  - |
> +    chip-info@9801a200 {
> +        compatible = "realtek,rtd1195-chip";
> +        reg = <0x9801a200 0x8>,
> +              <0x98007028 0x4>;
> +    };
>  ...
> -- 
> 2.16.4
>
Andreas Färber Nov. 6, 2019, 8:42 a.m. UTC | #2
Am 06.11.19 um 05:46 schrieb Rob Herring:
> On Sun, Nov 03, 2019 at 02:36:39AM +0100, Andreas Färber wrote:
>> Allow to optionally specify a second register to identify the chip.
>> Whether needed and which register to specify depends on the family;
>> RTD1295 family will want the CHIP_INFO1 register.
>>
>> Signed-off-by: Andreas Färber <afaerber@suse.de>
>> ---
>>  A SoC specific binding would defeat the purpose of the generic Linux driver;
> 
> Why? You can map any number of compatibles to a generic driver.

Because the purpose of the driver is to read from the registers which
chip it is. If we tell it via the compatible what it is supposed to be,
1) only the revision would need to be read, and 2) how should it react
if the compatible tells it one thing and the register value another.

Also it doesn't solve the problem that we may need to extend the binding
as new models emerge, or instead of just rtd1195, rtd1295, rtd1395, etc.
we'd also need one for each chip, i.e., rtd1296, cf. 1) above.

>>  is it possible to check the root node's compatible in an if: expression
>>  to prohibit using more than one reg on "realtek,rtd1195"?
> 
> The "rule" is different programming model, different compatible string 
> for the block.

Agreed in general.

> But this looks simple enough, I don't really care.

Hope you also read the cover letter wrt syscon? That would probably
obsolete this binding then and require to move the driver's logic into a
module init instead for lack of dedicated compatible to bind against,
like Meson does.

Regards,
Andreas

Patch
diff mbox series

diff --git a/Documentation/devicetree/bindings/soc/realtek/realtek,rtd1195-chip.yaml b/Documentation/devicetree/bindings/soc/realtek/realtek,rtd1195-chip.yaml
index 565ad2419553..e431cf559b66 100644
--- a/Documentation/devicetree/bindings/soc/realtek/realtek,rtd1195-chip.yaml
+++ b/Documentation/devicetree/bindings/soc/realtek/realtek,rtd1195-chip.yaml
@@ -11,13 +11,15 @@  maintainers:
 
 description: |
   The Realtek SoCs have some registers to identify the chip and revision.
+  To identify the exact model within a family, further registers are needed.
 
 properties:
   compatible:
     const: "realtek,rtd1195-chip"
 
   reg:
-    maxItems: 1
+    minItems: 1
+    maxItems: 2
 
 required:
   - compatible
@@ -29,4 +31,10 @@  examples:
         compatible = "realtek,rtd1195-chip";
         reg = <0x1801a200 0x8>;
     };
+  - |
+    chip-info@9801a200 {
+        compatible = "realtek,rtd1195-chip";
+        reg = <0x9801a200 0x8>,
+              <0x98007028 0x4>;
+    };
 ...