xref: /freebsd-src/sys/contrib/device-tree/Bindings/i2c/opencores,i2c-ocores.yaml (revision fac71e4e09885bb2afa3d984a0c239a52e1a7418)
1b97ee269SEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2b97ee269SEmmanuel Vadot%YAML 1.2
3b97ee269SEmmanuel Vadot---
4b97ee269SEmmanuel Vadot$id: http://devicetree.org/schemas/i2c/opencores,i2c-ocores.yaml#
5b97ee269SEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
6b97ee269SEmmanuel Vadot
7b97ee269SEmmanuel Vadottitle: OpenCores I2C controller
8b97ee269SEmmanuel Vadot
9b97ee269SEmmanuel Vadotmaintainers:
10b97ee269SEmmanuel Vadot  - Peter Korsgaard <peter@korsgaard.com>
11b97ee269SEmmanuel Vadot  - Andrew Lunn <andrew@lunn.ch>
12b97ee269SEmmanuel Vadot
13b97ee269SEmmanuel VadotallOf:
14b97ee269SEmmanuel Vadot  - $ref: /schemas/i2c/i2c-controller.yaml#
15b97ee269SEmmanuel Vadot
16b97ee269SEmmanuel Vadotproperties:
17b97ee269SEmmanuel Vadot  compatible:
18b97ee269SEmmanuel Vadot    oneOf:
19b97ee269SEmmanuel Vadot      - items:
20b97ee269SEmmanuel Vadot          - enum:
21b97ee269SEmmanuel Vadot              - sifive,fu740-c000-i2c # Opencore based IP block FU740-C000 SoC
22b97ee269SEmmanuel Vadot              - sifive,fu540-c000-i2c # Opencore based IP block FU540-C000 SoC
23b97ee269SEmmanuel Vadot          - const: sifive,i2c0
24b97ee269SEmmanuel Vadot      - enum:
25b97ee269SEmmanuel Vadot          - opencores,i2c-ocores
26b97ee269SEmmanuel Vadot          - aeroflexgaisler,i2cmst
27b97ee269SEmmanuel Vadot
28b97ee269SEmmanuel Vadot  reg:
29b97ee269SEmmanuel Vadot    maxItems: 1
30b97ee269SEmmanuel Vadot
31b97ee269SEmmanuel Vadot  interrupts:
32b97ee269SEmmanuel Vadot    maxItems: 1
33b97ee269SEmmanuel Vadot
34b97ee269SEmmanuel Vadot  clocks:
35b97ee269SEmmanuel Vadot    maxItems: 1
36b97ee269SEmmanuel Vadot
37b97ee269SEmmanuel Vadot  clock-frequency:
38b97ee269SEmmanuel Vadot    description: |
39b97ee269SEmmanuel Vadot      clock-frequency property is meant to control the bus frequency for i2c bus
40b97ee269SEmmanuel Vadot      drivers, but it was incorrectly used to specify i2c controller input clock
41b97ee269SEmmanuel Vadot      frequency. So the following rules are set to fix this situation:
42b97ee269SEmmanuel Vadot      - if clock-frequency is present and neither opencores,ip-clock-frequency nor
43b97ee269SEmmanuel Vadot        clocks are, then clock-frequency specifies i2c controller clock frequency.
44b97ee269SEmmanuel Vadot        This is to keep backwards compatibility with setups using old DTB. i2c bus
45b97ee269SEmmanuel Vadot        frequency is fixed at 100 KHz.
46b97ee269SEmmanuel Vadot      - if clocks is present it specifies i2c controller clock. clock-frequency
47b97ee269SEmmanuel Vadot        property specifies i2c bus frequency.
48b97ee269SEmmanuel Vadot      - if opencores,ip-clock-frequency is present it specifies i2c controller
49b97ee269SEmmanuel Vadot        clock frequency. clock-frequency property specifies i2c bus frequency.
50b97ee269SEmmanuel Vadot    default: 100000
51b97ee269SEmmanuel Vadot
52b97ee269SEmmanuel Vadot  reg-io-width:
53b97ee269SEmmanuel Vadot    description: |
54b97ee269SEmmanuel Vadot      io register width in bytes
55b97ee269SEmmanuel Vadot    enum: [1, 2, 4]
56b97ee269SEmmanuel Vadot
57b97ee269SEmmanuel Vadot  reg-shift:
58b97ee269SEmmanuel Vadot    description: |
59b97ee269SEmmanuel Vadot      device register offsets are shifted by this value
60b97ee269SEmmanuel Vadot    default: 0
61b97ee269SEmmanuel Vadot
62b97ee269SEmmanuel Vadot  regstep:
63*fac71e4eSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32
64b97ee269SEmmanuel Vadot    description: |
65b97ee269SEmmanuel Vadot      deprecated, use reg-shift above
66b97ee269SEmmanuel Vadot    deprecated: true
67b97ee269SEmmanuel Vadot
68b97ee269SEmmanuel Vadot  opencores,ip-clock-frequency:
69b97ee269SEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32
70b97ee269SEmmanuel Vadot    description: |
71b97ee269SEmmanuel Vadot      Frequency of the controller clock in Hz. Mutually exclusive with clocks.
72b97ee269SEmmanuel Vadot      See the note above.
73b97ee269SEmmanuel Vadot
74b97ee269SEmmanuel Vadotrequired:
75b97ee269SEmmanuel Vadot  - compatible
76b97ee269SEmmanuel Vadot  - reg
77b97ee269SEmmanuel Vadot  - "#address-cells"
78b97ee269SEmmanuel Vadot  - "#size-cells"
79b97ee269SEmmanuel Vadot
80b97ee269SEmmanuel VadotoneOf:
81b97ee269SEmmanuel Vadot  - required:
82b97ee269SEmmanuel Vadot      - opencores,ip-clock-frequency
83b97ee269SEmmanuel Vadot  - required:
84b97ee269SEmmanuel Vadot      - clocks
85b97ee269SEmmanuel Vadot
86b97ee269SEmmanuel VadotunevaluatedProperties: false
87b97ee269SEmmanuel Vadot
88b97ee269SEmmanuel Vadotexamples:
89b97ee269SEmmanuel Vadot  - |
90b97ee269SEmmanuel Vadot    i2c@a0000000 {
91b97ee269SEmmanuel Vadot      compatible = "opencores,i2c-ocores";
92b97ee269SEmmanuel Vadot      reg = <0xa0000000 0x8>;
93b97ee269SEmmanuel Vadot      #address-cells = <1>;
94b97ee269SEmmanuel Vadot      #size-cells = <0>;
95b97ee269SEmmanuel Vadot      interrupts = <10>;
96b97ee269SEmmanuel Vadot      opencores,ip-clock-frequency = <20000000>;
97b97ee269SEmmanuel Vadot
98b97ee269SEmmanuel Vadot      reg-shift = <0>;	/* 8 bit registers */
99b97ee269SEmmanuel Vadot      reg-io-width = <1>;	/* 8 bit read/write */
100b97ee269SEmmanuel Vadot    };
101b97ee269SEmmanuel Vadot
102b97ee269SEmmanuel Vadot    i2c@b0000000 {
103b97ee269SEmmanuel Vadot      compatible = "opencores,i2c-ocores";
104b97ee269SEmmanuel Vadot      reg = <0xa0000000 0x8>;
105b97ee269SEmmanuel Vadot      #address-cells = <1>;
106b97ee269SEmmanuel Vadot      #size-cells = <0>;
107b97ee269SEmmanuel Vadot      interrupts = <10>;
108b97ee269SEmmanuel Vadot      clocks = <&osc>;
109b97ee269SEmmanuel Vadot      clock-frequency = <400000>; /* i2c bus frequency 400 KHz */
110b97ee269SEmmanuel Vadot
111b97ee269SEmmanuel Vadot      reg-shift = <0>;	/* 8 bit registers */
112b97ee269SEmmanuel Vadot      reg-io-width = <1>;	/* 8 bit read/write */
113b97ee269SEmmanuel Vadot    };
114b97ee269SEmmanuel Vadot...
115