SPI的配置
*****************

J6X SPI 接口说明
------------------

.. image:: ./media/image02_01_zh_CN.png
   :align: center
   :alt:


如图为J6X Acore SPI接口示意图：

-  J6X Acore支持2路SPI，且SPI0，SPI1只能做SPI Master。

SPI 设备树配置说明
--------------------

.. code:: bash

   # hobot-drivers/kernel-dts/hobot-j6e-matrix.dts
   spi0: spi@39800000 {
           compatible = "hobot,hb-dw-spi";
           reg-io-width = <4>;
           #address-cells = <1>;
           #size-cells = <0>;
           reg = <0x0 0x39800000 0x0 0x1000>;
           interrupts = <GIC_SPI PERISYS_SPI0_SSI_INTR PERISYS_SPI0_SSI_INTR_TRIG_TYPE>;
           status = "okay";
           num-cs = <2>;
           clocks = <&clk_62p5m>;
           clock-names = "apb_pclk";
           freq-pclk = <200000000>;
           sample-delay = <1>;
           pinctrl-names = "default";
           pinctrl-0 = <&peri_spi0>;
           dmas = <&pdma0 8			/* read channel */
           &pdma0 9	>;		/* write channel */
           dma-names = "rx", "tx";
           spidev@0 {
           compatible = "rohm,dh2228fv";
           spi-max-frequency = <50000000>;
           reg = <0>;
           };
   };

   spi1: spi@39810000 {
           compatible = "hobot,hb-dw-spi";
           reg-io-width = <4>;
           #address-cells = <1>;
           #size-cells = <0>;
           reg = <0x0 0x39810000 0x0 0x1000>;
           interrupts = <GIC_SPI PERISYS_SPI1_SSI_INTR PERISYS_SPI1_SSI_INTR_TRIG_TYPE>;
           status = "okay";
           num-cs = <2>;
           clocks = <&clk_62p5m>;
           clock-names = "apb_pclk";
           freq-pclk = <13000000>;
           sample-delay = <1>;
           pinctrl-names = "default";
           pinctrl-0 = <&peri_spi1>;
           dmas = <&pdma0 10			/* read channel */
           &pdma0 11	>;		/* write channel */
           dma-names = "rx", "tx";
           spidev@0 {
           compatible = "rohm,dh2228fv";
           spi-max-frequency = <13000000>;
           reg = <0>;
           };
   };

这里着重说明J6X SPI新增的配置项

-  sample-delay：spi控制器作master时，对接收数据的采样延迟值，如果出现数据bit位错位的情况，可以调整该值。

-  num-cs：spi控制器作master时，支持cs个数，J6X SPI作master时，最多支持两个片选。