162306a36Sopenharmony_ci# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) 262306a36Sopenharmony_ci%YAML 1.2 362306a36Sopenharmony_ci--- 462306a36Sopenharmony_ci$id: http://devicetree.org/schemas/spi/sprd,spi-adi.yaml# 562306a36Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/core.yaml# 662306a36Sopenharmony_ci 762306a36Sopenharmony_cititle: Spreadtrum ADI controller 862306a36Sopenharmony_ci 962306a36Sopenharmony_cimaintainers: 1062306a36Sopenharmony_ci - Orson Zhai <orsonzhai@gmail.com> 1162306a36Sopenharmony_ci - Baolin Wang <baolin.wang7@gmail.com> 1262306a36Sopenharmony_ci - Chunyan Zhang <zhang.lyra@gmail.com> 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_cidescription: | 1562306a36Sopenharmony_ci ADI is the abbreviation of Anolog-Digital interface, which is used to access 1662306a36Sopenharmony_ci analog chip (such as PMIC) from digital chip. ADI controller follows the SPI 1762306a36Sopenharmony_ci framework for its hardware implementation is alike to SPI bus and its timing 1862306a36Sopenharmony_ci is compatile to SPI timing. 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci ADI controller has 50 channels including 2 software read/write channels and 2162306a36Sopenharmony_ci 48 hardware channels to access analog chip. For 2 software read/write channels, 2262306a36Sopenharmony_ci users should set ADI registers to access analog chip. For hardware channels, 2362306a36Sopenharmony_ci we can configure them to allow other hardware components to use it independently, 2462306a36Sopenharmony_ci which means we can just link one analog chip address to one hardware channel, 2562306a36Sopenharmony_ci then users can access the mapped analog chip address by this hardware channel 2662306a36Sopenharmony_ci triggered by hardware components instead of ADI software channels. 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci Thus we introduce one property named "sprd,hw-channels" to configure hardware 2962306a36Sopenharmony_ci channels, the first value specifies the hardware channel id which is used to 3062306a36Sopenharmony_ci transfer data triggered by hardware automatically, and the second value specifies 3162306a36Sopenharmony_ci the analog chip address where user want to access by hardware components. 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci Since we have multi-subsystems will use unique ADI to access analog chip, when 3462306a36Sopenharmony_ci one system is reading/writing data by ADI software channels, that should be under 3562306a36Sopenharmony_ci one hardware spinlock protection to prevent other systems from reading/writing 3662306a36Sopenharmony_ci data by ADI software channels at the same time, or two parallel routine of setting 3762306a36Sopenharmony_ci ADI registers will make ADI controller registers chaos to lead incorrect results. 3862306a36Sopenharmony_ci Then we need one hardware spinlock to synchronize between the multiple subsystems. 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_ci The new version ADI controller supplies multiple master channels for different 4162306a36Sopenharmony_ci subsystem accessing, that means no need to add hardware spinlock to synchronize, 4262306a36Sopenharmony_ci thus change the hardware spinlock support to be optional to keep backward 4362306a36Sopenharmony_ci compatibility. 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ciallOf: 4662306a36Sopenharmony_ci - $ref: /schemas/spi/spi-controller.yaml# 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ciproperties: 4962306a36Sopenharmony_ci compatible: 5062306a36Sopenharmony_ci enum: 5162306a36Sopenharmony_ci - sprd,sc9860-adi 5262306a36Sopenharmony_ci - sprd,sc9863-adi 5362306a36Sopenharmony_ci - sprd,ums512-adi 5462306a36Sopenharmony_ci 5562306a36Sopenharmony_ci reg: 5662306a36Sopenharmony_ci maxItems: 1 5762306a36Sopenharmony_ci 5862306a36Sopenharmony_ci hwlocks: 5962306a36Sopenharmony_ci maxItems: 1 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci hwlock-names: 6262306a36Sopenharmony_ci const: adi 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci sprd,hw-channels: 6562306a36Sopenharmony_ci $ref: /schemas/types.yaml#/definitions/uint32-matrix 6662306a36Sopenharmony_ci description: A list of hardware channels 6762306a36Sopenharmony_ci minItems: 1 6862306a36Sopenharmony_ci maxItems: 48 6962306a36Sopenharmony_ci items: 7062306a36Sopenharmony_ci items: 7162306a36Sopenharmony_ci - description: The hardware channel id which is used to transfer data 7262306a36Sopenharmony_ci triggered by hardware automatically, channel id 0-1 are for software 7362306a36Sopenharmony_ci use, 2-49 are hardware channels. 7462306a36Sopenharmony_ci minimum: 2 7562306a36Sopenharmony_ci maximum: 49 7662306a36Sopenharmony_ci - description: The analog chip address where user want to access by 7762306a36Sopenharmony_ci hardware components. 7862306a36Sopenharmony_ci 7962306a36Sopenharmony_cirequired: 8062306a36Sopenharmony_ci - compatible 8162306a36Sopenharmony_ci - reg 8262306a36Sopenharmony_ci - '#address-cells' 8362306a36Sopenharmony_ci - '#size-cells' 8462306a36Sopenharmony_ci 8562306a36Sopenharmony_ciunevaluatedProperties: false 8662306a36Sopenharmony_ci 8762306a36Sopenharmony_ciexamples: 8862306a36Sopenharmony_ci - | 8962306a36Sopenharmony_ci aon { 9062306a36Sopenharmony_ci #address-cells = <2>; 9162306a36Sopenharmony_ci #size-cells = <2>; 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ci adi_bus: spi@40030000 { 9462306a36Sopenharmony_ci compatible = "sprd,sc9860-adi"; 9562306a36Sopenharmony_ci reg = <0 0x40030000 0 0x10000>; 9662306a36Sopenharmony_ci hwlocks = <&hwlock1 0>; 9762306a36Sopenharmony_ci hwlock-names = "adi"; 9862306a36Sopenharmony_ci #address-cells = <1>; 9962306a36Sopenharmony_ci #size-cells = <0>; 10062306a36Sopenharmony_ci sprd,hw-channels = <30 0x8c20>; 10162306a36Sopenharmony_ci }; 10262306a36Sopenharmony_ci }; 10362306a36Sopenharmony_ci... 104