
On Tue, Feb 12, 2019 at 4:11 PM Andre Przywara andre.przywara@arm.com wrote:
We already have a driver for the SPI devices in older Allwinner CPUs. Newer SoCs (SUN6I generation) have a similar, but improved IP block. This series adds support for that, so we can access the SPI flash that some newer boards come with. This series gathers some patches that have appeared on the list in one form or another before (hence the v2 tag), but brings them all together and updates them.
The SUN4I/SUN6I SPI devices share a very similar architecure, but differ annoyingly in quite some details, to a point where a shared driver would look unnecessarily complicated. So we use an #ifdef based approach, which keeps the driver simple, at the cost of not being able to access both types of device in one binary build. But since there are no SoCs which feature both types, this is a theoretical disadvantage.
Patch 1/4 moves the clock toggling from the probe/remove to the claim/release-bus stage. Patch 2/4 adds the SPI gate clocks and reset gates to the clock drivers, also describes at least the enable bit for the SPI mod clock. This is used in patch 3/4, which uses the new DM clock framework in the driver, helping to abstract differences between the SUN4I/SUN6I types. Patch 4/4 eventually adds support for the new SUN6I generation SPI device. The actual device support is determined at compile time, based on the CONFIG_SUNXI_GEN_SUN6I symbol.
What's left out of this series is the config bits needed to actually activate the support for a board. At the moment this is unnecessarily verbose, so that Oskari is looking at simplifying this at the Kconfig level, which would complement this series.
This has been briefly tested on the Pine64-LTS and the OrangePi PC2 board. Please test them if you have other devices with a SUN6I SPI generation.
I have new series for this which I sent two days back [1]. which uses same sun4i driver and implement enum reg set to avoid ifdef.