Skip to content

Commit f15e60d

Browse files
Chunyan Zhangbroonie
authored andcommitted
spi: Convert sprd ADI bindings to yaml
Convert spi-sprd-adi.txt to yaml. Signed-off-by: Chunyan Zhang <[email protected]> Reviewed-by: Rob Herring <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 3b66ca9 commit f15e60d

File tree

2 files changed

+102
-63
lines changed

2 files changed

+102
-63
lines changed

Documentation/devicetree/bindings/spi/spi-sprd-adi.txt

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

0 commit comments

Comments
 (0)