xref: /freebsd/sys/contrib/device-tree/Bindings/spi/sprd,spi-adi.yaml (revision 354d7675fe12ace9cde344cb79c7ded792802f88)
1*354d7675SEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2*354d7675SEmmanuel Vadot
3*354d7675SEmmanuel Vadot%YAML 1.2
4*354d7675SEmmanuel Vadot---
5*354d7675SEmmanuel Vadot$id: "http://devicetree.org/schemas/spi/sprd,spi-adi.yaml#"
6*354d7675SEmmanuel Vadot$schema: "http://devicetree.org/meta-schemas/core.yaml#"
7*354d7675SEmmanuel Vadot
8*354d7675SEmmanuel Vadottitle: Spreadtrum ADI controller
9*354d7675SEmmanuel Vadot
10*354d7675SEmmanuel Vadotmaintainers:
11*354d7675SEmmanuel Vadot  - Orson Zhai <orsonzhai@gmail.com>
12*354d7675SEmmanuel Vadot  - Baolin Wang <baolin.wang7@gmail.com>
13*354d7675SEmmanuel Vadot  - Chunyan Zhang <zhang.lyra@gmail.com>
14*354d7675SEmmanuel Vadot
15*354d7675SEmmanuel Vadotdescription: |
16*354d7675SEmmanuel Vadot  ADI is the abbreviation of Anolog-Digital interface, which is used to access
17*354d7675SEmmanuel Vadot  analog chip (such as PMIC) from digital chip. ADI controller follows the SPI
18*354d7675SEmmanuel Vadot  framework for its hardware implementation is alike to SPI bus and its timing
19*354d7675SEmmanuel Vadot  is compatile to SPI timing.
20*354d7675SEmmanuel Vadot
21*354d7675SEmmanuel Vadot  ADI controller has 50 channels including 2 software read/write channels and
22*354d7675SEmmanuel Vadot  48 hardware channels to access analog chip. For 2 software read/write channels,
23*354d7675SEmmanuel Vadot  users should set ADI registers to access analog chip. For hardware channels,
24*354d7675SEmmanuel Vadot  we can configure them to allow other hardware components to use it independently,
25*354d7675SEmmanuel Vadot  which means we can just link one analog chip address to one hardware channel,
26*354d7675SEmmanuel Vadot  then users can access the mapped analog chip address by this hardware channel
27*354d7675SEmmanuel Vadot  triggered by hardware components instead of ADI software channels.
28*354d7675SEmmanuel Vadot
29*354d7675SEmmanuel Vadot  Thus we introduce one property named "sprd,hw-channels" to configure hardware
30*354d7675SEmmanuel Vadot  channels, the first value specifies the hardware channel id which is used to
31*354d7675SEmmanuel Vadot  transfer data triggered by hardware automatically, and the second value specifies
32*354d7675SEmmanuel Vadot  the analog chip address where user want to access by hardware components.
33*354d7675SEmmanuel Vadot
34*354d7675SEmmanuel Vadot  Since we have multi-subsystems will use unique ADI to access analog chip, when
35*354d7675SEmmanuel Vadot  one system is reading/writing data by ADI software channels, that should be under
36*354d7675SEmmanuel Vadot  one hardware spinlock protection to prevent other systems from reading/writing
37*354d7675SEmmanuel Vadot  data by ADI software channels at the same time, or two parallel routine of setting
38*354d7675SEmmanuel Vadot  ADI registers will make ADI controller registers chaos to lead incorrect results.
39*354d7675SEmmanuel Vadot  Then we need one hardware spinlock to synchronize between the multiple subsystems.
40*354d7675SEmmanuel Vadot
41*354d7675SEmmanuel Vadot  The new version ADI controller supplies multiple master channels for different
42*354d7675SEmmanuel Vadot  subsystem accessing, that means no need to add hardware spinlock to synchronize,
43*354d7675SEmmanuel Vadot  thus change the hardware spinlock support to be optional to keep backward
44*354d7675SEmmanuel Vadot  compatibility.
45*354d7675SEmmanuel Vadot
46*354d7675SEmmanuel VadotallOf:
47*354d7675SEmmanuel Vadot  - $ref: /spi/spi-controller.yaml#
48*354d7675SEmmanuel Vadot
49*354d7675SEmmanuel Vadotproperties:
50*354d7675SEmmanuel Vadot  compatible:
51*354d7675SEmmanuel Vadot    enum:
52*354d7675SEmmanuel Vadot      - sprd,sc9860-adi
53*354d7675SEmmanuel Vadot      - sprd,sc9863-adi
54*354d7675SEmmanuel Vadot      - sprd,ums512-adi
55*354d7675SEmmanuel Vadot
56*354d7675SEmmanuel Vadot  reg:
57*354d7675SEmmanuel Vadot    maxItems: 1
58*354d7675SEmmanuel Vadot
59*354d7675SEmmanuel Vadot  hwlocks:
60*354d7675SEmmanuel Vadot    maxItems: 1
61*354d7675SEmmanuel Vadot
62*354d7675SEmmanuel Vadot  hwlock-names:
63*354d7675SEmmanuel Vadot    const: adi
64*354d7675SEmmanuel Vadot
65*354d7675SEmmanuel Vadot  sprd,hw-channels:
66*354d7675SEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32-matrix
67*354d7675SEmmanuel Vadot    description: A list of hardware channels
68*354d7675SEmmanuel Vadot    minItems: 1
69*354d7675SEmmanuel Vadot    maxItems: 48
70*354d7675SEmmanuel Vadot    items:
71*354d7675SEmmanuel Vadot      items:
72*354d7675SEmmanuel Vadot        - description: The hardware channel id which is used to transfer data
73*354d7675SEmmanuel Vadot            triggered by hardware automatically, channel id 0-1 are for software
74*354d7675SEmmanuel Vadot            use, 2-49 are hardware channels.
75*354d7675SEmmanuel Vadot          minimum: 2
76*354d7675SEmmanuel Vadot          maximum: 49
77*354d7675SEmmanuel Vadot        - description: The analog chip address where user want to access by
78*354d7675SEmmanuel Vadot            hardware components.
79*354d7675SEmmanuel Vadot
80*354d7675SEmmanuel Vadotrequired:
81*354d7675SEmmanuel Vadot  - compatible
82*354d7675SEmmanuel Vadot  - reg
83*354d7675SEmmanuel Vadot  - '#address-cells'
84*354d7675SEmmanuel Vadot  - '#size-cells'
85*354d7675SEmmanuel Vadot
86*354d7675SEmmanuel VadotunevaluatedProperties: false
87*354d7675SEmmanuel Vadot
88*354d7675SEmmanuel Vadotexamples:
89*354d7675SEmmanuel Vadot  - |
90*354d7675SEmmanuel Vadot    aon {
91*354d7675SEmmanuel Vadot        #address-cells = <2>;
92*354d7675SEmmanuel Vadot        #size-cells = <2>;
93*354d7675SEmmanuel Vadot
94*354d7675SEmmanuel Vadot        adi_bus: spi@40030000 {
95*354d7675SEmmanuel Vadot            compatible = "sprd,sc9860-adi";
96*354d7675SEmmanuel Vadot            reg = <0 0x40030000 0 0x10000>;
97*354d7675SEmmanuel Vadot            hwlocks = <&hwlock1 0>;
98*354d7675SEmmanuel Vadot            hwlock-names = "adi";
99*354d7675SEmmanuel Vadot            #address-cells = <1>;
100*354d7675SEmmanuel Vadot            #size-cells = <0>;
101*354d7675SEmmanuel Vadot            sprd,hw-channels = <30 0x8c20>;
102*354d7675SEmmanuel Vadot        };
103*354d7675SEmmanuel Vadot    };
104*354d7675SEmmanuel Vadot...
105