From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sean Anderson Date: Sat, 21 Mar 2020 23:33:38 -0400 Subject: [PATCH v1 2/8] spi: dw: Add device tree properties for fields in CTRL0 In-Reply-To: <7c54ed0d-258a-b060-d3bf-8e641f68f705@denx.de> References: <20200305191925.959494-1-seanga2@gmail.com> <20200305191925.959494-3-seanga2@gmail.com> <6d4919a2-d647-7df8-bb42-4ddd3ca1b194@gmail.com> <58a071d6-554a-4a3d-a53f-3bf420fbc7df@denx.de> <192e776e-6f15-3a50-2028-255d4b3e5c48@gmail.com> <7c54ed0d-258a-b060-d3bf-8e641f68f705@denx.de> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 3/21/20 11:13 PM, Marek Vasut wrote: > On 3/22/20 4:08 AM, Sean Anderson wrote: >> On 3/21/20 11:04 PM, Marek Vasut wrote: >>> Could be a different revision of the IP. This is usually handled by >>> using SoC-specific compatible strings, see e.g. Linux >>> Documentation/devicetree/bindings/usb/renesas,usb3-peri.yaml >>> >>> You don't want to encode register layout in the DT. >> >> Ok, then I think adding compatible strings would be the cleanest. >> >>> >>>> It is possible to >>>> add several compatible strings like "kendryte,k210-spi3". >>> >>> Why ? >> >> See below. >> >>> >>>> I chose this >>>> method because the bitfields are different for spi0 and spi1, spi2, and >>>> spi3. If there are other incompatibilities discovered, then it may make >>>> more sense to use different strings. Another option could have been to >>>> use the DW_SPI_VERSION field to detect different controllers, but it is >>>> the same among all the controllers on the K210. >>> >>> The controllers on the same SoC have different register layout ? >>> >> >> Yup! >> >> Don't ask me why. > > Now that is truly an odd design. Is there a datasheet for this SoC ? Nope. Everything has been done referencing their sdk. In hindsight, porting this board was a poor decision because of all the hoops I've had to jump through due to the absence of documentation. Unfortunately, it's probably the only budget risc-v board with S-mode until the end of the year or so. > You might be able to somehow enumerate those controllers in DT and > derive their layout from that enumeration or somesuch I think. So like derive it from the sequence number? I'd rather do this in a more standard way, if possible. --Sean