1*c66ec88fSEmmanuel VadotSpreadtrum ADI controller 2*c66ec88fSEmmanuel Vadot 3*c66ec88fSEmmanuel VadotADI is the abbreviation of Anolog-Digital interface, which is used to access 4*c66ec88fSEmmanuel Vadotanalog chip (such as PMIC) from digital chip. ADI controller follows the SPI 5*c66ec88fSEmmanuel Vadotframework for its hardware implementation is alike to SPI bus and its timing 6*c66ec88fSEmmanuel Vadotis compatile to SPI timing. 7*c66ec88fSEmmanuel Vadot 8*c66ec88fSEmmanuel VadotADI controller has 50 channels including 2 software read/write channels and 9*c66ec88fSEmmanuel Vadot48 hardware channels to access analog chip. For 2 software read/write channels, 10*c66ec88fSEmmanuel Vadotusers should set ADI registers to access analog chip. For hardware channels, 11*c66ec88fSEmmanuel Vadotwe can configure them to allow other hardware components to use it independently, 12*c66ec88fSEmmanuel Vadotwhich means we can just link one analog chip address to one hardware channel, 13*c66ec88fSEmmanuel Vadotthen users can access the mapped analog chip address by this hardware channel 14*c66ec88fSEmmanuel Vadottriggered by hardware components instead of ADI software channels. 15*c66ec88fSEmmanuel Vadot 16*c66ec88fSEmmanuel VadotThus we introduce one property named "sprd,hw-channels" to configure hardware 17*c66ec88fSEmmanuel Vadotchannels, the first value specifies the hardware channel id which is used to 18*c66ec88fSEmmanuel Vadottransfer data triggered by hardware automatically, and the second value specifies 19*c66ec88fSEmmanuel Vadotthe analog chip address where user want to access by hardware components. 20*c66ec88fSEmmanuel Vadot 21*c66ec88fSEmmanuel VadotSince we have multi-subsystems will use unique ADI to access analog chip, when 22*c66ec88fSEmmanuel Vadotone system is reading/writing data by ADI software channels, that should be under 23*c66ec88fSEmmanuel Vadotone hardware spinlock protection to prevent other systems from reading/writing 24*c66ec88fSEmmanuel Vadotdata by ADI software channels at the same time, or two parallel routine of setting 25*c66ec88fSEmmanuel VadotADI registers will make ADI controller registers chaos to lead incorrect results. 26*c66ec88fSEmmanuel VadotThen we need one hardware spinlock to synchronize between the multiple subsystems. 27*c66ec88fSEmmanuel Vadot 28*c66ec88fSEmmanuel VadotThe new version ADI controller supplies multiple master channels for different 29*c66ec88fSEmmanuel Vadotsubsystem accessing, that means no need to add hardware spinlock to synchronize, 30*c66ec88fSEmmanuel Vadotthus change the hardware spinlock support to be optional to keep backward 31*c66ec88fSEmmanuel Vadotcompatibility. 32*c66ec88fSEmmanuel Vadot 33*c66ec88fSEmmanuel VadotRequired properties: 34*c66ec88fSEmmanuel Vadot- compatible: Should be "sprd,sc9860-adi". 35*c66ec88fSEmmanuel Vadot- reg: Offset and length of ADI-SPI controller register space. 36*c66ec88fSEmmanuel Vadot- #address-cells: Number of cells required to define a chip select address 37*c66ec88fSEmmanuel Vadot on the ADI-SPI bus. Should be set to 1. 38*c66ec88fSEmmanuel Vadot- #size-cells: Size of cells required to define a chip select address size 39*c66ec88fSEmmanuel Vadot on the ADI-SPI bus. Should be set to 0. 40*c66ec88fSEmmanuel Vadot 41*c66ec88fSEmmanuel VadotOptional properties: 42*c66ec88fSEmmanuel Vadot- hwlocks: Reference to a phandle of a hwlock provider node. 43*c66ec88fSEmmanuel Vadot- hwlock-names: Reference to hwlock name strings defined in the same order 44*c66ec88fSEmmanuel Vadot as the hwlocks, should be "adi". 45*c66ec88fSEmmanuel Vadot- sprd,hw-channels: This is an array of channel values up to 49 channels. 46*c66ec88fSEmmanuel Vadot The first value specifies the hardware channel id which is used to 47*c66ec88fSEmmanuel Vadot transfer data triggered by hardware automatically, and the second 48*c66ec88fSEmmanuel Vadot value specifies the analog chip address where user want to access 49*c66ec88fSEmmanuel Vadot by hardware components. 50*c66ec88fSEmmanuel Vadot 51*c66ec88fSEmmanuel VadotSPI slave nodes must be children of the SPI controller node and can contain 52*c66ec88fSEmmanuel Vadotproperties described in Documentation/devicetree/bindings/spi/spi-bus.txt. 53*c66ec88fSEmmanuel Vadot 54*c66ec88fSEmmanuel VadotExample: 55*c66ec88fSEmmanuel Vadot adi_bus: spi@40030000 { 56*c66ec88fSEmmanuel Vadot compatible = "sprd,sc9860-adi"; 57*c66ec88fSEmmanuel Vadot reg = <0 0x40030000 0 0x10000>; 58*c66ec88fSEmmanuel Vadot hwlocks = <&hwlock1 0>; 59*c66ec88fSEmmanuel Vadot hwlock-names = "adi"; 60*c66ec88fSEmmanuel Vadot #address-cells = <1>; 61*c66ec88fSEmmanuel Vadot #size-cells = <0>; 62*c66ec88fSEmmanuel Vadot sprd,hw-channels = <30 0x8c20>; 63*c66ec88fSEmmanuel Vadot }; 64