xref: /freebsd/sys/contrib/device-tree/Bindings/spi/sprd,spi-adi.yaml (revision cb7aa33ac6cd46a5434798e50363136e64f3ae98)
1354d7675SEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2354d7675SEmmanuel Vadot%YAML 1.2
3354d7675SEmmanuel Vadot---
4*cb7aa33aSEmmanuel Vadot$id: http://devicetree.org/schemas/spi/sprd,spi-adi.yaml#
5*cb7aa33aSEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
6354d7675SEmmanuel Vadot
7354d7675SEmmanuel Vadottitle: Spreadtrum ADI controller
8354d7675SEmmanuel Vadot
9354d7675SEmmanuel Vadotmaintainers:
10354d7675SEmmanuel Vadot  - Orson Zhai <orsonzhai@gmail.com>
11354d7675SEmmanuel Vadot  - Baolin Wang <baolin.wang7@gmail.com>
12354d7675SEmmanuel Vadot  - Chunyan Zhang <zhang.lyra@gmail.com>
13354d7675SEmmanuel Vadot
14354d7675SEmmanuel Vadotdescription: |
15354d7675SEmmanuel Vadot  ADI is the abbreviation of Anolog-Digital interface, which is used to access
16354d7675SEmmanuel Vadot  analog chip (such as PMIC) from digital chip. ADI controller follows the SPI
17354d7675SEmmanuel Vadot  framework for its hardware implementation is alike to SPI bus and its timing
18354d7675SEmmanuel Vadot  is compatile to SPI timing.
19354d7675SEmmanuel Vadot
20354d7675SEmmanuel Vadot  ADI controller has 50 channels including 2 software read/write channels and
21354d7675SEmmanuel Vadot  48 hardware channels to access analog chip. For 2 software read/write channels,
22354d7675SEmmanuel Vadot  users should set ADI registers to access analog chip. For hardware channels,
23354d7675SEmmanuel Vadot  we can configure them to allow other hardware components to use it independently,
24354d7675SEmmanuel Vadot  which means we can just link one analog chip address to one hardware channel,
25354d7675SEmmanuel Vadot  then users can access the mapped analog chip address by this hardware channel
26354d7675SEmmanuel Vadot  triggered by hardware components instead of ADI software channels.
27354d7675SEmmanuel Vadot
28354d7675SEmmanuel Vadot  Thus we introduce one property named "sprd,hw-channels" to configure hardware
29354d7675SEmmanuel Vadot  channels, the first value specifies the hardware channel id which is used to
30354d7675SEmmanuel Vadot  transfer data triggered by hardware automatically, and the second value specifies
31354d7675SEmmanuel Vadot  the analog chip address where user want to access by hardware components.
32354d7675SEmmanuel Vadot
33354d7675SEmmanuel Vadot  Since we have multi-subsystems will use unique ADI to access analog chip, when
34354d7675SEmmanuel Vadot  one system is reading/writing data by ADI software channels, that should be under
35354d7675SEmmanuel Vadot  one hardware spinlock protection to prevent other systems from reading/writing
36354d7675SEmmanuel Vadot  data by ADI software channels at the same time, or two parallel routine of setting
37354d7675SEmmanuel Vadot  ADI registers will make ADI controller registers chaos to lead incorrect results.
38354d7675SEmmanuel Vadot  Then we need one hardware spinlock to synchronize between the multiple subsystems.
39354d7675SEmmanuel Vadot
40354d7675SEmmanuel Vadot  The new version ADI controller supplies multiple master channels for different
41354d7675SEmmanuel Vadot  subsystem accessing, that means no need to add hardware spinlock to synchronize,
42354d7675SEmmanuel Vadot  thus change the hardware spinlock support to be optional to keep backward
43354d7675SEmmanuel Vadot  compatibility.
44354d7675SEmmanuel Vadot
45354d7675SEmmanuel VadotallOf:
46c9ccf3a3SEmmanuel Vadot  - $ref: /schemas/spi/spi-controller.yaml#
47354d7675SEmmanuel Vadot
48354d7675SEmmanuel Vadotproperties:
49354d7675SEmmanuel Vadot  compatible:
50354d7675SEmmanuel Vadot    enum:
51354d7675SEmmanuel Vadot      - sprd,sc9860-adi
52354d7675SEmmanuel Vadot      - sprd,sc9863-adi
53354d7675SEmmanuel Vadot      - sprd,ums512-adi
54354d7675SEmmanuel Vadot
55354d7675SEmmanuel Vadot  reg:
56354d7675SEmmanuel Vadot    maxItems: 1
57354d7675SEmmanuel Vadot
58354d7675SEmmanuel Vadot  hwlocks:
59354d7675SEmmanuel Vadot    maxItems: 1
60354d7675SEmmanuel Vadot
61354d7675SEmmanuel Vadot  hwlock-names:
62354d7675SEmmanuel Vadot    const: adi
63354d7675SEmmanuel Vadot
64354d7675SEmmanuel Vadot  sprd,hw-channels:
65354d7675SEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32-matrix
66354d7675SEmmanuel Vadot    description: A list of hardware channels
67354d7675SEmmanuel Vadot    minItems: 1
68354d7675SEmmanuel Vadot    maxItems: 48
69354d7675SEmmanuel Vadot    items:
70354d7675SEmmanuel Vadot      items:
71354d7675SEmmanuel Vadot        - description: The hardware channel id which is used to transfer data
72354d7675SEmmanuel Vadot            triggered by hardware automatically, channel id 0-1 are for software
73354d7675SEmmanuel Vadot            use, 2-49 are hardware channels.
74354d7675SEmmanuel Vadot          minimum: 2
75354d7675SEmmanuel Vadot          maximum: 49
76354d7675SEmmanuel Vadot        - description: The analog chip address where user want to access by
77354d7675SEmmanuel Vadot            hardware components.
78354d7675SEmmanuel Vadot
79354d7675SEmmanuel Vadotrequired:
80354d7675SEmmanuel Vadot  - compatible
81354d7675SEmmanuel Vadot  - reg
82354d7675SEmmanuel Vadot  - '#address-cells'
83354d7675SEmmanuel Vadot  - '#size-cells'
84354d7675SEmmanuel Vadot
85354d7675SEmmanuel VadotunevaluatedProperties: false
86354d7675SEmmanuel Vadot
87354d7675SEmmanuel Vadotexamples:
88354d7675SEmmanuel Vadot  - |
89354d7675SEmmanuel Vadot    aon {
90354d7675SEmmanuel Vadot        #address-cells = <2>;
91354d7675SEmmanuel Vadot        #size-cells = <2>;
92354d7675SEmmanuel Vadot
93354d7675SEmmanuel Vadot        adi_bus: spi@40030000 {
94354d7675SEmmanuel Vadot            compatible = "sprd,sc9860-adi";
95354d7675SEmmanuel Vadot            reg = <0 0x40030000 0 0x10000>;
96354d7675SEmmanuel Vadot            hwlocks = <&hwlock1 0>;
97354d7675SEmmanuel Vadot            hwlock-names = "adi";
98354d7675SEmmanuel Vadot            #address-cells = <1>;
99354d7675SEmmanuel Vadot            #size-cells = <0>;
100354d7675SEmmanuel Vadot            sprd,hw-channels = <30 0x8c20>;
101354d7675SEmmanuel Vadot        };
102354d7675SEmmanuel Vadot    };
103354d7675SEmmanuel Vadot...
104