spi: tegra114: add spi driver
Subsystems (4)
Laxman Dewangan
maintainerPATCH v2 1/1 spi: tegra114: add spi driver
Add SPI driver for NVIDIA's Tegra114 SPI controller. This controller is different than the older SoCs SPI controller in internal design as well as register interface.
This driver supports the:
- non DMA based transfer for smaller transfer i.e. less than FIFO depth.
- APB DMA based transfer for lager transfer i.e. more than FIFO depth.
- Clock gating through runtime PM callbacks.
- registration through DT only.
---
Changes from V1:
- All nit cleanups for nomenclature like Nvidia to NVIDIA, spi to SPI etc.
- remove bits_per_word check as all transfer have this valid parameter.
- Cleanups in dt parsing and remove dt node validity.
- use devm_ioremap_resource for mapping physical address.
.../bindings/spi/nvidia,tegra114-spi.txt | 25 + drivers/spi/Kconfig | 8 + drivers/spi/Makefile | 1 + drivers/spi/spi-tegra114.c | 1246 ++++++++++++++++++++ 4 files changed, 1280 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/spi/nvidia,tegra114-spi.txt create mode 100644 drivers/spi/spi-tegra114.c
Documentation/devicetree/bindings/spi/nvidia,tegra114-spi.txt new file +25 -0
@@ -0,0 +1,25 @@ +NVIDIA Tegra114 SPI controller. + +Required properties: +- compatible : should be "nvidia,tegra114-spi". +- reg: Should contain SPI registers location and length. +- interrupts: Should contain SPI interrupts. +- nvidia,dma-request-selector : The Tegra DMA controller's phandle and + request selector for this SPI controller. + +Recommended properties: +- spi-max-frequency: Definition as per + Documentation/devicetree/bindings/spi/spi-bus.txt +Example: + +spi@7000d600 { + compatible = "nvidia,tegra114-spi"; + reg = <0x7000d600 0x200>; + interrupts = <0 82 0x04>; + nvidia,dma-request-selector = <&apbdma 16>; + spi-max-frequency = <25000000>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; +}; +
drivers/spi/Kconfig +8 -0
@@ -405,6 +405,14 @@ config SPI_TEGRA20_SFLASH The main usecase of this controller is to use spi flash as boot device. +config SPI_TEGRA114 + tristate "NVIDIA Tegra114 SPI Controller" + depends on ARCH_TEGRA && TEGRA20_APB_DMA + help + SPI driver for NVIDIA Tegra114 SPI Controller interface. This controller + is different than the older SoCs SPI controller and also register interface + get changed with this controller. + config SPI_TEGRA20_SLINK tristate "Nvidia Tegra20/Tegra30 SLINK Controller" depends on ARCH_TEGRA && TEGRA20_APB_DMA
drivers/spi/Makefile +1 -0
@@ -65,6 +65,7 @@ obj-$(CONFIG_SPI_SH_SCI) += spi-sh-sci.o obj-$(CONFIG_SPI_SIRF) += spi-sirf.o obj-$(CONFIG_SPI_TEGRA20_SFLASH) += spi-tegra20-sflash.o obj-$(CONFIG_SPI_TEGRA20_SLINK) += spi-tegra20-slink.o +obj-$(CONFIG_SPI_TEGRA114) += spi-tegra114.o obj-$(CONFIG_SPI_TI_SSP) += spi-ti-ssp.o obj-$(CONFIG_SPI_TLE62X0) += spi-tle62x0.o obj-$(CONFIG_SPI_TOPCLIFF_PCH) += spi-topcliff-pch.o
drivers/spi/spi-tegra114.c new file +1246 -0
1,246 lines not on this page · raw message
Signature · 1 line
1.7.1.1
Quoted 3 lines · Laxman Dewangan
Add SPI driver for NVIDIA's Tegra114 SPI controller. This controller is different than the older SoCs SPI controller in internal design as well as register interface.
Looks good. Just a couple of nits mentioned below, then,
Note: There are a few minor diffs between this file and spi-tegra20-slink.c. It might be worth eliminating as many as possible, perhaps in a followon patch.
Documentation/devicetree/bindings/spi/nvidia,tegra114-spi.txt line 8
Quoted 10 lines
Documentation/devicetree/bindings/spi/nvidia,tegra114-spi.txt +8
-0+NVIDIA Tegra114 SPI controller. + +Required properties: +- compatible : should be "nvidia,tegra114-spi". +- reg: Should contain SPI registers location and length. +- interrupts: Should contain SPI interrupts. +- nvidia,dma-request-selector : The Tegra DMA controller's phandle and + request selector for this SPI controller.
The binding should specify that a clock named "spi" needs to be provided, using the standard properties in ../clock/clock-bindings.txt
drivers/spi/Makefile obj-$(CONFIG_SPI_SH_SCI) += spi-sh-sci.o · line 68
Quoted 6 lines
drivers/spi/Makefile +1
-0obj-$(CONFIG_SPI_SIRF) += spi-sirf.o obj-$(CONFIG_SPI_TEGRA20_SFLASH) += spi-tegra20-sflash.o obj-$(CONFIG_SPI_TEGRA20_SLINK) += spi-tegra20-slink.o +obj-$(CONFIG_SPI_TEGRA114) += spi-tegra114.o
While Tegra114 is newer, it should really be listed before the Tegra20 entries, since the Makefile is alpha-numerically sorted right now I believe.
drivers/spi/spi-tegra114.c line 1236
Quoted 8 lines
drivers/spi/spi-tegra114.c +6
-0+static struct platform_driver tegra_spi_driver = { + .driver = { + .name ="spi-tegra114" , + .owner =THIS_MODULE , + .pm = &tegra_spi_pm_ops, + .of_match_table =of_match_ptr (tegra_spi_of_match),
No need to use of_match_ptr() there; just use the raw value since CONFIG_OF is guaranteed to be enabled.